@Override public PackageDetail getDetail(final AdapterId componentId, InvokeContext context) throws ServiceException { ServiceContext serviceContext = context.getServiceContext(); AdapterTypeInput input = AdapterTypeInput.newInstance(componentId.getAdapterType()); ListValueOutput<AdapterPollingNotificationInfo> infos = pollingNotifications.invoke(input, serviceContext); AdapterPollingNotificationInfo info = infos.getSingleValue( new Predicate<AdapterPollingNotificationInfo>() { @Override public boolean apply(AdapterPollingNotificationInfo input) { return input != null && componentId.getName().equals(input.getNotificationNodeName()); } }); return PackageDetail.build(info.getPackageName()); }
@Test public void testInvoke() throws Exception { GetUserTaskList service = new GetUserTaskList(); ListValueOutput<SchedulerInfo> output = service.invoke(NoInput.singleton, getContext()); List<SchedulerInfo> values = output.getValues(); SchedulerInfo expected = SchedulerInfo.builder() .description("GniFrmkToolsStats.jdbc:schedulingStatistics") .expired(false) .name("GniFrmkToolsStats.jdbc:schedulingStatistics") .neverRun(true) .oid("3e75d780-ca57-11df-ac89-8ee26cc7631d") .service("GniFrmkToolsStats.jdbc:schedulingStatistics") .suspended(true) .type("repeat") .build(); SchedulerInfo actual = values.get(0); Assert.assertEquals(expected, actual); }