use of com.twitter.heron.api.Config in project incubator-heron by apache.
the class ConfigBuilderTest method testBuildConfig_IncorrectByteResourceFormat_ExceptionThrow.
@Test(expected = IllegalArgumentException.class)
public void testBuildConfig_IncorrectByteResourceFormat_ExceptionThrow() throws Exception {
Config config = null;
try {
EcoParser ecoParser = new EcoParser();
InputStream inputStream = new ByteArrayInputStream(INCORRECT_BYTES_FORMAT_YAML.getBytes());
FileInputStream mockPropsStream = PowerMockito.mock(FileInputStream.class);
EcoTopologyDefinition ecoTopologyDefinition = ecoParser.parseFromInputStream(inputStream, mockPropsStream, false);
config = subject.buildConfig(ecoTopologyDefinition);
} finally {
assertNull(config);
}
}
use of com.twitter.heron.api.Config in project incubator-heron by apache.
the class ConfigBuilderTest method testBuildConfig_SpecifyingComponentJVMOptions_ReturnsCorrectValues.
@Test
public void testBuildConfig_SpecifyingComponentJVMOptions_ReturnsCorrectValues() throws Exception {
EcoParser ecoParser = new EcoParser();
InputStream inputStream = new ByteArrayInputStream(JVM_OPTIONS_CONFIG.getBytes());
FileInputStream mockPropsStream = PowerMockito.mock(FileInputStream.class);
EcoTopologyDefinition ecoTopologyDefinition = ecoParser.parseFromInputStream(inputStream, mockPropsStream, false);
Config config = subject.buildConfig(ecoTopologyDefinition);
assertThat(config.get(Config.TOPOLOGY_COMPONENT_JVMOPTS), is(equalTo("{\"c3BvdXQtMSw=\":\"LVhYOk5ld1NpemU9MzAwbSwgLVhtczJnIA==\"}")));
}
use of com.twitter.heron.api.Config in project incubator-heron by apache.
the class ConfigBuilderTest method testBuildConfig_IncorrectComponentJVMOptions_ExceptionThrown.
@Test(expected = IllegalArgumentException.class)
public void testBuildConfig_IncorrectComponentJVMOptions_ExceptionThrown() throws Exception {
Config config = null;
try {
EcoParser ecoParser = new EcoParser();
InputStream inputStream = new ByteArrayInputStream(INCORRECT_JVM_OPTIONS_CONFIG.getBytes());
FileInputStream mockPropsStream = PowerMockito.mock(FileInputStream.class);
EcoTopologyDefinition ecoTopologyDefinition = ecoParser.parseFromInputStream(inputStream, mockPropsStream, false);
config = subject.buildConfig(ecoTopologyDefinition);
} finally {
assertNull(config);
}
}
use of com.twitter.heron.api.Config in project incubator-heron by apache.
the class ConfigBuilderTest method testBuildConfig_ConfigIsNotDefined_ReturnsEmptyConfig.
@Test
public void testBuildConfig_ConfigIsNotDefined_ReturnsEmptyConfig() throws Exception {
EcoTopologyDefinition ecoTopologyDefinition = new EcoTopologyDefinition();
Config config = subject.buildConfig(ecoTopologyDefinition);
assertThat(0, is(equalTo(config.size())));
}
use of com.twitter.heron.api.Config in project incubator-heron by apache.
the class ConfigBuilderTest method testBuildConfig_ByteAllocationTooSmall_ExceptionThrown.
@Test(expected = IllegalArgumentException.class)
public void testBuildConfig_ByteAllocationTooSmall_ExceptionThrown() throws Exception {
Config config = null;
try {
EcoParser ecoParser = new EcoParser();
InputStream inputStream = new ByteArrayInputStream(INCORRECT_RAM_BYTES.getBytes());
FileInputStream mockPropsStream = PowerMockito.mock(FileInputStream.class);
EcoTopologyDefinition ecoTopologyDefinition = ecoParser.parseFromInputStream(inputStream, mockPropsStream, false);
config = subject.buildConfig(ecoTopologyDefinition);
} finally {
assertNull(config);
}
}
Aggregations