NodeTemplateResource extends TEntityTemplateResource<TNodeTemplate> implements INodeTemplateResourceOrNodeTypeImplementationResource { @Path("deploymentartifacts/") public DeploymentArtifactsResource getDeploymentArtifacts() { return new DeploymentArtifactsResource(this.o, this); } NodeTemplateResource(IIdDetermination<TNodeTemplate> idDetermination, TNodeTemplate o, int idx, List<TNodeTemplate> list, IPersistable res); @Path("deploymentartifacts/") DeploymentArtifactsResource getDeploymentArtifacts(); @Path("yamlartifacts/{artifactId}") GenericFileResource postYamlArtifactFile(@PathParam("artifactId") String id); @GET @Path("minInstances") String getMinInstances(); @PUT @Path("minInstances") Response setMinInstances(@FormParam(value = "minInstances") String minInstances); @GET @Path("maxInstances") String getMaxInstances(); @PUT @Path("maxInstances") Response setMaxInstances(@FormParam(value = "maxInstances") String maxInstances); @Path("x") @GET @ApiOperation(value = "@return the x coordinate of the node template") String getX(); @Path("x") @PUT Response setX(String x); @Path("y") @GET @ApiOperation(value = "@return the y coordinate of the node template") String getY(); @Path("y") @PUT Response setY(String y); @Override Namespace getNamespace(); @POST @Path("state") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) Response createStateElement(@FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file")
        FormDataContentDisposition fileDetail, @FormDataParam("file") FormDataBodyPart body, @Context UriInfo uriInfo); ServiceTemplateResource getServiceTemplateResource(); @HEAD Response getHEAD();  }
@Test public void addStateArtifactToNodeTemplate() throws Exception { this.setRevisionTo("origin/plain"); Path filePath = MavenTestingUtils.getProjectFilePath("src/test/resources/servicetemplates/plan.zip"); this.assertNoContentPost("servicetemplates/http%253A%252F%252Fplain.winery.opentosca.org%252Fservicetemplates/ServiceTemplateWithOneNodeTemplate_w1-wip1/" + "topologytemplate/nodetemplates/NodeTypeWith5Versions_0_3.4-w3-wip1/state", filePath); TNodeTemplate nodeTemplate = getObjectFromGetRequest("servicetemplates/" + "http%253A%252F%252Fplain.winery.opentosca.org%252Fservicetemplates/ServiceTemplateWithOneNodeTemplate_w1-wip1/" + "topologytemplate/nodetemplates/NodeTypeWith5Versions_0_3.4-w3-wip1", TNodeTemplate.class ); TDeploymentArtifacts deploymentArtifacts = nodeTemplate.getDeploymentArtifacts(); assertNonNull(deploymentArtifacts); TDeploymentArtifact deploymentArtifact = deploymentArtifacts.getDeploymentArtifact("state"); assertNonNull(deploymentArtifact); assertEquals(OpenToscaBaseTypes.stateArtifactType, deploymentArtifact.getArtifactType()); }
@Test public void addStateArtifactToNodeTemplateThatAlreadyHasADeploymentArtifact() throws Exception { this.setRevisionTo("origin/plain"); Path filePath = MavenTestingUtils.getProjectFilePath("src/test/resources/servicetemplates/plan.zip"); this.assertNoContentPost("servicetemplates/http%253A%252F%252Fopentosca.org%252Fexamples%252Fservicetemplates/ServiceTemplateWithDeploymentArtifact_w1-wip1/" + "topologytemplate/nodetemplates/StatefulComponent_w1-wip1/state", filePath); TNodeTemplate nodeTemplate = getObjectFromGetRequest("servicetemplates/" + "http%253A%252F%252Fopentosca.org%252Fexamples%252Fservicetemplates/ServiceTemplateWithDeploymentArtifact_w1-wip1/" + "topologytemplate/nodetemplates/StatefulComponent_w1-wip1", TNodeTemplate.class ); TDeploymentArtifacts deploymentArtifacts = nodeTemplate.getDeploymentArtifacts(); assertNonNull(deploymentArtifacts); assertEquals(2, deploymentArtifacts.getDeploymentArtifact().size()); assertNonNull(deploymentArtifacts.getDeploymentArtifact("test-artifact")); TDeploymentArtifact deploymentArtifact = deploymentArtifacts.getDeploymentArtifact("state"); assertNonNull(deploymentArtifact); assertEquals(OpenToscaBaseTypes.stateArtifactType, deploymentArtifact.getArtifactType()); }