@Test public void searchCISbyName(){ System.out.println("testing search CIS"); cisManagerUnderTest = new CisManager(); this.setMockingOnCISManager(cisManagerUnderTest); cisManagerUnderTestInterface = cisManagerUnderTest; ICisOwned[] ciss = new ICisOwned [3]; int[] cissCheck = {0,0,0}; try { ciss[0] = (cisManagerUnderTestInterface.createCis( "alfa", TEST_CIS_TYPW ,null,"")).get(); ciss[1] = (cisManagerUnderTestInterface.createCis( "alfaromeo", TEST_CIS_TYPW ,null,"")).get(); ciss[2] = (cisManagerUnderTestInterface.createCis( "beta", TEST_CIS_TYPW ,null,"")).get(); assertEquals(ciss[1],cisManagerUnderTest.searchCisByName("alfaromeo").get(0)); assertEquals(2,cisManagerUnderTest.searchCisByName("alfa").size()); assertEquals(0,cisManagerUnderTest.searchCisByName("gama").size()); assertNull(cisManagerUnderTest.getOwnedCis("invalidJid.xmpp")); ICisOwned test0 = cisManagerUnderTest.getOwnedCis(ciss[0].getCisId()); assertEquals(ciss[0],test0); } catch (InterruptedException e) { e.printStackTrace(); fail("exception"); } catch (ExecutionException e) { e.printStackTrace(); fail("exception"); } for(int i=0;i<ciss.length;i++){ cisManagerUnderTestInterface.deleteCis(ciss[i].getCisId()); } assertEquals(cisManagerUnderTest.getCisList().size(),0); }
@Override public List<ICis> searchCisByName(String name){ List<ICis> l = new ArrayList<ICis>(); Iterator<Cis> it = getOwnedCISs().iterator(); while(it.hasNext()){ Cis element = it.next(); if(element.getName().contains(name)) l.add(element); } Iterator<CisSubscribedImp> it2 = this.getSubscribedCISs().iterator(); while(it2.hasNext()){ CisSubscribedImp element = it2.next(); if(element.getName().contains(name)) l.add(element); } return l; }
CisManager implements ICisManager, IFeatureServer { @Override public List<ICis> searchCisByName(String name){ List<ICis> l = new ArrayList<ICis>(); Iterator<Cis> it = getOwnedCISs().iterator(); while(it.hasNext()){ Cis element = it.next(); if(element.getName().contains(name)) l.add(element); } Iterator<CisSubscribedImp> it2 = this.getSubscribedCISs().iterator(); while(it2.hasNext()){ CisSubscribedImp element = it2.next(); if(element.getName().contains(name)) l.add(element); } return l; } }
CisManager implements ICisManager, IFeatureServer { @Override public List<ICis> searchCisByName(String name){ List<ICis> l = new ArrayList<ICis>(); Iterator<Cis> it = getOwnedCISs().iterator(); while(it.hasNext()){ Cis element = it.next(); if(element.getName().contains(name)) l.add(element); } Iterator<CisSubscribedImp> it2 = this.getSubscribedCISs().iterator(); while(it2.hasNext()){ CisSubscribedImp element = it2.next(); if(element.getName().contains(name)) l.add(element); } return l; } CisManager(); }
CisManager implements ICisManager, IFeatureServer { @Override public List<ICis> searchCisByName(String name){ List<ICis> l = new ArrayList<ICis>(); Iterator<Cis> it = getOwnedCISs().iterator(); while(it.hasNext()){ Cis element = it.next(); if(element.getName().contains(name)) l.add(element); } Iterator<CisSubscribedImp> it2 = this.getSubscribedCISs().iterator(); while(it2.hasNext()){ CisSubscribedImp element = it2.next(); if(element.getName().contains(name)) l.add(element); } return l; } CisManager(); ICssDirectoryRemote getCssDirectoryRemote(); void setCssDirectoryRemote(ICssDirectoryRemote cssDirectoryRemote); IActivityFeedManager getiActivityFeedManager(); void setiActivityFeedManager(IActivityFeedManager iActivityFeedManager); IUserFeedback getiUsrFeedback(); void setiUsrFeedback(IUserFeedback iUsrFeedback); INegotiation getNegotiator(); IPrivacyDataManager getPrivacyDataManager(); void setNegotiator(INegotiation negotiator); IPrivacyPolicyManager getPrivacyPolicyManager(); ICtxBroker getInternalCtxBroker(); void setInternalCtxBroker(ICtxBroker internalCtxBroker); IEventMgr getEventMgr(); void setEventMgr(IEventMgr eventMgr); ICISCommunicationMgrFactory getCcmFactory(); void setCcmFactory(ICISCommunicationMgrFactory ccmFactory); ICommManager getICommMgr(); void setICommMgr(ICommManager cSSendpoint); ICisDirectoryRemote getiCisDirRemote(); void setiCisDirRemote(ICisDirectoryRemote iCisDirRemote); void startup(); void init(); @Override Future<ICisOwned> createCis(String cisName, String cisType,
			Hashtable<String, MembershipCriteria> cisCriteria,
			String description); @Override Future<ICisOwned> createCis(String cisName, String cisType,
			Hashtable<String, MembershipCriteria> cisCriteria,
			String description, String privacyPolicy); boolean subscribeToCis(CisRecord record); boolean unsubscribeToCis(String cisjid); @Override List<String> getJavaPackages(); @Override Object getQuery(Stanza stanza, Object payload); ICommManager getiCommMgr(); void setiCommMgr(ICommManager iCommMgr); @Override List<String> getXMLNamespaces(); @Override void receiveMessage(Stanza stanza, Object payload); @Override Object setQuery(Stanza arg0, Object arg1); @Override boolean deleteCis(String cisId); @Override List<ICis> getCisList(); @Override List<ICis> searchCisByName(String name); @Override List<ICisOwned> getListOfOwnedCis(); @Override List<ICis> getRemoteCis(); @Override List<ICisOwned> searchCisByMember(IIdentity css); @Override ICis getCis(String cisId); @Override ICisOwned getOwnedCis(String cisId); SessionFactory getSessionFactory(); void setSessionFactory(SessionFactory sessionFactory); List<Cis> getOwnedCISs(); List<CisSubscribedImp> getSubscribedCISs(); @Override void getListOfMembers(Requestor req, IIdentity targetcis,
			ICisManagerCallback callback); ICisRemote getHandlerToRemoteCis(String cisId); @Override void joinRemoteCIS(CisAdvertisementRecord adv, ICisManagerCallback callback); @Override void leaveRemoteCIS(String cisId, ICisManagerCallback callback); void UnRegisterCisManager(); void setPrivacyPolicyManager(IPrivacyPolicyManager privacyPolicyManager); void setPrivacyDataManager(IPrivacyDataManager privacyDataManager); boolean isPrivacyPolicyNegotiationIncluded(); void setPrivacyPolicyNegotiationIncluded(
			boolean privacyPolicyNegotiationIncluded); }
