More app BUCK file refactoring

Change-Id: I97506033c4c0cf145c558df7d4f86f37c7fe8332
diff --git a/BUCK b/BUCK
index 33cfd41..bc37a53 100644
--- a/BUCK
+++ b/BUCK
@@ -1,6 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:javax.ws.rs-api',
@@ -11,38 +8,28 @@
     '//core/store/serializers:onos-core-serializers',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
+BUNDLES = [
+    ':onos-apps-olt-api',
+    ':onos-apps-olt',
 ]
 
-java_library(
-    name = 'onos-app-olt-api',
+osgi_jar_with_tests (
+    name = 'onos-apps-olt-api',
     srcs = glob(['api/' + SRC + '*.java']),
     deps = COMPILE_DEPS,
     visibility = ['PUBLIC'],
 )
 
-java_test(
-    name = 'onos-app-olt-api-tests',
-    srcs = glob([TEST + 'api/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-olt-api'],
-    source_under_test = [':onos-app-olt-api'],
-)
-
-java_library(
-    name = 'onos-app-olt-app',
+osgi_jar_with_tests (
     srcs = glob(['app/' + SRC + '*.java']),
-    deps = COMPILE_DEPS + [':onos-app-olt-api'],
+    deps = COMPILE_DEPS + [':onos-apps-olt-api'],
     visibility = ['PUBLIC'],
 )
 
-java_test(
-    name = 'onos-app-olt-app-tests',
-    srcs = glob([TEST + 'app/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-olt-api', ':onos-app-olt-app'],
-    source_under_test = [':onos-app-olt-app'],
+onos_app (
+    title = 'ONOS OLT REST API',
+    category = 'Security',
+    url = 'http://onosproject.org',
+    description = 'OLT application for CORD.',
+    included_bundles = BUNDLES,
 )