Package com.ibm.sbt.services.client.base

Examples of com.ibm.sbt.services.client.base.NamedUrlPart


    serviceMappingKeys = new String[]{""};
  }

  @Override
  public NamedUrlPart getAuthType(){
    NamedUrlPart part = super.getAuthType();
    if (!part.getValue().equalsIgnoreCase("oauth")) {
      part = new NamedUrlPart("authType","");
    }
    return part;
    }
View Full Code Here


*/
public class ActivityUrlsTest extends BaseActivityServiceTest {

  @Test
  public void testActivityUrls() throws XMLException, IOException {
    NamedUrlPart activityUuid = ActivityUrls.activityPart("11111-22222-33333-44444");
    NamedUrlPart activityNodeUuid = ActivityUrls.activityNodePart("11111-22222-33333-44444");
    NamedUrlPart memberId = ActivityUrls.memberPart("66666-77777-88888");
   
    Assert.assertEquals("activities/service/atom2/service", ActivityUrls.ACTIVITIES_SERVICE.format(activityService));
    Assert.assertEquals("activities/service/atom2/activity?activityUuid=11111-22222-33333-44444", ActivityUrls.ACTIVITY.format(activityService, activityUuid));
    Assert.assertEquals("activities/service/atom2/tags", ActivityUrls.ACTIVITY_TAGS.format(activityService));
    Assert.assertEquals("activities/service/atom2/entrytemplates?activityUuid=11111-22222-33333-44444", ActivityUrls.ACTIVITY_TEMPLATES.format(activityService, activityUuid));
View Full Code Here

     * @return
     * @throws BssException
     */
    public JsonEntity getSubscriptionById(String subscriptionId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SUBSCRIPTIONID.format(this, new NamedUrlPart("subscriptionId", subscriptionId));
      return getEntity(serviceUrl, null, getJsonFeedHandler());
    } catch (Exception e) {
      throw new BssException(e, "Error retrieving subscription {0} caused by {1}", subscriptionId, e.getMessage());
    }
    }
View Full Code Here

      if (StringUtil.isEmpty(customerId)) {
        throw new IllegalArgumentException("Invalid id");
      }
      try {
        String serviceUrl = BssUrls.API_RESOURCE_GET_SUBSCRIPTION_BY_CUSTOMERID.format(this,
            new NamedUrlPart("customerId", customerId));
      return (EntityList<JsonEntity>)getEntities(serviceUrl, null, getJsonFeedHandler());
    } catch (Exception e) {
      throw new BssException(e, "Error retrieving subscription list by customer id {0} caused by {1}", customerId, e.getMessage());
    }
    }
View Full Code Here

     * @return
     * @throws BssException
     */
    public void suspendSubscription(String subscriptionId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SUBSCRIPTIONID.format(this, new NamedUrlPart("subscriptionId", subscriptionId));
        Response response = createData(serviceUrl, null, SuspendSubscriptionHeader, (Object)null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
View Full Code Here

     * @return
     * @throws BssException
     */
    public void unsuspendSubscription(String subscriptionId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SUBSCRIPTIONID.format(this, new NamedUrlPart("subscriptionId", subscriptionId));
        Response response = createData(serviceUrl, (Map<String, String>)null, UnsuspendSubscriptionHeader, (Object)null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
View Full Code Here

     * @return
     * @throws BssException
     */
    public void cancelSubscription(String subscriptionId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SUBSCRIPTIONID.format(this, new NamedUrlPart("subscriptionId", subscriptionId));
        Response response = deleteData(serviceUrl, null, null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
View Full Code Here

     * @throws BssException
     */
    public void updateSubscription(JsonJavaObject subscriptionObject) throws BssException {
      try {
        String subscriptionId = getSubscriptionId(subscriptionObject);
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SUBSCRIPTIONID.format(this, new NamedUrlPart("subscriptionId", subscriptionId));
        Response response = updateData(serviceUrl, null, JsonHeader, subscriptionObject, null);
       
        // expect a 204
        int statusCode = response.getResponse().getStatusLine().getStatusCode();
        if (statusCode != 204) {
View Full Code Here

     * @throws {@link IllegalArgumentException}
     */
    public JsonEntity getSeat(String subscriptionId, String seatId) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SEAT.format(this,
            new NamedUrlPart("subscriptionId", subscriptionId), new NamedUrlPart("seatId", seatId));
        return getEntity(serviceUrl, null, getJsonFeedHandler());
    } catch (Exception e) {
      throw new BssException(e, "Error retrieving a seat caused by {0}", e.getMessage());
    }
    }
View Full Code Here

     * @throws {@link IllegalArgumentException}
     */
    public void changeQuota(String subscriptionId, String seatId, JsonJavaObject seatObject) throws BssException {
      try {
        String serviceUrl = BssUrls.API_RESOURCE_SUBSCRIPTION_SEAT.format(this,
            new NamedUrlPart("subscriptionId", subscriptionId), new NamedUrlPart("seatId", seatId));
        createData(serviceUrl, null, ChangeQuotaHeaders, seatObject, ClientService.FORMAT_JSON);
    } catch (Exception e) {
      throw new BssException(e, "Error changing quota caused by {0}", e.getMessage());
    }
    }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.services.client.base.NamedUrlPart

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.