Skip to content
Snippets Groups Projects
Select Git revision
  • 8a7c33d3b10908a862662b39195245abbc03d4ff
  • master default protected
  • dev
  • ckan-2.9
  • refactor-css
  • improve-accessibility
  • fix-get_action-calls
  • summary-collection
  • debug-collections
  • debug-eakte
  • experimental-linked-resources-as-uploads
  • button-text-detail
  • Detailinfo
  • hash
  • URL_Upload
  • URL_Upload_working_BB
  • url_exp
  • ODPSH-550
  • href-for-preview
  • ODPSH-HASH-ALGO
  • Algo
  • v1.61
  • v1.6
  • v1.51
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • v0.1
  • sprint-18
  • sprint11_2
  • sprint10
  • sprint8
  • sprint7
  • sprint6
37 results

controller.py

Blame
  • XtaClientITCase.java 1.92 KiB
    package de.ozgcloud.xta.client;
    
    import static org.assertj.core.api.Assertions.*;
    
    import java.io.File;
    import java.io.IOException;
    import java.util.List;
    
    import org.junit.jupiter.api.BeforeEach;
    import org.junit.jupiter.api.DisplayName;
    import org.junit.jupiter.api.Nested;
    import org.junit.jupiter.api.Test;
    
    import com.google.common.io.Files;
    
    import de.ozgcloud.xta.client.config.XtaClientConfig;
    import lombok.SneakyThrows;
    
    class XtaClientITCase {
    
    	private XtaClient client;
    
    	private static final String CLIENT_IDENTIFIER = "afmsh:010600000000_Online-Dienste";
    
    	private static final String BASE_URL = "https://li33-0005.dp.dsecurecloud.de/MB_XTA-WS/XTA210";
    
    	private static final XtaClientFactory clientFactory;
    
    	private static final XtaClientConfig CONFIG;
    
    	static {
    		var clientCertKeyStore = XtaClientConfig.KeyStore.builder()
    				.content(readBytesFromFile("/path/to/KOP_SH_KIEL_DEV.p12"))
    				.type("PKCS12")
    				.password("***".toCharArray())
    				.build();
    		CONFIG = XtaClientConfig.builder()
    				.clientIdentifiers(List.of(CLIENT_IDENTIFIER))
    				.managementServiceUrl(BASE_URL + "managementPort.svc")
    				.sendServiceUrl(BASE_URL + "sendPort.svc")
    				.msgBoxServiceUrl(BASE_URL + "msgBoxPort.svc")
    				.clientCertKeystore(clientCertKeyStore)
    				.logSoapRequests(true)
    				.logSoapResponses(true)
    				.build();
    		clientFactory = XtaClientFactory.from(CONFIG);
    	}
    
    	@BeforeEach
    	@SneakyThrows
    	void mock() {
    		client = clientFactory.create();
    	}
    
    	@DisplayName("get status list")
    	@Nested
    	class TestGetStatusList {
    
    		@DisplayName("should return with no pending messages")
    		@Test
    		@SneakyThrows
    		void shouldReturnWithNoPendingMessages() {
    			var result = client.getMessagesMetadata(CLIENT_IDENTIFIER);
    
    			assertThat(result.pendingMessageCount()).isZero();
    		}
    	}
    
    	private static byte[] readBytesFromFile(String path) {
    		try {
    			return Files.toByteArray(new File(path));
    		} catch (IOException e) {
    			throw new RuntimeException(e);
    		}
    	}
    }