@Test
  public void updateEnvironmentTest() throws ConfigurationException {
    Environment env = new Environment();
    env.setDesc("sample env added");
    env.setName("testEnv");

    Configuration config = new Configuration();
    config.setEnvName("testEnv");
    config.setName("testserver");
    config.setType("Server");
    config.setDesc("server added");

    Properties propProd = new Properties();
    propProd.setProperty("protocol", "http");
    propProd.setProperty("host", "localhost");
    propProd.setProperty("port", "3030");
    propProd.setProperty("admin_username", "");
    propProd.setProperty("admin_password", "");
    propProd.setProperty("remoteDeployment", "false");
    propProd.setProperty("certificate", "");
    propProd.setProperty("type", "Apache Tomcat");
    propProd.setProperty("version", "7.0.x");
    propProd.setProperty("deploy_dir", "D:\\webapps");
    propProd.setProperty("context", "testserver");
    config.setProperties(propProd);
    env.setConfigurations(Arrays.asList(config));
    configmanagerImpl.updateEnvironment(env);
    Assert.assertEquals(1, configmanagerImpl.getEnvironments().size());
  }
  @Test
  public void cloneConfiguration() throws PhrescoException, ConfigurationException {
    Environment env = new Environment();
    env.setDesc("sample env added");
    env.setName("cloneenv");

    Configuration config = new Configuration();
    config.setEnvName("testEnv");
    config.setName("cloneserver");
    config.setType("Server");
    config.setDesc("server added");

    Properties propProd = new Properties();
    propProd.setProperty("protocol", "http");
    propProd.setProperty("host", "localhost");
    propProd.setProperty("port", "8654");
    propProd.setProperty("admin_username", "");
    propProd.setProperty("admin_password", "");
    propProd.setProperty("remoteDeployment", "false");
    propProd.setProperty("certificate", "");
    propProd.setProperty("type", "Apache Tomcat");
    propProd.setProperty("version", "6.0.x");
    propProd.setProperty("deploy_dir", "C:\\apache-tomcat-7.0.14\\webapps");
    propProd.setProperty("context", "ser");
    configmanagerImpl.cloneEnvironment("Production", env);
    Assert.assertEquals(1, configmanagerImpl.getConfigurations("cloneenv", "Server").size());
  }
  @Test
  public void deleteConfiguration() throws ConfigurationException {
    Configuration config = new Configuration();
    config.setEnvName("Production");
    config.setName("db");
    config.setType("Database");
    config.setDesc("email updated");
    configmanagerImpl.deleteConfigurations(Arrays.asList(config));
    Assert.assertEquals(0, configmanagerImpl.getConfigurations("Production", "Database").size());

    configmanagerImpl.deleteConfigurations("dev", Arrays.asList("Email"));
    Assert.assertEquals(1, configmanagerImpl.getConfigurations("dev", "Email").size());
  }
 @Test
 public void updateConfiguration() throws ConfigurationException {
   Properties propertiesEmail = new Properties();
   propertiesEmail.setProperty("port", "8596");
   propertiesEmail.setProperty("emailid", "*****@*****.**");
   propertiesEmail.setProperty("password", "prodtest");
   propertiesEmail.setProperty("incoming_mail_server", "tcp://");
   propertiesEmail.setProperty("incoming_mail_port", "2658");
   propertiesEmail.setProperty("host", "test");
   propertiesEmail.setProperty("username", "test");
   Configuration config = new Configuration();
   config.setEnvName("Production");
   config.setName("testemail");
   config.setType("Email");
   config.setDesc("email updated");
   config.setProperties(propertiesEmail);
   configmanagerImpl.updateConfiguration("Production", "testemail", config);
   Assert.assertEquals(1, configmanagerImpl.getConfigurations("Production", "Email").size());
 }
 @Test
 public void createConfigurationbyName() throws ConfigurationException {
   Properties propertiesEmail = new Properties();
   propertiesEmail.setProperty("port", "8596");
   propertiesEmail.setProperty("emailid", "*****@*****.**");
   propertiesEmail.setProperty("password", "test");
   propertiesEmail.setProperty("incoming_mail_server", "test");
   propertiesEmail.setProperty("incoming_mail_port", "test");
   propertiesEmail.setProperty("host", "test");
   propertiesEmail.setProperty("username", "test");
   Configuration config = new Configuration();
   config.setEnvName("Production");
   config.setName("testemail");
   config.setType("Email");
   config.setDesc("email added");
   config.setProperties(propertiesEmail);
   configmanagerImpl.createConfiguration("Production", config);
   Assert.assertEquals(1, configmanagerImpl.getConfigurations("Production", "Email").size());
   configmanagerImpl.createConfiguration("dev", Arrays.asList(config));
   Assert.assertEquals(2, configmanagerImpl.getConfigurations("dev", "Email").size());
 }