Commit f6beefaf authored by Alessio Carenini's avatar Alessio Carenini
Browse files

Merge branch 'Amber' of ssh://tuleap.ow2.org/chorevolution/enactment-engine into Amber

parents 5227f816 d5f13e1c
......@@ -16,7 +16,6 @@
package eu.chorevolution.datamodel;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.List;
......@@ -24,7 +23,7 @@ import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.stream.XMLInputFactory;
......@@ -65,6 +64,7 @@ public class Choreography {
public Choreography() {
}
@XmlAttribute
public String getId() {
return id;
}
......@@ -106,19 +106,6 @@ public class Choreography {
this.name = name;
}
public static Choreography create_new(String xml) throws JAXBException{
JAXBContext context = JAXBContext.newInstance(Choreography.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
Choreography c = (Choreography) unmarshaller.unmarshal(new StringReader(xml));
return c;
}
// based on
// http://arthur.gonigberg.com/2010/04/26/jaxb-generating-schema-from-object-model/
// and
public DeploymentLocation getLocation() {
return location;
}
......
......@@ -23,26 +23,28 @@ import eu.chorevolution.datamodel.deployment.DeploymentInfo;
@XmlRootElement
public class DeployedService extends DeployableService {
private List<DeploymentInfo> deploymentInfo;
private List<DeploymentInfo> deploymentInfo;
private String url;
public DeployedService() {
}
public List<DeploymentInfo> getDeploymentInfo() {
return deploymentInfo;
}
public DeployedService() {
}
public List<DeploymentInfo> getDeploymentInfo() {
return deploymentInfo;
}
public void setDeploymentInfo(List<DeploymentInfo> deploymentInfo) {
this.deploymentInfo = deploymentInfo;
}
public void setDeploymentInfo(List<DeploymentInfo> deploymentInfo) {
this.deploymentInfo = deploymentInfo;
}
public String getUrl() {
return url;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public void setUrl(String url) {
this.url = url;
}
}
......@@ -25,11 +25,14 @@ import org.junit.Test;
import eu.chorevolution.datamodel.Choreography;
import eu.chorevolution.datamodel.ChoreographyService;
import eu.chorevolution.datamodel.DeployableService;
import eu.chorevolution.datamodel.DeployedService;
import eu.chorevolution.datamodel.ExistingService;
import eu.chorevolution.datamodel.PackageType;
import eu.chorevolution.datamodel.ServiceDependency;
import eu.chorevolution.datamodel.ServiceGroup;
import eu.chorevolution.datamodel.ServiceType;
import eu.chorevolution.datamodel.deployment.CloudNode;
import eu.chorevolution.datamodel.deployment.DeploymentInfo;
import java.util.List;
public class DeserializationTest {
......@@ -78,4 +81,41 @@ public class DeserializationTest {
assertNotNull(dependency);
assertEquals("cdtouristagent", dependency.getServiceSpecName());
}
@Test
public void wp5After() throws Exception {
Choreography choreography = Choreography.fromXML(getClass().getResourceAsStream("/after_wp5.choreospec"));
assertNotNull(choreography);
assertNotNull(choreography.getId());
ServiceGroup serviceGroup = choreography.getServiceGroups().get(0);
assertNotNull(serviceGroup);
assertNotNull(serviceGroup.getServices());
assertFalse(serviceGroup.getServices().isEmpty());
ChoreographyService service = findService(serviceGroup.getServices(), "cdclientSTApp");
assertNotNull(service);
assertTrue(service instanceof DeployedService);
DeployedService dService = (DeployedService) service;
assertEquals(ServiceType.COORDINATION_DELEGATE, dService.getServiceType());
assertEquals(PackageType.ODE, dService.getPackageType());
assertEquals(1, dService.getInstances());
assertTrue(dService.getPackageUrl().startsWith("http://"));
assertNotNull(dService.getUrl());
List<DeploymentInfo> deploymentInfos = dService.getDeploymentInfo();
assertNotNull(deploymentInfos);
assertEquals(1, deploymentInfos.size());
DeploymentInfo deploymentInfo = deploymentInfos.get(0);
assertNotNull(deploymentInfo.getEndpoint());
CloudNode node = deploymentInfo.getNode();
assertNotNull(node);
assertNotNull(node.getCpus());
assertNotNull(node.getIp());
assertEquals("Ubuntu", node.getOs());
}
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
Copyright 2015 The CHOReVOLUTION project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<choreography id="13de56fd-4ddb-4a5a-847c-75672d57f2af">
<service_group>
<service xsi:type="existingService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>JourneyPlanner</name>
<role>Journey Planner</role>
<url>http://localhost:8080/JourneyPlanner/JourneyPlanner</url>
</service>
<service xsi:type="existingService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>OSMParking</name>
<role>OSM Parking</role>
<url>http://localhost:8080/OSMParking/OSMParking</url>
</service>
<service xsi:type="existingService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>Poi</name>
<role>Poi</role>
<url>http://localhost:8080/Poi/Poi</url>
</service>
<service xsi:type="existingService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>PublicTransportation</name>
<role>Public Transportation</role>
<url>http://localhost:8080/PublicTransportation/PublicTransportation</url>
</service>
<service xsi:type="existingService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>News</name>
<role>News</role>
<url>http://localhost:8080/News/News</url>
</service>
<service xsi:type="existingService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>STApp</name>
<role>STApp</role>
<url>http://localhost:8080/STApp/STApp</url>
</service>
<service xsi:type="existingService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>TrafficInformation</name>
<role>Traffic Information</role>
<url>http://localhost:8080/TrafficInformation/TrafficInformation</url>
</service>
<service xsi:type="existingService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>Weather</name>
<role>Weather</role>
<url>http://localhost:8080/Weather/Weather</url>
</service>
<service xsi:type="deployedService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>consumercdtripplanner</name>
<role>Consumer Trip Planner</role>
<instances>1</instances>
<packageType>WAR</packageType>
<packageUrl>http://localhost:8080/cdtripplanner/cdtripplanner</packageUrl>
<serviceType>COORDINATION_DELEGATE</serviceType>
<url>http://192.168.150.142/ode/processes/cdtripplanner</url>
<deploymentInfo>
<endpoint>http://192.168.150.130:8080/ode/processes/cdtripplanner</endpoint>
<node>
<cpus>2</cpus>
<hostname>chornode1</hostname>
<image>af036b89-0ef4-48e9-99ac-51b0cf9c314e</image>
<ip>192.168.150.130</ip>
<os>Ubuntu</os>
<privateKeyFile>/etc/enactment-engine/eekey.pem</privateKeyFile>
<ram>1024</ram>
<state>1</state>
<storage>10000</storage>
<user>ubuntu</user>
<zone>RegionOne</zone>
</node>
</deploymentInfo>
</service>
<service xsi:type="deployedService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>consumercdtouristagent</name>
<role>Consumer Tourist Agent</role>
<instances>1</instances>
<packageType>WAR</packageType>
<packageUrl>http://localhost:8080/cdtouristagent/cdtouristagent</packageUrl>
<serviceType>COORDINATION_DELEGATE</serviceType>
<url>http://192.168.150.142/ode/processes/cdtouristagent</url>
<deploymentInfo>
<endpoint>http://192.168.150.130:8080/ode/processes/cdtouristagent</endpoint>
<node>
<cpus>2</cpus>
<hostname>chornode1</hostname>
<image>af036b89-0ef4-48e9-99ac-51b0cf9c314e</image>
<ip>192.168.150.130</ip>
<os>Ubuntu</os>
<privateKeyFile>/etc/enactment-engine/eekey.pem</privateKeyFile>
<ram>1024</ram>
<state>1</state>
<storage>10000</storage>
<user>ubuntu</user>
<zone>RegionOne</zone>
</node>
</deploymentInfo>
</service>
<service xsi:type="deployedService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>cdtripplanner</name>
<role>Trip Planner</role>
<dependency>
<serviceSpecName>consumercdtripplanner</serviceSpecName>
<serviceSpecRole>Consumer Trip Planner</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>TrafficInformation</serviceSpecName>
<serviceSpecRole>Traffic Information</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>JourneyPlanner</serviceSpecName>
<serviceSpecRole>Journey Planner</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>OSMParking</serviceSpecName>
<serviceSpecRole>OSM Parking</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>PublicTransportation</serviceSpecName>
<serviceSpecRole>Public Transportation</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>Weather</serviceSpecName>
<serviceSpecRole>Weather</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>cdtouristagent</serviceSpecName>
<serviceSpecRole>Tourist Agent</serviceSpecRole>
</dependency>
<instances>1</instances>
<packageType>ODE</packageType>
<packageUrl>http://localhost:8080/cdtripplanner/cdtripplanner.war</packageUrl>
<serviceType>COORDINATION_DELEGATE</serviceType>
<url>http://192.168.150.142/ode/processes/cdtripplanner</url>
<deploymentInfo>
<endpoint>http://192.168.150.130:8080/ode/processes/cdtripplanner</endpoint>
<node>
<cpus>2</cpus>
<hostname>chornode1</hostname>
<image>af036b89-0ef4-48e9-99ac-51b0cf9c314e</image>
<ip>192.168.150.130</ip>
<os>Ubuntu</os>
<privateKeyFile>/etc/enactment-engine/eekey.pem</privateKeyFile>
<ram>1024</ram>
<state>1</state>
<storage>10000</storage>
<user>ubuntu</user>
<zone>RegionOne</zone>
</node>
</deploymentInfo>
</service>
<service xsi:type="deployedService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>cdtouristagent</name>
<role>Tourist Agent</role>
<dependency>
<serviceSpecName>consumercdtouristagent</serviceSpecName>
<serviceSpecRole>Consumer Tourist Agent</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>Poi</serviceSpecName>
<serviceSpecRole>Poi</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>News</serviceSpecName>
<serviceSpecRole>News</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>cdtripplanner</serviceSpecName>
<serviceSpecRole>Trip Planner</serviceSpecRole>
</dependency>
<dependency>
<serviceSpecName>cdclientSTApp</serviceSpecName>
<serviceSpecRole>CD Client STApp</serviceSpecRole>
</dependency>
<instances>1</instances>
<packageType>ODE</packageType>
<packageUrl>http://localhost:8080/cdtouristagent/cdtouristagent.war</packageUrl>
<serviceType>COORDINATION_DELEGATE</serviceType>
<url>http://192.168.150.142/ode/processes/cdtouristagent</url>
<deploymentInfo>
<endpoint>http://192.168.150.130:8080/ode/processes/cdtouristagent</endpoint>
<node>
<cpus>2</cpus>
<hostname>chornode1</hostname>
<image>af036b89-0ef4-48e9-99ac-51b0cf9c314e</image>
<ip>192.168.150.130</ip>
<os>Ubuntu</os>
<privateKeyFile>/etc/enactment-engine/eekey.pem</privateKeyFile>
<ram>1024</ram>
<state>1</state>
<storage>10000</storage>
<user>ubuntu</user>
<zone>RegionOne</zone>
</node>
</deploymentInfo>
</service>
<service xsi:type="deployedService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>cdclientSTApp</name>
<role>CD Client STApp</role>
<dependency>
<serviceSpecName>cdtouristagent</serviceSpecName>
<serviceSpecRole>Tourist Agent</serviceSpecRole>
</dependency>
<instances>1</instances>
<packageType>ODE</packageType>
<packageUrl>http://localhost:8080/STApp/STApp.war</packageUrl>
<serviceType>COORDINATION_DELEGATE</serviceType>
<url>http://192.168.150.142/ode/processes/STApp</url>
<deploymentInfo>
<endpoint>http://192.168.150.130:8080/ode/processes/STApp</endpoint>
<node>
<cpus>2</cpus>
<hostname>chornode1</hostname>
<image>af036b89-0ef4-48e9-99ac-51b0cf9c314e</image>
<ip>192.168.150.130</ip>
<os>Ubuntu</os>
<privateKeyFile>/etc/enactment-engine/eekey.pem</privateKeyFile>
<ram>1024</ram>
<state>1</state>
<storage>10000</storage>
<user>ubuntu</user>
<zone>RegionOne</zone>
</node>
</deploymentInfo>
</service>
</service_group>
</choreography>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment