@Before public void setup() throws IOException { final String windowDataDir = "target/" + this.getClass().getSimpleName(); final File windowDataDirFile = new File(windowDataDir); if (windowDataDirFile.exists()) { FileUtils.deleteFile(windowDataDirFile, true); } Attribute.AttributeMap attributeMap = new Attribute.AttributeMap.DefaultAttributeMap(); attributeMap.put(DAG.APPLICATION_PATH, windowDataDir); context = mockOperatorContext(12345, attributeMap); windowDataManager = new FSWindowDataManager(); stsBuilder = new MockSiteToSiteClient.Builder(); dpBuilder = new StringNiFiDataPacketBuilder(); operator = new NiFiSinglePortOutputOperator(stsBuilder, dpBuilder, windowDataManager, 1); }
@Before public void setup() throws IOException { final String windowDataDir = "target/" + this.getClass().getSimpleName(); final File windowDataDirFile = new File(windowDataDir); if (windowDataDirFile.exists()) { FileUtils.deleteFile(windowDataDirFile, true); } Attribute.AttributeMap attributeMap = new Attribute.AttributeMap.DefaultAttributeMap(); attributeMap.put(DAG.APPLICATION_PATH, windowDataDir); context = mockOperatorContext(12345, attributeMap); sink = new CollectorTestSink<>(); builder = new MockSiteToSiteClient.Builder(); windowDataManager = new FSWindowDataManager(); operator = new NiFiSinglePortInputOperator(builder, windowDataManager); operator.outputPort.setSink(sink); }
@Test public void testProxyLauncher() throws Exception { // use the embedded launcher to build the DAG only EmbeddedAppLauncher<?> embeddedLauncher = Launcher.getLauncher(LaunchMode.EMBEDDED); StreamingApplication app = (dag, conf) -> dag.setAttribute(DAGContext.APPLICATION_NAME, "DummyApp"); Configuration conf = new Configuration(false); DAG dag = embeddedLauncher.prepareDAG(app, conf); Attribute.AttributeMap launchAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); Properties configProperties = new Properties(); ApexYarnLauncher launcher = new ApexYarnLauncher(); launcher.launchApp(new MockApexYarnLauncherParams(dag, launchAttributes, configProperties)); }
@Before public void setupApexContexts() throws Exception { Attribute.AttributeMap.DefaultAttributeMap attributeMapForCompositePrimaryKey = new Attribute.AttributeMap.DefaultAttributeMap(); attributeMapForCompositePrimaryKey.put(DAG.APPLICATION_ID, APP_ID); contextForCompositePrimaryKeysOperator = mockOperatorContext(OPERATOR_ID_FOR_COMPOSITE_PRIMARY_KEYS, attributeMapForCompositePrimaryKey); Attribute.AttributeMap.DefaultAttributeMap portAttributesForCompositePrimaryKeys = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributesForCompositePrimaryKeys.put(Context.PortContext.TUPLE_CLASS, CompositePrimaryKeyRow.class); testPortContextForCompositePrimaryKeys = new TestPortContext(portAttributesForCompositePrimaryKeys); compositePrimaryKeysOperator = new CompositePrimaryKeyUpdateOperator(); compositePrimaryKeysOperator.setup(contextForCompositePrimaryKeysOperator); compositePrimaryKeysOperator.activate(contextForCompositePrimaryKeysOperator); compositePrimaryKeysOperator.input.setup(testPortContextForCompositePrimaryKeys); }
@Before public void setupApexContexts() throws Exception { Attribute.AttributeMap.DefaultAttributeMap attributeMapForCounters = new Attribute.AttributeMap.DefaultAttributeMap(); attributeMapForCounters.put(DAG.APPLICATION_ID, APP_ID); contextForCountersOperator = mockOperatorContext(OPERATOR_ID_FOR_COUNTER_COLUMNS, attributeMapForCounters); Attribute.AttributeMap.DefaultAttributeMap portAttributesForCounters = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributesForCounters.put(Context.PortContext.TUPLE_CLASS, CounterColumnTableEntry.class); testPortContextForCounters = new TestPortContext(portAttributesForCounters); counterUpdatesOperator = new CounterColumnUpdatesOperator(); counterUpdatesOperator.setup(contextForCountersOperator); counterUpdatesOperator.activate(contextForCountersOperator); counterUpdatesOperator.input.setup(testPortContextForCounters); }
@Override protected void starting(org.junit.runner.Description description) { String methodName = description.getMethodName(); String className = description.getClassName(); this.dir = "target/" + className + "/" + methodName; Attribute.AttributeMap portAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributes.put(Context.PortContext.TUPLE_CLASS, Person.class); portContext = new TestPortContext(portAttributes); super.starting(description); jsonParser.output.setup(testMeta.portContext); jsonParser.output.setSink(outputSink); jsonParser.err.setSink(errorSink); }
@Before public void setupApexContexts() throws Exception { Attribute.AttributeMap.DefaultAttributeMap attributeMap = new Attribute.AttributeMap.DefaultAttributeMap(); attributeMap.put(DAG.APPLICATION_ID, APP_ID); contextForUserUpsertOperator = mockOperatorContext(OPERATOR_ID_FOR_USER_UPSERTS, attributeMap); userUpsertOperator = new UserUpsertOperator(); Attribute.AttributeMap.DefaultAttributeMap portAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributes.put(Context.PortContext.TUPLE_CLASS, User.class); testPortContextForUserUpserts = new TestPortContext(portAttributes); userUpsertOperator.setup(contextForUserUpsertOperator); userUpsertOperator.activate(contextForUserUpsertOperator); userUpsertOperator.input.setup(testPortContextForUserUpserts); }
/** * Shortcut to run an application with the modified configuration. * * @param app - Application to be run * @param configuration - Configuration * @param runMillis - The time after which the application will be shutdown; pass 0 to run indefinitely. */ public static void runApp(StreamingApplication app, Configuration configuration, int runMillis) { EmbeddedAppLauncher launcher = newInstance(); Attribute.AttributeMap launchAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); launchAttributes.put(RUN_MILLIS, (long)runMillis); launcher.launchApp(app, configuration, launchAttributes); }
@Override protected void starting(org.junit.runner.Description description) { String methodName = description.getMethodName(); String className = description.getClassName(); this.dir = "target/" + className + "/" + methodName; Attribute.AttributeMap operAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); operAttributes.put(Context.DAGContext.APPLICATION_PATH, dir); Attribute.AttributeMap portAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributes.put(Context.PortContext.TUPLE_CLASS, EventRecord.class); context = mockOperatorContext(1, operAttributes); portContext = new TestPortContext(portAttributes); }
@Override protected void starting(org.junit.runner.Description description) { String methodName = description.getMethodName(); String className = description.getClassName(); this.dir = "target/" + className + "/" + methodName; Attribute.AttributeMap attributes = new Attribute.AttributeMap.DefaultAttributeMap(); attributes.put(Context.DAGContext.APPLICATION_PATH, dir); context = mockOperatorContext(1, attributes); Attribute.AttributeMap portAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributes.put(Context.PortContext.TUPLE_CLASS, SimpleOrder.class); portContext = new TestPortContext(portAttributes); }
@Override protected void starting(org.junit.runner.Description description) { String methodName = description.getMethodName(); String className = description.getClassName(); this.dir = "target/" + className + "/" + methodName; Attribute.AttributeMap attributes = new Attribute.AttributeMap.DefaultAttributeMap(); attributes.put(Context.DAGContext.APPLICATION_PATH, dir); context = mockOperatorContext(1, attributes); Attribute.AttributeMap portAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributes.put(Context.PortContext.TUPLE_CLASS, SimpleOrder.class); portContext = new TestPortContext(portAttributes); }
public OutputPortMeta() { this.attributes = new DefaultAttributeMap(); }
private OperatorMeta(String name, GenericOperator operator) { this(name, operator, new DefaultAttributeMap()); }
protected void setupOperator(HBasePOJOPutOperator operator) { configure(operator); AttributeMap.DefaultAttributeMap attributeMap = new AttributeMap.DefaultAttributeMap(); attributeMap.put(OperatorContext.PROCESSING_MODE, ProcessingMode.AT_LEAST_ONCE); attributeMap.put(OperatorContext.ACTIVATION_WINDOW_ID, -1L); attributeMap.put(DAG.APPLICATION_ID, APP_ID); OperatorContext context = mockOperatorContext(OPERATOR_ID, attributeMap); operator.setup(context); }
static OperatorContext getOperatorContext(final String app_id) { AttributeMap.DefaultAttributeMap attributeMap = new AttributeMap.DefaultAttributeMap(); attributeMap.put(DAG.APPLICATION_ID, app_id); return mockOperatorContext(OPERATOR_ID, attributeMap); }
@Before public void setupForTest() { AttributeMap.DefaultAttributeMap attributeMap = new AttributeMap.DefaultAttributeMap(); attributeMap.put(DAG.APPLICATION_ID, APP_ID); context = mockOperatorContext(OPERATOR_ID, attributeMap); Attribute.AttributeMap.DefaultAttributeMap portAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributes.put(Context.PortContext.TUPLE_CLASS, TestPojo.class); tpc = new TestPortContext(portAttributes); }
@Override protected void starting(org.junit.runner.Description description) { Attribute.AttributeMap portAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributes.put(Context.PortContext.TUPLE_CLASS, SimpleOrder.class); portContext = new TestPortContext(portAttributes); super.starting(description); avroWriter.output.setSink(outputSink); }
@Override protected void starting(org.junit.runner.Description description) { Attribute.AttributeMap portAttributes = new Attribute.AttributeMap.DefaultAttributeMap(); portAttributes.put(Context.PortContext.TUPLE_CLASS, SimpleOrder.class); portContext = new TestPortContext(portAttributes); super.starting(description); avroReader.output.setSink(outputSink); createReaderInput(); }
public BaseContext(AttributeMap attributes, Context parentContext) { this.attributes = attributes == null ? new DefaultAttributeMap() : attributes; this.parentContext = parentContext; }
public CacheContext(Attribute.AttributeMap attributeMap) { this.attributeMap = (Attribute.AttributeMap)(attributeMap == null ? new Attribute.AttributeMap.DefaultAttributeMap() : attributeMap); }