Package es.zoocial.tsa

Examples of es.zoocial.tsa.Configuration


          configurationFile = (String)context.getAttribute("configuration");
      }
     
      log.info(String.format("Configuring servlet with file '%s'", configurationFile));
     
      Configuration conf = new Configuration();
      conf.loadConfiguration(configurationFile);
     
      KeystoreHandler store = new KeystoreHandler();
      store.loadKeystore(KeystoreModel.fromMap(conf.getPropertySet("keystore")));
      stamper = new Timestamper(store);
     
      log.info("Servlet launched");
    }
View Full Code Here


public class ConfigurationTest {

  @Test
  public void testCreateConfiguration() {
    Assert.assertNotNull("Could not create configuration cfg instance", new Configuration());
  }
View Full Code Here

    Assert.assertNotNull("Could not create configuration cfg instance", new Configuration());
  }
 
  @Test(expected=IllegalArgumentException.class)
  public void testLoadConfigurationWithoutEnvVarThrowsIllegalArgumentException() {
    Configuration cfg = new Configuration();
    {
      cfg = Mockito.spy(cfg);
      Mockito.doReturn("")
          .when(cfg)
          .getConfigurationFilename();
    }
    cfg.loadConfiguration();
  }
View Full Code Here

  }

 
  @Test(expected=IllegalArgumentException.class)
  public void testLoadConfigurationWithInvalidEnvVarThrowsIllegalArgumentException() {
    Configuration cfg = new Configuration();
    {
      cfg = Mockito.spy(cfg);
      Mockito.doReturn("file://invalidfile-" + UUID.randomUUID().toString())
          .when(cfg)
          .getConfigurationFilename();
    }
    cfg.loadConfiguration();
  }
View Full Code Here

    cfg.loadConfiguration();
  }
 
  @Test
  public void testLoadConfigurationWithValidFileURL() {
    Configuration cfg = new Configuration();
    {
      URL confFileUrl = getClass().getResource(getClass().getSimpleName() + ".properties");
      cfg = Mockito.spy(cfg);
      Mockito.doReturn(confFileUrl.toString())
          .when(cfg)
          .getConfigurationFilename();
    }
    cfg.loadConfiguration();
   
    Assert.assertEquals("Configuration test key", "has some value", cfg.getProperty("some-key"));
  }
View Full Code Here

  }

 
  @Test
  public void testLoadConfigurationWithValidFileURLAsArgument() {
    Configuration cfg = new Configuration();
    URL confFileUrl = getClass().getResource(getClass().getSimpleName() + ".properties");
    cfg.loadConfiguration(confFileUrl.toString());
   
    Assert.assertEquals("Configuration test key", "has some value", cfg.getProperty("some-key"));
  }
View Full Code Here

    Assert.assertEquals("Configuration test key", "has some value", cfg.getProperty("some-key"));
  }
 
  @Test
  public void testGetConfigurationPropertySet() {
    Configuration cfg = new Configuration();
    URL confFileUrl = getClass().getResource(getClass().getSimpleName() + ".properties");
    cfg.loadConfiguration(confFileUrl.toString());
   
    Map<String, String> propertySet = cfg.getPropertySet("myprefix.");
    Assert.assertNotNull("Property Set", propertySet);
    Assert.assertEquals("Value 1", propertySet.get("value1"), "value 1");
    Assert.assertEquals("Value 2", propertySet.get("value2"), "value 2");
  }
View Full Code Here

 
  private static KeystoreHandler keystore = null;
 
  public static KeystoreHandler getP12Keystore() {
    if (keystore == null) {
      Configuration conf = new Configuration();
      conf.loadConfiguration(KeystoreHelper.class.getResource("keystore.properties").toString());
      Map<String, String> propertySet = conf.getPropertySet("keystore");
      URL url = null;
      try {
        url = new URL("file:cert/tsa.p12");
      } catch (MalformedURLException e) {
        throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of es.zoocial.tsa.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.