private boolean consoleSubscribe(String path, String eventType) throws RemoteException, RegistryException { // subscribe for management console notifications SubscriptionBean bean = infoServiceAdminClient.subscribe( path, "work://RoleSubscriptionTest", eventType, sessionCookie); return bean.getSubscriptionInstances() != null; }
public boolean managementUnsubscribe(String path) throws RegistryException, RegistryExceptionException, RemoteException { String sessionID = sessionCookie; SubscriptionBean sBean = infoServiceAdminClient.getSubscriptions(path, sessionID); infoServiceAdminClient.unsubscribe( path, sBean.getSubscriptionInstances()[0].getId(), sessionID); sBean = infoServiceAdminClient.getSubscriptions(path, sessionID); return (sBean.getSubscriptionInstances() == null); }
@Test(groups = {"wso2.greg"}) public void testRunSuccessCase() throws RemoteException { log.debug("Running SuccessCase"); SubscriptionBean collectionUpdatedBean = infoServiceAdminClient.subscribe( SYSTEM_FOLDER + "/" + SYSTEM_FOLDER_CHILD, END_POINT, EVENT_COLLECTION_UPDATED, loggedInSessionCookie); assertNotNull( collectionUpdatedBean.getSubscriptionInstances(), "Failed to subscribe to " + SYSTEM_FOLDER + "/" + SYSTEM_FOLDER_CHILD + " on event " + EVENT_COLLECTION_UPDATED); collectionUpdatedBean.setSubscriptionInstances(new SubscriptionInstance[0]); SubscriptionBean collectionDeletedBean = infoServiceAdminClient.subscribe( SYSTEM_FOLDER + "/" + SYSTEM_FOLDER_CHILD, END_POINT, EVENT_COLLECTION_DELETED, loggedInSessionCookie); assertNotNull( collectionDeletedBean.getSubscriptionInstances(), "Failed to subscribe to " + SYSTEM_FOLDER + " on event " + EVENT_COLLECTION_DELETED); collectionDeletedBean.setSubscriptionInstances(new SubscriptionInstance[1]); SubscriptionBean childCreatedBean = infoServiceAdminClient.subscribe( SYSTEM_FOLDER, END_POINT, EVENT_CHILD_CREATED, loggedInSessionCookie); assertNotNull( childCreatedBean.getSubscriptionInstances(), "Failed to subscribe to " + SYSTEM_FOLDER + " on event " + EVENT_CHILD_CREATED); childCreatedBean.setSubscriptionInstances(new SubscriptionInstance[2]); SubscriptionBean childDeletedBean = infoServiceAdminClient.subscribe( SYSTEM_FOLDER, END_POINT, EVENT_CHILD_DELETED, loggedInSessionCookie); assertNotNull( childDeletedBean.getSubscriptionInstances(), "Failed to subscribe to " + SYSTEM_FOLDER + " on event " + EVENT_CHILD_CREATED); childDeletedBean.setSubscriptionInstances(new SubscriptionInstance[3]); // TODO: unsubscribe }