CisManager implements ICisManager, IFeatureServer { @Override public List<ICis> searchCisByName(String name){ List<ICis> l = new ArrayList<ICis>(); Iterator<Cis> it = getOwnedCISs().iterator(); while(it.hasNext()){ Cis element = it.next(); if(element.getName().contains(name)) l.add(element); } Iterator<CisSubscribedImp> it2 = this.getSubscribedCISs().iterator(); while(it2.hasNext()){ CisSubscribedImp element = it2.next(); if(element.getName().contains(name)) l.add(element); } return l; } CisManager(); ICssDirectoryRemote getCssDirectoryRemote(); void setCssDirectoryRemote(ICssDirectoryRemote cssDirectoryRemote); IActivityFeedManager getiActivityFeedManager(); void setiActivityFeedManager(IActivityFeedManager iActivityFeedManager); IUserFeedback getiUsrFeedback(); void setiUsrFeedback(IUserFeedback iUsrFeedback); INegotiation getNegotiator(); IPrivacyDataManager getPrivacyDataManager(); void setNegotiator(INegotiation negotiator); IPrivacyPolicyManager getPrivacyPolicyManager(); ICtxBroker getInternalCtxBroker(); void setInternalCtxBroker(ICtxBroker internalCtxBroker); IEventMgr getEventMgr(); void setEventMgr(IEventMgr eventMgr); ICISCommunicationMgrFactory getCcmFactory(); void setCcmFactory(ICISCommunicationMgrFactory ccmFactory); ICommManager getICommMgr(); void setICommMgr(ICommManager cSSendpoint); ICisDirectoryRemote getiCisDirRemote(); void setiCisDirRemote(ICisDirectoryRemote iCisDirRemote); void startup(); void init(); @Override Future<ICisOwned> createCis(String cisName, String cisType,
			Hashtable<String, MembershipCriteria> cisCriteria,
			String description); @Override Future<ICisOwned> createCis(String cisName, String cisType,
			Hashtable<String, MembershipCriteria> cisCriteria,
			String description, String privacyPolicy); boolean subscribeToCis(CisRecord record); boolean unsubscribeToCis(String cisjid); @Override List<String> getJavaPackages(); @Override Object getQuery(Stanza stanza, Object payload); ICommManager getiCommMgr(); void setiCommMgr(ICommManager iCommMgr); @Override List<String> getXMLNamespaces(); @Override void receiveMessage(Stanza stanza, Object payload); @Override Object setQuery(Stanza arg0, Object arg1); @Override boolean deleteCis(String cisId); @Override List<ICis> getCisList(); @Override List<ICis> searchCisByName(String name); @Override List<ICisOwned> getListOfOwnedCis(); @Override List<ICis> getRemoteCis(); @Override List<ICisOwned> searchCisByMember(IIdentity css); @Override ICis getCis(String cisId); @Override ICisOwned getOwnedCis(String cisId); SessionFactory getSessionFactory(); void setSessionFactory(SessionFactory sessionFactory); List<Cis> getOwnedCISs(); List<CisSubscribedImp> getSubscribedCISs(); @Override void getListOfMembers(Requestor req, IIdentity targetcis,
			ICisManagerCallback callback); ICisRemote getHandlerToRemoteCis(String cisId); @Override void joinRemoteCIS(CisAdvertisementRecord adv, ICisManagerCallback callback); @Override void leaveRemoteCIS(String cisId, ICisManagerCallback callback); void UnRegisterCisManager(); void setPrivacyPolicyManager(IPrivacyPolicyManager privacyPolicyManager); void setPrivacyDataManager(IPrivacyDataManager privacyDataManager); boolean isPrivacyPolicyNegotiationIncluded(); void setPrivacyPolicyNegotiationIncluded(
			boolean privacyPolicyNegotiationIncluded);  }