Search in sources :

Example 1 with XTTopologyTemplate

use of org.eclipse.winery.model.tosca.xml.XTTopologyTemplate in project winery by eclipse.

the class RemoveEmptyListsTest method emptyPropertiesAndPoliciesListsRemovedFromNodeTemplate.

@Test
public void emptyPropertiesAndPoliciesListsRemovedFromNodeTemplate() {
    XTTopologyTemplate topologyTemplate = new XTTopologyTemplate.Builder().build();
    XTNodeTemplate nodeTemplate = new XTNodeTemplate.Builder("test", QName.valueOf("{ns}test")).build();
    topologyTemplate.getNodeTemplateOrRelationshipTemplate().add(nodeTemplate);
    nodeTemplate.setProperties(new XTEntityTemplate.Properties());
    nodeTemplate.setPolicies(new ArrayList<>());
    assertNotNull(((XTNodeTemplate) topologyTemplate.getNodeTemplateOrRelationshipTemplate().get(0)).getPolicies());
    assertNotNull(topologyTemplate.getNodeTemplateOrRelationshipTemplate().get(0).getProperties());
    // preconditions fulfilled
    RemoveEmptyLists removeEmptyLists = new RemoveEmptyLists();
    removeEmptyLists.removeEmptyLists(topologyTemplate);
    assertNull(((XTNodeTemplate) topologyTemplate.getNodeTemplateOrRelationshipTemplate().get(0)).getPolicies());
    assertNull(topologyTemplate.getNodeTemplateOrRelationshipTemplate().get(0).getProperties());
}
Also used : XTEntityTemplate(org.eclipse.winery.model.tosca.xml.XTEntityTemplate) XTNodeTemplate(org.eclipse.winery.model.tosca.xml.XTNodeTemplate) XTTopologyTemplate(org.eclipse.winery.model.tosca.xml.XTTopologyTemplate) Test(org.junit.jupiter.api.Test)

Example 2 with XTTopologyTemplate

use of org.eclipse.winery.model.tosca.xml.XTTopologyTemplate in project winery by eclipse.

the class Visitor method visit.

public void visit(XTServiceTemplate serviceTemplate) {
    Objects.requireNonNull(serviceTemplate);
    visit((XTExtensibleElements) serviceTemplate);
    final XTTopologyTemplate topologyTemplate = serviceTemplate.getTopologyTemplate();
    if (topologyTemplate != null) {
        topologyTemplate.accept(this);
    }
    final List<XTTag> tags = serviceTemplate.getTags();
    if (tags != null) {
        for (XTTag tag : tags) {
            tag.accept(this);
        }
    }
    final List<XTPlan> plans = serviceTemplate.getPlans();
    if (plans != null) {
        for (XTPlan plan : plans) {
            plan.accept(this);
        }
    }
    final XTBoundaryDefinitions boundaryDefinitions = serviceTemplate.getBoundaryDefinitions();
    if (boundaryDefinitions != null) {
        boundaryDefinitions.accept(this);
    }
}
Also used : XTTag(org.eclipse.winery.model.tosca.xml.XTTag) XTPlan(org.eclipse.winery.model.tosca.xml.XTPlan) XTBoundaryDefinitions(org.eclipse.winery.model.tosca.xml.XTBoundaryDefinitions) XTTopologyTemplate(org.eclipse.winery.model.tosca.xml.XTTopologyTemplate)

Aggregations

XTTopologyTemplate (org.eclipse.winery.model.tosca.xml.XTTopologyTemplate)2 XTBoundaryDefinitions (org.eclipse.winery.model.tosca.xml.XTBoundaryDefinitions)1 XTEntityTemplate (org.eclipse.winery.model.tosca.xml.XTEntityTemplate)1 XTNodeTemplate (org.eclipse.winery.model.tosca.xml.XTNodeTemplate)1 XTPlan (org.eclipse.winery.model.tosca.xml.XTPlan)1 XTTag (org.eclipse.winery.model.tosca.xml.XTTag)1 Test (org.junit.jupiter.api.Test)1