@Test public void test_initAds() throws Exception { adsSecurityManager.init(new SecurityServiceConfig(createDefaultMasterConfigWithAdsValues())); log.assertContent( "setSecuritServiceClass(AdsSecurityService)", "SessionManager.addListener(AdsServiceWrapper)", "addGlobalComponent(AdsServiceWrapper)"); assertEquals(AdsTest.ADSBV_JNLP_URL, adsSecurityManager.getAdsBvJnlpUrl()); }
@Test public void test_initAds_notEncrypted_shoudFail() throws Exception { try { adsSecurityManager.init( new SecurityServiceConfig( createDefaultMasterConfigWithAdsValues( "notAnEncryptedLogin", "notAnEncryptedPassword"))); fail(); } catch (StringEncrypterException e) { assertTrue( e.getLocalizedMessage() .startsWith("Impossible de decrypter la chaine 'notAnEncryptedLogin'")); } }
@Test public void test_assertConfigurationIsValid_notSet() throws Exception { SecurityServiceConfig config = new SecurityServiceConfig(new ContainerConfiguration()); try { AdsSecurityManager.assertConfigurationIsValid(config); fail(); } catch (Exception e) { assertEquals( "La configuration ads est invalide.\n" + "Veuillez vérifier la valeur de la propriété SecurityService.config.", e.getLocalizedMessage()); } }
@Test public void test_assertConfigurationIsValid_syntaxError() throws Exception { ContainerConfiguration configuration = new ContainerConfiguration(); configuration.setParameter(SecurityServiceConfig.SECURITY_SERVICE_CONFIG, "ads:"); SecurityServiceConfig config = new SecurityServiceConfig(configuration); try { AdsSecurityManager.assertConfigurationIsValid(config); fail(); } catch (IllegalArgumentException e) { assertEquals( "La configuration ads est invalide.\n" + "Veuillez vérifier la valeur de la propriété SecurityService.config.", e.getLocalizedMessage()); } }
@Test public void test_assertConfigurationIsValid() throws Exception { SecurityServiceConfig config = new SecurityServiceConfig(createDefaultMasterConfigWithAdsValues()); AdsSecurityManager.assertConfigurationIsValid(config); }