Skip to content
Snippets Groups Projects
Select Git revision
  • 0b1767e1ae0dac25e8834d66fb4a861d49113bd5
  • main default protected
  • release
  • master-interface-proto4
  • ozg-5634-ozgcloud-ingress
  • OZG-3322_connect_to_mongodb_over_tls
  • 2.19.0
  • 2.18.0
  • 2.17.0
  • 2.16.0
  • 2.15.0
  • 2.14.0
  • 2.13.0
  • 2.12.0
  • 2.11.0
  • 2.10.1
  • 2.10.0
  • 2.9.0
  • 2.8.0
  • 2.7.1
  • 2.7.0
  • 2.6.0
  • 2.5.1
  • 2.5.0
  • 2.4.0
  • 2.3.0
26 results

User.java

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);
    		}
    	}
    }