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


Java Node.setId方法代码示例

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


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

示例1: addSubscriptionActivities

import org.ligoj.app.model.Node; //导入方法依赖的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.Node; //导入方法依赖的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: newLdap

import org.ligoj.app.model.Node; //导入方法依赖的package包/类
private void newLdap() {
	final Node ldap = new Node();
	ldap.setId("service:id:ldap:secondary");
	ldap.setRefined(nodeRepository.findOneExpected("service:id:ldap"));
	ldap.setName("LDAP Test");
	nodeRepository.saveAndFlush(ldap);
	persistParameter(ldap, LdapPluginResource.PARAMETER_URL, "ldap://localhost:34389/");
	persistParameter(ldap, LdapPluginResource.PARAMETER_USER, "uid=admin,ou=system");
	persistParameter(ldap, LdapPluginResource.PARAMETER_PASSWORD, "secret");
	persistParameter(ldap, LdapPluginResource.PARAMETER_BASE_BN, "");
	persistParameter(ldap, LdapPluginResource.PARAMETER_UID_ATTRIBUTE, "uid");
	persistParameter(ldap, LdapPluginResource.PARAMETER_PEOPLE_DN, "dc=sample,dc=com");
	persistParameter(ldap, LdapPluginResource.PARAMETER_DEPARTMENT_ATTRIBUTE, "departmentNumber");
	persistParameter(ldap, LdapPluginResource.PARAMETER_LOCAL_ID_ATTRIBUTE, "employeeNumber");
	persistParameter(ldap, LdapPluginResource.PARAMETER_PEOPLE_CLASS, "inetOrgPerson");
	persistParameter(ldap, LdapPluginResource.PARAMETER_COMPANY_PATTERN, "gfi");
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:18,代码来源:LdapPluginResourceTest.java

示例4: addSubscriptionActivitiesDuplicateNode

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

示例5: acceptNotMatch

import org.ligoj.app.model.Node; //导入方法依赖的package包/类
@Test
public void acceptNotMatch() {
	final Node ldap = new Node();
	ldap.setId("service:id:ldap:test");
	ldap.setRefined(nodeRepository.findOneExpected("service:id:ldap"));
	ldap.setName("LDAP Test");
	nodeRepository.saveAndFlush(ldap);
	final ParameterValue parameterValue = new ParameterValue();
	parameterValue.setNode(ldap);
	parameterValue.setParameter(parameterRepository.findOneExpected("service:id:uid-pattern"));
	parameterValue.setData("-nomatch-");
	em.persist(parameterValue);
	Assert.assertFalse(resource.accept(new UsernamePasswordAuthenticationToken("some", ""), "service:id:ldap:test"));
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:15,代码来源:LdapPluginResourceTest.java

示例6: accept

import org.ligoj.app.model.Node; //导入方法依赖的package包/类
@Test
public void accept() {
	final Node ldap = new Node();
	ldap.setId("service:id:ldap:test");
	ldap.setRefined(nodeRepository.findOneExpected("service:id:ldap"));
	ldap.setName("LDAP Test");
	nodeRepository.saveAndFlush(ldap);
	persistParameter(ldap, IdentityResource.PARAMETER_UID_PATTERN, "some-.*-text");
	Assert.assertTrue(resource.accept(new UsernamePasswordAuthenticationToken("some-awesome-text", ""), "service:id:ldap:test"));
}
 
开发者ID:ligoj,项目名称:plugin-id-ldap,代码行数:11,代码来源:LdapPluginResourceTest.java

示例7: executeUnavailablePlugin

import org.ligoj.app.model.Node; //导入方法依赖的package包/类
@Test
public void executeUnavailablePlugin() throws Exception {
	final VmResource resource = new VmResource();
	final Subscription entity = subscriptionRepository.findOneExpected(subscription);
	final Node node = new Node();
	node.setId("_deleted_plugin_");
	node.setName("any");
	nodeRepository.saveAndFlush(node);
	entity.setNode(node);
	subscriptionRepository.saveAndFlush(entity);

	applicationContext.getAutowireCapableBeanFactory().autowireBean(resource);
	resource.servicePluginLocator = mockServicePluginLocator;
	resource.execute(entity, VmOperation.OFF);
	Mockito.verify(mockVmTool, Mockito.never()).execute(subscription, VmOperation.OFF);
	Mockito.verify(mockVmTool, Mockito.never()).execute(subscription, VmOperation.ON);
	Mockito.verify(mockVmTool, Mockito.never()).execute(subscription, VmOperation.REBOOT);
	Mockito.verify(mockVmTool, Mockito.never()).execute(subscription, VmOperation.RESET);
	Mockito.verify(mockVmTool, Mockito.never()).execute(subscription, VmOperation.SHUTDOWN);
	Mockito.verify(mockVmTool, Mockito.never()).execute(subscription, VmOperation.SUSPEND);

	Assert.assertEquals(1, vmExecutionRepository.findAllBy("subscription.id", subscription).size());
	final VmExecution execution = vmExecutionRepository.findBy("subscription.id", subscription);
	Assert.assertFalse(execution.isSucceed());
	Assert.assertEquals("fdaugan", execution.getTrigger());
	Assert.assertEquals(VmOperation.OFF, execution.getOperation());
	Assert.assertEquals("Plugin issue for _deleted_plugin_:Not found", execution.getError());
}
 
开发者ID:ligoj,项目名称:plugin-vm,代码行数:29,代码来源:VmResourceTest.java

示例8: findAll

import org.ligoj.app.model.Node; //导入方法依赖的package包/类
@Test
public void findAll() {
	final ImportCatalogResource resource = newResource();

	// Add importable provider
	resource.locator = Mockito.mock(ServicePluginLocator.class);
	final ImportCatalogService service = Mockito.mock(ImportCatalogService.class);
	Mockito.when(resource.locator.getResource("service:prov:test", ImportCatalogService.class)).thenReturn(service);

	// Add not updatable provider node
	final Node notImportNode = new Node();
	notImportNode.setId("service:prov:any");
	notImportNode.setName("Cannot import");
	notImportNode.setRefined(nodeRepository.findOneExpected("service:prov"));
	nodeRepository.saveAndFlush(notImportNode);

	final List<CatalogVo> catalogs = resource.findAll();
	Assert.assertEquals(3, catalogs.size());

	// This provider does not support catalog update
	Assert.assertEquals(0, catalogs.get(0).getStatus().getNbInstancePrices().intValue());
	Assert.assertNull(catalogs.get(0).getStatus().getEnd());
	Assert.assertNull(catalogs.get(0).getStatus().getStart());
	Assert.assertEquals("service:prov:any", catalogs.get(0).getNode().getId());
	Assert.assertFalse(catalogs.get(0).isCanImport());
	Assert.assertEquals(0, catalogs.get(0).getNbQuotes());

	// This provider supports catalog update
	Assert.assertNotNull(catalogs.get(1).getStatus());
	Assert.assertEquals("service:prov:test", catalogs.get(1).getNode().getId());
	Assert.assertTrue(catalogs.get(1).isCanImport());
	Assert.assertEquals(2, catalogs.get(1).getNbQuotes());

	// This provider does not support catalog update
	Assert.assertEquals("service:prov:x", catalogs.get(2).getNode().getId());
	Assert.assertFalse(catalogs.get(2).isCanImport());
	Assert.assertNull(catalogs.get(2).getStatus().getEnd());
	Assert.assertNull(catalogs.get(2).getStatus().getStart());
	Assert.assertEquals(1, catalogs.get(2).getNbQuotes());

	final ImportCatalogStatus status = catalogs.get(1).getStatus();
	Assert.assertEquals(DEFAULT_USER, status.getAuthor());
	Assert.assertNull(status.getEnd());
	Assert.assertNull(status.getLocation());
	Assert.assertEquals("service:prov:test", status.getLocked().getId());
	Assert.assertNotNull(status.getStart());
	Assert.assertEquals(0, status.getDone());
	Assert.assertEquals(0, status.getWorkload());
}
 
开发者ID:ligoj,项目名称:plugin-prov,代码行数:50,代码来源:ImportCatalogResourceTest.java


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