Search in sources :

Example 1 with Derby

use of com.torodb.standalone.config.model.backend.derby.Derby in project torodb by torodb.

the class ConfigTest method testParseWithYAMLUsingDerby.

@Test
public void testParseWithYAMLUsingDerby() throws Exception {
    CliConfig cliConfig = new CliConfig() {

        @Override
        public boolean hasConfFile() {
            return true;
        }

        @Override
        public InputStream getConfInputStream() {
            return ConfigTest.class.getResourceAsStream("/test-parse-with-yaml-using-derby.yml");
        }
    };
    Config config = CliConfigUtils.readConfig(cliConfig);
    Assert.assertTrue("/backend not defined", config.getBackend() != null);
    Assert.assertEquals("/backend/derby not defined", Derby.class, config.getBackend().getBackendImplementation().getClass());
    Assert.assertTrue("/backend/derby not identified as AbstractDerby", config.getBackend().is(Derby.class));
    Assert.assertTrue("/backend/derby not identified as AbstractDerby Like", config.getBackend().isLike(Derby.class));
    Assert.assertEquals("/backend/derby/host has different value than that specified", "localhost", config.getBackend().as(Derby.class).getHost());
    Assert.assertEquals("/backend/derby/port has different value than that specified", Integer.valueOf(5432), config.getBackend().as(Derby.class).getPort());
    Assert.assertEquals("/backend/derby/user has different value than that specified", "root", config.getBackend().as(Derby.class).getUser());
    Assert.assertEquals("/backend/derby/password specified but should have not been read from parameters", null, config.getBackend().as(Derby.class).getPassword());
}
Also used : Derby(com.torodb.standalone.config.model.backend.derby.Derby) Config(com.torodb.standalone.config.model.Config) CliConfig(com.torodb.standalone.CliConfig) CliConfig(com.torodb.standalone.CliConfig) Test(org.junit.Test)

Example 2 with Derby

use of com.torodb.standalone.config.model.backend.derby.Derby in project torodb by torodb.

the class ConfigTest method testParseWithYAMLAndReplaceBackendWithParam.

@Test
public void testParseWithYAMLAndReplaceBackendWithParam() throws Exception {
    CliConfig cliConfig = new CliConfig() {

        @Override
        public boolean hasConfFile() {
            return true;
        }

        @Override
        public InputStream getConfInputStream() {
            return ConfigTest.class.getResourceAsStream("/test-parse-with-yaml.yml");
        }

        @Override
        public List<String> getParams() {
            String[] params = new String[] { "/backend=null", "/backend/derby/host=localhost", "/backend/derby/port=5432", "/backend/derby/user=root" };
            return Arrays.asList(params);
        }
    };
    Config config = CliConfigUtils.readConfig(cliConfig);
    Assert.assertTrue("/backend not defined", config.getBackend() != null);
    Assert.assertEquals("/backend/derby not defined", Derby.class, config.getBackend().getBackendImplementation().getClass());
    Assert.assertTrue("/backend/derby not identified as AbstractDerby", config.getBackend().is(Derby.class));
    Assert.assertTrue("/backend/derby not identified as AbstractDerby Like", config.getBackend().isLike(Derby.class));
    Assert.assertEquals("/backend/derby/host has different value than that specified", "localhost", config.getBackend().as(Derby.class).getHost());
    Assert.assertEquals("/backend/derby/port has different value than that specified", Integer.valueOf(5432), config.getBackend().as(Derby.class).getPort());
    Assert.assertEquals("/backend/derby/user has different value than that specified", "root", config.getBackend().as(Derby.class).getUser());
    Assert.assertEquals("/backend/derby/password specified but should have not been read from parameters", null, config.getBackend().as(Derby.class).getPassword());
}
Also used : Derby(com.torodb.standalone.config.model.backend.derby.Derby) Config(com.torodb.standalone.config.model.Config) CliConfig(com.torodb.standalone.CliConfig) CliConfig(com.torodb.standalone.CliConfig) Test(org.junit.Test)

Example 3 with Derby

use of com.torodb.standalone.config.model.backend.derby.Derby in project torodb by torodb.

the class ToroDbBootstrapServiceTest method setUp.

@Before
public void setUp() {
    config = new Config();
    config.getProtocol().getMongo().setReplication(null);
    config.getBackend().setBackendImplementation(new Derby());
    config.getBackend().as(Derby.class).setPassword("torodb");
    config.getGeneric().setLogLevel(LogLevel.TRACE);
    ConfigUtils.validateBean(config);
}
Also used : Derby(com.torodb.standalone.config.model.backend.derby.Derby) Config(com.torodb.standalone.config.model.Config) Before(org.junit.Before)

Aggregations

Config (com.torodb.standalone.config.model.Config)3 Derby (com.torodb.standalone.config.model.backend.derby.Derby)3 CliConfig (com.torodb.standalone.CliConfig)2 Test (org.junit.Test)2 Before (org.junit.Before)1