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

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


        registerCustomer();
        String subscriberId = addSubscriber();
       
        SubscriberManagementService subscriberManagement = getSubscriberManagementService();
       
        JsonEntity jsonEntity = subscriberManagement.getSubscriberById(subscriberId);
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, jsonEntity);
      Assert.assertEquals(subscriberId, subscriberManagement.getSubscriberId(jsonEntity.getJsonObject()));

      JsonJavaObject rootObject = jsonEntity.getJsonObject();
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, rootObject);
     
      subscriberManagement.suspendSubscriber(subscriberId, false);
     
      jsonEntity = subscriberManagement.getSubscriberById(subscriberId);
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, jsonEntity);
      Assert.assertEquals(subscriberId, subscriberManagement.getSubscriberId(jsonEntity.getJsonObject()));
     
      rootObject = jsonEntity.getJsonObject();
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, rootObject);
     
      System.out.println(rootObject);
      JsonJavaObject subscriberObject = rootObject.getAsObject("Subscriber");
      System.out.println(subscriberObject);
View Full Code Here


        registerCustomer();
        String subscriptionId = createSubscription();
       
        SubscriptionManagementService subscriptionManagement = getSubscriptionManagementService();
       
        JsonEntity jsonEntity = subscriptionManagement.getSubscriptionById(subscriptionId);
      Assert.assertNotNull("Unable to retrieve subscription: "+subscriptionId, jsonEntity);
      System.out.println(jsonEntity.toJsonString());
     
      Assert.assertEquals(subscriptionId, subscriptionManagement.getSubscriptionId(jsonEntity.getJsonObject()));

      JsonJavaObject rootObject = jsonEntity.getJsonObject();
      Assert.assertNotNull("Unable to retrieve subscription: "+subscriptionId, rootObject);
     
      subscriptionManagement.cancelSubscription(subscriptionId);
     
      try {
        jsonEntity = subscriptionManagement.getSubscriptionById(subscriptionId);
        Assert.assertNotNull("Unable to retrieve subscription: "+subscriptionId, jsonEntity);
        Assert.assertEquals(subscriptionId, subscriptionManagement.getSubscriptionId(jsonEntity.getJsonObject()));
       
        rootObject = jsonEntity.getJsonObject();
        Assert.assertNotNull("Unable to retrieve subscription: "+subscriptionId, rootObject);
       
        System.out.println(rootObject);
        JsonJavaObject subscriptionObject = rootObject.getAsObject("Subscription");
        System.out.println(subscriptionObject);
View Full Code Here

      try {
        CustomerManagementService customerManagement = getCustomerManagementService();
        SubscriptionManagementService subscriptionManagement = getSubscriptionManagementService();
        EntityList<JsonEntity> customerList = customerManagement.getCustomers();
        if (!customerList.isEmpty()) {
          JsonEntity customer = customerList.get(0);
          long customerId = customer.getAsLong("Id");
         
          EntityList<JsonEntity> subscriptionList = subscriptionManagement.getSubscriptionsById("" + customerId);
          if(!subscriptionList.isEmpty()){
          JsonEntity subscription = subscriptionList.get(0);
          long subscriptionId = subscription.getAsLong("Id");
            System.out.println(subscription.toJsonString(false));
            Assert.assertNotNull("Unable to retrieve subscriptions for customer: "+customerId, subscription);
            Assert.assertEquals(""+subscriptionId, getSubscriptionManagementService().getSubscriptionId(subscription.getJsonObject()));
          }
        }
       
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

          JsonJavaObject response = getSubscriberManagementService().addSubscriber(subscriber);
          long subscriberId = response.getAsLong("Long");
          Assert.assertNotNull("Invalid subscriber id", subscriberId);
          System.out.println(subscriberId);
         
          JsonEntity subscriberEntity = getSubscriberManagementService().getSubscriberById(String.valueOf(subscriberId));
          System.out.println(subscriberEntity.toJsonString());
         
      } catch (BssException be) {
        JsonJavaObject jsonObject = be.getResponseJson();
        System.err.println(jsonObject);
        Assert.fail("Error registering customer because: "+jsonObject);
View Full Code Here

          try {
           
            System.out.println("Unregistering: "+customerId);
            customerManagement.unregisterCustomer(customerId);
           
            JsonEntity jsonEntity = customerManagement.getCustomerById(customerId);
            Assert.assertNull("Able to retrieve unregistered customer: "+customerId, jsonEntity);
            System.out.println("Unregistered: "+customerId);
          } catch (BssException be) {
              JsonJavaObject jsonObject = be.getResponseJson();
              System.out.println(jsonObject);
View Full Code Here

        registerCustomer();
        String subscriberId = addSubscriber();
       
        SubscriberManagementService subscriberManagement = getSubscriberManagementService();
       
        JsonEntity jsonEntity = subscriberManagement.getSubscriberById(subscriberId);
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, jsonEntity);
      Assert.assertEquals(subscriberId, subscriberManagement.getSubscriberId(jsonEntity.getJsonObject()));

      JsonJavaObject rootObject = jsonEntity.getJsonObject();
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, rootObject);
     
      subscriberManagement.suspendSubscriber(subscriberId, false);
     
      jsonEntity = subscriberManagement.getSubscriberById(subscriberId);
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, jsonEntity);
      Assert.assertEquals(subscriberId, subscriberManagement.getSubscriberId(jsonEntity.getJsonObject()));
     
      rootObject = jsonEntity.getJsonObject();
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, rootObject);
     
      System.out.println(rootObject);
      JsonJavaObject subscriberObject = rootObject.getAsObject("Subscriber");
      System.out.println(subscriberObject);
      Assert.assertEquals("SUSPENDED", subscriberObject.get("SubscriberState"));
     
      subscriberManagement.unsuspendSubscriber(subscriberId);
     
      jsonEntity = subscriberManagement.getSubscriberById(subscriberId);
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, jsonEntity);
      Assert.assertEquals(subscriberId, subscriberManagement.getSubscriberId(jsonEntity.getJsonObject()));
     
      rootObject = jsonEntity.getJsonObject();
      Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, rootObject);
     
      System.out.println(rootObject);
      subscriberObject = rootObject.getAsObject("Subscriber");
      System.out.println(subscriberObject);
