@Test public void checkChangeRequestIsApproved() { CORootController rootController = CORootController.setupDummyData(); Baseline bl = rootController.getBaselinesFromVSCI(rootController.getTrunk().getSCIs().get(0)).get(0); ChangeRequest c = new ChangeRequest(); c.setVersion(bl); c.setProblem("Test Problem"); c.setSolution("test solution"); Developer dev = rootController.getDevelopers().get(0); SimpleDateFormat dformat = new SimpleDateFormat("dd/MM/yyyy"); Date convDate = null; try { convDate = dformat.parse("02/09/1984"); } catch (ParseException e) { e.printStackTrace(); } rootController.approveChangeRequest( c, dev, ChangeRequest.ASSESSMENT_APPROVED, ChangeRequest.PRIORITY_HIGH, convDate); // If the collection of approved requests contains the created change // request the test passes. assertTrue(rootController.getApprovedRequests(dev).contains(c)); }
@Test public void checkChangeRequestCreated() { CORootController rootController = CORootController.setupDummyData(); Baseline bl = rootController.getBaselinesFromVSCI(rootController.getTrunk().getSCIs().get(0)).get(0); ChangeRequest c = new ChangeRequest(); c.setVersion(bl); c.setProblem("Test Problem"); c.setSolution("test solution"); rootController.print(bl.getChanges()); // If when we return a collection of all change requests, we can safely // assume that the change request was created correctly. assertTrue(rootController.getChangeRequests().contains(c)); }
@Test public void checkChangeRequestCompleted() { CORootController rootController = CORootController.setupDummyData(); Baseline bl = rootController.getBaselinesFromVSCI(rootController.getTrunk().getSCIs().get(0)).get(0); ChangeRequest c = new ChangeRequest(); c.setVersion(bl); c.setProblem("Test Problem"); c.setSolution("test solution"); Developer dev = rootController.getDevelopers().get(0); SimpleDateFormat dformat = new SimpleDateFormat("dd/MM/yyyy"); Date convDate = null; try { convDate = dformat.parse("02/09/1984"); } catch (ParseException e) { e.printStackTrace(); } rootController.approveChangeRequest( c, dev, ChangeRequest.ASSESSMENT_APPROVED, ChangeRequest.PRIORITY_HIGH, convDate); rootController.completeChangeRequest(c); System.out.println(c.getDeadlineDate().toString()); // If the change requests completion date data member is not null, // the c can be assumed to be completed. assertTrue(c.getCompletionDate() != null); }
void processConnections() { synchronized (this.pendingStateChanges) { Iterator<ChangeRequest> changes = this.pendingStateChanges.iterator(); while (changes.hasNext()) { ChangeRequest change = (ChangeRequest) changes.next(); SelectionKey key = change.getSocket().keyFor(this.selector); key.interestOps(change.getOps()); } this.pendingStateChanges.clear(); } try { selector.selectNow(); } catch (IOException e) { LOG.severe("Couldn't select channels."); } processSelectedKeys(); selector.selectedKeys().clear(); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.Request#cancel() */ @Override public void cancel() { super.cancel(); this.actualLocation = null; }