System.out.println(subscription.toJsonString());
}
String subscriptionId = String.valueOf(subscriptionList.get(0).getAsLong("SubscriptionId"));
System.out.println(subscriptionId);
JsonEntity subscription = subscriptionManagement.getSubscriptionById(subscriptionId);
System.out.println(subscription.toJsonString());
SubscriberManagementService subscriberManagement = getSubscriberManagementService();
JsonEntity jsonEntity = subscriberManagement.getSubscriberById(subscriberId);
Assert.assertNotNull("Unable to retrieve subscriber: "+subscriberId, jsonEntity);
Assert.assertEquals(subscriberId, subscriberManagement.getSubscriberId(jsonEntity.getJsonObject()));
subscriberManagement.activateSubscriber(subscriberId);
jsonEntity = subscriberManagement.getSubscriberById(subscriberId);
Assert.assertNotNull("Unable to retrieve activated subscriber: "+subscriberId, jsonEntity);
Assert.assertEquals(subscriberId, subscriberManagement.getSubscriberId(jsonEntity.getJsonObject()));
JsonJavaObject 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("ACTIVE", subscriberObject.get("SubscriberState"));
JsonEntity entitlement = subscriberManagement.entitleSubscriber(subscriberId, subscriptionId, true);
Assert.assertNotNull("Unable to entitle subscriber: "+subscriberId, entitlement);
System.out.println("Entitlement: " + entitlement.toJsonString());
jsonEntity = subscriberManagement.getSubscriberById(subscriberId);
System.out.println("Entitled subscriber: " + jsonEntity.toJsonString());
Assert.assertNotNull("Unable to retrieve activated subscriber: "+subscriberId, jsonEntity);
Assert.assertEquals(subscriberId, subscriberManagement.getSubscriberId(jsonEntity.getJsonObject()));