private void createPlayerAndTournamentAndCommit() { final Player player = BowlingFactory.eINSTANCE.createPlayer(); player.setName("player"); final Tournament tournament = BowlingFactory.eINSTANCE.createTournament(); tournament.getPlayerPoints().put(player, 32); RunESCommand.run( new Callable<Void>() { public Void call() throws Exception { getLocalProject().getModelElements().add(player); getLocalProject().getModelElements().add(tournament); return null; } }); commit(); }
@Override @Test public void testController() throws ESException { assertEquals(0, getLocalProject().getModelElements().size()); final ESUpdateCallback updateCallback = new MyUpdateCallback(); final IProgressMonitor monitor = new NullProgressMonitor(); // create checkout checkout(); createPlayerAndTournamentAndCommit(); final ESPrimaryVersionSpec baseVersion = getLocalProject().getBaseVersion(); // update checkout getCopy().update(getLocalProject().getBaseVersion(), updateCallback, monitor); // delete player deleteTournamentAndCommit(); assertEquals(1, getLocalProject().getModelElements().size()); // update checkout getCopy().update(getLocalProject().getBaseVersion(), updateCallback, monitor); assertEquals(1, getCopy().getModelElements().size()); // revert to version where tournament has been created revertAndCommit(baseVersion); // update checkout getCopy().update(ESVersionSpec.FACTORY.createHEAD(), updateCallback, monitor); assertEquals(2, getCopy().getModelElements().size()); final Tournament tournament = getCopy().getAllModelElementsByClass(Tournament.class).iterator().next(); assertEquals(new Integer(32), tournament.getPlayerPoints().values().iterator().next()); // revert again, should have no effect revertAndCommit(baseVersion); getCopy().update(ESVersionSpec.FACTORY.createHEAD(), updateCallback, monitor); assertEquals(2, getCopy().getModelElements().size()); }