From de34053feb46c82f70b7f6facd293f8f5f83fe4f Mon Sep 17 00:00:00 2001
From: erbel <johannes.erbel@cs.uni-goettingen.de>
Date: Wed, 23 Jan 2019 13:45:33 +0100
Subject: [PATCH] Adjusted Empty model

---
 .../rwm/mocci/DeployHadoopMonitoringTest.java | 17 +----
 .../de/ugoe/cs/rwm/mocci/TestUtility.java     | 13 ++--
 src/test/resources/occi/Empty.occic           | 74 +------------------
 3 files changed, 9 insertions(+), 95 deletions(-)
 mode change 100755 => 100644 src/test/resources/occi/Empty.occic

diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/DeployHadoopMonitoringTest.java b/src/test/java/de/ugoe/cs/rwm/mocci/DeployHadoopMonitoringTest.java
index d07f0d4..09eaea7 100644
--- a/src/test/java/de/ugoe/cs/rwm/mocci/DeployHadoopMonitoringTest.java
+++ b/src/test/java/de/ugoe/cs/rwm/mocci/DeployHadoopMonitoringTest.java
@@ -5,22 +5,11 @@ import static org.junit.Assert.assertTrue;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.eclipse.cmf.occi.core.Configuration;
-import org.eclipse.cmf.occi.core.Link;
-import org.eclipse.cmf.occi.core.Mixin;
-import org.eclipse.cmf.occi.core.OCCIPackage;
 import org.eclipse.cmf.occi.core.util.OcciRegistry;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.epsilon.emc.emf.CachedResourceSet;
 import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import de.ugoe.cs.rwm.docci.MartDeployer;
@@ -31,7 +20,6 @@ import de.ugoe.cs.rwm.docci.connector.LocalhostConnector;
 import de.ugoe.cs.rwm.tocci.Transformator;
 import de.ugoe.cs.rwm.tocci.TransformatorFactory;
 import de.ugoe.cs.rwm.tocci.occi2openstack.OCCI2OPENSTACKTransformator;
-import monitoring.MonitoringPackage;
 
 public class DeployHadoopMonitoringTest {
 	private static String manNWid = "urn:uuid:29d78078-fb4c-47aa-a9af-b8aaf3339590";
@@ -58,7 +46,6 @@ public class DeployHadoopMonitoringTest {
 	public void deployHadoopWithNewMonitoring() {
 		CachedResourceSet.getCache().clear();
 		System.out.println(OcciRegistry.getInstance().getRegisteredExtensions());
-		//Logger.getRootLogger().setLevel(Level.FATAL);
 		Path occiPath = Paths.get(ModelUtility.getPathToResource("occi/hadoopClusterNewExtWithMem.occic"));
 
 		Resource model = ModelUtility.loadOCCIintoEMFResource(occiPath);
@@ -80,9 +67,9 @@ public class DeployHadoopMonitoringTest {
 		Connector conn = new LocalhostConnector("localhost", 8080, "ubuntu");
 		MartDeployer deployer = new MartDeployer(conn);
 
-		deployer.deploy(occiPath);
+		deployer.deploy(model);
 		
-		assertTrue(TestUtility.equalsRuntime(occiPath, conn));
+		assertTrue(TestUtility.equalsRuntime(model, conn));
 
 	}
 }
diff --git a/src/test/java/de/ugoe/cs/rwm/mocci/TestUtility.java b/src/test/java/de/ugoe/cs/rwm/mocci/TestUtility.java
index 08b0bca..d1cc070 100644
--- a/src/test/java/de/ugoe/cs/rwm/mocci/TestUtility.java
+++ b/src/test/java/de/ugoe/cs/rwm/mocci/TestUtility.java
@@ -44,22 +44,17 @@ public class TestUtility {
 		OCCIPackage.eINSTANCE.eClass();
 		ModmacaoPackage.eINSTANCE.eClass();
 		OpenstackruntimePackage.eINSTANCE.eClass();
+		
 		PlacementPackage.eINSTANCE.eClass();
 		WorkflowPackage.eINSTANCE.eClass();
 		OssweruntimePackage.eINSTANCE.eClass();
 		AnsibleconfigurationPackage.eINSTANCE.eClass();
-		PlatformPackage.eINSTANCE.eClass();
 		MonitoringPackage.eINSTANCE.eClass();
 
-		
-		
-		OcciRegistry.getInstance().registerExtension("http://schemas.ugoe.cs.rwm/monitoring#",
-				MonitoringPackage.class.getClassLoader().getResource("model/monitoring.occie").toString());
-		
-		
+		PlatformPackage.eINSTANCE.eClass();
 		OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/occi/platform#",
 				PlatformPackage.class.getClassLoader().getResource("model/platform.occie").toString());
-		
+
 		OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/modmacao#",
 				ModmacaoPackage.class.getClassLoader().getResource("model/modmacao.occie").toString());
 		OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/openstack/runtime#",
@@ -78,6 +73,8 @@ public class TestUtility {
 				OCCIPackage.class.getClassLoader().getResource("model/ossweruntime.occie").toString());
 		OcciRegistry.getInstance().registerExtension("http://schemas.modmacao.org/occi/ansible#",
 				OCCIPackage.class.getClassLoader().getResource("model/ansibleconfiguration.occie").toString());
+		OcciRegistry.getInstance().registerExtension("http://schemas.ugoe.cs.rwm/monitoring#",
+				MonitoringPackage.class.getClassLoader().getResource("model/monitoring.occie").toString());
 
 		
 	} 
