use of com.datatorrent.stram.plan.logical.LogicalPlanConfiguration in project apex-core by apache.
the class TestModuleExpansion method conflictingNamesWithOperator2.
/**
* Module and Operator with same name is not allowed in a DAG, to prevent properties
* conflict.
*/
@Test(expected = java.lang.IllegalArgumentException.class)
public void conflictingNamesWithOperator2() {
Configuration conf = new Configuration(false);
LogicalPlanConfiguration lpc = new LogicalPlanConfiguration(conf);
LogicalPlan dag = new LogicalPlan();
Level2ModuleA module = dag.addModule("M1", new Level2ModuleA());
DummyInputOperator in = dag.addOperator("M1", new DummyInputOperator());
dag.addStream("s1", in.out, module.mIn);
lpc.prepareDAG(dag, null, "ModuleApp");
dag.validate();
}
use of com.datatorrent.stram.plan.logical.LogicalPlanConfiguration in project apex-core by apache.
the class TestModuleExpansion method conflictingNamesWithOperator1.
/**
* Module and Operator with same name is not allowed in a DAG, to prevent properties
* conflict.
*/
@Test(expected = java.lang.IllegalArgumentException.class)
public void conflictingNamesWithOperator1() {
Configuration conf = new Configuration(false);
LogicalPlanConfiguration lpc = new LogicalPlanConfiguration(conf);
LogicalPlan dag = new LogicalPlan();
DummyInputOperator in = dag.addOperator("M1", new DummyInputOperator());
Level2ModuleA module = dag.addModule("M1", new Level2ModuleA());
dag.addStream("s1", in.out, module.mIn);
lpc.prepareDAG(dag, null, "ModuleApp");
dag.validate();
}
use of com.datatorrent.stram.plan.logical.LogicalPlanConfiguration in project apex-core by apache.
the class TestModuleExpansion method testModuleExtreme.
@Test
public void testModuleExtreme() {
StreamingApplication app = new NestedModuleApp();
Configuration conf = new Configuration(false);
LogicalPlanConfiguration lpc = new LogicalPlanConfiguration(conf);
LogicalPlan dag = new LogicalPlan();
lpc.prepareDAG(dag, app, "ModuleApp");
dag.validate();
validateTopLevelOperators(dag);
validateTopLevelStreams(dag);
validatePublicMethods(dag);
}
use of com.datatorrent.stram.plan.logical.LogicalPlanConfiguration in project apex-core by apache.
the class TestModuleExpansion method conflictingNamesWithExpandedModule.
/**
* Generate a conflict, Add a top level operator with name "m1_O1",
* and add a module "m1" which will populate operator "O1", causing name conflict with
* top level operator.
*/
@Test(expected = java.lang.IllegalArgumentException.class)
public void conflictingNamesWithExpandedModule() {
Configuration conf = new Configuration(false);
LogicalPlanConfiguration lpc = new LogicalPlanConfiguration(conf);
LogicalPlan dag = new LogicalPlan();
DummyInputOperator in = dag.addOperator(componentName("m1", "O1"), new DummyInputOperator());
Level2ModuleA module = dag.addModule("m1", new Level2ModuleA());
dag.addStream("s1", in.out, module.mIn);
lpc.prepareDAG(dag, null, "ModuleApp");
dag.validate();
}
use of com.datatorrent.stram.plan.logical.LogicalPlanConfiguration in project apex-core by apache.
the class StramAppLauncher method findAppConfigClasses.
/**
* Scan the application jar file entries for configuration classes.
* This needs to occur in a class loader with access to the application dependencies.
*/
private void findAppConfigClasses(List<String> classFileNames) {
URLClassLoader cl = URLClassLoader.newInstance(launchDependencies.toArray(new URL[launchDependencies.size()]));
for (final String classFileName : classFileNames) {
final String className = classFileName.replace('/', '.').substring(0, classFileName.length() - 6);
try {
final Class<?> clazz = cl.loadClass(className);
if (!Modifier.isAbstract(clazz.getModifiers()) && StreamingApplication.class.isAssignableFrom(clazz)) {
final AppFactory appConfig = new StreamingAppFactory(classFileName, clazz) {
@Override
public LogicalPlan createApp(LogicalPlanConfiguration planConfig) {
// load class from current context class loader
Class<? extends StreamingApplication> c = StramUtils.classForName(className, StreamingApplication.class);
StreamingApplication app = StramUtils.newInstance(c);
return super.createApp(app, planConfig);
}
};
appResourceList.add(appConfig);
}
} catch (Throwable e) {
// java.lang.NoClassDefFoundError
LOG.error("Unable to load class: " + className + " " + e);
}
}
}
Aggregations