test_class.declarator: LOGGER = LoggerFactory.getLogger(FulfillPoliciesTest.class)
test_class.modifier: private static final
test_class.original_string: private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(FulfillPoliciesTest.class);
test_class.type: org.slf4j.Logger
test_class.var_name: LOGGER
test_class.declarator: topology
test_class.modifier: private
test_class.original_string: private TopologyWrapper topology;
test_class.type: TopologyWrapper
test_class.var_name: topology
test_class.file: org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/targetallocation/criteria/fulfillpolicies/FulfillPoliciesTest.java
test_class.identifier: FulfillPoliciesTest
test_class.superclass: extends TestWithGitBackedRepository
test_case.body: @Test
      public void testSimpleOperators() throws Exception {
          JsonNode params = JacksonProvider.mapper.readTree("{\"policySelection\":[" +
              "{\"policy\":\"floorwarmth10\",\"property\":\"warmth\",\"operator\":\">\"}," +
              "{\"policy\":\"floorwarmth30\",\"property\":\"warmth\",\"operator\":\"<\"}]}");
          Criteria fulfillPolicies = new FulfillPolicies(params, Integer.MAX_VALUE);
          List<TopologyWrapper> allocatedTopologies = fulfillPolicies.allocate(topology);
          assertEquals(4, allocatedTopologies.size());
  
          TopologyWrapper allocated1 = allocatedTopologies.get(0);
          TopologyWrapper allocated2 = allocatedTopologies.get(1);
          TopologyWrapper allocated3 = allocatedTopologies.get(2);
          TopologyWrapper allocated4 = allocatedTopologies.get(3);
  
          assertEquals(8, allocated1.getNodeTemplates().size());
          assertEquals(8, allocated2.getNodeTemplates().size());
          assertEquals(8, allocated3.getNodeTemplates().size());
          assertEquals(8, allocated4.getNodeTemplates().size());
  
          List<String> targetLabels1 = getTargetLabels(allocated1);
          List<String> targetLabels2 = getTargetLabels(allocated2);
          List<String> targetLabels3 = getTargetLabels(allocated3);
          List<String> targetLabels4 = getTargetLabels(allocated4);
  
          assertEquals(3, targetLabels1.stream().filter("PastureProvider"::equalsIgnoreCase).count());
          assertEquals(1, targetLabels1.stream().filter("FieldProvider"::equalsIgnoreCase).count());
  
          assertEquals(2, targetLabels2.stream().filter("PastureProvider"::equalsIgnoreCase).count());
          assertEquals(2, targetLabels2.stream().filter("FieldProvider"::equalsIgnoreCase).count());
  
          assertEquals(2, targetLabels3.stream().filter("PastureProvider"::equalsIgnoreCase).count());
          assertEquals(2, targetLabels3.stream().filter("FieldProvider"::equalsIgnoreCase).count());
  
          assertEquals(1, targetLabels4.stream().filter("PastureProvider"::equalsIgnoreCase).count());
          assertEquals(3, targetLabels4.stream().filter("FieldProvider"::equalsIgnoreCase).count());
      }
