Package com.ibm.sbt.services.client.connections.communities

Examples of com.ibm.sbt.services.client.connections.communities.CommunityService


        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mmZ");
        df.setTimeZone(tz);
       
        String entry = MessageFormat.format(CommunityEventEntry, title, df.format(start), df.format(end));
        System.out.println(entry);
        CommunityService communityService = getCommunityService();
        Map<String, String> params = new HashMap<String, String>();
        params.put("communityUuid", community.getCommunityUuid());
        Response response = communityService.createData("/communities/calendar/atom/calendar/event", params, entry);
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        return statusCode == 200;
      } catch (Exception e) {
        Assert.fail("Error creating event caused by: "+e.getMessage());
      }
View Full Code Here


      return this.getClass().getName() + "#" + this.hashCode() + " Community - " + System.currentTimeMillis();
    }
   
    protected CommunityService getCommunityService() {
        if (communityService == null) {
            communityService = new CommunityService(getEnvironment().getEndpointName());
        }
        return communityService;
    }
View Full Code Here

    }
   
    protected Community getLastCreatedCommunity() {
        Community community = null;
        try {
            CommunityService communityService = getCommunityService();
            Collection<Community> communities = communityService.getMyCommunities();
            community = communities.iterator().next();
            Trace.log("Last created community: "+community.getCommunityUuid());
            Trace.log("Last created community: "+community.getPublished());
            Iterator<Community> i = communities.iterator();
            while (i.hasNext()) {
View Full Code Here

    protected Community getCommunity(String communityUuid, boolean failOnCse) {
        Community community = null;
        try {
         
           
            CommunityService communityService = getCommunityService();
            community = communityService.getCommunity(communityUuid);
            Trace.log("Got community: "+community.getCommunityUuid());
        } catch (ClientServicesException cse) {
          if (failOnCse) {
            fail("Error retrieving community", cse);
          }
View Full Code Here

    }
   
    protected Community createCommunity(String title, String type, String content, String tags, boolean retry) {
        Community community = null;
        try {
            CommunityService communityService = getCommunityService();
           
          long start = System.currentTimeMillis();
            community = new Community(communityService, "");
            community.setTitle(title);
            community.setCommunityType(type);
            community.setContent(content);
            community.setTags(tags);
            String communityUuid = communityService.createCommunity(community);
            community = communityService.getCommunity(communityUuid);
           
            long duration = System.currentTimeMillis() - start;
            Trace.log("Created test community: "+communityUuid + " took "+duration+"(ms)");
        }
        catch (ClientServicesException cse) {
View Full Code Here

    protected void deleteCommunity(Community community) {
        if (community != null) {
            try {
           
                CommunityService communityService = getCommunityService();
                communityService.deleteCommunity(community.getCommunityUuid());
            } catch (ClientServicesException cse) {
                community = null;
              // check if community delete failed because
              // community was already deleted
              Throwable t = cse.getCause();
View Full Code Here

   
    protected void deleteCommunity(String communityId) {
        if (communityId != null) {
            try {
             
                CommunityService communityService = getCommunityService();
                communityService.deleteCommunity(communityId);
            } catch (ClientServicesException cse) {
                fail("Error deleting community "+communityId, cse);
            }
        }
    }
View Full Code Here

            }
        }
    }
   
    protected void addMember(Community community, String id, String role) throws Exception {
        CommunityService communityService = getCommunityService();
        Member member = new Member(communityService, id);
        member.setRole(role);
        communityService.addMember(community.getCommunityUuid(), member);
    }
View Full Code Here

        member.setRole(role);
        communityService.addMember(community.getCommunityUuid(), member);
    }

    protected boolean hasMember(Community community, String id) throws Exception {
        CommunityService communityService = getCommunityService();
        EntityList<Member> memberList = communityService.getMembers(community.getCommunityUuid());
        for (int i=0; i<memberList.size(); i++) {
          Member member = (Member)memberList.get(i);
            if (id.equals(member.getEmail()) || id.equals(member.getUserid())) {
                return true;
            }
View Full Code Here

      fail("SBTServiceException: " + e.getMessage());
    }
    }
   
    protected void createCommunityWithTags(String tags) {
      CommunityService communityService = new CommunityService();
      Community community = null;
      try{
      community = new Community(communityService, "");
      community.setTitle(this.getClass().getName() + "#" + this.hashCode() + " Community - " + System.currentTimeMillis());
      community.setContent("Test Community created to test Activity Streams");
      community.setTags(tags);
      String communityId = communityService.createCommunity(community);
      }catch(ClientServicesException cse){
        assertNull("CommunityServiceException in testing SearchByFilters");
      }
    }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.client.connections.communities.CommunityService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.