Breaks hermetic build.

Revert "Minor fixes for the Bazel build of GUI2"

This reverts commit 42db831c4ac2bb0c9afc5e4dc34c9d766a9d6034.

Change-Id: I3bf0793753c0bedfbcbf242108736fc7247e29b3
diff --git a/web/gui/BUILD b/web/gui/BUILD
index 34aa8fa..82c7e20 100644
--- a/web/gui/BUILD
+++ b/web/gui/BUILD
@@ -108,7 +108,7 @@
           " export HOME=. &&" +
           " export XDG_CONFIG_HOME=$(@D)/config &&" +  # npm config cache to the sandbos
           " export BABEL_DISABLE_CACHE=1 &&" +  # turn off babel cache
-          " if [[ ! -z $${HTTP_PROXY-} ]]; then NPM_ARGS='--proxy $$HTTP_PROXY --without-ssl --insecure'; else NPM_ARGS=''; fi &&" +
+          ' if [[ ! -z $${HTTP_PROXY-} ]]; then NPM_ARGS="--proxy $$HTTP_PROXY --without-ssl --insecure"; else NPM_ARGS=""; fi &&' +
           " NPM=$$ROOT/$(location @nodejs//:bin/npm) &&" +
           " mkdir -p tools/gui &&" +
           " cd tools/gui &&" +
@@ -205,15 +205,6 @@
     deps = COMPILE_DEPS,
 )
 
-filegroup(
-    name = "onos-gui-java-for-gui2",
-    srcs = glob([
-        "src/main/java/org/onosproject/ui/impl/Main*Resource.java",
-        "src/main/java/org/onosproject/ui/impl/ApplicationResource.java",
-    ]),
-    visibility = ["//visibility:public"],
-)
-
 """
     Builds the tar ball for the ONOS GUI
 """
diff --git a/web/gui2/BUILD b/web/gui2/BUILD
index f2a6013..adfce11 100644
--- a/web/gui2/BUILD
+++ b/web/gui2/BUILD
@@ -120,11 +120,10 @@
           " export HOME=. &&" +
           " export XDG_CONFIG_HOME=$(@D)/config &&" +  # npm config cache to the sandbox
           " export BABEL_DISABLE_CACHE=1 &&" +  # turn off babel cache
-          " if [[ ! -z $${HTTP_PROXY-} ]]; then NPM_ARGS='--proxy $$HTTP_PROXY --without-ssl --insecure'; else NPM_ARGS=''; fi &&" +
           " NPM=$$ROOT/$(location @nodejs//:bin/npm) &&" +
           " mkdir -p web/gui2 &&" +
           " cd web/gui2 &&" +
-          " $$NPM $$NPM_ARGS install  --no-cache --loglevel=error > $$ROOT/$(location onos-gui2-npm-install.log) 2>&1 &&" +
+          " $$NPM install  --no-cache --loglevel=error > $$ROOT/$(location onos-gui2-npm-install.log) 2>&1 &&" +
           " jar Mcf $$ROOT/$(location onos-gui2-npm-install.jar) . &&" +
           " touch $$ROOT/$(location onos-gui2-npm-install.log)",  # to get the log always as the 2nd file
     visibility = ["//visibility:public"],
@@ -301,9 +300,9 @@
 
 osgi_jar_with_tests(
     name = "_onos-gui2-base-jar",
-    srcs = [
-        "src/main/java/org/onosproject/ui/impl/gui2/LogoutResource.java",
-        "//web/gui:onos-gui-java-for-gui2",
+    exclude_tests = [
+        "org.onosproject.ui.impl.AbstractUiImplTest",
+        "org.onosproject.ui.impl.topo.model.AbstractTopoModelTest",
     ],
     test_deps = TEST_DEPS,
     web_context = "/onos/ui2",
@@ -320,7 +319,6 @@
         ":_onos-gui2-ng-build",
         ":_onos-gui2-base-jar",
         ":_web_inf_classes_files",
-        "src/main/webapp/WEB-INF/web.xml",
     ],
     outs = ["onos-gui2.jar"],
     cmd = " ROOT=`pwd` &&" +
@@ -331,7 +329,7 @@
           " (cd WEB-INF/classes && jar xf $$ROOT/$${BUILD_FILES[1]}) &&" +
           " jar xf $$ROOT/$(location :_onos-gui2-base-jar) &&" +
           " find . -type f -exec touch -t 201808280000 {} \; &&" +
-          " jar cmf META-INF/MANIFEST.MF $$ROOT/$@ WEB-INF/web.xml WEB-INF/classes",
+          " jar cmf META-INF/MANIFEST.MF $$ROOT/$@ WEB-INF/classes",
     output_to_bindir = 1,
     visibility = ["//visibility:public"],
 )
