diff --git a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatManagerImpl.java b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatManagerImpl.java index 120618d17c51..08b13904a40e 100644 --- a/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatManagerImpl.java +++ b/chat/chat-impl/impl/src/java/org/sakaiproject/chat2/model/impl/ChatManagerImpl.java @@ -1097,10 +1097,10 @@ public List getPresentUsers(String siteId, String channelId){ if (StringUtils.isNotBlank(siteId)) { // refresh our presence at the location and retrieve the present users - String location = siteId + "-presence"; + String location = siteId + PresenceService.PRESENCE_SUFFIX; presenceService.setPresence(location); - for(UsageSession us : presenceService.getPresence(siteId + "-presence")){ + for(UsageSession us : presenceService.getPresence(siteId + PresenceService.PRESENCE_SUFFIX)){ //check if still online in the heartbeat map if (isOnline(channelId, us.getId())) { TransferableChatMessage tcm = heartbeatMap.getIfPresent(channelId).getIfPresent(us.getId()); diff --git a/portal/portal-chat/tool/src/java/org/sakaiproject/portal/chat/entity/PCServiceEntityProvider.java b/portal/portal-chat/tool/src/java/org/sakaiproject/portal/chat/entity/PCServiceEntityProvider.java index a44b595a12c7..b2bc4a894fb0 100644 --- a/portal/portal-chat/tool/src/java/org/sakaiproject/portal/chat/entity/PCServiceEntityProvider.java +++ b/portal/portal-chat/tool/src/java/org/sakaiproject/portal/chat/entity/PCServiceEntityProvider.java @@ -522,9 +522,9 @@ public Map handleLatestData(EntityReference ref, Map 0 && showSiteUsers) { // A site id has been specified, so we refresh our presence at the // location and retrieve the present users - String location = siteId + "-presence"; + String location = siteId + PresenceService.PRESENCE_SUFFIX; presenceService.setPresence(location); - List presentSakaiUsers = presenceService.getPresentUsers(siteId + "-presence"); + List presentSakaiUsers = presenceService.getPresentUsers(siteId + PresenceService.PRESENCE_SUFFIX); presentSakaiUsers.remove(currentUser); for (User user : presentSakaiUsers) { UserMessage heartbeat = heartbeatMap.get(user.getId()); diff --git a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/PresenceHandler.java b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/PresenceHandler.java index bbd1bf0b60fd..348a32379afd 100644 --- a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/PresenceHandler.java +++ b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/PresenceHandler.java @@ -30,6 +30,7 @@ import org.sakaiproject.exception.PermissionException; import org.sakaiproject.portal.api.Portal; import org.sakaiproject.portal.api.PortalHandlerException; +import org.sakaiproject.presence.api.PresenceService; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.cover.SiteService; import org.sakaiproject.tool.api.ActiveTool; @@ -125,7 +126,7 @@ public void doPresence(HttpServletRequest req, HttpServletResponse res, // site's presence... // Note: the placement is transient, but will always have the same id // and context based on the siteId - Placement placement = new org.sakaiproject.util.Placement(siteId + "-presence", + Placement placement = new org.sakaiproject.util.Placement(siteId + PresenceService.PRESENCE_SUFFIX, tool.getId(), tool, null, siteId, null); portal diff --git a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/SiteHandler.java b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/SiteHandler.java index ff81fdeb8902..e3222b18dc69 100644 --- a/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/SiteHandler.java +++ b/portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/handlers/SiteHandler.java @@ -55,6 +55,7 @@ import org.sakaiproject.portal.api.StoredState; import org.sakaiproject.portal.charon.site.AllSitesViewImpl; import org.sakaiproject.portal.charon.site.PortalSiteHelperImpl; +import org.sakaiproject.presence.api.PresenceService; import org.sakaiproject.tool.api.Tool; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.api.ToolManager; @@ -562,7 +563,7 @@ public void doSite(HttpServletRequest req, HttpServletResponse res, Session sess try{ boolean presenceEvents = ServerConfigurationService.getBoolean("presence.events.log", true); if (presenceEvents) - org.sakaiproject.presence.cover.PresenceService.setPresence(siteId + "-presence"); + org.sakaiproject.presence.cover.PresenceService.setPresence(siteId + PresenceService.PRESENCE_SUFFIX); }catch(Exception e){} //End - log the visit into SAKAI_EVENT diff --git a/presence/presence-api/api/src/java/org/sakaiproject/presence/api/PresenceService.java b/presence/presence-api/api/src/java/org/sakaiproject/presence/api/PresenceService.java index db47436e9675..e84c7a2b7c8c 100644 --- a/presence/presence-api/api/src/java/org/sakaiproject/presence/api/PresenceService.java +++ b/presence/presence-api/api/src/java/org/sakaiproject/presence/api/PresenceService.java @@ -39,6 +39,9 @@ public interface PresenceService /** This string starts the references to resources in this service. */ static final String REFERENCE_ROOT = "/presence"; + /** This string gets appended to presence event references. */ + static final String PRESENCE_SUFFIX = "-presence"; + /** Name for the event of establishing presence at a location. */ static final String EVENT_PRESENCE = "pres.begin"; diff --git a/sitestats/sitestats-impl/pom.xml b/sitestats/sitestats-impl/pom.xml index 2469fcddb053..37b6f24d7178 100644 --- a/sitestats/sitestats-impl/pom.xml +++ b/sitestats/sitestats-impl/pom.xml @@ -78,6 +78,10 @@ org.sakaiproject.edu-services.course-management coursemanagement-api + + org.sakaiproject.presence + sakai-presence-api + diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsUpdateManagerImpl.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsUpdateManagerImpl.java index 2d891638691d..3331cf32f13c 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsUpdateManagerImpl.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/StatsUpdateManagerImpl.java @@ -53,6 +53,7 @@ import org.sakaiproject.event.api.UsageSession; import org.sakaiproject.event.api.UsageSessionService; import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.presence.api.PresenceService; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.api.SiteService; import org.sakaiproject.sitestats.api.EventStat; @@ -78,8 +79,6 @@ */ @Slf4j public class StatsUpdateManagerImpl extends HibernateDaoSupport implements Runnable, StatsUpdateManager, Observer, StatsUpdateManagerMXBean { - private final static String PRESENCE_SUFFIX = "-presence"; - private final static int PRESENCE_SUFFIX_LENGTH = PRESENCE_SUFFIX.length(); /** Spring bean members */ private boolean collectThreadEnabled = true; @@ -1606,8 +1605,8 @@ private String parseSiteId(Event e){ || StatsManager.SITEVISITEND_EVENTID.equals(eventId)){ // presence (site visit) syntax (/presence/SITE_ID-presence) String[] parts = eventRef.split("/"); - if(parts.length > 2 && parts[2].endsWith(PRESENCE_SUFFIX)) { - return parts[2].substring(0, parts[2].length() - PRESENCE_SUFFIX_LENGTH); + if(parts.length > 2 && parts[2].endsWith(PresenceService.PRESENCE_SUFFIX)) { + return parts[2].substring(0, parts[2].length() - PresenceService.PRESENCE_SUFFIX.length()); } }else{ diff --git a/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/StatsUpdateManagerTest.java b/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/StatsUpdateManagerTest.java index 8d8b77db7fcf..5f6422bd91b3 100644 --- a/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/StatsUpdateManagerTest.java +++ b/sitestats/sitestats-impl/src/test/org/sakaiproject/sitestats/test/StatsUpdateManagerTest.java @@ -41,6 +41,7 @@ import org.sakaiproject.event.api.Event; import org.sakaiproject.event.api.EventTrackingService; import org.sakaiproject.exception.IdUnusedException; +import org.sakaiproject.presence.api.PresenceService; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.api.SiteService; import org.sakaiproject.sitestats.api.EventStat; @@ -211,8 +212,8 @@ public void testInvalidEvents() { @Test public void testSiteVisits() { // #1 Test: 2 site visit (different users) - Event eSV1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); - Event eSV2 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_B_ID, "session-id-b"); + Event eSV1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); + Event eSV2 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_B_ID, "session-id-b"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV1, eSV2))); // #1: SST_EVENTS List r1 = (List) db.getResultsForClass(EventStatImpl.class); @@ -248,8 +249,8 @@ public void testSiteVisits() { // #2 Test: 2 site visit (same users) db.deleteAll(); - eSV1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); - eSV2 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + eSV1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); + eSV2 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV1, eSV2))); // #2: SST_EVENTS r1 = (List) db.getResultsForClass(EventStatImpl.class); @@ -279,28 +280,28 @@ public void testSitePresenceSplitUpdates() { // Start and end across collections. { List events = new ArrayList<>(); - events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/" + FakeData.SITE_A_ID + "-presence", null, FakeData.USER_A_ID, "session-id")); + events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/" + FakeData.SITE_A_ID + PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id")); Assert.assertTrue(M_sum.collectEvents(events)); } { List events = new ArrayList<>(); - events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISITEND_EVENTID, "/presence/" + FakeData.SITE_A_ID + "-presence", null, FakeData.USER_A_ID, "session-id")); + events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISITEND_EVENTID, "/presence/" + FakeData.SITE_A_ID + PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id")); Assert.assertTrue(M_sum.collectEvents(events)); } // Start and end in the same collection. { List events = new ArrayList<>(); - events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/" + FakeData.SITE_A_ID + "-presence", null, FakeData.USER_A_ID, "session-id")); - events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISITEND_EVENTID, "/presence/" + FakeData.SITE_A_ID + "-presence", null, FakeData.USER_A_ID, "session-id")); + events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/" + FakeData.SITE_A_ID + PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id")); + events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISITEND_EVENTID, "/presence/" + FakeData.SITE_A_ID + PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id")); Assert.assertTrue(M_sum.collectEvents(events)); } // Multiple end events in the same collection. { List events = new ArrayList<>(); - events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/" + FakeData.SITE_A_ID + "-presence", null, FakeData.USER_A_ID, "session-id")); - events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISITEND_EVENTID, "/presence/" + FakeData.SITE_A_ID + "-presence", null, FakeData.USER_A_ID, "session-id")); - events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISITEND_EVENTID, "/presence/" + FakeData.SITE_A_ID + "-presence", null, FakeData.USER_A_ID, "session-id")); + events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/" + FakeData.SITE_A_ID + PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id")); + events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISITEND_EVENTID, "/presence/" + FakeData.SITE_A_ID + PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id")); + events.add(M_sum.buildEvent(new Date(), StatsManager.SITEVISITEND_EVENTID, "/presence/" + FakeData.SITE_A_ID + PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id")); Assert.assertTrue(M_sum.collectEvents(events)); } } @@ -431,8 +432,8 @@ public void testSitePresences() { // BEGIN SITE PRESENCE Date now = new Date(); - Event eSV1 = M_sum.buildEvent(now, StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); - Event eSV2 = M_sum.buildEvent(now, StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_B_ID, "session-id-b"); + Event eSV1 = M_sum.buildEvent(now, StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); + Event eSV2 = M_sum.buildEvent(now, StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_B_ID, "session-id-b"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV1, eSV2))); // ... check SST_PRESENCES List r1 = (List) db.getResultsForClass(SitePresenceImpl.class); @@ -459,8 +460,8 @@ public void testSitePresences() { Thread.sleep(minPresenceTime); }catch(Exception e) {} now = new Date(); - Event eSV1e = M_sum.buildEvent(now, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); - Event eSV2e = M_sum.buildEvent(now, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_B_ID, "session-id-b"); + Event eSV1e = M_sum.buildEvent(now, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); + Event eSV2e = M_sum.buildEvent(now, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_B_ID, "session-id-b"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV1e, eSV2e))); // ... check SST_PRESENCES r1 = (List) db.getResultsForClass(SitePresenceImpl.class); @@ -488,7 +489,7 @@ public void testSitePresences() { // BEGIN SITE PRESENCE now = new Date(); - eSV1 = M_sum.buildEvent(now, StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + eSV1 = M_sum.buildEvent(now, StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV1))); try{ // give it time before ending presence @@ -497,7 +498,7 @@ public void testSitePresences() { }catch(Exception e) {} Date now2 = new Date(); long secondDuration = now2.getTime() - now.getTime(); - eSV2 = M_sum.buildEvent(now2, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + eSV2 = M_sum.buildEvent(now2, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV2))); // ... check SST_PRESENCES r1 = (List) db.getResultsForClass(SitePresenceImpl.class); @@ -512,7 +513,7 @@ public void testSitePresences() { // END SITE PRESENCE now = new Date(); - eSV1e = M_sum.buildEvent(now, StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + eSV1e = M_sum.buildEvent(now, StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV1e))); try{ // give it time before ending presence @@ -521,7 +522,7 @@ public void testSitePresences() { }catch(Exception e) {} now2 = new Date(); secondDuration = now2.getTime() - now.getTime(); - eSV2e = M_sum.buildEvent(now2, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + eSV2e = M_sum.buildEvent(now2, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV2e))); // ... check SST_PRESENCES r1 = (List) db.getResultsForClass(SitePresenceImpl.class); @@ -559,7 +560,7 @@ public void testSitePresences() { }catch(Exception e) {} now2 = new Date(); secondDuration = now2.getTime() - now.getTime(); - eSV2e = M_sum.buildEvent(now2, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + eSV2e = M_sum.buildEvent(now2, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV2e))); r1 = (List) db.getResultsForClass(SitePresenceImpl.class); Assert.assertEquals(1, r1.size()); @@ -596,7 +597,7 @@ public void testSitePresences() { }catch(Exception e) {} now2 = new Date(); secondDuration = now2.getTime() - now.getTime(); - eSV2e = M_sum.buildEvent(now2, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + eSV2e = M_sum.buildEvent(now2, StatsManager.SITEVISITEND_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); Assert.assertTrue(M_sum.collectEvents(Arrays.asList(eSV2e))); r1 = (List) db.getResultsForClass(SitePresenceImpl.class); Assert.assertEquals(1, r1.size()); @@ -711,8 +712,8 @@ public void testConfigIsCollectAdminEvents() { // #3: collect admin events Assert.assertEquals(true, M_sum.isCollectAdminEvents()); // make sure it processes admin events - Event e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, "admin", "session-id-a"); - Event e2 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + Event e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, "admin", "session-id-a"); + Event e2 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); M_sum.collectEvents(Arrays.asList(e1, e2)); List results2 = (List) db.getResultsForClass(SiteVisitsImpl.class); Assert.assertEquals(1, results2.size()); @@ -737,11 +738,11 @@ public void testConfigIsCollectEventsForSiteWithToolOnly() { // make sure events get processed for sites with SiteStats only M_sum.setCollectEventsForSiteWithToolOnly(true); Assert.assertEquals(true, M_sum.isCollectEventsForSiteWithToolOnly()); - Event e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + Event e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); M_sum.collectEvent(e1); List results2 = (List) db.getResultsForClass(SiteVisitsImpl.class); Assert.assertEquals(1, results2.size()); - e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_B_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_B_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); M_sum.collectEvent(e1); results2 = (List) db.getResultsForClass(SiteVisitsImpl.class); Assert.assertEquals(1, results2.size()); @@ -749,11 +750,11 @@ public void testConfigIsCollectEventsForSiteWithToolOnly() { db.deleteAll(); M_sum.setCollectEventsForSiteWithToolOnly(false); Assert.assertEquals(false, M_sum.isCollectEventsForSiteWithToolOnly()); - e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_A_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); M_sum.collectEvent(e1); results2 = (List) db.getResultsForClass(SiteVisitsImpl.class); Assert.assertEquals(1, results2.size()); - e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_B_ID+"-presence", null, FakeData.USER_A_ID, "session-id-a"); + e1 = M_sum.buildEvent(new Date(), StatsManager.SITEVISIT_EVENTID, "/presence/"+FakeData.SITE_B_ID+PresenceService.PRESENCE_SUFFIX, null, FakeData.USER_A_ID, "session-id-a"); M_sum.collectEvent(e1); results2 = (List) db.getResultsForClass(SiteVisitsImpl.class); Assert.assertEquals(2, results2.size());