View Full Code Here

    @Test
    public void testChangePasswordBadRequest() {
      try {
        String subscriberId = addSubscriber();
        JsonEntity subscriber = getSubscriberById(subscriberId);
        String loginName = subscriber.getAsString("Subscriber/Person/EmailAddress");
        System.out.println(loginName);
       
        UserCredentialJsonBuilder userCredential = new UserCredentialJsonBuilder();
        userCredential.setLoginName(loginName)
                .setNewPassword("new_passw0rd")
View Full Code Here

 
    @Test
    public void testChangePassword() {
      try {
        String subscriberId = addSubscriber();
        JsonEntity subscriber = getSubscriberById(subscriberId);
        String loginName = subscriber.getAsString("Subscriber/Person/EmailAddress");
        System.out.println(loginName);
       
        UserCredentialJsonBuilder userCredential = new UserCredentialJsonBuilder();
        userCredential.setLoginName(loginName)
                .setNewPassword("one_time_passw0rd");
View Full Code Here

    @Test
    @Ignore // This use case is not supported
    public void testChangeMyPassword() {
      try {
        String subscriberId = addSubscriber();
        JsonEntity subscriber = getSubscriberById(subscriberId);
        String loginName = subscriber.getAsString("Subscriber/Person/EmailAddress");
        System.out.println(loginName);
       
        UserCredentialJsonBuilder userCredential = new UserCredentialJsonBuilder();
        userCredential.setLoginName(loginName)
                .setNewPassword("one_time_passw0rd");
View Full Code Here

       
        // Step 6. Change email
        updateSubscriberEmail(subscriberId, "john.doe@example.com");
       
        // Display provisioned subscriber
        JsonEntity subscriber = getSubscriberById(subscriberId);
        System.out.println(subscriber.toJsonString());
       
      } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("Error provisioning subscriber caused by: "+e.getMessage());       
      }
View Full Code Here

TOP

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

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.