diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2020-12-09 14:44:41 +0100 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2020-12-09 14:44:41 +0100 |
commit | a126c249b8ed83dce4386331a49d04a42b53e448 (patch) | |
tree | f2e035c580e4f3acf4d69a91c4d7219587d5aeae /eaaf_core_utils/src/test | |
parent | 50b25badd1592ae68ca24ccfe16517b745e0df84 (diff) | |
parent | 4e2417b8b5e59b9659900ad36ce7248810813aeb (diff) | |
download | EAAF-Components-a126c249b8ed83dce4386331a49d04a42b53e448.tar.gz EAAF-Components-a126c249b8ed83dce4386331a49d04a42b53e448.tar.bz2 EAAF-Components-a126c249b8ed83dce4386331a49d04a42b53e448.zip |
Merge branch 'feature/gitlabci' into 'nightlyBuild'
Feature/gitlabci
See merge request egiz/eaaf_components!5
Diffstat (limited to 'eaaf_core_utils/src/test')
5 files changed, 46 insertions, 38 deletions
diff --git a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/logging/EaafUtilsMessageSourceTest.java b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/logging/EaafUtilsMessageSourceTest.java index 53ea54dc..125dcb09 100644 --- a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/logging/EaafUtilsMessageSourceTest.java +++ b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/logging/EaafUtilsMessageSourceTest.java @@ -2,19 +2,21 @@ package at.gv.egiz.eaaf.core.impl.logging; import java.util.List; -import at.gv.egiz.eaaf.core.api.logging.IMessageSourceLocation; - import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import at.gv.egiz.eaaf.core.api.logging.IMessageSourceLocation; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/spring/test_eaaf_pvp_not_lazy.beans.xml") +@DirtiesContext public class EaafUtilsMessageSourceTest { @Autowired diff --git a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/utils/test/AuthenticatedEncryptionPendingRequestIdGenerationStrategyTest.java b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/utils/test/AuthenticatedEncryptionPendingRequestIdGenerationStrategyTest.java index 8b437dcf..09a9543a 100644 --- a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/utils/test/AuthenticatedEncryptionPendingRequestIdGenerationStrategyTest.java +++ b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/utils/test/AuthenticatedEncryptionPendingRequestIdGenerationStrategyTest.java @@ -20,6 +20,7 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -33,6 +34,7 @@ import at.gv.egiz.eaaf.core.impl.utils.AuthenticatedEncryptionPendingRequestIdGe @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/spring/test_eaaf_pvp_not_lazy.beans.xml") +@DirtiesContext public class AuthenticatedEncryptionPendingRequestIdGenerationStrategyTest { @Autowired private EaafKeyStoreFactory keyStoreFactory; diff --git a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/utils/test/AuthenticatedEncryptionPendingRequestIdGenerationStrategyWithHsmTest.java b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/utils/test/AuthenticatedEncryptionPendingRequestIdGenerationStrategyWithHsmTest.java index 95a2b7a7..b588bb3a 100644 --- a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/utils/test/AuthenticatedEncryptionPendingRequestIdGenerationStrategyWithHsmTest.java +++ b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/impl/utils/test/AuthenticatedEncryptionPendingRequestIdGenerationStrategyWithHsmTest.java @@ -4,6 +4,7 @@ import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -12,6 +13,7 @@ import at.gv.egiz.eaaf.core.impl.utils.AuthenticatedEncryptionPendingRequestIdGe @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/spring/test_eaaf_pvp_not_lazy_with_hsm.beans.xml") +@DirtiesContext public class AuthenticatedEncryptionPendingRequestIdGenerationStrategyWithHsmTest { @Autowired private AuthenticatedEncryptionPendingRequestIdGenerationStrategy pendingIdStrategy; diff --git a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/credentials/EaafKeyStoreFactoryTest.java b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/credentials/EaafKeyStoreFactoryTest.java index c0bd6f20..6d1b63d7 100644 --- a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/credentials/EaafKeyStoreFactoryTest.java +++ b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/credentials/EaafKeyStoreFactoryTest.java @@ -19,6 +19,7 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.annotation.DirtiesContext.MethodMode; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -45,7 +46,7 @@ import io.grpc.StatusRuntimeException; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/spring/test_eaaf_pvp_lazy.beans.xml") -@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) +@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD) public class EaafKeyStoreFactoryTest { private static final String HSM_FACASE_HOST = "eid.a-sit.at"; @@ -72,7 +73,7 @@ public class EaafKeyStoreFactoryTest { /** * jUnit test set-up. */ - @Before + @Before public void testSetup() { mapConfig.clearAllConfig(); Security.removeProvider(HsmFacadeProvider.getInstance().getName()); @@ -80,7 +81,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void startWithoutConfigHsmFacadeConfig() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -88,7 +89,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void buildyStoreWithOutConfig() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -106,7 +107,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void buildyStoreWithPkcs11() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -125,7 +126,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreWithoutConfig() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -144,7 +145,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreWithoutConfigSecond() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -163,7 +164,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreWithoutPassword() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -184,7 +185,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreWithoutPath() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -206,7 +207,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreWithoutType() throws EaafException { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -224,7 +225,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreWithWrongPath() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -247,7 +248,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreWithWrongPassword() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -270,7 +271,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreSuccessJks() throws EaafException { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -290,7 +291,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreAccessOperations() throws EaafException, KeyStoreException { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -359,7 +360,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void softwareKeyStoreSuccessPkcs12() throws EaafException { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -379,7 +380,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void symmetricSoftwareKeyWithOutConfig() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -399,7 +400,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void symmetricSoftwareKeyWithOutSalt() { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -420,7 +421,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void symmetricSoftwareKeyValid() throws EaafException { final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class); Assert.assertFalse("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized()); @@ -439,7 +440,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeNoHostConfig() { context.getBean(EaafKeyStoreFactory.class); @@ -447,7 +448,7 @@ public class EaafKeyStoreFactoryTest { @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeOnlyHostConfig() { mapConfig.putConfigValue(EaafKeyStoreFactory.CONFIG_PROP_HSM_FACADE_HOST, RandomStringUtils.randomNumeric(10)); @@ -462,7 +463,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeMissingPort() { mapConfig.putConfigValue(EaafKeyStoreFactory.CONFIG_PROP_HSM_FACADE_HOST, RandomStringUtils.randomNumeric(10)); @@ -482,7 +483,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeMissingUsername() { mapConfig.putConfigValue(EaafKeyStoreFactory.CONFIG_PROP_HSM_FACADE_HOST, RandomStringUtils.randomNumeric(10)); @@ -501,7 +502,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeMissingPassword() { mapConfig.putConfigValue(EaafKeyStoreFactory.CONFIG_PROP_HSM_FACADE_HOST, RandomStringUtils.randomNumeric(10)); @@ -521,7 +522,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeMissingTrustedCertificate() { mapConfig.putConfigValue(EaafKeyStoreFactory.CONFIG_PROP_HSM_FACADE_HOST, RandomStringUtils.randomNumeric(10)); @@ -543,7 +544,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeMissingTrustedCertificateFile() { mapConfig.putConfigValue(EaafKeyStoreFactory.CONFIG_PROP_HSM_FACADE_HOST, RandomStringUtils.randomNumeric(10)); @@ -566,8 +567,8 @@ public class EaafKeyStoreFactoryTest { } } - @Test - @DirtiesContext + @Test + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeMissingWrongTrustedCertificate() { mapConfig.putConfigValue(EaafKeyStoreFactory.CONFIG_PROP_HSM_FACADE_HOST, RandomStringUtils.randomNumeric(10)); @@ -591,7 +592,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeInitialized() { mapConfig.putConfigValue(EaafKeyStoreFactory.CONFIG_PROP_HSM_FACADE_HOST, RandomStringUtils.randomNumeric(10)); @@ -610,7 +611,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeAlreadLoaded() { HsmFacadeProvider provider = HsmFacadeProvider.getInstance(); Security.addProvider(provider); @@ -621,7 +622,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeKeyStoreNoKeyStoreName() { configureHsmFacade(); @@ -643,7 +644,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeKeyStoreSuccess() throws EaafException { configureHsmFacade(); @@ -671,7 +672,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void symmetricHsmFacadeKeyWithOutConfig() { configureHsmFacade(); @@ -693,7 +694,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void symmetricHsmFacadeKeyWithOutKeyAlias() { configureHsmFacade(); @@ -716,7 +717,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void symmetricHsmFacadeKeyWrongKeyAlias() { configureHsmFacade(); @@ -741,7 +742,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void symmetricHsmFacadeKeyValid() throws EaafException { configureHsmFacade(); @@ -762,7 +763,7 @@ public class EaafKeyStoreFactoryTest { } @Test - @DirtiesContext + @DirtiesContext(methodMode = MethodMode.BEFORE_METHOD) public void hsmFacadeKeyStoreSuccessASitTestFacade() throws EaafException, KeyStoreException { configureHsmFacade(); diff --git a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/http/HttpClientFactoryTest.java b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/http/HttpClientFactoryTest.java index 433e6893..c88e05d5 100644 --- a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/http/HttpClientFactoryTest.java +++ b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/http/HttpClientFactoryTest.java @@ -42,6 +42,7 @@ import okhttp3.tls.HeldCertificate; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/spring/test_eaaf_pvp_not_lazy.beans.xml") +@DirtiesContext public class HttpClientFactoryTest { @Autowired private EaafKeyStoreFactory keyStoreFactory; |