@Test public void testStats() { JobProcessor jp = new JobProcessor() { @Override protected ProcessBuilder createProcessBuilder(JobDefinition od) { return null; } }; String correlation = "{\"processing\": { \"collectStatistics\" : \"NONE\"}}"; JobDefinition od = new JobDefinition(1L, "","","","","",correlation, "1", PARTITION_KEY); assertFalse(jp.collectStats(od)); correlation = "{\"processing\": { \"collectStatistics\" : \"N\"}}"; od = new JobDefinition(1L, "","","","","",correlation, "1", PARTITION_KEY); assertTrue(jp.collectStats(od)); }
boolean collectStats( JobDefinition od ) { boolean collectStats = true; String correlation = od.getCorrelation(); if ( !StringUtils.isEmpty( correlation ) && !correlation.equals( "null" ) ) { JsonReader reader = Json.createReader( new StringReader( correlation ) ); JsonObject object = reader.readObject(); if ( object.containsKey( "processing" ) ) { JsonObject ob = object.getJsonObject( "processing" ); if ( ob.containsKey( "collectStatistics" ) ) { String s = ob.getString( "collectStatistics" ); if ( "NONE".equalsIgnoreCase( s ) ) { collectStats = false; } } } } return collectStats; }
JobProcessor { boolean collectStats( JobDefinition od ) { boolean collectStats = true; String correlation = od.getCorrelation(); if ( !StringUtils.isEmpty( correlation ) && !correlation.equals( "null" ) ) { JsonReader reader = Json.createReader( new StringReader( correlation ) ); JsonObject object = reader.readObject(); if ( object.containsKey( "processing" ) ) { JsonObject ob = object.getJsonObject( "processing" ); if ( ob.containsKey( "collectStatistics" ) ) { String s = ob.getString( "collectStatistics" ); if ( "NONE".equalsIgnoreCase( s ) ) { collectStats = false; } } } } return collectStats; } }
JobProcessor { boolean collectStats( JobDefinition od ) { boolean collectStats = true; String correlation = od.getCorrelation(); if ( !StringUtils.isEmpty( correlation ) && !correlation.equals( "null" ) ) { JsonReader reader = Json.createReader( new StringReader( correlation ) ); JsonObject object = reader.readObject(); if ( object.containsKey( "processing" ) ) { JsonObject ob = object.getJsonObject( "processing" ); if ( ob.containsKey( "collectStatistics" ) ) { String s = ob.getString( "collectStatistics" ); if ( "NONE".equalsIgnoreCase( s ) ) { collectStats = false; } } } } return collectStats; }  }
JobProcessor { boolean collectStats( JobDefinition od ) { boolean collectStats = true; String correlation = od.getCorrelation(); if ( !StringUtils.isEmpty( correlation ) && !correlation.equals( "null" ) ) { JsonReader reader = Json.createReader( new StringReader( correlation ) ); JsonObject object = reader.readObject(); if ( object.containsKey( "processing" ) ) { JsonObject ob = object.getJsonObject( "processing" ); if ( ob.containsKey( "collectStatistics" ) ) { String s = ob.getString( "collectStatistics" ); if ( "NONE".equalsIgnoreCase( s ) ) { collectStats = false; } } } } return collectStats; }  boolean process( JobDefinition od, String clusterID, String workerID ); String getLastErrorString(); }
JobProcessor { boolean collectStats( JobDefinition od ) { boolean collectStats = true; String correlation = od.getCorrelation(); if ( !StringUtils.isEmpty( correlation ) && !correlation.equals( "null" ) ) { JsonReader reader = Json.createReader( new StringReader( correlation ) ); JsonObject object = reader.readObject(); if ( object.containsKey( "processing" ) ) { JsonObject ob = object.getJsonObject( "processing" ); if ( ob.containsKey( "collectStatistics" ) ) { String s = ob.getString( "collectStatistics" ); if ( "NONE".equalsIgnoreCase( s ) ) { collectStats = false; } } } } return collectStats; }  boolean process( JobDefinition od, String clusterID, String workerID ); String getLastErrorString();  }