diff --git a/web/gui2/README.md b/web/gui2/README.md
index 3064b76..9883467 100644
--- a/web/gui2/README.md
+++ b/web/gui2/README.md
@@ -81,7 +81,11 @@
 
 ## Build
 The build is handled through the web/gui2/BUCK file. This downloads Node, NPM and Angular CLI
-It runs ```ng build --prod --extract-css``` and copies everything over in to WEB-INF/classes/dist
+It runs ```ng build --prod --extract-css``` and copies everything over in to WEB-INF/classes/dist (there
+is something weird in BUCK resources - if there is a file in the root dir of the
+outputted folder this is copied to the sources root directory, where as files
+are copied to WEB-INF/classes. To get around this I put all the outputted stuff in to 
+```dist``` and it gets copied to /WEB-INF/classes/dist/ )
 
 To run it manually in Angular CLI run `ng build` (and add on --prod --extract-css --watch as necessary to alter its behaviour)
 
diff --git a/web/gui2/src/main/java/org/onosproject/ui/impl/DummyClass.java b/web/gui2/src/main/java/org/onosproject/ui/impl/DummyClass.java
new file mode 100644
index 0000000..643e597
--- /dev/null
+++ b/web/gui2/src/main/java/org/onosproject/ui/impl/DummyClass.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.
+ */
+
+package org.onosproject.ui.impl;
+
+/**
+ * A dummy class to satisfy Bazel build.
+ * Since all classes implementing the REST interface to the GUI framework for GUI2
+ * are in the /web/gui project, no classes are needed here.
+ */
+public final class DummyClass {
+    private static final String DUMMY_ATTRIBUTE = "test";
+
+    private DummyClass() {
+        //Hidden
+    }
+
+    static String getDummyAttribute() {
+        return DUMMY_ATTRIBUTE;
+    }
+}
diff --git a/web/gui2/src/main/java/org/onosproject/ui/impl/gui2/LogoutResource.java b/web/gui2/src/main/java/org/onosproject/ui/impl/gui2/LogoutResource.java
deleted file mode 100644
index 19c606d..0000000
--- a/web/gui2/src/main/java/org/onosproject/ui/impl/gui2/LogoutResource.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2018-present Open Networking Foundation
- *
- * 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.
- */
-package org.onosproject.ui.impl.gui2;
-
-import org.onlab.rest.BaseResource;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * Application upload resource for GUI 2.
- */
-@Path("logout")
-public class LogoutResource extends BaseResource {
-
-    @Context
-    private HttpServletRequest servletRequest;
-
-    @GET
-    public Response logout() throws IOException, URISyntaxException {
-        servletRequest.getSession().invalidate();
-        String url = servletRequest.getRequestURL().toString();
-        url = url.replaceFirst("/onos/ui2/.*", "/onos/ui2/login.html");
-        return Response.temporaryRedirect(new URI(url)).build();
-    }
-
-}
diff --git a/web/gui2/src/main/java/org/onosproject/ui/impl/gui2/package-info.java b/web/gui2/src/main/java/org/onosproject/ui/impl/package-info.java
similarity index 87%
rename from web/gui2/src/main/java/org/onosproject/ui/impl/gui2/package-info.java
rename to web/gui2/src/main/java/org/onosproject/ui/impl/package-info.java
index df962e5..3fe40b2 100644
--- a/web/gui2/src/main/java/org/onosproject/ui/impl/gui2/package-info.java
+++ b/web/gui2/src/main/java/org/onosproject/ui/impl/package-info.java
@@ -15,6 +15,6 @@
  */
 
 /**
- * Set of resources providing data for the ONOS GUI2.
+ * Set of resources providing data for the ONOS GUI.
  */
