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

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


      try {
        String customerId = registerCustomer();

        CustomerManagementService customerManagement = getCustomerManagementService();
       
        JsonEntity jsonEntity = customerManagement.getCustomerById(customerId);
      Assert.assertNotNull("Unable to retrieve customer: "+customerId, jsonEntity);
      Assert.assertEquals(customerId, customerManagement.getCustomerId(jsonEntity.getJsonObject()));

      JsonJavaObject rootObject = jsonEntity.getJsonObject();
      Assert.assertNotNull("Unable to retrieve customer: "+customerId, rootObject);
     
      System.out.println(rootObject);
      JsonJavaObject customerObject = rootObject.getAsObject("Customer");
      JsonJavaObject organizationObject = customerObject.getAsObject("Organization");
      organizationObject.putString("Phone", "888-888-8888");
      JsonJavaObject contactObject = organizationObject.getAsObject("Contact");
      contactObject.putString("WorkPhone", "800-666-1234");
     
      customerManagement.updateCustomerProfile(rootObject);
     
      jsonEntity = customerManagement.getCustomerById(customerId);
      Assert.assertNotNull("Unable to retrieve customer: "+customerId, jsonEntity);
      Assert.assertEquals(customerId, customerManagement.getCustomerId(jsonEntity.getJsonObject()));
     
      rootObject = jsonEntity.getJsonObject();
      Assert.assertNotNull("Unable to retrieve customer: "+customerId, customerObject);
     
      System.out.println(rootObject);
      customerObject = rootObject.getAsObject("Customer");
      organizationObject = customerObject.getAsObject("Organization");
View Full Code Here


        entitleSubscriber(subscriberId, storageSubscriptionId, true);
        //JsonEntity docsEntitlement = entitleSubscriber(subscriberId, docsSubscriptionId, true);
        //System.out.println(docsEntitlement.toJsonString());
       
        // Optional: Check seats
        JsonEntity jsonEntity = getSubscriberManagementService().getSubscriberById(subscriberId);
        JsonJavaObject rootObject = jsonEntity.getJsonObject();
        JsonJavaObject subscriberObject = rootObject.getAsObject("Subscriber");
      List<Object> seatSet = subscriberObject.getAsList("SeatSet");
        for (Object seat : seatSet) {
          System.out.println(seat);
        }
View Full Code Here

   
    public IFeedHandler<JsonEntity> getJsonFeedHandler(String entitiesPath) {
      return new JsonFeedHandler<JsonEntity>(this, entitiesPath) {
        @Override
        public JsonEntity newEntity(BaseService service, JsonJavaObject jsonObject) {
          return new JsonEntity(service, jsonObject);
        }
      };
    }
View Full Code Here

     *
     * @throws BssException
     */
    public boolean waitSubscriptionState(String subscriptionId, String state, int maxAttempts, long waitInterval, StateChangeListener listener) throws BssException {
      for (int i=0; i<maxAttempts; i++) {
        JsonEntity subscription = getSubscriptionById(subscriptionId);
        String currentState = subscription.getAsString("Subscription/SubscriptionState");
        if (state.equalsIgnoreCase(currentState)) {
          try {
            listener.stateChanged(subscription);
            return true;
          } catch (Exception e) {
View Full Code Here

     *
     * @throws BssException
     */
    public boolean waitCustomerState(String customerId, String state, int maxAttempts, long waitInterval, StateChangeListener listener) throws BssException {
      for (int i=0; i<maxAttempts; i++) {
        JsonEntity subscription = getCustomerById(customerId);
        String currentState = subscription.getAsString("Customer/CustomerState");
        if (state.equalsIgnoreCase(currentState)) {
          try {
            if (listener != null) {
              listener.stateChanged(subscription);
            }
View Full Code Here

      for (int i=0; i<maxAttempts; i++) {
        String[] currentRoles = getRoles(loginName);
        if (!Arrays.equals(roles, currentRoles)) {
          try {
            if (listener != null) {
              JsonEntity jsonEntity = null;
              listener.stateChanged(jsonEntity);
            }
            return true;
          } catch (Exception e) {
            logger.log(Level.WARNING, "Error invoking state change listener", e);
View Full Code Here

     *
     * @throws BssException
     */
    public boolean waitSubscriberState(String subscriberId, String state, int maxAttempts, long waitInterval, StateChangeListener listener) throws BssException {
      for (int i=0; i<maxAttempts; i++) {
        JsonEntity subscriber = getSubscriberById(subscriberId);
        String currentState = subscriber.getAsString("Subscriber/SubscriberState");
        if (state.equalsIgnoreCase(currentState)) {
          try {
            if (listener != null) {
              listener.stateChanged(subscriber);
            }
View Full Code Here

     *
     * @throws BssException
     */
    public boolean waitSeatState(String subscriberId, String subscriptionId, String state, int maxAttempts, long waitInterval, StateChangeListener listener) throws BssException {
      for (int i=0; i<maxAttempts; i++) {
        JsonEntity subscriber = getSubscriberById(subscriberId);
        JsonJavaObject subscriberJson = subscriber.getJsonObject().getAsObject("Subscriber");
        List<Object> seatSet = subscriberJson.getAsList("SeatSet");
        JsonJavaObject seatJson = findSeat(seatSet, subscriptionId);
        if (seatJson != null) {
            String currentState = seatJson.getAsString("SeatState");
            if (state.equalsIgnoreCase(currentState)) {
View Full Code Here

       
        for (String subscriptionId : subscriptionIds) {
          sa.entitleSubscriber(subscriberId, subscriptionId, true);
        }
       
        JsonEntity subscriberJson = sa.getSubscriberById(subscriberId);
        System.out.println(subscriberJson.toJsonString(false));
      }
     
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

      //EntityList<JsonEntity> subscribers = subscriberManagement.getSubscribersByEmail(email);
      //JsonEntity subscriber = subscribers.get(0);
      //String subscriberId = String.valueOf(subscriber.getAsLong("Oid"));
      String subscriberId = cp.addSubscriber(customerId, cp.getUniqueEmail("mailinator.com"), SubscriberManagementService.Role.CustomerAdministrator);
      System.out.println("Subscriber Id: " + subscriberId);
      JsonEntity subscriber = cp.getSubscriberById(subscriberId);
      System.out.println("Subscriber: " + subscriber.toJsonString(false));
         String loginName = subscriber.getAsString("Subscriber/Person/EmailAddress");
         System.out.println("Login Name: " + loginName);
      String subscriberState = subscriber.getAsString("Subscriber/SubscriberState");
      System.out.println("Subscriber State: " + subscriberState);
     
      if (!"ACTIVE".equals(subscriberState)) {
        subscriberManagement.activateSubscriber(subscriberId);
        System.out.println("Activated subscriber: " + subscriberId);
      }
     
      cp.setOneTimePassword(loginName, "one-time-123");
      cp.changePassword(loginName, "one-time-123", "password1");
      System.out.println("Changed password: " + loginName);
     
      cp.entitleSubscriber(subscriberId, subscriptionId, true);
      System.out.println("Entitled subscriber: " + subscriptionId);
     
      subscriber = subscriberManagement.getSubscriberById(subscriberId);
      System.out.println(subscriber.toJsonString(false))
     
      System.out.println("Customer provisioning successful");
     
    } catch (Exception e) {
      e.printStackTrace();
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.