@Test public void testLoadState() throws Throwable { sprintTeamRequests_TestRelease(handler); WaitForEventsListener listener = new WaitForEventsListener(sprintService); Element state = new Element("SprintService"); state.setAttribute("release-id", "1001"); state.setAttribute("release-name", "Test Release"); state.setAttribute("release-cycle-id", "1001"); state.setAttribute("release-cycle-name", "Sprint 1"); state.setAttribute("team-id", "101"); state.setAttribute("team-name", "The Team"); sprintService.loadState(state); handler.consume(); listener.waitForEvents(1001, 1001, 101); Assert.assertEquals(1001, sprintService.getRelease().getId()); Assert.assertEquals(1001, sprintService.getSprint().getId()); Assert.assertEquals(101, sprintService.getTeam().getId()); }
public void loadState(Element state) { selectSprint(loadEntity(state, "release-cycle")); selectTeam(loadEntity(state, "team")); selectRelease(loadEntity(state, "release")); }
SprintService implements PersistentStateComponent<Element>, ServerTypeListener, CachingEntityListener { public void loadState(Element state) { selectSprint(loadEntity(state, "release-cycle")); selectTeam(loadEntity(state, "team")); selectRelease(loadEntity(state, "release")); } }
SprintService implements PersistentStateComponent<Element>, ServerTypeListener, CachingEntityListener { public void loadState(Element state) { selectSprint(loadEntity(state, "release-cycle")); selectTeam(loadEntity(state, "team")); selectRelease(loadEntity(state, "release")); } SprintService(Project project); }
SprintService implements PersistentStateComponent<Element>, ServerTypeListener, CachingEntityListener { public void loadState(Element state) { selectSprint(loadEntity(state, "release-cycle")); selectTeam(loadEntity(state, "team")); selectRelease(loadEntity(state, "release")); } SprintService(Project project); Element getState(); void loadState(Element state); @Override void connectedTo(ServerType serverType); synchronized Entity getRelease(); synchronized Entity getSprint(); synchronized Entity getTeam(); void addListener(Listener listener); void removeListener(Listener listener); synchronized void selectRelease(final Entity release); synchronized void selectSprint(Entity sprint); synchronized void selectTeam(Entity team); synchronized Entity getCurrentSprint(); synchronized EntityList getTeams(); EntityList getSprints(); EntityList getReleases(); static boolean isSameTense(Entity sprint1, Entity sprint2); static boolean isCurrentSprint(Entity sprint); static long distance(long now, Entity entity); @Override Entity lookup(final EntityRef ref); @Override void entityLoaded(Entity entity, Event event); @Override void entityNotFound(EntityRef ref, boolean removed); }
SprintService implements PersistentStateComponent<Element>, ServerTypeListener, CachingEntityListener { public void loadState(Element state) { selectSprint(loadEntity(state, "release-cycle")); selectTeam(loadEntity(state, "team")); selectRelease(loadEntity(state, "release")); } SprintService(Project project); Element getState(); void loadState(Element state); @Override void connectedTo(ServerType serverType); synchronized Entity getRelease(); synchronized Entity getSprint(); synchronized Entity getTeam(); void addListener(Listener listener); void removeListener(Listener listener); synchronized void selectRelease(final Entity release); synchronized void selectSprint(Entity sprint); synchronized void selectTeam(Entity team); synchronized Entity getCurrentSprint(); synchronized EntityList getTeams(); EntityList getSprints(); EntityList getReleases(); static boolean isSameTense(Entity sprint1, Entity sprint2); static boolean isCurrentSprint(Entity sprint); static long distance(long now, Entity entity); @Override Entity lookup(final EntityRef ref); @Override void entityLoaded(Entity entity, Event event); @Override void entityNotFound(EntityRef ref, boolean removed);  }