当前位置: 首页>>代码示例>>Java>>正文


Java Subscription.setId方法代码示例

本文整理汇总了Java中org.ligoj.app.model.Subscription.setId方法的典型用法代码示例。如果您正苦于以下问题:Java Subscription.setId方法的具体用法?Java Subscription.setId怎么用?Java Subscription.setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ligoj.app.model.Subscription的用法示例。


在下文中一共展示了Subscription.setId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSubscriptionActivities

import org.ligoj.app.model.Subscription; //导入方法依赖的package包/类
@Test
public void addSubscriptionActivities() throws Exception {
	final LdapPluginResource resource = new LdapPluginResource();
	final Map<String, Map<String, Activity>> activities = new HashMap<>();
	final Subscription susbscription = new Subscription();
	final Node service = new Node();
	service.setId("J1");
	susbscription.setNode(service);
	susbscription.setId(1);
	final SampleActivityProvider plugin = Mockito.mock(SampleActivityProvider.class);
	final Map<String, Activity> activities1 = new HashMap<>();
	final Activity activity2 = new Activity();
	activities1.put(DEFAULT_USER, activity2);
	Mockito.when(plugin.getActivities(1, null)).thenReturn(activities1);
	final Set<INamableBean<String>> nodes = new HashSet<>();
	resource.addSubscriptionActivities(activities, null, susbscription, plugin, nodes);
	Assert.assertEquals(1, activities.size());
	Assert.assertTrue(activities.containsKey(DEFAULT_USER));
	Assert.assertEquals(1, activities.get(DEFAULT_USER).size());
	Assert.assertTrue(activities.get(DEFAULT_USER).containsKey("J1"));
	Assert.assertEquals(activity2, activities.get(DEFAULT_USER).get("J1"));
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:23,代码来源:LdapPluginResourceTest.java

示例2: addSubscriptionActivitiesDuplicateUser

import org.ligoj.app.model.Subscription; //导入方法依赖的package包/类
@Test
public void addSubscriptionActivitiesDuplicateUser() throws Exception {
	final LdapPluginResource resource = new LdapPluginResource();
	final Map<String, Map<String, Activity>> activities = new HashMap<>();
	activities.put(DEFAULT_USER, new HashMap<>());
	final Activity activity1 = new Activity();
	activities.get(DEFAULT_USER).put("J0", activity1);
	final Subscription susbscription = new Subscription();
	final Node service = new Node();
	service.setId("J1");
	susbscription.setNode(service);
	susbscription.setId(1);
	final SampleActivityProvider plugin = Mockito.mock(SampleActivityProvider.class);
	final Map<String, Activity> activities1 = new HashMap<>();
	final Activity activity2 = new Activity();
	activities1.put(DEFAULT_USER, activity2);
	Mockito.when(plugin.getActivities(1, null)).thenReturn(activities1);
	final Set<INamableBean<String>> nodes = new HashSet<>();
	resource.addSubscriptionActivities(activities, null, susbscription, plugin, nodes);
	Assert.assertEquals(1, activities.size());
	Assert.assertTrue(activities.containsKey(DEFAULT_USER));
	Assert.assertEquals(2, activities.get(DEFAULT_USER).size());
	Assert.assertTrue(activities.get(DEFAULT_USER).containsKey("J1"));
	Assert.assertEquals(activity1, activities.get(DEFAULT_USER).get("J0"));
	Assert.assertEquals(activity2, activities.get(DEFAULT_USER).get("J1"));
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:27,代码来源:LdapPluginResourceTest.java

示例3: toFile

import org.ligoj.app.model.Subscription; //导入方法依赖的package包/类
@Test
public void toFile() throws IOException {
	ThreadClassLoaderScope scope = null;
	try {
		final PluginsClassLoader classLoader = Mockito.mock(PluginsClassLoader.class);
		scope = new ThreadClassLoaderScope(new URLClassLoader(new URL[0], classLoader));
		final File file = new File("");
		final Subscription entity = new Subscription();
		entity.setId(15);
		Mockito.when(classLoader.toFile(entity, "15", "some")).thenReturn(file);
		Assert.assertSame(file, resource.toFile(entity, "some"));
		Assert.assertNotNull(PluginsClassLoader.getInstance());
	} finally {
		IOUtils.closeQuietly(scope);
	}
}
 
开发者ID:ligoj,项目名称:plugin-prov,代码行数:17,代码来源:TerraformResourceTest.java

示例4: format

import org.ligoj.app.model.Subscription; //导入方法依赖的package包/类
@Test
public void format() {
	final VmSchedule vmSchedule = new VmSchedule();
	vmSchedule.setId(6789);
	final Subscription subscription = new Subscription();
	subscription.setId(12345);
	vmSchedule.setSubscription(subscription);
	Assert.assertEquals("6789-12345", VmJob.format(vmSchedule));
}
 
开发者ID:ligoj,项目名称:plugin-vm,代码行数:10,代码来源:VmJobTest.java


注:本文中的org.ligoj.app.model.Subscription.setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。