test_case.class_method_signature: FulfillPoliciesTest.testSimpleOperators()
test_case.full_signature: @Test public void testSimpleOperators()
test_case.identifier: testSimpleOperators
test_case.invocations: readTree allocate assertEquals size get get get get assertEquals size getNodeTemplates assertEquals size getNodeTemplates assertEquals size getNodeTemplates assertEquals size getNodeTemplates getTargetLabels getTargetLabels getTargetLabels getTargetLabels assertEquals count filter stream assertEquals count filter stream assertEquals count filter stream assertEquals count filter stream assertEquals count filter stream assertEquals count filter stream assertEquals count filter stream assertEquals count filter stream
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSimpleOperators()
focal_class.file: org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/targetallocation/criteria/fulfillpolicies/FulfillPolicies.java
focal_class.identifier: FulfillPolicies
focal_class.class_method_signature: FulfillPolicies.FulfillPolicies(JsonNode params, int outputCap)
focal_class.full_signature: public  FulfillPolicies(JsonNode params, int outputCap)
focal_class.identifier: FulfillPolicies
focal_class.modifiers: public
focal_class.parameters: (JsonNode params, int outputCap)
focal_class.signature:  FulfillPolicies(JsonNode params, int outputCap)
focal_class.class_method_signature: FulfillPolicies.filter(List<TopologyWrapper> topologies)
focal_class.full_signature: @Override public List<TopologyWrapper> filter(List<TopologyWrapper> topologies)
focal_class.identifier: filter
focal_class.modifiers: @Override public
focal_class.parameters: (List<TopologyWrapper> topologies)
focal_class.return: List<TopologyWrapper>
focal_class.signature: List<TopologyWrapper> filter(List<TopologyWrapper> topologies)
focal_class.class_method_signature: FulfillPolicies.generateTargetLabelTopologies(TopologyWrapper topology)
focal_class.full_signature: @Override public List<TopologyWrapper> generateTargetLabelTopologies(TopologyWrapper topology)
focal_class.identifier: generateTargetLabelTopologies
focal_class.modifiers: @Override public
focal_class.parameters: (TopologyWrapper topology)
focal_class.return: List<TopologyWrapper>
focal_class.signature: List<TopologyWrapper> generateTargetLabelTopologies(TopologyWrapper topology)
focal_class.class_method_signature: FulfillPolicies.assignTargetLabels(TopologyWrapper topology)
focal_class.full_signature: private Map<TNodeTemplate, Set<String>> assignTargetLabels(TopologyWrapper topology)
focal_class.identifier: assignTargetLabels
focal_class.modifiers: private
focal_class.parameters: (TopologyWrapper topology)
focal_class.return: Map<TNodeTemplate, Set<String>>
focal_class.signature: Map<TNodeTemplate, Set<String>> assignTargetLabels(TopologyWrapper topology)
focal_class.class_method_signature: FulfillPolicies.getPossibleMatches(TopologyWrapper topology)
focal_class.full_signature: @Override protected List<List<PermutationHelper>> getPossibleMatches(TopologyWrapper topology)
focal_class.identifier: getPossibleMatches
focal_class.modifiers: @Override protected
focal_class.parameters: (TopologyWrapper topology)
focal_class.return: List<List<PermutationHelper>>
focal_class.signature: List<List<PermutationHelper>> getPossibleMatches(TopologyWrapper topology)
focal_class.class_method_signature: FulfillPolicies.getPoliciesForNTs(TopologyWrapper topology, JsonNode params)
focal_class.full_signature: private Map<TNodeTemplate, List<PolicyWrapper>> getPoliciesForNTs(TopologyWrapper topology, JsonNode params)
focal_class.identifier: getPoliciesForNTs
focal_class.modifiers: private
focal_class.parameters: (TopologyWrapper topology, JsonNode params)
focal_class.return: Map<TNodeTemplate, List<PolicyWrapper>>
focal_class.signature: Map<TNodeTemplate, List<PolicyWrapper>> getPoliciesForNTs(TopologyWrapper topology, JsonNode params)
focal_class.class_method_signature: FulfillPolicies.getNTsWithPolicies(TopologyWrapper topology)
focal_class.full_signature: private List<TNodeTemplate> getNTsWithPolicies(TopologyWrapper topology)
focal_class.identifier: getNTsWithPolicies
focal_class.modifiers: private
focal_class.parameters: (TopologyWrapper topology)
focal_class.return: List<TNodeTemplate>
focal_class.signature: List<TNodeTemplate> getNTsWithPolicies(TopologyWrapper topology)
focal_class.class_method_signature: FulfillPolicies.mapFragmentsByNTs(Map<TNodeTemplate, List<TTopologyTemplate>> fragments,
                                                                            List<TTopologyTemplate> fragmentsFulfillingPolicies)
focal_class.full_signature: private Map<TNodeTemplate, List<TTopologyTemplate>> mapFragmentsByNTs(Map<TNodeTemplate, List<TTopologyTemplate>> fragments,
                                                                            List<TTopologyTemplate> fragmentsFulfillingPolicies)
focal_class.identifier: mapFragmentsByNTs
focal_class.modifiers: private
focal_class.parameters: (Map<TNodeTemplate, List<TTopologyTemplate>> fragments,
                                                                            List<TTopologyTemplate> fragmentsFulfillingPolicies)
focal_class.return: Map<TNodeTemplate, List<TTopologyTemplate>>
focal_class.signature: Map<TNodeTemplate, List<TTopologyTemplate>> mapFragmentsByNTs(Map<TNodeTemplate, List<TTopologyTemplate>> fragments,
                                                                            List<TTopologyTemplate> fragmentsFulfillingPolicies)
focal_class.class_method_signature: FulfillPolicies.split(TopologyWrapper topology)
focal_class.full_signature: @Override protected void split(TopologyWrapper topology)
focal_class.identifier: split
focal_class.modifiers: @Override protected
focal_class.parameters: (TopologyWrapper topology)
focal_class.return: void
focal_class.signature: void split(TopologyWrapper topology)
focal_class.superclass: extends CriteriaCached
focal_method.body: @Override
      public List<TopologyWrapper> filter(List<TopologyWrapper> topologies) {
          // clone to avoid altering input topologies
          List<TopologyWrapper> cloned = topologies.stream().map(t ->
              new TopologyWrapper(AllocationUtils.deepcopy(t.getTopology()))).collect(Collectors.toList());
          // all generated topologies have the same policies for top level nts -> get policies from any of them
          Map<TNodeTemplate, List<PolicyWrapper>> policiesForNTs = getPoliciesForNTs(cloned.get(0), params);
          return new PoliciesFilter(cloned, policiesForNTs).filter();
      }
focal_method.class_method_signature: FulfillPolicies.filter(List<TopologyWrapper> topologies)
focal_method.full_signature: @Override public List<TopologyWrapper> filter(List<TopologyWrapper> topologies)
focal_method.identifier: filter
focal_method.invocations: collect map stream deepcopy getTopology toList getPoliciesForNTs get filter
focal_method.modifiers: @Override public
focal_method.parameters: (List<TopologyWrapper> topologies)
focal_method.return: List<TopologyWrapper>
focal_method.signature: List<TopologyWrapper> filter(List<TopologyWrapper> topologies)