@Test public void testLookup() throws Throwable { selectTestRelease(); Assert.assertEquals("Test Release", sprintService.lookup(new EntityRef("release", 1001)).getPropertyValue("name")); Assert.assertEquals("Sprint 2", sprintService.lookup(new EntityRef("release-cycle", 1002)).getPropertyValue("name")); Assert.assertEquals("The Others", sprintService.lookup(new EntityRef("team", 102)).getPropertyValue("name")); Assert.assertNull(sprintService.lookup(new EntityRef("defect", 1))); sprintService.resetValues(); Assert.assertNull(sprintService.lookup(new EntityRef("release", 1001))); Assert.assertNull(sprintService.lookup(new EntityRef("release-cycle", 1002))); Assert.assertNull(sprintService.lookup(new EntityRef("team", 102))); Assert.assertNull(sprintService.lookup(new EntityRef("defect", 1))); }
@Override public Entity lookup(final EntityRef ref) { if("release".equals(ref.type)) { return find(releaseSelector, ref); } else if("release-cycle".equals(ref.type)) { return find(sprintSelector, ref); } else if("team".equals(ref.type)) { return find(teamSelector, ref); } else { return null; } }
SprintService implements PersistentStateComponent<Element>, ServerTypeListener, CachingEntityListener { @Override public Entity lookup(final EntityRef ref) { if("release".equals(ref.type)) { return find(releaseSelector, ref); } else if("release-cycle".equals(ref.type)) { return find(sprintSelector, ref); } else if("team".equals(ref.type)) { return find(teamSelector, ref); } else { return null; } } }
SprintService implements PersistentStateComponent<Element>, ServerTypeListener, CachingEntityListener { @Override public Entity lookup(final EntityRef ref) { if("release".equals(ref.type)) { return find(releaseSelector, ref); } else if("release-cycle".equals(ref.type)) { return find(sprintSelector, ref); } else if("team".equals(ref.type)) { return find(teamSelector, ref); } else { return null; } } SprintService(Project project); }
SprintService implements PersistentStateComponent<Element>, ServerTypeListener, CachingEntityListener { @Override public Entity lookup(final EntityRef ref) { if("release".equals(ref.type)) { return find(releaseSelector, ref); } else if("release-cycle".equals(ref.type)) { return find(sprintSelector, ref); } else if("team".equals(ref.type)) { return find(teamSelector, ref); } else { return null; } } 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 { @Override public Entity lookup(final EntityRef ref) { if("release".equals(ref.type)) { return find(releaseSelector, ref); } else if("release-cycle".equals(ref.type)) { return find(sprintSelector, ref); } else if("team".equals(ref.type)) { return find(teamSelector, ref); } else { return null; } } 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);  }