-package org.onosproject.ui.impl.gui2;
\ No newline at end of file
+package org.onosproject.ui.impl;
\ No newline at end of file
diff --git a/web/gui2/src/main/webapp/WEB-INF/web.xml b/web/gui2/src/main/webapp/WEB-INF/web.xml
index 60c222b..ae8c650 100644
--- a/web/gui2/src/main/webapp/WEB-INF/web.xml
+++ b/web/gui2/src/main/webapp/WEB-INF/web.xml
@@ -135,25 +135,25 @@
         <!--<url-pattern>/raw/*</url-pattern>-->
     <!--</servlet-mapping>-->
 
-    <servlet>
-        <servlet-name>JAX-RS Service</servlet-name>
-        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
-        <init-param>
-            <param-name>jersey.config.server.provider.classnames</param-name>
-            <param-value>
-                org.glassfish.jersey.media.multipart.MultiPartFeature,
-                org.onosproject.ui.impl.gui2.LogoutResource,
+    <!--<servlet>-->
+        <!--<servlet-name>JAX-RS Service</servlet-name>-->
+        <!--<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>-->
+        <!--<init-param>-->
+            <!--<param-name>jersey.config.server.provider.classnames</param-name>-->
+            <!--<param-value>-->
+                <!--org.glassfish.jersey.media.multipart.MultiPartFeature,-->
+                <!--org.onosproject.ui.impl.LogoutResource,-->
                 <!--org.onosproject.ui.impl.TopologyResource,-->
-                org.onosproject.ui.impl.ApplicationResource
-            </param-value>
-        </init-param>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
+                <!--org.onosproject.ui.impl.ApplicationResource-->
+            <!--</param-value>-->
+        <!--</init-param>-->
+        <!--<load-on-startup>1</load-on-startup>-->
+    <!--</servlet>-->
 
-    <servlet-mapping>
-        <servlet-name>JAX-RS Service</servlet-name>
-        <url-pattern>/rs/*</url-pattern>
-    </servlet-mapping>
+    <!--<servlet-mapping>-->
+        <!--<servlet-name>JAX-RS Service</servlet-name>-->
+        <!--<url-pattern>/rs/*</url-pattern>-->
+    <!--</servlet-mapping>-->
 
     <!--<servlet>-->
         <!--<servlet-name>Web Socket Service</servlet-name>-->
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.html b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.html
index 230263d..9aa9584 100644
--- a/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.html
+++ b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.html
@@ -118,7 +118,7 @@
                     </td>
                     <td class="table-icon">
                         <!-- The path below gets the app icon from the old GUI path -->
-                        <img src="rs/applications/{{app.icon}}/icon"
+                        <img src="../../ui/rs/applications/{{app.icon}}/icon"
                                                 height="24px" width="24px" />
                     </td>
                     <td>{{ app.title }}</td>
diff --git a/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.ts b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.ts
index 3a8e2a8..b2f6231 100644
--- a/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.ts
+++ b/web/gui2/src/main/webapp/app/view/apps/apps/apps.component.ts
@@ -39,7 +39,7 @@
 const DRAGDROPMSGEXT = 'Only files ending in .oar can be dropped';
 
 /** Prefix to access the REST service for applications */
-export const APPURLPREFIX = 'rs/applications/';
+export const APPURLPREFIX = '../../ui/rs/applications/'; // TODO: This is a hack to work off GUIv1 URL
 /** Suffix to access the icon of the application - gives back an image */
 export const ICONURLSUFFIX = '/icon';
 
diff --git a/web/gui2/src/test/java/org/onosproject/ui/impl/DummyTest.java b/web/gui2/src/test/java/org/onosproject/ui/impl/DummyTest.java
index 6e7b732..a5ce1d9 100644
--- a/web/gui2/src/test/java/org/onosproject/ui/impl/DummyTest.java
+++ b/web/gui2/src/test/java/org/onosproject/ui/impl/DummyTest.java
@@ -17,15 +17,15 @@
 
 import org.junit.Test;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
 
 /**
- * This is just a dummy file to satisfy Bazel's need for a file to be present.
+ * This is just a dummy file to get BUCK going.
  */
 public class DummyTest {
 
     @Test
     public void dummyTest() {
-        assertTrue(true);
+        assertEquals("test", DummyClass.getDummyAttribute());
     }
 }