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


Java IterableUtils.toList方法代码示例

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


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

示例1: findLastByFacilityStatesUpdatedSince

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Override
public Iterable<FacilityStateSnapshot> findLastByFacilityStatesUpdatedSince(Iterable<FacilityState> facilityStates,
		long timestamp) {
	final Set<FacilityState> states = new TreeSet<>(IterableUtils.toList(facilityStates));
	final List<FacilityStateSnapshot> snapshots = new LinkedList<>();
	synchronized (facilityStateSnapshots) {
		for (Entry<Long, Collection<FacilityStateSnapshot>> entry : facilityStateSnapshots.asMap().entrySet()) {
			final Iterator<FacilityStateSnapshot> iterator = entry.getValue().iterator();
			if (iterator.hasNext()) {
				final FacilityStateSnapshot snapshot = iterator.next();
				if (states.contains(snapshot.getState()) && snapshot.getTimestamp() > timestamp) {
					snapshots.add(snapshot);
				}
			}
		}
	}
	return snapshots;
}
 
开发者ID:highsource,项目名称:aufzugswaechter,代码行数:19,代码来源:MemoryBasedFacilityStateSnapshotService.java

示例2: update_infra_shouldnt_create_a_new_infra

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void update_infra_shouldnt_create_a_new_infra() {
    add_infra_should_create_a_new_infra();
    
	Infrastructure infra = new Infrastructure();
	infra.setDescription("Test description 2");
	infra.setGroup("group");
	infra.setId(id);
	HttpEntity<InfrastructureResource> response = this.controller.updateInfrastructure(id, infra);
	Assert.assertNotNull(response);
	Assert.assertNotNull(response.getBody());
	InfrastructureResource infraReturned = response.getBody();
	Assert.assertNotNull(infraReturned);
	Assert.assertNotNull(infraReturned.getId());
	Assert.assertEquals(infra.getDescription(), infraReturned.getDescription());
	Assert.assertEquals(infra.getCrm(), infraReturned.getCrm());
	Assert.assertEquals(infra.getGroup(), infraReturned.getGroup());
	Assert.assertEquals(3, infraReturned.getLinks().size());

	List<InfrastructureResource> infras = IterableUtils.toList(this.controller.getInfrastructures(null, null, new PagedResourcesAssembler<Infrastructure>(resolver, null)));
	Assert.assertNotNull(infras);
	Assert.assertEquals(1, infras.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:24,代码来源:InfrastrauctureControllerTest.java

示例3: add_zone_should_create_a_new_zone

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void add_zone_should_create_a_new_zone() {
	Zone zone = new Zone();
	zone.setDescription("Test description");
	zone.setInfraId(infraId);
	zone.setIp(0xC0A80001L);
	HttpEntity<ZoneResource> resp = this.controller.addZone(infraId, zone);
	Assert.assertNotNull(resp);
	Assert.assertNotNull(resp.getBody());
	ZoneResource zoneReturned = resp.getBody();
	Assert.assertNotNull(zoneReturned);
	Assert.assertNotNull(zoneReturned.getId());
	Assert.assertEquals(zone.getDescription(), zoneReturned.getDescription());
	Assert.assertEquals(zone.getInfraId(), zoneReturned.getInfraId());
	Assert.assertEquals(zone.getIp(), zoneReturned.getIp());
	Assert.assertEquals(3, zoneReturned.getLinks().size());
	id = zoneReturned.getZoneId();

	List<ZoneResource> zones = IterableUtils.toList(this.controller.getZones(infraId, null, new PagedResourcesAssembler<Zone>(resolver, null)));
	Assert.assertNotNull(zones);
	Assert.assertEquals(1, zones.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:23,代码来源:ZoneControllerTest.java

示例4: get_all_should_return_an_array_with_two_elem

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void get_all_should_return_an_array_with_two_elem() {
    add_address_twice_should_create_a_new_address();
    
	List<AddressResource> addresses = IterableUtils.toList(this.controller.getAddresses(null, infraId, subnetId, null, new PagedResourcesAssembler<Address>(resolver, null)));
	Assert.assertNotNull(addresses);
	Assert.assertEquals(2, addresses.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:9,代码来源:AddessControllerTest.java

示例5: get_free_should_return_an_array_with_two_elem_with_second_page

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void get_free_should_return_an_array_with_two_elem_with_second_page() {
       add_address_twice_should_create_a_new_address();
       
	PagedResources<AddressResource> resources = this.controller.getAddresses(RequestMode.FREE, infraId, subnetId, new PageRequest(2, 512), new PagedResourcesAssembler<Address>(resolver, null));
	List<AddressResource> addresses = IterableUtils.toList(resources.getContent());
	Assert.assertNotNull(addresses);
	Assert.assertEquals(512, addresses.size());
	Assert.assertEquals(2, resources.getMetadata().getNumber());
	Assert.assertEquals(4, resources.getMetadata().getTotalPages());
	Assert.assertEquals(2044L, resources.getMetadata().getTotalElements());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:13,代码来源:AddessControllerTest.java

示例6: get_all_should_return_empty_array

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void get_all_should_return_empty_array() {
	HttpEntity<PagedResources<SubnetResource>> resp = this.controller.getSubnets(null, null, infraId, null, new PagedResourcesAssembler<Subnet>(resolver, null));
	Assert.assertNotNull(resp);
	Assert.assertNotNull(resp.getBody());
	List<SubnetResource> subnets = IterableUtils.toList(resp.getBody());
	Assert.assertNotNull(subnets);
	Assert.assertTrue(subnets.isEmpty());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:10,代码来源:SubnetControllerTest.java

示例7: get_all_should_return_an_array_with_one_elem_with_page

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void get_all_should_return_an_array_with_one_elem_with_page() {
    add_zone_twice_should_create_a_new_zone();
    
	List<ZoneResource> zones = IterableUtils.toList(this.controller.getZones(infraId, new PageRequest(0, 1), new PagedResourcesAssembler<Zone>(resolver, null)));
	Assert.assertNotNull(zones);
	Assert.assertEquals(1, zones.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:9,代码来源:ZoneControllerTest.java

示例8: get_all_should_return_an_array_with_two_elem_with_null_page

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void get_all_should_return_an_array_with_two_elem_with_null_page() {
       add_range_twice_should_create_a_new_range();
       
	List<RangeResource> ranges = IterableUtils.toList(this.controller.getRanges(infraId, zoneId, null, new PagedResourcesAssembler<Range>(resolver, null)));
	Assert.assertNotNull(ranges);
	Assert.assertEquals(2, ranges.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:9,代码来源:RangeControllerTest.java

示例9: delete_zone_should_work

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void delete_zone_should_work() {
	this.controller.deleteZone(infraId, id);

	List<ZoneResource> zones = IterableUtils.toList(this.controller.getZones(infraId, null, new PagedResourcesAssembler<Zone>(resolver, null)));
	Assert.assertNotNull(zones);
	Assert.assertEquals(0, zones.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:9,代码来源:ZoneControllerTest.java

示例10: get_infras_with_search_should_return_first_infra

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void get_infras_with_search_should_return_first_infra() {
    add_infra_twice_should_create_a_new_infra();
    
	List<InfrastructureResource> infras = IterableUtils.toList(this.controller.getInfrastructures("group", new PageRequest(0, 1), new PagedResourcesAssembler<Infrastructure>(resolver, null)));
	Assert.assertNotNull(infras);
	Assert.assertEquals(1, infras.size());
	InfrastructureResource infra = infras.get(0);
	Assert.assertNotNull(infra);
	Assert.assertEquals("Test description", infra.getDescription());
	Assert.assertEquals(3, infra.getLinks().size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:13,代码来源:InfrastrauctureControllerTest.java

示例11: get_all_should_return_an_array_with_two_elem_with_null_page

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void get_all_should_return_an_array_with_two_elem_with_null_page() {
       add_subnet_shouldnt_create_a_new_subnet();
       
	HttpEntity<PagedResources<SubnetResource>> resp = this.controller.getSubnets(null, null, infraId, null, new PagedResourcesAssembler<Subnet>(resolver, null));
	Assert.assertNotNull(resp);
	Assert.assertNotNull(resp.getBody());
	List<SubnetResource> subnets = IterableUtils.toList(resp.getBody());
	Assert.assertNotNull(subnets);
	Assert.assertEquals(2, subnets.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:12,代码来源:SubnetControllerTest.java

示例12: delete_subnet_should_work

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void delete_subnet_should_work() {
       add_subnet_should_create_a_new_subnet();
       
	this.controller.deleteSubnet(infraId, id, null);
	
	HttpEntity<PagedResources<SubnetResource>> resp = this.controller.getSubnets(null, null, infraId, null, new PagedResourcesAssembler<Subnet>(resolver, null));
	Assert.assertNotNull(resp);
	Assert.assertNotNull(resp.getBody());
	List<SubnetResource> subnets = IterableUtils.toList(resp.getBody());
	Assert.assertNotNull(subnets);
	Assert.assertEquals(0, subnets.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:14,代码来源:SubnetControllerTest.java

示例13: add_plan_should_create_a_new_plan

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void add_plan_should_create_a_new_plan() {
	AddressPlan plan = new AddressPlan();
	plan.setDescription("Test description");
	plan.setInfraId(infraId);
	plan.setLastModifed(new Date());
	plan.setName("test");
	HttpEntity<AddressPlanResource> resp = this.controller.addAddressPlan(infraId, plan);
	Assert.assertNotNull(resp);
	Assert.assertNotNull(resp.getBody());
	AddressPlanResource planReturned = resp.getBody();
	Assert.assertNotNull(planReturned);
	Assert.assertNotNull(planReturned.getId());
	Assert.assertEquals(plan.getDescription(), planReturned.getDescription());
	Assert.assertEquals(plan.getInfraId(), planReturned.getInfraId());
	Assert.assertEquals(plan.getName(), planReturned.getName());
	Assert.assertEquals(plan.getLastModifed(), planReturned.getLastModifed());
	Assert.assertEquals(2, planReturned.getLinks().size());
	id = planReturned.getPlanId();

	HttpEntity<PagedResources<AddressPlanResource>> respList = this.controller.getAddressPlans(infraId, null, new PagedResourcesAssembler<AddressPlan>(resolver, null));
	Assert.assertNotNull(respList);
	Assert.assertNotNull(respList.getBody());
	List<AddressPlanResource> plans = IterableUtils.toList(respList.getBody());
	Assert.assertNotNull(plans);
	Assert.assertEquals(1, plans.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:28,代码来源:AddressPlanControllerTest.java

示例14: get_all_should_return_an_array_with_one_elem_with_page

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void get_all_should_return_an_array_with_one_elem_with_page() {
       add_range_twice_should_create_a_new_range();
       
	List<RangeResource> ranges = IterableUtils.toList(this.controller.getRanges(infraId, zoneId, new PageRequest(0, 1), new PagedResourcesAssembler<Range>(resolver, null)));
	Assert.assertNotNull(ranges);
	Assert.assertEquals(1, ranges.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:9,代码来源:RangeControllerTest.java

示例15: get_all_should_return_an_array_with_two_elem_with_page

import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
@Test
public void get_all_should_return_an_array_with_two_elem_with_page() {
    add_plan_twice_should_create_a_new_plan();
    
	HttpEntity<PagedResources<AddressPlanResource>> resp = this.controller.getAddressPlans(infraId, new PageRequest(0, 1), new PagedResourcesAssembler<AddressPlan>(resolver, null));
	Assert.assertNotNull(resp);
	Assert.assertNotNull(resp.getBody());
	List<AddressPlanResource> plans = IterableUtils.toList(resp.getBody());
	Assert.assertNotNull(plans);
	Assert.assertEquals(1, plans.size());
}
 
开发者ID:bozzo,项目名称:ipplan-api,代码行数:12,代码来源:AddressPlanControllerTest.java


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