OverviewToListStatements { public Statements asStatements(Execution execution, JsonNode json) { return asStatements(execution, OverviewObject.fromJson(json)); }  Statements asStatements(Execution execution, JsonNode json); Statements asStatements(
            Execution execution, OverviewObject overview);  }
@Test public void deleted() { Execution execution = Mockito.mock(Execution.class); JsonNode node = overviewFactory.createQueued(execution); Mockito.when(execution.getStatus()).thenReturn(ExecutionStatus.DELETED); String graph = "http: Mockito.when(execution.getListGraph()).thenReturn(graph); String iri = "http: Mockito.when(execution.getIri()).thenReturn(iri); Statements actual = this.toStatements.asStatements(execution, node); Statements expected = Statements.arrayList(); expected.setDefaultGraph(graph); expected.addIri(iri, RDF.TYPE, LP_LIST.TOMBSTONE); Assert.assertTrue(actual.containsAllLogMissing(expected)); }
@Test public void progressPriorTo20181018() { ObjectMapper mapper = new ObjectMapper(); ObjectNode root = mapper.createObjectNode(); root.set("status", mapper.createObjectNode() .put("@id", ExecutionStatus.QUEUED.asStr())); String pipeline = "http: root.set("pipeline", mapper.createObjectNode() .put("@id", pipeline)); Date start = new GregorianCalendar(2019, 1, 1, 23, 2, 10).getTime(); Date finished = new GregorianCalendar(2019, 1, 5, 13, 6, 30).getTime(); root.put("executionStarted", dateFormat.format(start)); root.put("executionFinished", dateFormat.format(finished)); root.put("directorySize", 1204); root.set("pipelineProgress", mapper.createObjectNode() .put("current", 3) .put("total", 10)); Date lastChange = new GregorianCalendar(2016, 1, 5, 13, 6, 30).getTime(); root.put("lastChange", dateFormat.format(lastChange)); Execution execution = Mockito.mock(Execution.class); String graph = "http: Mockito.when(execution.getListGraph()).thenReturn(graph); String iri = "http: Mockito.when(execution.getIri()).thenReturn(iri); Statements expected = Statements.arrayList(); expected.setDefaultGraph(graph); expected.addIri(iri, RDF.TYPE, LP_EXEC.EXECUTION); expected.addLong(iri, LP_EXEC.HAS_SIZE, 1204L); expected.addIri(iri, LP_OVERVIEW.HAS_PIPELINE, pipeline); expected.addDate(iri, LP_OVERVIEW.HAS_START, start); expected.addDate(iri, LP_OVERVIEW.HAS_END, finished); expected.addInt(iri, LP_OVERVIEW.HAS_PROGRESS_CURRENT, 3); expected.addInt(iri, LP_OVERVIEW.HAS_PROGRESS_TOTAL, 10); expected.addIri( iri, LP_OVERVIEW.HAS_STATUS, ExecutionStatus.QUEUED.asStr()); Statements actual = this.toStatements.asStatements(execution, root); Assert.assertTrue(actual.containsAllLogMissing(expected)); }
@Test public void fullInformation() { ObjectMapper mapper = new ObjectMapper(); ObjectNode root = mapper.createObjectNode(); root.set("status", mapper.createObjectNode() .put("@id", ExecutionStatus.QUEUED.asStr())); String pipeline = "http: root.set("pipeline", mapper.createObjectNode() .put("@id", pipeline)); Date start = new GregorianCalendar(2019, 1, 1, 23, 2, 10).getTime(); Date finished = new GregorianCalendar(2019, 1, 5, 13, 6, 30).getTime(); root.put("executionStarted", dateFormat.format(start)); root.put("executionFinished", dateFormat.format(finished)); root.put("directorySize", 1204); root.set("pipelineProgress", mapper.createObjectNode() .put("current", 3) .put("total", 10) .put("total_map", 5) .put("current_mapped", 2) .put("current_executed", 1)); Date lastChange = new GregorianCalendar(2016, 1, 5, 13, 6, 30).getTime(); root.put("lastChange", dateFormat.format(lastChange)); Execution execution = Mockito.mock(Execution.class); String graph = "http: Mockito.when(execution.getListGraph()).thenReturn(graph); String iri = "http: Mockito.when(execution.getIri()).thenReturn(iri); Statements expected = Statements.arrayList(); expected.setDefaultGraph(graph); expected.addIri(iri, RDF.TYPE, LP_EXEC.EXECUTION); expected.addLong(iri, LP_EXEC.HAS_SIZE, 1204L); expected.addIri(iri, LP_OVERVIEW.HAS_PIPELINE, pipeline); expected.addDate(iri, LP_OVERVIEW.HAS_START, start); expected.addDate(iri, LP_OVERVIEW.HAS_END, finished); expected.addInt(iri, LP_OVERVIEW.HAS_PROGRESS_CURRENT, 3); expected.addInt(iri, LP_OVERVIEW.HAS_PROGRESS_TOTAL, 10); expected.addInt(iri, LP_OVERVIEW.HAS_PROGRESS_TOTAL_MAP, 5); expected.addInt(iri, LP_OVERVIEW.HAS_PROGRESS_MAPPED, 2); expected.addInt(iri, LP_OVERVIEW.HAS_PROGRESS_EXECUTED, 1); expected.addIri( iri, LP_OVERVIEW.HAS_STATUS, ExecutionStatus.QUEUED.asStr()); Statements actual = this.toStatements.asStatements(execution, root); Assert.assertTrue(actual.containsAllLogMissing(expected)); }