Fixing archetypes so that the REST overlay works together with UI overlays.

Change-Id: Iab60f4cd07b59e1750ef0733883f4f7ecd0b3b46
diff --git a/tools/package/archetypes/rest/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/rest/src/main/resources/archetype-resources/pom.xml
index f442ed0..e891556 100644
--- a/tools/package/archetypes/rest/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/rest/src/main/resources/archetype-resources/pom.xml
@@ -164,8 +164,9 @@
                             com.google.common.*,
                             org.onlab.packet.*,
                             org.onlab.rest.*,
-                            org.onosproject.*,
+                            org.onlab.osgi.*,
                             org.onlab.util.*,
+                            org.onosproject.*,
                             org.jboss.netty.util.*
                         </Import-Package>
                         <Web-ContextPath>${web.context}</Web-ContextPath>
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
index e44b34d..ec42b88 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/java/AppUiComponent.java
@@ -61,6 +61,7 @@
     // Application UI extension
     protected UiExtension extension =
             new UiExtension.Builder(getClass().getClassLoader(), uiViews)
+                    .resourcePath(VIEW_ID)
                     .messageHandlerFactory(messageHandlerFactory)
                     .build();
 
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/sampleCustom/css.html
similarity index 100%
rename from tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/css.html
rename to tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/sampleCustom/css.html
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html b/tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/sampleCustom/js.html
similarity index 100%
rename from tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/js.html
rename to tools/package/archetypes/ui/src/main/resources/archetype-resources/src/main/resources/sampleCustom/js.html
diff --git a/tools/test/scenarios/archetypes.xml b/tools/test/scenarios/archetypes.xml
index 307a206..790b334 100644
--- a/tools/test/scenarios/archetypes.xml
+++ b/tools/test/scenarios/archetypes.xml
@@ -23,7 +23,7 @@
         <step name="Build-App" requires="Create-App" exec="mvn clean install"/>
         <step name="Install-App" requires="^"
               exec="onos-app ${OCI} install! target/test-app-1.2.3.oar"/>
-        <step name="Verify-App" requires="^"
+        <step name="Verify-App" requires="^" delay="5"
               exec="onos-check-components ${OCI} org.test.app.AppComponent"/>
 
         <step name="Create-App-CLI-Overlay" requires="Install-App"
@@ -32,7 +32,7 @@
               exec="mvn clean install"/>
         <step name="Reinstall-App-With-CLI" requires="^,~Verify-App"
               exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/>
-        <step name="Verify-CLI" requires="^"
+        <step name="Verify-CLI" requires="^" delay="2"
               exec="onos ${OCI} sample"/>
 
         <step name="Create-App-UI-Overlay" requires="Reinstall-App-With-CLI"
@@ -41,7 +41,7 @@
               exec="mvn clean install"/>
         <step name="Reinstall-App-With-UI" requires="^,~Verify-CLI"
               exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/>
-        <step name="Verify-UI" requires="^"
+        <step name="Verify-UI" requires="^" delay="2"
               exec="onos-check-views ${OCI} id=sample"/>
 
         <step name="Create-App-UI-Table-Overlay" requires="Reinstall-App-With-UI"
@@ -50,7 +50,7 @@
               exec="mvn clean install"/>
         <step name="Reinstall-App-With-UI-Table" requires="^,~Verify-UI"
               exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/>
-        <step name="Verify-UI-Table" requires="^"
+        <step name="Verify-UI-Table" requires="^" delay="2"
               exec="onos-check-views ${OCI} id=sample"/>
 
         <step name="Create-App-UI-Topo-Overlay" requires="Reinstall-App-With-UI-Table"
@@ -59,20 +59,17 @@
               exec="mvn clean install"/>
         <step name="Reinstall-App-With-UI-Topo" requires="^,~Verify-UI-Table"
               exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/>
-        <step name="Verify-UI-Topo" requires="^"
+        <step name="Verify-UI-Topo" requires="^" delay="2"
               exec="onos-check-views ${OCI} id=sample"/>
 
-        <step name="Clean-Up-For-REST-App" cwd="${WORKSPACE}/tmp" env="~" requires="Reinstall-App-With-UI-Topo"
-              exec="rm -r test-app"/>
-
-        <step name="Create-REST-App" cwd="${WORKSPACE}/tmp" requires="^"
-              exec="onos-create-app app org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/>
         <step name="Create-REST-Overlay" requires="^"
               exec="onos-create-app rest org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/>
         <step name="Build-REST-App" requires="^"
               exec="mvn clean install"/>
         <step name="Install-REST-App" requires="^,~Verify-UI-Topo"
               exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/>
+        <step name="Verify-REST-CLI" requires="^" delay="2"
+              exec="onos ${OCI} sample"/>
         <step name="Verify-REST-App" requires="^" delay="2"
               exec="curl --fail -isS --user ${ONOS_WEB_USER}:${ONOS_WEB_PASS} http://${OCI}:8181/onos/test-app/sample"/>
 
diff --git a/tools/test/scenarios/setup.xml b/tools/test/scenarios/setup.xml
index 071db8b..a53e317 100644
--- a/tools/test/scenarios/setup.xml
+++ b/tools/test/scenarios/setup.xml
@@ -33,15 +33,16 @@
             <step name="Wait-for-Start-${#}" exec="onos-wait-for-start ${OC#}"
                   requires="Install-${#},~Secure-SSH"/>
 
-            <step name="Check-Nodes-${#}" exec="onos-check-nodes ${OC#}"
+            <step name="Check-Nodes-${#}" exec="onos-check-nodes ${OC#}" delay="3"
                   requires="~Wait-for-Start-${#}"/>
-            <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}"
-                  requires="~Wait-for-Start-${#}"/>
-            <step name="Check-Components-${#}"
+            <step name="Check-Components-${#}" delay="5"
                   exec="onos-check-components ${OC#}"
-                  requires="~Wait-for-Start-${#},"/>
-            <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#} ${ONOS_APPS} includes"
                   requires="~Wait-for-Start-${#}"/>
+
+            <step name="Check-Logs-${#}" exec="onos-check-logs ${OC#}"
+                  requires="~Check-Components-${#}"/>
+            <step name="Check-Apps-${#}" exec="onos-check-apps ${OC#} ${ONOS_APPS} includes"
+                  requires="~Check-Components-${#}"/>
         </parallel>
     </group>
 </scenario>