List of usage examples for java.util SortedMap size
int size();
From source file:com.restfb.util.InsightUtilsTest.java
@Test public void executeInsightQueriesByMetricByDate2() throws IOException, ParseException { // note that the query that is passed to the FacebookClient WebRequestor is // ignored,/* ww w . ja v a 2 s.co m*/ // so arguments of executeInsightQueriesByDate: // (String pageObjectId, Set<String> metrics, Period period) // are effectively ignored. In this test we are validating the // WebRequestor's json // is properly processed Date d20030629_0000pst = sdfPST.parse("20030629_0000"); Date d20030630_0000pst = sdfPST.parse("20030630_0000"); Date d20030701_0000pst = sdfPST.parse("20030701_0000"); Date d20030702_0000pst = sdfPST.parse("20030702_0000"); // intentionally using (chaotic) HashSet to ensure implementation is // tolerant of that collection Set<Date> periodEndDates = new HashSet<Date>(); periodEndDates.add(d20030629_0000pst); periodEndDates.add(d20030630_0000pst); periodEndDates.add(d20030701_0000pst); periodEndDates.add(d20030702_0000pst); SortedMap<String, SortedMap<Date, Object>> results = executeInsightQueriesByMetricByDate( createFixedResponseFacebookClient("multiResponse_2metrics_4dates.json"), TEST_PAGE_OBJECT, toStringSet("page_active_users", "page_tab_views_login_top_unique"), Period.DAY, periodEndDates); Assert.assertNotNull(results); assertEquals(2, results.size()); SortedMap<Date, Object> metricResult = results.get("page_active_users"); assertEquals(4, metricResult.size()); // {"name":0,"fql_result_set":[{"metric":"page_active_users","value":761},{"metric":"page_tab_views_login_top_unique","value":{"wall":30,"app_4949752878":3,"photos":2}}]}, // here we validate the date map is sorted, so the results will come out in // a predictable order Iterator<Object> itValues = metricResult.values().iterator(); assertEquals(761, itValues.next()); assertEquals(705, itValues.next()); assertEquals(582, itValues.next()); assertEquals(125, itValues.next()); metricResult = results.get("page_tab_views_login_top_unique"); assertEquals(4, metricResult.size()); JsonObject o = (JsonObject) metricResult.get(d20030629_0000pst); assertEquals(3, o.length()); assertEquals(2, o.getInt("photos")); assertEquals(3, o.getInt("app_4949752878")); assertEquals(30, o.getInt("wall")); o = (JsonObject) metricResult.get(d20030630_0000pst); assertEquals(4, o.length()); assertEquals(1, o.getInt("photos")); assertEquals(1, o.getInt("app_4949752878")); assertEquals(2, o.getInt("app_2373072738")); assertEquals(23, o.getInt("wall")); o = (JsonObject) metricResult.get(d20030701_0000pst); assertEquals(2, o.length()); assertEquals(1, o.getInt("app_4949752878")); assertEquals(12, o.getInt("wall")); o = (JsonObject) metricResult.get(d20030702_0000pst); assertEquals(2, o.length()); assertEquals(1, o.getInt("photos")); assertEquals(11, o.getInt("wall")); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamSecGroupMemberTable.java
public CFAccSecGroupMemberBuff[] readDerivedByUserIdx(CFAccAuthorization Authorization, UUID SecUserId) { final String S_ProcName = "CFAccRamSecGroupMember.readDerivedByUserIdx() "; CFAccSecGroupMemberByUserIdxKey key = schema.getFactorySecGroupMember().newUserIdxKey(); key.setRequiredSecUserId(SecUserId); CFAccSecGroupMemberBuff[] recArray;/*from w w w. ja v a 2 s. c o m*/ if (dictByUserIdx.containsKey(key)) { SortedMap<CFAccSecGroupMemberPKey, CFAccSecGroupMemberBuff> subdictUserIdx = dictByUserIdx.get(key); recArray = new CFAccSecGroupMemberBuff[subdictUserIdx.size()]; Iterator<CFAccSecGroupMemberBuff> iter = subdictUserIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccSecGroupMemberBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamSecGroupMemberTable.java
public CFAstSecGroupMemberBuff[] readDerivedByUserIdx(CFAstAuthorization Authorization, UUID SecUserId) { final String S_ProcName = "CFAstRamSecGroupMember.readDerivedByUserIdx() "; CFAstSecGroupMemberByUserIdxKey key = schema.getFactorySecGroupMember().newUserIdxKey(); key.setRequiredSecUserId(SecUserId); CFAstSecGroupMemberBuff[] recArray;//from w w w . ja va2 s .co m if (dictByUserIdx.containsKey(key)) { SortedMap<CFAstSecGroupMemberPKey, CFAstSecGroupMemberBuff> subdictUserIdx = dictByUserIdx.get(key); recArray = new CFAstSecGroupMemberBuff[subdictUserIdx.size()]; Iterator<CFAstSecGroupMemberBuff> iter = subdictUserIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstSecGroupMemberBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTSecGroupMemberTable.java
public CFAccTSecGroupMemberBuff[] readDerivedByUserIdx(CFAccAuthorization Authorization, UUID SecUserId) { final String S_ProcName = "CFAccRamTSecGroupMember.readDerivedByUserIdx() "; CFAccTSecGroupMemberByUserIdxKey key = schema.getFactoryTSecGroupMember().newUserIdxKey(); key.setRequiredSecUserId(SecUserId); CFAccTSecGroupMemberBuff[] recArray; if (dictByUserIdx.containsKey(key)) { SortedMap<CFAccTSecGroupMemberPKey, CFAccTSecGroupMemberBuff> subdictUserIdx = dictByUserIdx.get(key); recArray = new CFAccTSecGroupMemberBuff[subdictUserIdx.size()]; Iterator<CFAccTSecGroupMemberBuff> iter = subdictUserIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); }/*from w w w. ja v a 2 s . c o m*/ } else { recArray = new CFAccTSecGroupMemberBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamTSecGroupMemberTable.java
public CFAstTSecGroupMemberBuff[] readDerivedByUserIdx(CFAstAuthorization Authorization, UUID SecUserId) { final String S_ProcName = "CFAstRamTSecGroupMember.readDerivedByUserIdx() "; CFAstTSecGroupMemberByUserIdxKey key = schema.getFactoryTSecGroupMember().newUserIdxKey(); key.setRequiredSecUserId(SecUserId); CFAstTSecGroupMemberBuff[] recArray; if (dictByUserIdx.containsKey(key)) { SortedMap<CFAstTSecGroupMemberPKey, CFAstTSecGroupMemberBuff> subdictUserIdx = dictByUserIdx.get(key); recArray = new CFAstTSecGroupMemberBuff[subdictUserIdx.size()]; Iterator<CFAstTSecGroupMemberBuff> iter = subdictUserIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); }//from w w w . ja v a 2 s. c om } else { recArray = new CFAstTSecGroupMemberBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamSecGroupMemberTable.java
public CFAccSecGroupMemberBuff[] readDerivedByGroupIdx(CFAccAuthorization Authorization, long ClusterId, int SecGroupId) { final String S_ProcName = "CFAccRamSecGroupMember.readDerivedByGroupIdx() "; CFAccSecGroupMemberByGroupIdxKey key = schema.getFactorySecGroupMember().newGroupIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecGroupId(SecGroupId); CFAccSecGroupMemberBuff[] recArray;/* w ww . j a va2s . co m*/ if (dictByGroupIdx.containsKey(key)) { SortedMap<CFAccSecGroupMemberPKey, CFAccSecGroupMemberBuff> subdictGroupIdx = dictByGroupIdx.get(key); recArray = new CFAccSecGroupMemberBuff[subdictGroupIdx.size()]; Iterator<CFAccSecGroupMemberBuff> iter = subdictGroupIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccSecGroupMemberBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamSecGroupMemberTable.java
public CFAstSecGroupMemberBuff[] readDerivedByGroupIdx(CFAstAuthorization Authorization, long ClusterId, int SecGroupId) { final String S_ProcName = "CFAstRamSecGroupMember.readDerivedByGroupIdx() "; CFAstSecGroupMemberByGroupIdxKey key = schema.getFactorySecGroupMember().newGroupIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecGroupId(SecGroupId); CFAstSecGroupMemberBuff[] recArray;// w w w . jav a 2 s. co m if (dictByGroupIdx.containsKey(key)) { SortedMap<CFAstSecGroupMemberPKey, CFAstSecGroupMemberBuff> subdictGroupIdx = dictByGroupIdx.get(key); recArray = new CFAstSecGroupMemberBuff[subdictGroupIdx.size()]; Iterator<CFAstSecGroupMemberBuff> iter = subdictGroupIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstSecGroupMemberBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTSecGroupMemberTable.java
public CFAccTSecGroupMemberBuff[] readDerivedByGroupIdx(CFAccAuthorization Authorization, long TenantId, int TSecGroupId) { final String S_ProcName = "CFAccRamTSecGroupMember.readDerivedByGroupIdx() "; CFAccTSecGroupMemberByGroupIdxKey key = schema.getFactoryTSecGroupMember().newGroupIdxKey(); key.setRequiredTenantId(TenantId);//from w ww . jav a 2s . c o m key.setRequiredTSecGroupId(TSecGroupId); CFAccTSecGroupMemberBuff[] recArray; if (dictByGroupIdx.containsKey(key)) { SortedMap<CFAccTSecGroupMemberPKey, CFAccTSecGroupMemberBuff> subdictGroupIdx = dictByGroupIdx.get(key); recArray = new CFAccTSecGroupMemberBuff[subdictGroupIdx.size()]; Iterator<CFAccTSecGroupMemberBuff> iter = subdictGroupIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccTSecGroupMemberBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamTSecGroupMemberTable.java
public CFAstTSecGroupMemberBuff[] readDerivedByGroupIdx(CFAstAuthorization Authorization, long TenantId, int TSecGroupId) { final String S_ProcName = "CFAstRamTSecGroupMember.readDerivedByGroupIdx() "; CFAstTSecGroupMemberByGroupIdxKey key = schema.getFactoryTSecGroupMember().newGroupIdxKey(); key.setRequiredTenantId(TenantId);/*w ww . ja v a2 s.c o m*/ key.setRequiredTSecGroupId(TSecGroupId); CFAstTSecGroupMemberBuff[] recArray; if (dictByGroupIdx.containsKey(key)) { SortedMap<CFAstTSecGroupMemberPKey, CFAstTSecGroupMemberBuff> subdictGroupIdx = dictByGroupIdx.get(key); recArray = new CFAstTSecGroupMemberBuff[subdictGroupIdx.size()]; Iterator<CFAstTSecGroupMemberBuff> iter = subdictGroupIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstTSecGroupMemberBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTSecGroupMemberTable.java
public CFAccTSecGroupMemberBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAccRamTSecGroupMember.readDerivedByTenantIdx() "; CFAccTSecGroupMemberByTenantIdxKey key = schema.getFactoryTSecGroupMember().newTenantIdxKey(); key.setRequiredTenantId(TenantId);/*w w w .java 2s .c o m*/ CFAccTSecGroupMemberBuff[] recArray; if (dictByTenantIdx.containsKey(key)) { SortedMap<CFAccTSecGroupMemberPKey, CFAccTSecGroupMemberBuff> subdictTenantIdx = dictByTenantIdx .get(key); recArray = new CFAccTSecGroupMemberBuff[subdictTenantIdx.size()]; Iterator<CFAccTSecGroupMemberBuff> iter = subdictTenantIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccTSecGroupMemberBuff[0]; } return (recArray); }