test_class.file: org.eclipse.winery.repository.rest/src/test/java/org/eclipse/winery/repository/rest/resources/servicetemplates/ServiceTemplateResourceTest.java
test_class.identifier: ServiceTemplateResourceTest
test_class.superclass: extends AbstractResourceTest
test_case.body: @Test
      public void injectNodeTemplates() throws Exception {
          this.setRevisionTo("d535f69bf50b2c4eda437be46b7ba1f85c4ff3bc");
          this.assertPost("servicetemplates/http%253A%252F%252Fwinery.opentosca.org%252Ftest%252Fservicetemplates%252Fponyuniverse%252Finjector/FoodandHouseInjectionTest/injector/replace", "servicetemplates/ServiceTemplateResource-injectNodeTemplates-input2.json");
      }
test_case.class_method_signature: ServiceTemplateResourceTest.injectNodeTemplates()
test_case.full_signature: @Test public void injectNodeTemplates()
test_case.identifier: injectNodeTemplates
test_case.invocations: setRevisionTo assertPost
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void injectNodeTemplates()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(ServiceTemplateResource.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(ServiceTemplateResource.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/servicetemplates/ServiceTemplateResource.java
focal_class.identifier: ServiceTemplateResource
focal_class.interfaces: implements IHasName
focal_class.class_method_signature: ServiceTemplateResource.ServiceTemplateResource(ServiceTemplateId id)
focal_class.full_signature: public  ServiceTemplateResource(ServiceTemplateId id)
focal_class.identifier: ServiceTemplateResource
focal_class.modifiers: public
focal_class.parameters: (ServiceTemplateId id)
focal_class.signature:  ServiceTemplateResource(ServiceTemplateId id)
focal_class.class_method_signature: ServiceTemplateResource.getServiceTemplate()
focal_class.full_signature: public TServiceTemplate getServiceTemplate()
focal_class.identifier: getServiceTemplate
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: TServiceTemplate
focal_class.signature: TServiceTemplate getServiceTemplate()
focal_class.class_method_signature: ServiceTemplateResource.setTopology(TTopologyTemplate topologyTemplate, String type)
focal_class.full_signature: @Override public void setTopology(TTopologyTemplate topologyTemplate, String type)
focal_class.identifier: setTopology
focal_class.modifiers: @Override public
focal_class.parameters: (TTopologyTemplate topologyTemplate, String type)
focal_class.return: void
focal_class.signature: void setTopology(TTopologyTemplate topologyTemplate, String type)
focal_class.class_method_signature: ServiceTemplateResource.getTopologyTemplateResource()
focal_class.full_signature: @Path("topologytemplate/") public TopologyTemplateResource getTopologyTemplateResource()
focal_class.identifier: getTopologyTemplateResource
focal_class.modifiers: @Path("topologytemplate/") public
focal_class.parameters: ()
focal_class.return: TopologyTemplateResource
focal_class.signature: TopologyTemplateResource getTopologyTemplateResource()
focal_class.class_method_signature: ServiceTemplateResource.getPlansResource()
focal_class.full_signature: @Path("plans/") public PlansResource getPlansResource()
focal_class.identifier: getPlansResource
focal_class.modifiers: @Path("plans/") public
focal_class.parameters: ()
focal_class.return: PlansResource
focal_class.signature: PlansResource getPlansResource()
focal_class.class_method_signature: ServiceTemplateResource.getSelfServicePortalResource()
focal_class.full_signature: @Path("selfserviceportal/") public SelfServicePortalResource getSelfServicePortalResource()
focal_class.identifier: getSelfServicePortalResource
focal_class.modifiers: @Path("selfserviceportal/") public
focal_class.parameters: ()
focal_class.return: SelfServicePortalResource
focal_class.signature: SelfServicePortalResource getSelfServicePortalResource()
focal_class.class_method_signature: ServiceTemplateResource.getBoundaryDefinitionsResource()
focal_class.full_signature: @Path("boundarydefinitions/") public BoundaryDefinitionsResource getBoundaryDefinitionsResource()
focal_class.identifier: getBoundaryDefinitionsResource
focal_class.modifiers: @Path("boundarydefinitions/") public
focal_class.parameters: ()
focal_class.return: BoundaryDefinitionsResource
focal_class.signature: BoundaryDefinitionsResource getBoundaryDefinitionsResource()
focal_class.class_method_signature: ServiceTemplateResource.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: ServiceTemplateResource.setName(String name)
focal_class.full_signature: @Override public Response setName(String name)
focal_class.identifier: setName
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: Response
focal_class.signature: Response setName(String name)
focal_class.class_method_signature: ServiceTemplateResource.getSubstitutableNodeTypeAsResponse()
focal_class.full_signature: @GET @ApiOperation(value = "Returns the associated node type, which can be substituted by this service template.") @ApiResponses(value = { @ApiResponse(code = 200, response = QName.class, message = "QName of the form {namespace}localName") }) @Path("substitutableNodeType") @Produces(MediaType.TEXT_PLAIN) public Response getSubstitutableNodeTypeAsResponse()
focal_class.identifier: getSubstitutableNodeTypeAsResponse
focal_class.modifiers: @GET @ApiOperation(value = "Returns the associated node type, which can be substituted by this service template.") @ApiResponses(value = { @ApiResponse(code = 200, response = QName.class, message = "QName of the form {namespace}localName") }) @Path("substitutableNodeType") @Produces(MediaType.TEXT_PLAIN) public
focal_class.parameters: ()
focal_class.return: Response
focal_class.signature: Response getSubstitutableNodeTypeAsResponse()
focal_class.class_method_signature: ServiceTemplateResource.getSubstitutableNodeType()
focal_class.full_signature: public QName getSubstitutableNodeType()
focal_class.identifier: getSubstitutableNodeType
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: QName
focal_class.signature: QName getSubstitutableNodeType()
focal_class.class_method_signature: ServiceTemplateResource.deleteSubstitutableNodeType()
focal_class.full_signature: @DELETE @ApiOperation(value = "Removes the association to substitutable node type") @Path("substitutableNodeType") public Response deleteSubstitutableNodeType()
focal_class.identifier: deleteSubstitutableNodeType
focal_class.modifiers: @DELETE @ApiOperation(value = "Removes the association to substitutable node type") @Path("substitutableNodeType") public
focal_class.parameters: ()
focal_class.return: Response
focal_class.signature: Response deleteSubstitutableNodeType()
focal_class.class_method_signature: ServiceTemplateResource.getInjectorOptions()
focal_class.full_signature: @GET @Path("injector/options") @Produces( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) public Response getInjectorOptions()
focal_class.identifier: getInjectorOptions
focal_class.modifiers: @GET @Path("injector/options") @Produces( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) public
focal_class.parameters: ()
focal_class.return: Response
focal_class.signature: Response getInjectorOptions()
focal_class.class_method_signature: ServiceTemplateResource.injectNodeTemplates(InjectorReplaceData injectorReplaceData, @Context UriInfo uriInfo)
focal_class.full_signature: @POST @Path("injector/replace") @Consumes( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) @Produces( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) public Response injectNodeTemplates(InjectorReplaceData injectorReplaceData, @Context UriInfo uriInfo)
focal_class.identifier: injectNodeTemplates
focal_class.modifiers: @POST @Path("injector/replace") @Consumes( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) @Produces( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) public
focal_class.parameters: (InjectorReplaceData injectorReplaceData, @Context UriInfo uriInfo)
focal_class.return: Response
focal_class.signature: Response injectNodeTemplates(InjectorReplaceData injectorReplaceData, @Context UriInfo uriInfo)
focal_class.class_method_signature: ServiceTemplateResource.complianceChecking(@Context UriInfo uriInfo)
focal_class.full_signature: @Path("constraintchecking") @Produces(MediaType.APPLICATION_XML) @POST public Response complianceChecking(@Context UriInfo uriInfo)
focal_class.identifier: complianceChecking
focal_class.modifiers: @Path("constraintchecking") @Produces(MediaType.APPLICATION_XML) @POST public
focal_class.parameters: (@Context UriInfo uriInfo)
focal_class.return: Response
focal_class.signature: Response complianceChecking(@Context UriInfo uriInfo)
focal_class.class_method_signature: ServiceTemplateResource.substitute()
focal_class.full_signature: @Path("substitute") @Produces(MediaType.APPLICATION_JSON) @GET public ServiceTemplateId substitute()
focal_class.identifier: substitute
focal_class.modifiers: @Path("substitute") @Produces(MediaType.APPLICATION_JSON) @GET public
focal_class.parameters: ()
focal_class.return: ServiceTemplateId
focal_class.signature: ServiceTemplateId substitute()
focal_class.class_method_signature: ServiceTemplateResource.createNewStatefulVersion()
focal_class.full_signature: @POST() @Path("createnewstatefulversion") @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response createNewStatefulVersion()
focal_class.identifier: createNewStatefulVersion
focal_class.modifiers: @POST() @Path("createnewstatefulversion") @Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public
focal_class.parameters: ()
focal_class.return: Response
focal_class.signature: Response createNewStatefulVersion()
focal_class.class_method_signature: ServiceTemplateResource.threatModeling()
focal_class.full_signature: @Path("threatmodeling") @Produces(MediaType.APPLICATION_JSON) @GET public ThreatAssessment threatModeling()
focal_class.identifier: threatModeling
focal_class.modifiers: @Path("threatmodeling") @Produces(MediaType.APPLICATION_JSON) @GET public
focal_class.parameters: ()
focal_class.return: ThreatAssessment
focal_class.signature: ThreatAssessment threatModeling()
focal_class.class_method_signature: ServiceTemplateResource.createNewElement()
focal_class.full_signature: @Override protected TExtensibleElements createNewElement()
focal_class.identifier: createNewElement
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: TExtensibleElements
focal_class.signature: TExtensibleElements createNewElement()
focal_class.class_method_signature: ServiceTemplateResource.synchronizeReferences()
focal_class.full_signature: @Override public void synchronizeReferences()
focal_class.identifier: synchronizeReferences
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void synchronizeReferences()
focal_class.class_method_signature: ServiceTemplateResource.getParameterResource()
focal_class.full_signature: @Path("parameters") public ParameterResource getParameterResource()
focal_class.identifier: getParameterResource
focal_class.modifiers: @Path("parameters") public
focal_class.parameters: ()
focal_class.return: ParameterResource
focal_class.signature: ParameterResource getParameterResource()
focal_class.class_method_signature: ServiceTemplateResource.getToscaLightCompatibility()
focal_class.full_signature: @Path("toscalight") @Produces(MediaType.APPLICATION_JSON) @GET public Map<String, Object> getToscaLightCompatibility()
focal_class.identifier: getToscaLightCompatibility
focal_class.modifiers: @Path("toscalight") @Produces(MediaType.APPLICATION_JSON) @GET public
focal_class.parameters: ()
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> getToscaLightCompatibility()
focal_class.superclass: extends AbstractComponentInstanceResourceContainingATopology
focal_method.body: @POST
      @Path("injector/replace")
      @Consumes( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
      @Produces( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
      public Response injectNodeTemplates(InjectorReplaceData injectorReplaceData, @Context UriInfo uriInfo) throws Exception {
  
          if (injectorReplaceData.hostInjections != null) {
              Collection<TTopologyTemplate> hostInjectorTopologyTemplates = injectorReplaceData.hostInjections.values();
              hostInjectorTopologyTemplates.forEach(t -> {
                  try {
                      ModelUtilities.patchAnyAttributes(t.getNodeTemplates());
                  } catch (IOException e) {
                      LOGGER.error("XML was invalid", e);
                  }
              });
          }
          if (injectorReplaceData.connectionInjections != null) {
              Collection<TTopologyTemplate> connectionInjectorTopologyTemplates = injectorReplaceData.connectionInjections.values();
              connectionInjectorTopologyTemplates.forEach(t -> {
                  try {
                      ModelUtilities.patchAnyAttributes(t.getNodeTemplates());
                  } catch (IOException e) {
                      LOGGER.error("XML was invalid", e);
                  }
              });
          }
  
          Splitting splitting = new Splitting();
          TTopologyTemplate matchedHostsTopologyTemplate;
          TTopologyTemplate matchedConnectedTopologyTemplate;
  
          //Test Method findOpenRequirements
          Map<TRequirement, String> requirementsAndMatchingBasisCapabilityTypes =
              splitting.getOpenRequirementsAndMatchingBasisCapabilityTypeNames(this.getServiceTemplate().getTopologyTemplate());
          // Output check
          for (TRequirement req : requirementsAndMatchingBasisCapabilityTypes.keySet()) {
              System.out.println("open Requirement: " + req.getId());
              System.out.println("matchingbasisType: " + requirementsAndMatchingBasisCapabilityTypes.get(req));
          }
          // End Output check
  
          if (requirementsAndMatchingBasisCapabilityTypes.containsValue("Container")) {
              matchedHostsTopologyTemplate = splitting.injectNodeTemplates(this.getServiceTemplate().getTopologyTemplate(), injectorReplaceData.hostInjections, InjectRemoval.REMOVE_REPLACED_AND_SUCCESSORS);
  
              if (requirementsAndMatchingBasisCapabilityTypes.containsValue("Endpoint")) {
                  matchedConnectedTopologyTemplate = splitting.injectConnectionNodeTemplates(matchedHostsTopologyTemplate, injectorReplaceData.connectionInjections);
              } else {
                  matchedConnectedTopologyTemplate = matchedHostsTopologyTemplate;
              }
          } else if (requirementsAndMatchingBasisCapabilityTypes.containsValue("Endpoint")) {
              matchedConnectedTopologyTemplate = splitting.injectConnectionNodeTemplates(this.getServiceTemplate().getTopologyTemplate(), injectorReplaceData.connectionInjections);
          } else {
              throw new SplittingException("No open Requirements which can be matched");
          }
  
          TTopologyTemplate daSpecifiedTopology = matchedConnectedTopologyTemplate;
  
          //Start additional functionality Driver Injection
          if (!DASpecification.getNodeTemplatesWithAbstractDAs(matchedConnectedTopologyTemplate).isEmpty() &&
              DASpecification.getNodeTemplatesWithAbstractDAs(matchedConnectedTopologyTemplate) != null) {
              daSpecifiedTopology = DriverInjection.injectDriver(matchedConnectedTopologyTemplate);
          }
          //End additional functionality Driver Injection
  
          this.getServiceTemplate().setTopologyTemplate(daSpecifiedTopology);
  
          LOGGER.debug("Persisting...");
          RestUtils.persist(this);
          LOGGER.debug("Persisted.");
  
          //No renaming of the Service Template allowed because of the plans
  
          URI url = uriInfo.getBaseUri().resolve(RestUtils.getAbsoluteURL(id));
          LOGGER.debug("URI of the old and new service template {}", url.toString());
          return Response.created(url).build();
      }
focal_method.class_method_signature: ServiceTemplateResource.injectNodeTemplates(InjectorReplaceData injectorReplaceData, @Context UriInfo uriInfo)
focal_method.full_signature: @POST @Path("injector/replace") @Consumes( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) @Produces( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) public Response injectNodeTemplates(InjectorReplaceData injectorReplaceData, @Context UriInfo uriInfo)
focal_method.identifier: injectNodeTemplates
focal_method.invocations: values forEach patchAnyAttributes getNodeTemplates error values forEach patchAnyAttributes getNodeTemplates error getOpenRequirementsAndMatchingBasisCapabilityTypeNames getTopologyTemplate getServiceTemplate keySet println getId println get containsValue injectNodeTemplates getTopologyTemplate getServiceTemplate containsValue injectConnectionNodeTemplates containsValue injectConnectionNodeTemplates getTopologyTemplate getServiceTemplate isEmpty getNodeTemplatesWithAbstractDAs getNodeTemplatesWithAbstractDAs injectDriver setTopologyTemplate getServiceTemplate debug persist debug resolve getBaseUri getAbsoluteURL debug toString build created
focal_method.modifiers: @POST @Path("injector/replace") @Consumes( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) @Produces( {MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) public
focal_method.parameters: (InjectorReplaceData injectorReplaceData, @Context UriInfo uriInfo)
focal_method.return: Response
focal_method.signature: Response injectNodeTemplates(InjectorReplaceData injectorReplaceData, @Context UriInfo uriInfo)