Commit 4bb6f42e authored by wklicki's avatar wklicki

Refactor code structure for improved readability and maintainability

parent 18414575
...@@ -151,6 +151,22 @@ ...@@ -151,6 +151,22 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-Djavax.net.ssl.trustStore=${project.basedir}/src/main/resources/security/gus-truststore.jks
-Djavax.net.ssl.trustStorePassword=changeit
</jvmArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
-Djavax.net.ssl.trustStore=${project.build.outputDirectory}/security/gus-truststore.jks
-Djavax.net.ssl.trustStorePassword=changeit
</argLine>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
......
...@@ -3,6 +3,7 @@ package com.framework.tools.gus.rest; ...@@ -3,6 +3,7 @@ package com.framework.tools.gus.rest;
import com.framework.tools.gus.soap.CompanyInfo; import com.framework.tools.gus.soap.CompanyInfo;
import com.framework.tools.gus.soap.GusSoapClient; import com.framework.tools.gus.soap.GusSoapClient;
import com.framework.tools.gus.ws.*; import com.framework.tools.gus.ws.*;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
@SpringBootTest @SpringBootTest
class GusSoapClientTest { class GusSoapClientTest {
...@@ -32,4 +34,32 @@ class GusSoapClientTest { ...@@ -32,4 +34,32 @@ class GusSoapClientTest {
logger.info("Wyloguj response: {}", wylResult); logger.info("Wyloguj response: {}", wylResult);
assertTrue(wylResult); assertTrue(wylResult);
} }
/**
* Odpytuje produkcyjne API GUS o dane spółki Orange Polska S.A. (NIP: 5260250995).
* Wymaga poprawnego klucza produkcyjnego ustawionego w zmiennej środowiskowej GUS_KEY -
* test jest pomijany (skip), jeśli klucz nie jest dostępny.
*/
@Test
void getOrangeCompanyDataFromProd() {
String prodKey = connectionConfig.getKey();
assumeTrue(StringUtils.isNotEmpty(prodKey), "GUS_KEY env variable not set - skipping production test");
soapClient.setUrl(connectionConfig.getUrlProd());
soapClient.login(prodKey);
logger.info("sid returned: {}", soapClient.getSessionId());
assertTrue(StringUtils.isNotEmpty(soapClient.getSessionId()));
String orangeNip = "5260250995";
CompanyInfo companyFullData = soapClient.getCompanyFullData(orangeNip);
logger.info("Orange company data loaded: {}", companyFullData);
assertNotNull(companyFullData);
assertEquals(orangeNip, companyFullData.NIP);
assertTrue(companyFullData.Nazwa != null && companyFullData.Nazwa.toUpperCase().contains("ORANGE"));
boolean wylResult = soapClient.logout();
logger.info("Wyloguj response: {}", wylResult);
assertTrue(wylResult);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment