use of alien4cloud.model.orchestrators.locations.LocationResourceTemplate in project alien4cloud by alien4cloud.
the class DefaultNodeMatcherTest method unknown_type_from_topology_should_not_match_any_location_resource.
@Test
public void unknown_type_from_topology_should_not_match_any_location_resource() throws Exception {
// Given
Map<String, MatchingConfiguration> emptyMatchingConfigurations = new HashMap<>();
// When
NodeTemplate wantedNodeTemplate = nodeTemplate("tosca.nodes.Unknown");
NodeType wantedNodeType = new NodeType();
List<LocationResourceTemplate> proposition = nodeMatcher.matchNode(wantedNodeTemplate, wantedNodeType, locationResources, emptyMatchingConfigurations);
// Then
assertThat(proposition).hasSize(0);
}
use of alien4cloud.model.orchestrators.locations.LocationResourceTemplate in project alien4cloud by alien4cloud.
the class DefaultNodeMatcherTest method real_world_location_resource_compute_should_be_able_to_match_an_abstract_compute_from_topology.
@Test
public void real_world_location_resource_compute_should_be_able_to_match_an_abstract_compute_from_topology() throws Exception {
// Given
Map<String, MatchingConfiguration> emptyMatchingConfigurations = new HashMap<>();
// When
NodeTemplate wantedNodeTemplate = nodeTemplate("tosca.nodes.Compute");
NodeType wantedNodeType = new NodeType();
List<LocationResourceTemplate> proposition = nodeMatcher.matchNode(wantedNodeTemplate, wantedNodeType, locationResources, emptyMatchingConfigurations);
// Then
assertThat(proposition).hasSize(1);
}
use of alien4cloud.model.orchestrators.locations.LocationResourceTemplate in project alien4cloud by alien4cloud.
the class DefaultNodeMatcherTest method abstract_template_should_be_matched_if_service_is_available_2.
@Test
public void abstract_template_should_be_matched_if_service_is_available_2() throws Exception {
// Given
Map<String, MatchingConfiguration> emptyMatchingConfigurations = new HashMap<>();
// When
NodeTemplate wantedNodeTemplate = nodeTemplate("alien.service.MongoDB");
NodeType wantedNodeType = new NodeType();
wantedNodeType.setAbstract(true);
List<LocationResourceTemplate> proposition = nodeMatcher.matchNode(wantedNodeTemplate, wantedNodeType, locationResources, emptyMatchingConfigurations);
// Then
assertThat(proposition).hasSize(1);
assertThat(proposition.get(0).isService()).isTrue();
}
use of alien4cloud.model.orchestrators.locations.LocationResourceTemplate in project alien4cloud by alien4cloud.
the class LocationResourceServiceTest method getResources.
@Test
public void getResources() {
ILocationResourceAccessor accessor = locationResourceService.accessor(LOCATION_ID);
List<LocationResourceTemplate> resources = accessor.getResources();
Assert.assertEquals(LOCATION_CONFIGURED_ELEMENTS, resources.size());
}
use of alien4cloud.model.orchestrators.locations.LocationResourceTemplate in project alien4cloud by alien4cloud.
the class LocationResourceServiceTest method getResourcesOfTypeForUnconfiguredLocationShouldReturnEmptyList.
@Test
public void getResourcesOfTypeForUnconfiguredLocationShouldReturnEmptyList() {
ILocationResourceAccessor accessor = locationResourceService.accessor(UNCONFIGURED_LOCATION_ID);
List<LocationResourceTemplate> resources = accessor.getResources(CONFIGURED_TYPE);
Assert.assertEquals(0, resources.size());
}
Aggregations