diff --git a/src/test/resources/occi/Empty.occic b/src/test/resources/occi/Empty.occic
old mode 100755
new mode 100644
index 6ea0102..3618611
--- a/src/test/resources/occi/Empty.occic
+++ b/src/test/resources/occi/Empty.occic
@@ -1,76 +1,6 @@
 <?xml version="1.0" encoding="ASCII"?>
 <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:occi="http://schemas.ogf.org/occi/core/ecore">
-  <occi:Extension name="template" scheme="http://schemas.openstack.org/template#">
-    <mixins name="36637a26-fded-4635-b6c5-ec8ec0745eab" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: m1.medium"/>
-    <mixins name="60ab5827-e8cd-44f3-a33a-ee2fb989f7a7" scheme="http://schemas.openstack.org/template/os#" title="Sahara_Spark1.6_Ubuntu"/>
-    <mixins name="cc5d21d7-fc0e-451d-884b-aba0efac9c33" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: mongoscale_m8"/>
-    <mixins name="9961ccdf-2ee2-42d1-ac6d-b45318212cad" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: mongoscale_m10"/>
-    <mixins name="32ef77d0-5d26-46f5-9ea3-f805a7a05af6" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: mongoscale_m4"/>
-    <mixins name="2a665c12-e4c5-41fe-b16e-2aec31c799eb" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: mongoscale_m2"/>
-    <mixins name="5437eae8-7c47-4834-929c-a314de77d291" scheme="http://schemas.openstack.org/template/os#" title="Ubuntu 16.04 Server"/>
-    <mixins name="e739cb33-4224-4829-8dcb-9b66a1b8ceb9" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: m1.large"/>
-    <mixins name="d1f5a7a6-0fbe-4146-87fe-1e9441462833" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: mongoscale_m6"/>
-    <mixins name="41598b12-2d7d-4ffe-b3c1-0f52e68fa1ea" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: mongoscale_m1"/>
-    <mixins name="0" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: m1.nano"/>
-    <mixins name="8dd25971-1bbd-47db-9d49-2fef02fa0bc8" scheme="http://schemas.openstack.org/template/resource#" title="Flavor: m1.small"/>
-    <mixins name="e7a211eb-d1dc-4e3a-8da6-f9daabdb81c8" scheme="http://schemas.openstack.org/template/os#" title="Centos 7"/>
-    <mixins name="adf63ddc-debe-4d7e-b899-b936e989439f" scheme="http://schemas.openstack.org/template/os#" title="Ubuntu 14.04 Server"/>
-  </occi:Extension>
-  <occi:Extension name="instance" scheme="http://schemas.openstack.org/instance#">
-    <mixins name="public_key" scheme="http://schemas.openstack.org/instance/credentials#" title="Contextualization extension - public_key"/>
-  </occi:Extension>
-  <occi:Extension name="occi" scheme="http://schemas.ogf.org/occi#">
-    <mixins name="resource_tpl" scheme="http://schemas.ogf.org/occi/infrastructure#" title="OCCI Resource Template"/>
-    <mixins name="os_tpl" scheme="http://schemas.ogf.org/occi/infrastructure#" title="OCCI OS Template"/>
-  </occi:Extension>
-  <occi:Extension name="compute" scheme="http://schemas.openstack.org/compute#">
-    <mixins name="user_data" scheme="http://schemas.openstack.org/compute/instance#" title="Contextualization extension - user_data"/>
-  </occi:Extension>
-  <occi:Extension name="infrastructure" scheme="http://schemas.ogf.org/occi/infrastructure#">
-    <kinds name="storage" scheme="http://schemas.ogf.org/occi/infrastructure#" title="storage resource" parent="/7/@kinds[term='resource']">
-      <actions name="snapshot" scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#" title="snapshot storage instance"/>
-      <actions name="online" scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#" title="online storage instance"/>
-      <actions name="resize" scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#" title="resize storage instance"/>
-      <actions name="backup" scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#" title="backup storage instance"/>
-      <actions name="offline" scheme="http://schemas.ogf.org/occi/infrastructure/storage/action#" title="offline storage instance"/>
-    </kinds>
-    <kinds name="network" scheme="http://schemas.ogf.org/occi/infrastructure#" title="network resource" parent="/7/@kinds[term='resource']">
-      <actions name="down" scheme="http://schemas.ogf.org/occi/infrastructure/network/action#" title="down network instance"/>
-      <actions name="up" scheme="http://schemas.ogf.org/occi/infrastructure/network/action#" title="up network instance"/>
-    </kinds>
-    <kinds name="ipreservation" scheme="http://schemas.ogf.org/occi/infrastructure#" title="IPReservation" parent="/4/@kinds[term='network']"/>
-    <kinds name="storagelink" scheme="http://schemas.ogf.org/occi/infrastructure#" title="storage link resource" parent="/7/@kinds[term='link']" source="/4/@kinds[term='compute']" target="/4/@kinds[term='storage']"/>
-    <kinds name="compute" scheme="http://schemas.ogf.org/occi/infrastructure#" title="compute resource" parent="/7/@kinds[term='resource']">
-      <actions name="start" scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#" title="start compute instance"/>
-      <actions name="restart" scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#" title="restart compute instance"/>
-      <actions name="suspend" scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#" title="suspend compute instance"/>
-      <actions name="stop" scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#" title="stop compute instance"/>
-      <actions name="save" scheme="http://schemas.ogf.org/occi/infrastructure/compute/action#" title="save compute instance"/>
-    </kinds>
-    <kinds name="networkinterface" scheme="http://schemas.ogf.org/occi/infrastructure#" title="network link resource" parent="/7/@kinds[term='link']" source="/4/@kinds[term='compute']" target="/4/@kinds[term='network']"/>
-    <mixins name="ssh_key" scheme="http://schemas.ogf.org/occi/infrastructure/credentials#" title="Credentials mixin"/>
-    <mixins name="ipnetwork" scheme="http://schemas.ogf.org/occi/infrastructure/network#" title="IP Networking Mixin"/>
-    <mixins name="user_data" scheme="http://schemas.ogf.org/occi/infrastructure/compute#" title="Contextualization mixin"/>
-    <mixins name="ipnetworkinterface" scheme="http://schemas.ogf.org/occi/infrastructure/networkinterface#" title="IP Network interface Mixin"/>
-  </occi:Extension>
-  <occi:Extension name="infrastructure" scheme="http://schemas.openstack.org/infrastructure#">
-    <mixins name="neutron" scheme="http://schemas.openstack.org/infrastructure/network#" title="Network component"/>
-    <mixins name="osnetwork" scheme="http://schemas.openstack.org/infrastructure/network#" title="openstack network"/>
-  </occi:Extension>
-  <occi:Extension name="network" scheme="http://schemas.openstack.org/network#">
-    <mixins name="provider" scheme="http://schemas.openstack.org/network/floatingippool#" title="provider"/>
-  </occi:Extension>
-  <occi:Extension scheme="http://schemas.ogf.org/occi/core#">
-    <kinds name="link" scheme="http://schemas.ogf.org/occi/core#" title="link"/>
-    <kinds name="entity" scheme="http://schemas.ogf.org/occi/core#" title="entity"/>
-    <kinds name="resource" scheme="http://schemas.ogf.org/occi/core#" title="resource" parent="/7/@kinds[term='entity']"/>
-  </occi:Extension>
-  <occi:Configuration description="Extracted Runtime Model" location="http://192.168.34.1:8787/occi1.1OCCIBasicAuthentication" use="/0 /4 /5">
-    <resources id="urn:uuid:29d78078-fb4c-47aa-a9af-b8aaf3339590" title="Management Network" kind="/4/@kinds[term='network']">
-      <parts>
-        <mixin href="http://schemas.modmacao.org/openstack/runtime#//@mixins[term='runtimeid']"/>
-        <attributes name="openstack.runtime.id" value="75a4639e-9ce7-4058-b859-8a711b0e2e7b"/>
-      </parts>
-    </resources>
+  <occi:Configuration>
+
   </occi:Configuration>
 </xmi:XMI>
-- 
GitLab