public static MetricsEvent getMetricEvents( String operationID ) { return new MetricsEvent( new RemoteSource( ModelType.OPERATION, operationID ), null ); } }
private boolean sameType( RemoteSource source1, RemoteSource source2 ) { return source1.getModelType() == source2.getModelType(); } }
@Override public int hashCode() { int result = 0; if ( source instanceof RemoteSource ) { result = this.getClass().getName().hashCode(); result = 31 * result + ( ( (RemoteSource) source ).getModelType() != null ? ( (RemoteSource) source ).getModelType().toString().hashCode() : 0 ); result = 31 * result + ( ( (RemoteSource) source ).getId() != null ? ( (RemoteSource) source ).getId().hashCode() : 0 ); } else { result = source.getId().hashCode(); result = 31 * result + data.hashCode(); } return result; } }
public static LogEvent getOperationLogEvent( String operationID ) { return new LogEvent( new RemoteSource( ModelType.OPERATION, operationID ), null ); }
private boolean isTrans( RemoteSource source1 ) { return source1.getModelType() == ModelType.TRANSFORMATION; }
public static DataEvent getOperationRowEvent( String operationID ) { return new DataEvent( new RemoteSource( ModelType.OPERATION, operationID ), null ); }
public static StatusEvent getOperationStatusEvent( String operationID ) { return new StatusEvent( new RemoteSource( ModelType.OPERATION, operationID ), null ); }
@Test( expected = MessageEventFireEventException.class ) public void testOperationFireEventThrowException() throws KettleException { addHandlers( operationMessageEvent, messageEventHandler, messageEventHandler2 ); doThrow( new RuntimeException( "Test" ) ).when( messageEventHandler ).execute( any( Message.class ) ); LogEvent logEvent = new LogEvent<>( new RemoteSource( ModelType.OPERATION, "Operation_ID" ), logEntry ); messageEventService.fireEvent( logEvent ); verify( messageEventHandler, never() ).execute( logEvent ); verify( messageEventHandler2 ).execute( logEvent ); }
@Test public void testTransformationFireEvent() throws Exception { addHandlers( transformationMessageEvent, messageEventHandler, messageEventHandler2 ); LogEvent logEvent = new LogEvent<>( new RemoteSource( ModelType.TRANSFORMATION, "Operation_ID" ), logEntry ); messageEventService.fireEvent( logEvent ); verify( messageEventHandler ).execute( logEvent ); verify( messageEventHandler2 ).execute( logEvent ); }
@Test public void testOperationFireEvent() throws KettleException { addHandlers( operationMessageEvent, messageEventHandler, messageEventHandler2 ); LogEvent logEvent = new LogEvent<>( new RemoteSource( ModelType.OPERATION, "Operation_ID" ), logEntry ); messageEventService.fireEvent( logEvent ); verify( messageEventHandler ).execute( logEvent ); verify( messageEventHandler2 ).execute( logEvent ); }