List of usage examples for java.time OffsetDateTime now
public static OffsetDateTime now()
From source file:org.jbpm.bpmn2.IntermediateEventTest.java
@Test(timeout = 10000) public void testTimerBoundaryEventDateISO() throws Exception { NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener( "TimerEvent", 1); KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-TimerBoundaryEventDateISO.bpmn2"); ksession = createKnowledgeSession(kbase); ksession.addEventListener(countDownListener); ksession.getWorkItemManager().registerWorkItemHandler("MyTask", new DoNothingWorkItemHandler()); HashMap<String, Object> params = new HashMap<String, Object>(); OffsetDateTime plusTwoSeconds = OffsetDateTime.now().plusSeconds(2); params.put("date", plusTwoSeconds.toString()); ProcessInstance processInstance = ksession.startProcess("TimerBoundaryEvent", params); assertProcessInstanceActive(processInstance); countDownListener.waitTillCompleted(); ksession = restoreSession(ksession, true); assertProcessInstanceFinished(processInstance, ksession); }
From source file:org.matonto.catalog.impl.SimpleCatalogManager.java
/** * Adds the model for a Catalog to the repository which contains the provided metadata using the provided Resource * as the context.// w w w . j av a2s . c om * * @param catalogId The Resource identifying the Catalog you wish you create. * @param title The title text. * @param description The description text. */ private void addCatalogToRepo(Resource catalogId, String title, String description) { try (RepositoryConnection conn = repository.getConnection()) { OffsetDateTime now = OffsetDateTime.now(); Catalog catalog = catalogFactory.createNew(catalogId); catalog.setProperty(vf.createLiteral(title), vf.createIRI(DCTERMS.TITLE.stringValue())); catalog.setProperty(vf.createLiteral(description), vf.createIRI(DCTERMS.DESCRIPTION.stringValue())); catalog.setProperty(vf.createLiteral(now), vf.createIRI(DCTERMS.ISSUED.stringValue())); catalog.setProperty(vf.createLiteral(now), vf.createIRI(DCTERMS.MODIFIED.stringValue())); conn.add(catalog.getModel(), catalogId); } catch (RepositoryException e) { throw new MatOntoException("Error in repository connection.", e); } }
From source file:org.jbpm.bpmn2.IntermediateEventTest.java
@Test(timeout = 10000) public void testIntermediateCatchEventTimerDateISO() throws Exception { NodeLeftCountDownProcessEventListener countDownListener = new NodeLeftCountDownProcessEventListener("timer", 1);/*from w w w . j a v a 2 s . c o m*/ KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-IntermediateCatchEventTimerDateISO.bpmn2"); ksession = createKnowledgeSession(kbase); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler()); ksession.addEventListener(countDownListener); HashMap<String, Object> params = new HashMap<String, Object>(); OffsetDateTime plusTwoSeconds = OffsetDateTime.now().plusSeconds(2); params.put("date", plusTwoSeconds.toString()); ProcessInstance processInstance = ksession.startProcess("IntermediateCatchEvent", params); assertProcessInstanceActive(processInstance); // now wait for 1 second for timer to trigger countDownListener.waitTillCompleted(); assertProcessInstanceFinished(processInstance, ksession); }