Remove all references to java_library in the source BUCK build.

Change-Id: Ie0e8753b62aeff9c4b5476b0108d05e92e3decdb
diff --git a/apps/test/BUCK b/apps/test/BUCK
deleted file mode 100644
index 8e97d9b..0000000
--- a/apps/test/BUCK
+++ /dev/null
@@ -1,137 +0,0 @@
-SRC = 'src/main/java/org/onosproject/**/'
-#FIXME there are some tests in main
-TEST = 'src/test/java/org/onosproject/**/'
-
-COMPILE_DEPS = [
-    '//lib:CORE_DEPS',
-    '//lib:org.apache.karaf.shell.console',
-    '//cli:onos-cli',
-    '//utils/rest:onlab-rest',
-    '//lib:javax.ws.rs-api',
-    '//core/store/serializers:onos-core-serializers',
-]
-
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-   name = 'onos-app-test',
-   visibility = ['PUBLIC'],
-   deps = [':onos-app-demo',
-           ':onos-app-distributed-primitives',
-           ':onos-app-election',
-           ':onos-app-intent-perf',
-           ':onos-app-loadtest',
-           ':onos-app-messaging-perf',
-   ],
-)
-
-# demo
-
-java_library(
-    name = 'onos-app-demo',
-    srcs = glob(['demo/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-)
-
-java_test(
-    name = 'onos-app-demo-tests',
-    srcs = glob(['demo/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-demo'],
-    source_under_test = [':onos-app-demo'],
-)
-
-# distributed-primitives
-
-java_library(
-    name = 'onos-app-distributed-primitives',
-    srcs = glob(['distributed-primitives/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-)
-
-java_test(
-    name = 'onos-app-distributed-primitives-tests',
-    srcs = glob(['distributed-primitives/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-distributed-primitives'],
-    source_under_test = [':onos-app-distributed-primitives'],
-)
-
-# election
-
-java_library(
-    name = 'onos-app-election',
-    srcs = glob(['election/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-)
-
-java_test(
-    name = 'onos-app-election-tests',
-    srcs = glob(['election/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-election'],
-    source_under_test = [':onos-app-election'],
-)
-
-# intent-perf
-
-java_library(
-    name = 'onos-app-intent-perf',
-    srcs = glob(['intent-perf/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-)
-
-java_test(
-    name = 'onos-app-intent-perf-tests',
-    srcs = glob(['intent-perf/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-intent-perf'],
-    source_under_test = [':onos-app-intent-perf'],
-)
-
-# loadtest
-
-java_library(
-    name = 'onos-app-loadtest',
-    srcs = glob(['loadtest/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-)
-
-java_test(
-    name = 'onos-app-loadtest-tests',
-    srcs = glob(['loadtest/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-loadtest'],
-    source_under_test = [':onos-app-loadtest'],
-)
-
-# messaging-perf
-
-java_library(
-    name = 'onos-app-messaging-perf',
-    srcs = glob(['messaging-perf/' + SRC + '*.java']),
-    deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-)
-
-java_test(
-    name = 'onos-app-messaging-perf-tests',
-    srcs = glob(['messaging-perf/' + TEST + '*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-messaging-perf'],
-    source_under_test = [':onos-app-messaging-perf'],
-)
-
diff --git a/apps/test/demo/BUCK b/apps/test/demo/BUCK
new file mode 100644
index 0000000..0993ed4
--- /dev/null
+++ b/apps/test/demo/BUCK
@@ -0,0 +1,19 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+)
+
+onos_app (
+    title = 'Flow Throughput Demo App',
+    category = 'Test',
+    url = 'http://onosproject.org',
+    description = 'Flow throughput test application.',
+)
diff --git a/apps/test/distributed-primitives/BUCK b/apps/test/distributed-primitives/BUCK
new file mode 100644
index 0000000..f50042f
--- /dev/null
+++ b/apps/test/distributed-primitives/BUCK
@@ -0,0 +1,19 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+)
+
+onos_app (
+    title = 'Distributed Primitives Test App',
+    category = 'Test',
+    url = 'http://onosproject.org',
+    description = 'ONOS app to test distributed primitives.',
+)
diff --git a/apps/test/election/BUCK b/apps/test/election/BUCK
new file mode 100644
index 0000000..9822348
--- /dev/null
+++ b/apps/test/election/BUCK
@@ -0,0 +1,19 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+)
+
+onos_app (
+    title = 'Master Election Test App',
+    category = 'Test',
+    url = 'http://onosproject.org',
+    description = 'Master election test application.',
+)
diff --git a/apps/test/flow-perf/BUCK b/apps/test/flow-perf/BUCK
new file mode 100644
index 0000000..f065aab
--- /dev/null
+++ b/apps/test/flow-perf/BUCK
@@ -0,0 +1,19 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+)
+
+onos_app (
+    title = 'Flow Performance Test App',
+    category = 'Test',
+    url = 'http://onosproject.org',
+    description = 'Messaging performance test application.',
+)
diff --git a/apps/test/intent-perf/BUCK b/apps/test/intent-perf/BUCK
new file mode 100644
index 0000000..a57a16a
--- /dev/null
+++ b/apps/test/intent-perf/BUCK
@@ -0,0 +1,19 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+)
+
+onos_app (
+    title = 'Intent Performance Test App',
+    category = 'Test',
+    url = 'http://onosproject.org',
+    description = 'Intent performance test application.',
+)
diff --git a/apps/test/loadtest/BUCK b/apps/test/loadtest/BUCK
new file mode 100644
index 0000000..933cbce
--- /dev/null
+++ b/apps/test/loadtest/BUCK
@@ -0,0 +1,19 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+)
+
+onos_app (
+    title = 'Distributed Load Test App',
+    category = 'Test',
+    url = 'http://onosproject.org',
+    description = 'Distributed consensus load test application.',
+)
diff --git a/apps/test/messaging-perf/BUCK b/apps/test/messaging-perf/BUCK
new file mode 100644
index 0000000..766a707
--- /dev/null
+++ b/apps/test/messaging-perf/BUCK
@@ -0,0 +1,19 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+)
+
+onos_app (
+    title = 'Messaging Performance Test App',
+    category = 'Test',
+    url = 'http://onosproject.org',
+    description = 'Messaging performance test application.',
+)