本文整理汇总了Java中org.ligoj.app.resource.subscription.SubscriptionResource类的典型用法代码示例。如果您正苦于以下问题:Java SubscriptionResource类的具体用法?Java SubscriptionResource怎么用?Java SubscriptionResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SubscriptionResource类属于org.ligoj.app.resource.subscription包,在下文中一共展示了SubscriptionResource类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newMockResource
import org.ligoj.app.resource.subscription.SubscriptionResource; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void newMockResource() {
resource = new AbstractIndexBasedPluginResource("service", "impl") {
@Override
protected String getRepositoryUrl(final Map<String, String> parameters) {
return StringUtils.appendIfMissing(super.getRepositoryUrl(parameters), "/");
}
/**
* Return the revision number.
*/
@Override
protected Object toData(final String statusContent) {
return 1;
}
{
subscriptionResource = Mockito.mock(SubscriptionResource.class);
parameters = new HashMap<>();
parameters.put("service:url", "http://localhost:" + MOCK_PORT);
parameters.put("service:user", "user");
parameters.put("service:password", "secret");
parameters.put("service:index", "true");
parameters.put("service:repository", "my-repo");
Mockito.when(subscriptionResource.getParameters(1)).thenReturn(parameters);
Mockito.when(subscriptionResource.getParametersNoCheck(1)).thenReturn(parameters);
IndexBasedPluginResourceTest.this.subscriptionResource = subscriptionResource;
pvResource = Mockito.mock(ParameterValueResource.class);
Mockito.when(pvResource.getNodeParameters("service:impl:node")).thenReturn(parameters);
inMemoryPagination = Mockito.mock(InMemoryPagination.class);
Mockito.when(inMemoryPagination.newPage(ArgumentMatchers.anyCollection(),
ArgumentMatchers.any(Pageable.class)))
.thenAnswer(i -> new PageImpl<>(new ArrayList<>((Collection<Object>) i.getArguments()[0]),
(Pageable) i.getArguments()[1], ((Collection<Object>) i.getArguments()[0]).size()));
}
};
}
示例2: getSubscriptionResource
import org.ligoj.app.resource.subscription.SubscriptionResource; //导入依赖的package包/类
/**
* Return the {@link SubscriptionResource} instance. Used to resolve the related
* subscription and validate the visibility.
*
* @return The {@link SubscriptionResource} instance.
*/
SubscriptionResource getSubscriptionResource();