Skip to content
Snippets Groups Projects
Commit 94ce8fe7 authored by Patient NTUMBA's avatar Patient NTUMBA
Browse files

Update VsbManage test

parent 2b1e8962
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<gidl:GIDLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gidl="http://eu.chorevolution/modelingnotations/gidl" hostAddress="http://jinx.viktoria.chalmers.se:3004/" protocol="REST">
<hasInterfaces role="provider">
<hasOperations name="getCongestion​" type="two_way_sync" qos="reliable">
<hasScope name="getCongestion​" verb="POST" uri="getCongestion​"/>
<inputData name="response" context="body">
<hasDataType xsi:type="gidl:ComplexType" name="congestionStatusResponse" occurences="one">
<hasDataType xsi:type="gidl:ComplexType" name="routeSegmentsCongestionStatus" occurences="unbounded">
<hasDataType xsi:type="gidl:ComplexType" name="routeSegmentCongestionStatus" occurences="one">
<hasDataType xsi:type="gidl:ComplexType" name="routeSegment" occurences="one">
<hasDataType xsi:type="gidl:ComplexType" name="strart" occurences="one">
<hasDataType xsi:type="gidl:SimpleType" name="lat" occurences="one" type="string"/>
<hasDataType xsi:type="gidl:SimpleType" name="lon" occurences="one" type="string"/>
</hasDataType>
<hasDataType xsi:type="gidl:ComplexType" name="end" occurences="one">
<hasDataType xsi:type="gidl:SimpleType" name="lat" occurences="one" type="string"/>
<hasDataType xsi:type="gidl:SimpleType" name="lon" occurences="one" type="string"/>
</hasDataType>
</hasDataType>
<hasDataType xsi:type="gidl:SimpleType" name="congestionLevel" occurences="one" type="string"/>
<hasDataType xsi:type="gidl:SimpleType" name="speed" occurences="one" type="string"/>
</hasDataType>
</hasDataType>
</hasDataType>
</inputData>
<outputData name="request" context="body">
<hasDataType xsi:type="gidl:ComplexType" name="congestionStatusRequest" occurences="one">
<hasDataType xsi:type="gidl:ComplexType" name="routeSegments" occurences="unbounded">
<hasDataType xsi:type="gidl:ComplexType" name="start" occurences="one">
<hasDataType xsi:type="gidl:SimpleType" name="lat" occurences="one" type="string"/>
<hasDataType xsi:type="gidl:SimpleType" name="lon" occurences="one" type="string"/>
</hasDataType>
<hasDataType xsi:type="gidl:ComplexType" name="end" occurences="one">
<hasDataType xsi:type="gidl:SimpleType" name="lat" occurences="one" type="string"/>
<hasDataType xsi:type="gidl:SimpleType" name="lon" occurences="one" type="string"/>
</hasDataType>
</hasDataType>
</hasDataType>
</outputData>
</hasOperations>
</hasInterfaces>
</gidl:GIDLModel>
...@@ -28,7 +28,5 @@ ...@@ -28,7 +28,5 @@
<version>4.12-beta-2</version> <version>4.12-beta-2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -67,13 +67,11 @@ public class VsbManager { ...@@ -67,13 +67,11 @@ public class VsbManager {
if(getClass().getClassLoader().getResource("config.json").toString().startsWith("jar")){ if(getClass().getClassLoader().getResource("config.json").toString().startsWith("jar")){
STARTING_FROM_JAR = true; STARTING_FROM_JAR = true;
} }
} }
/******************************** Public method to call ***********************************************/ /******************************** Public method to call ***********************************************/
/** /**
* Returns VsbOutput object which contains the generated 1 byte array of archive war * Returns VsbOutput object which contains the generated 1 byte array of archive war
* and 1 array bytes of wsdl file * and 1 array bytes of wsdl file
...@@ -153,9 +151,8 @@ public class VsbManager { ...@@ -153,9 +151,8 @@ public class VsbManager {
/*************** Private method called by public method ************************************************/ /*************** Private method called by public method ************************************************/
private void setConstants(String interfaceDescriptionPath) { private void setConstants(String interfaceDescriptionPath){
Random rand = new Random(); Random rand = new Random();
Constants.service_port = String.valueOf(rand.nextInt(Constants.service_port_max_range - Constants.service_port_min_range + 1) + Constants.service_port_min_range); Constants.service_port = String.valueOf(rand.nextInt(Constants.service_port_max_range - Constants.service_port_min_range + 1) + Constants.service_port_min_range);
Constants.setinvaddr_service_port = String.valueOf(rand.nextInt(Constants.setinvaddr_service_port_max_range - Constants.setinvaddr_service_port_min_range + 1)+ Constants.setinvaddr_service_port_min_range); Constants.setinvaddr_service_port = String.valueOf(rand.nextInt(Constants.setinvaddr_service_port_max_range - Constants.setinvaddr_service_port_min_range + 1)+ Constants.setinvaddr_service_port_min_range);
...@@ -185,7 +182,6 @@ public class VsbManager { ...@@ -185,7 +182,6 @@ public class VsbManager {
} }
PathResolver.updatePortServiceSetInvAddr(Constants.setinvaddr_service_port); PathResolver.updatePortServiceSetInvAddr(Constants.setinvaddr_service_port);
Constants.webapp_src_bc = new File(bc_generators_copy+ File.separator + "webapp-bc-generator" Constants.webapp_src_bc = new File(bc_generators_copy+ File.separator + "webapp-bc-generator"
+ File.separator + "src" + File.separator + "main" + File.separator + File.separator + "src" + File.separator + "main" + File.separator
+ "webapp").getAbsolutePath(); + "webapp").getAbsolutePath();
...@@ -202,7 +198,6 @@ public class VsbManager { ...@@ -202,7 +198,6 @@ public class VsbManager {
Constants.wsdlDestination = new File(Constants.generatedCodePath).getAbsolutePath(); Constants.wsdlDestination = new File(Constants.generatedCodePath).getAbsolutePath();
} }
private VsbOutput generate(String interfaceDescriptionPath, ProtocolType busProtocol) { private VsbOutput generate(String interfaceDescriptionPath, ProtocolType busProtocol) {
if(!isInterfaceDescriptionFile(interfaceDescriptionPath)){ if(!isInterfaceDescriptionFile(interfaceDescriptionPath)){
......
package eu.chorevolution.vsb.manager; package eu.chorevolution.vsb.manager;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import eu.chorevolution.vsb.bc.manager.BcManagerRestService; import eu.chorevolution.vsb.bc.manager.BcManagerRestService;
import eu.chorevolution.vsb.gmdl.utils.PathResolver; import eu.chorevolution.vsb.gmdl.utils.PathResolver;
import eu.chorevolution.vsb.gmdl.utils.enums.ProtocolType; import eu.chorevolution.vsb.gmdl.utils.enums.ProtocolType;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
//import eu.chorevolution.vsb.bindingcomponent.generated.GeneratedFactory; //import eu.chorevolution.vsb.bindingcomponent.generated.GeneratedFactory;
public class VsbManagerTest{ public class VsbManagerTest{
public static void main(String[] args){
String interfaceDescriptionPath = null;
@Before
public void setUp(){
interfaceDescriptionPath = PathResolver.myFilePath(BcManagerRestService.class,"bridge.gidl");
}
@Test
public void generateWarFile(){
boolean generateWarFile = true;
try {
VsbManager vsbm = new VsbManager();
vsbm.generateWar(interfaceDescriptionPath, ProtocolType.SOAP, "ServiceTest");
vsbm.deleteGeneratedFiles();
} catch (Exception e){
generateWarFile = false;
}
//assertTrue(generateWarFile);
} String interfaceDescriptionPath = PathResolver.myFilePath(BcManagerRestService.class,"dts-congestion.gidl");
VsbManager vsbm = new VsbManager();
vsbm.generateWar(interfaceDescriptionPath, ProtocolType.SOAP, "ServiceTest");
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment