Bugfix for unregister of bundles and renamed Java Bundle API getters
authorMarkus Jung <markus.jung@samsung.com>
Thu, 9 Jul 2015 10:55:22 +0000 (19:55 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 13 Jul 2015 01:16:23 +0000 (01:16 +0000)
Added java bundle test. Allowing container test sample app and unit tests to be build in parallel.
Configureable library path for Java bundles. Set bundle-api version number to 0.1

Change-Id: I8660787613b38d7acc4296c9c6c701397e18dee2
Signed-off-by: Markus Jung <markus.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1597
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
17 files changed:
service/resource-manipulation/modules/resourceContainer/SConscript
service/resource-manipulation/modules/resourceContainer/bundle-java-api/pom.xml
service/resource-manipulation/modules/resourceContainer/bundle-java-api/src/main/java/org/iotivity/resourcecontainer/bundle/api/BaseActivator.java
service/resource-manipulation/modules/resourceContainer/examples/HueJavaSampleBundle/hue/pom.xml
service/resource-manipulation/modules/resourceContainer/examples/HueJavaSampleBundle/hue/src/main/java/org/iotivity/bundle/hue/HueBundleActivator.java
service/resource-manipulation/modules/resourceContainer/examples/ResourceContainerConfig.xml
service/resource-manipulation/modules/resourceContainer/include/BundleInfo.h
service/resource-manipulation/modules/resourceContainer/include/internal/BundleInfoInternal.h
service/resource-manipulation/modules/resourceContainer/include/internal/ResourceContainerImpl.h
service/resource-manipulation/modules/resourceContainer/src/BaseActivator.cpp
service/resource-manipulation/modules/resourceContainer/src/BundleInfoInternal.cpp
service/resource-manipulation/modules/resourceContainer/src/ContainerSample.cpp [moved from service/resource-manipulation/modules/resourceContainer/src/ContainerTest.cpp with 100% similarity]
service/resource-manipulation/modules/resourceContainer/src/ResourceContainerImpl.cpp
service/resource-manipulation/modules/resourceContainer/unittests/ResourceContainerTest.cpp
service/resource-manipulation/modules/resourceContainer/unittests/ResourceContainerTestConfig.xml
service/resource-manipulation/modules/resourceContainer/unittests/SConscript
service/resource-manipulation/modules/resourceContainer/unittests/TestBundleJava/hue-0.1-jar-with-dependencies.jar [new file with mode: 0644]

index 45ae6c7..7012d59 100644 (file)
 ##
 import os
 Import('env')
+import os.path
+
+def filtered_glob(env, pattern, omit=[],
+  ondisk=True, source=False, strings=False):
+    return filter(
+      lambda f: os.path.basename(f.path) not in omit,
+      env.Glob(pattern))
+
+env.AddMethod(filtered_glob, "FilteredGlob");
 
 # Add third party libraries
 lib_env = env.Clone()
@@ -95,7 +104,10 @@ resource_container_env.AppendUnique(LIBS = ['dl', 'jvm'])
 ######################################################################
 # Source files and Targets
 ######################################################################
-res_container_src = env.Glob('src/*.cpp')
+res_container_src = ['src/BaseActivator.cpp','src/BundleActivator.cpp','src/BundleInfo.cpp', 
+       'src/BundleInfoInternal.cpp', 'src/BundleResource.cpp', 'src/Configuration.cpp', 'src/JavaBundleResource.cpp', 'src/ProtocolBridgeResource.cpp',
+       'src/ProtocolBridgeConnector.cpp', 'src/ResourceContainer.cpp', 'src/ResourceContainerBundleAPI.cpp', 'src/ResourceContainerImpl.cpp', 
+       'src/SoftSensorResource.cpp']
 res_container_static = resource_container_env.StaticLibrary('ResContainerLib', res_container_src)
 res_container_shared = resource_container_env.SharedLibrary('ResContainerLib', res_container_src)
 
@@ -169,6 +181,8 @@ containertest_env.AppendUnique(LINKFLAGS=["-rdynamic"])
 Command("examples/ResourceContainerConfig.xml","examples/ResourceContainerConfig.xml", Copy("$TARGET", "$SOURCE"))
 Ignore("examples/ResourceContainerConfig.xml", "examples/ResourceContainerConfig.xml")
 
-containertestapp = containertest_env.Program('ContainerTest', res_container_src)
-Alias("containertest", containertestapp)
-env.AppendTarget('containertest')
+
+containersampleapp_src =  [res_container_src , 'src/ContainerSample.cpp']
+containersampleapp = containertest_env.Program('ContainerSample',containersampleapp_src)
+Alias("containersample", containersampleapp)
+env.AppendTarget('containersample')
index 4150b61..a1dfceb 100644 (file)
@@ -4,7 +4,7 @@
   <groupId>org.iotivity.resourcecontainer</groupId>
   <artifactId>bundle-api</artifactId>
   <packaging>jar</packaging>
-  <version>1.0</version>
+  <version>0.1</version>
   <name>resource-container-api</name>
   <url>http://maven.apache.org</url>
   <dependencies>
index 361a963..11e3310 100644 (file)
@@ -99,6 +99,7 @@ public class BaseActivator implements BundleActivator {
      * Unregisters a resource from the resource container.
      */
     public void unregisterResource(BundleResource resource) {
+        bundleResources.remove(resource);
         unregisterJavaResource(resource, resource.getURI());
     }
 
index d3e9902..2bc318c 100644 (file)
@@ -4,7 +4,7 @@
   <groupId>org.iotivity.bundles</groupId>
   <artifactId>hue</artifactId>
   <packaging>jar</packaging>
-  <version>1.0-SNAPSHOT</version>
+  <version>0.1</version>
   <name>hue</name>
   <url>http://maven.apache.org</url>
   <dependencies>
@@ -23,7 +23,7 @@
     <dependency>
                <groupId>org.iotivity.resourcecontainer</groupId>
                <artifactId>bundle-api</artifactId>
-               <version>1.0</version>
+               <version>0.1</version>
                <scope>compile</scope>
     </dependency>
     <dependency>
index c288145..43d67a6 100644 (file)
@@ -20,8 +20,8 @@ public class HueBundleActivator extends BaseActivator {
         for (ResourceConfig config : resourceConfig) {
 
             HueLightResource hueLightResource = new HueLightResource(connector,
-                    config.getM_name(), config.getM_uri(),
-                    config.getM_resourceType(), config.getM_address());
+                    config.getName(), config.getURI(),
+                    config.getResourceType(), config.getAddress());
             registerResource(hueLightResource);
         }
     }
index a302471..03fd4f9 100644 (file)
@@ -9,7 +9,7 @@
                 <name>DiscomfortIndexSensor1</name>
                                <resourceType>oic.softsensor</resourceType>
                 <attributes>
-                  <attribute>
+                  <attribute>  
                     <name>version</name>       
                     <type>string</type>
                     <value>1.0</value>
@@ -59,7 +59,8 @@
     </bundle>
     <bundle>
         <id>oic.bundle.hueJavaSample</id>
-        <path>../../../../../../../../service/resource-manipulation/modules/resourceContainer/examples/HueJavaSampleBundle/hue/target/hue-1.0-SNAPSHOT-jar-with-dependencies.jar </path>
+        <path>../../../../../../../../service/resource-manipulation/modules/resourceContainer/examples/HueJavaSampleBundle/hue/target/hue-0.1-SNAPSHOT-jar-with-dependencies.jar </path>
+        <libraryPath>.</libraryPath>
         <uri>/hueJava</uri>
         <activator>org.iotivity.bundle.hue.HueBundleActivator</activator>
         <version>1.0.0</version>
index 19a0703..fba9a08 100644 (file)
@@ -41,6 +41,10 @@ namespace OIC
             virtual string getID() = 0;
             virtual void setPath(string path) = 0;
             virtual string getPath() = 0;
+            virtual void setActivatorName(string activator) = 0;
+            virtual string getActivatorName() = 0;
+            virtual void setLibraryPath(string libpath) = 0;
+            virtual string getLibraryPath() = 0;
             virtual void setVersion(string version) = 0;
             virtual string getVersion() = 0;
             static BundleInfo* build();
index a333fbf..8467da3 100644 (file)
@@ -53,6 +53,9 @@ namespace OIC{
                 void setActivated(bool activated);
                 bool isActivated();
 
+                virtual void setLibraryPath(string libpath);
+                virtual string getLibraryPath();
+
                 void setActivatorName(string activatorName);
                 string getActivatorName();
 
@@ -87,6 +90,7 @@ namespace OIC{
                 string m_activator_name;
                 jmethodID m_java_activator, m_java_deactivator;
                 jobject m_java_activator_object;
+                string m_library_path;
         };
     }
 }
index b89dca3..d19b1c0 100644 (file)
@@ -54,7 +54,8 @@ namespace OIC
                 void deactivateBundle(string bundleId);
                 void registerBundle(BundleInfo *bundleinfo);
                 void unregisterBundle(BundleInfo *bundleinfo);
-                void unregisterBundle(string id);
+                void unregisterBundleSo(string id);
+                void unregisterBundleJava(string id);
 
                 // methods from ResourceContainerBundleAPI
                 void registerResource(BundleResource *resource);
index fa24c69..c3a2500 100644 (file)
@@ -47,9 +47,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_resourcecontainer_bundle_api_BaseActiva
     javaBundleResource->m_resourceType = string(str_resourceType, strlen(str_resourceType));
     javaBundleResource->m_name = string(str_res_name, strlen(str_res_name));
     container->registerResource(javaBundleResource);
-    cout << "JavaBundles: " << &java_resources << endl;
-    cout << "Bundle resource: " << &java_resources[str_uri] << endl;
-    cout << "Uri: " << str_uri << endl;
+
     java_resources[str_uri] = javaBundleResource;
 }
 
@@ -61,10 +59,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_resourcecontainer_bundle_api_BaseActiva
 JNIEXPORT void JNICALL Java_org_iotivity_resourcecontainer_bundle_api_BaseActivator_unregisterJavaResource
   (JNIEnv *env, jobject obj, jobject bundleResource, jstring uri){
     const char *str_uri = env->GetStringUTFChars(uri, 0);
-    cout << "unregister java resource " << endl;
-    cout << "JavaBundles: " << &java_resources << endl;
-    cout << "Bundle resource: " << &java_resources[str_uri] << endl;
-    cout << "Uri: " << str_uri << endl;
+
     if(java_resources[str_uri] != NULL){
         ResourceContainerImpl *container = ResourceContainerImpl::getImplInstance();
         container->unregisterResource(java_resources[str_uri]);
index f79bd27..8785ee0 100644 (file)
@@ -141,6 +141,14 @@ namespace OIC
             return m_activator_name;
         }
 
+        void BundleInfoInternal::setLibraryPath(string libpath){
+            m_library_path = libpath;
+        }
+
+        string BundleInfoInternal::getLibraryPath(){
+            return m_library_path;
+        }
+
         void BundleInfoInternal::setJavaBundleActivatorMethod(jmethodID javaBundleActivator)
         {
             m_java_activator = javaBundleActivator;
index ff86b83..2e24d72 100644 (file)
@@ -24,6 +24,9 @@
 #include <iostream>
 #include <fstream>
 #include <jni.h>
+#include <iostream>
+#include <fstream>
+#include <stdio.h>
 
 #include "ResourceContainerImpl.h"
 #include "BundleActivator.h"
@@ -75,7 +78,7 @@ namespace OIC
         bool has_suffix(const std::string &str, const std::string &suffix)
         {
             return str.size() >= suffix.size()
-                   && str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
+                    && str.compare(str.size() - suffix.size(), suffix.size(), suffix) == 0;
         }
 
         void ResourceContainerImpl::startContainer(string configFile)
@@ -100,6 +103,7 @@ namespace OIC
                         string activatorName = bundles[i]["activator"];
                         std::replace(activatorName.begin(), activatorName.end(), '.', '/');
                         ((BundleInfoInternal *) bundleInfo)->setActivatorName(activatorName);
+                        ((BundleInfoInternal *) bundleInfo)->setLibraryPath(bundles[i]["libraryPath"]);
 
                     }
                     info_logger() << "Init Bundle:" << bundles[i]["id"] << ";" << bundles[i]["path"]
@@ -117,8 +121,8 @@ namespace OIC
         void ResourceContainerImpl::stopContainer()
         {
             info_logger() << "Stopping resource container.";
-            for (std::map<std::string, BundleInfoInternal *>::iterator it = m_bundles.begin();
-                 it != m_bundles.end(); ++it)
+            for (std::map< std::string, BundleInfoInternal * >::iterator it = m_bundles.begin();
+                    it != m_bundles.end(); ++it)
             {
                 BundleInfoInternal *bundleInfo = it->second;
                 deactivateBundle(bundleInfo);
@@ -128,7 +132,7 @@ namespace OIC
 
         void ResourceContainerImpl::activateBundle(BundleInfo *bundleInfo)
         {
-            BundleInfoInternal  *bundleInfoInternal = (BundleInfoInternal *)bundleInfo;
+            BundleInfoInternal *bundleInfoInternal = (BundleInfoInternal *) bundleInfo;
 
             if (bundleInfoInternal->isLoaded())
             {
@@ -138,7 +142,7 @@ namespace OIC
 
         void ResourceContainerImpl::deactivateBundle(BundleInfo *bundleInfo)
         {
-            if (((BundleInfoInternal *)bundleInfo)->isActivated())
+            if (((BundleInfoInternal *) bundleInfo)->isActivated())
             {
                 deactivateBundle(bundleInfo->getID());
             }
@@ -180,34 +184,41 @@ namespace OIC
         {
             info_logger() << "Registering bundle: " << bundleInfo->getPath() << endl;
 
-            m_bundles[bundleInfo->getID()] = ((BundleInfoInternal *)bundleInfo);
+            m_bundles[bundleInfo->getID()] = ((BundleInfoInternal *) bundleInfo);
 
             if (has_suffix(bundleInfo->getPath(), ".jar"))
             {
-                ((BundleInfoInternal *)bundleInfo)->setJavaBundle(true);
+                ((BundleInfoInternal *) bundleInfo)->setJavaBundle(true);
                 registerJavaBundle(bundleInfo);
             }
             else
             {
-                ((BundleInfoInternal *)bundleInfo)->setJavaBundle(false);
+                ((BundleInfoInternal *) bundleInfo)->setJavaBundle(false);
                 registerSoBundle(bundleInfo);
             }
         }
 
         void ResourceContainerImpl::unregisterBundle(BundleInfo *bundleInfo)
         {
-            if (((BundleInfoInternal *)bundleInfo)->isLoaded()
-                && !((BundleInfoInternal *)bundleInfo)->isActivated())
+            BundleInfoInternal* bundleInfoInternal = (BundleInfoInternal*) bundleInfo;
+            if (bundleInfoInternal->isLoaded() && !bundleInfoInternal->isActivated())
             {
-                unregisterBundle(bundleInfo->getID());
+                if (!bundleInfoInternal->getJavaBundle())
+                {
+                    unregisterBundleSo(bundleInfo->getID());
+                }
+                else
+                {
+                    unregisterBundleJava(bundleInfo->getID());
+                }
             }
         }
 
-        void ResourceContainerImpl::unregisterBundle(string id)
+        void ResourceContainerImpl::unregisterBundleSo(string id)
         {
             void *bundleHandle = m_bundles[id]->getBundleHandle();
             info_logger() << "Unregister bundle: " << m_bundles[id]->getID() << ", "
-                          << m_bundles[id]->getID() << endl;
+                    << m_bundles[id]->getID() << endl;
             char *error;
             dlclose(bundleHandle);
             if ((error = dlerror()) != NULL)
@@ -220,6 +231,15 @@ namespace OIC
             }
         }
 
+        void ResourceContainerImpl::unregisterBundleJava(string id)
+        {
+            info_logger() << "Unregister Java bundle: " << m_bundles[id]->getID() << ", "
+                    << m_bundles[id]->getID() << endl;
+
+            info_logger() << "Destroying JVM" << endl;
+            m_bundleVM[id]->DestroyJavaVM();
+        }
+
         void ResourceContainerImpl::registerResource(BundleResource *resource)
         {
 
@@ -228,7 +248,7 @@ namespace OIC
             ResourceObject::Ptr server = nullptr;
 
             info_logger() << "Registration of resource " << strUri << "," << strResourceType
-                          << endl;
+                    << endl;
 
             server = buildResourceObject(strUri, strResourceType);
 
@@ -241,14 +261,15 @@ namespace OIC
                 resource->registerObserver(this);
 
                 server->setGetRequestHandler(
-                    std::bind(&ResourceContainerImpl::getRequestHandler, this,
-                              std::placeholders::_1, std::placeholders::_2));
+                        std::bind(&ResourceContainerImpl::getRequestHandler, this,
+                                std::placeholders::_1, std::placeholders::_2));
 
                 server->setSetRequestHandler(
-                    std::bind(&ResourceContainerImpl::setRequestHandler, this,
-                              std::placeholders::_1, std::placeholders::_2));
+                        std::bind(&ResourceContainerImpl::setRequestHandler, this,
+                                std::placeholders::_1, std::placeholders::_2));
 
-                info_logger() << "Registration finished " << strUri << "," << strResourceType << endl;
+                info_logger() << "Registration finished " << strUri << "," << strResourceType
+                        << endl;
             }
         }
 
@@ -256,11 +277,11 @@ namespace OIC
         {
             string strUri = resource->m_uri;
             string strResourceType = resource->m_resourceType;
-            cout << "Resource container unregisterResource called. " << strUri << endl;
 
             if (m_mapServers.find(strUri) != m_mapServers.end())
             {
                 m_mapServers[strUri].reset();
+
                 m_mapResources.erase(m_mapResources.find(strUri));
                 m_mapBundleResources[resource->m_bundleId].remove(strUri);
             }
@@ -269,7 +290,7 @@ namespace OIC
         void ResourceContainerImpl::getBundleConfiguration(std::string bundleId,
                 configInfo *configOutput)
         {
-            m_config->getBundleConfiguration(bundleId, (configInfo *)configOutput);
+            m_config->getBundleConfiguration(bundleId, (configInfo *) configOutput);
         }
 
         void ResourceContainerImpl::getResourceConfiguration(std::string bundleId,
@@ -279,17 +300,17 @@ namespace OIC
         }
 
         PrimitiveGetResponse ResourceContainerImpl::getRequestHandler(
-            const PrimitiveRequest &request, const ResourceAttributes &attributes)
+                const PrimitiveRequest &request, const ResourceAttributes &attributes)
         {
             ResourceAttributes attr;
 
             if (m_mapServers.find(request.getResourceUri()) != m_mapServers.end()
-                && m_mapResources.find(request.getResourceUri()) != m_mapResources.end())
+                    && m_mapResources.find(request.getResourceUri()) != m_mapResources.end())
             {
                 for (string attrName : m_mapResources[request.getResourceUri()]->getAttributeNames())
                 {
                     attr[attrName] = m_mapResources[request.getResourceUri()]->getAttribute(
-                                         attrName);
+                            attrName);
                 }
             }
 
@@ -297,12 +318,12 @@ namespace OIC
         }
 
         PrimitiveSetResponse ResourceContainerImpl::setRequestHandler(
-            const PrimitiveRequest &request, const ResourceAttributes &attributes)
+                const PrimitiveRequest &request, const ResourceAttributes &attributes)
         {
             ResourceAttributes attr = attributes;
 
             if (m_mapServers.find(request.getResourceUri()) != m_mapServers.end()
-                && m_mapResources.find(request.getResourceUri()) != m_mapResources.end())
+                    && m_mapResources.find(request.getResourceUri()) != m_mapResources.end())
             {
                 for (string attrName : m_mapResources[request.getResourceUri()]->getAttributeNames())
                 {
@@ -320,7 +341,7 @@ namespace OIC
         void ResourceContainerImpl::onNotificationReceived(std::string strResourceUri)
         {
             info_logger() << "ResourceContainerImpl::onNotificationReceived\n\tnotification from "
-                          << strResourceUri << ".\n";
+                    << strResourceUri << ".\n";
 
             if (m_mapServers.find(strResourceUri) != m_mapServers.end())
             {
@@ -337,8 +358,8 @@ namespace OIC
         ResourceObject::Ptr ResourceContainerImpl::buildResourceObject(string strUri,
                 string strResourceType)
         {
-            return ResourceObject::Builder(strUri, strResourceType,
-                                           "DEFAULT_INTERFACE").setObservable(true).setDiscoverable(true).build();
+            return ResourceObject::Builder(strUri, strResourceType, "DEFAULT_INTERFACE").setObservable(
+                    true).setDiscoverable(true).build();
         }
 
         void ResourceContainerImpl::startBundle(string bundleId)
@@ -352,7 +373,7 @@ namespace OIC
         }
 
         void ResourceContainerImpl::addBundle(string bundleId, string bundleUri, string bundlePath,
-                                              std::map< string, string > params)
+                std::map< string, string > params)
         {
             // To be implemented
         }
@@ -365,12 +386,12 @@ namespace OIC
         std::list< BundleInfo * > ResourceContainerImpl::listBundles()
         {
             std::list< BundleInfo * > ret;
-            for (std::map<std::string, BundleInfoInternal *>::iterator it = m_bundles.begin();
-                 it != m_bundles.end(); ++it)
+            for (std::map< std::string, BundleInfoInternal * >::iterator it = m_bundles.begin();
+                    it != m_bundles.end(); ++it)
             {
                 {
                     BundleInfo *bundleInfo = BundleInfo::build();
-                    ((BundleInfoInternal *)bundleInfo)->setBundleInfo((BundleInfo *)it->second);
+                    ((BundleInfoInternal *) bundleInfo)->setBundleInfo((BundleInfo *) it->second);
                     ret.push_back(it->second);
                 }
             }
@@ -392,12 +413,13 @@ namespace OIC
         {
             std::list< string > ret;
 
-            if (m_mapBundleResources.find(bundleId) != m_mapBundleResources.end())
+              if (m_mapBundleResources.find(bundleId) != m_mapBundleResources.end())
             {
                 ret = m_mapBundleResources[bundleId];
             }
-
+            
             return ret;
+
         }
 
         JavaVM *ResourceContainerImpl::getJavaVM(string bundleId)
@@ -408,61 +430,90 @@ namespace OIC
         void ResourceContainerImpl::registerJavaBundle(BundleInfo *bundleInfo)
         {
             info_logger() << "Registering Java bundle " << bundleInfo->getID() << endl;
-            JavaVM *jvm;
-            JNIEnv *env;
+            JavaVM * jvm;
+            JNIEnv * env;
             JavaVMInitArgs vm_args;
             JavaVMOption options[3];
 
             BundleInfoInternal *bundleInfoInternal = (BundleInfoInternal *) bundleInfo;
 
+            if(FILE *file = fopen(bundleInfo->getPath().c_str(), "r")){
+                fclose(file);
+                info_logger() << "Resource bundle " << bundleInfo->getPath() << " available." << endl;
+                //return true;
+            }
+            else{
+                error_logger() << "Resource bundle " << bundleInfo->getPath() << " not available" << endl;
+                return;
+            }
+
             options[0].optionString = "-Djava.compiler=NONE";
             char classpath[1000];
             strcpy(classpath, "-Djava.class.path=");
             strcat(classpath, bundleInfo->getPath().c_str());
 
+
+            info_logger() << "Configured classpath: " << classpath << "|" << endl;
+
             options[1].optionString = classpath;
 
-            options[2].optionString = "-Djava.library.path=.";
+            char libraryPath[1000];
+            strcpy(libraryPath, "-Djava.library.path=");
+            strcat(libraryPath, bundleInfo->getLibraryPath().c_str());
+            options[2].optionString = libraryPath;
+
+            info_logger() << "Configured library path: " << libraryPath << "|" << endl;
 
             vm_args.version = JNI_VERSION_1_4;
             vm_args.options = options;
             vm_args.nOptions = 3;
             vm_args.ignoreUnrecognized = 1;
 
-            JNI_CreateJavaVM(&jvm, (void **) &env, &vm_args);
+            int res;
+            res = JNI_CreateJavaVM(&jvm, (void **) &env, &vm_args);
+
+            if(res < 0){
+                error_logger() << " cannot create JavaVM." << endl;
+                return;
+            }
+            else{
+                info_logger() << "JVM successfully created " << endl;
+            }
 
             m_bundleVM.insert(std::pair< string, JavaVM * >(bundleInfo->getID(), jvm));
 
             const char *className = bundleInfoInternal->getActivatorName().c_str();
 
+            info_logger() << "Looking up class: " << bundleInfoInternal->getActivatorName() << "|" << endl;
+
             jclass bundleActivatorClass = env->FindClass(className);
 
             if (bundleActivatorClass == NULL)
             {
                 error_logger() << "Cannot register bundle " << bundleInfoInternal->getID()
-                               << " bundle activator(" << bundleInfoInternal->getActivatorName()
-                               << ") not found " << endl;
+                        << " bundle activator(" << bundleInfoInternal->getActivatorName()
+                        << ") not found " << endl;
                 return;
             }
 
             jmethodID activateMethod = env->GetMethodID(bundleActivatorClass, "activateBundle",
-                                       "()V");
+                    "()V");
 
             if (activateMethod == NULL)
             {
                 error_logger() << "Cannot register bundle " << bundleInfoInternal->getID()
-                               << " activate bundle method not found " << endl;
+                        << " activate bundle method not found " << endl;
                 return;
             }
             bundleInfoInternal->setJavaBundleActivatorMethod(activateMethod);
 
             jmethodID deactivateMethod = env->GetMethodID(bundleActivatorClass, "deactivateBundle",
-                                         "()V");
+                    "()V");
 
             if (deactivateMethod == NULL)
             {
                 error_logger() << "Cannot register bundle " << bundleInfoInternal->getID()
-                               << " deactivate bundle method not found " << endl;
+                        << " deactivate bundle method not found " << endl;
                 return;
             }
 
@@ -498,7 +549,7 @@ namespace OIC
             {
                 bundleActivator = (activator_t *) dlsym(bundleHandle, "externalActivateBundle");
                 bundleDeactivator = (deactivator_t *) dlsym(bundleHandle,
-                                    "externalDeactivateBundle");
+                        "externalDeactivateBundle");
                 if ((error = dlerror()) != NULL)
                 {
                     error_logger() << error << endl;
@@ -525,7 +576,7 @@ namespace OIC
             info_logger() << "Activating java bundle" << endl;
             JavaVM *vm = getJavaVM(bundleId);
             BundleInfoInternal *bundleInfoInternal = (BundleInfoInternal *) m_bundles[bundleId];
-            JNIEnv *env;
+            JNIEnv * env;
             int envStat = vm->GetEnv((void **) &env, JNI_VERSION_1_4);
 
             if (envStat == JNI_EDETACHED)
@@ -541,7 +592,7 @@ namespace OIC
             }
 
             env->CallVoidMethod(bundleInfoInternal->getJavaBundleActivatorObject(),
-                                bundleInfoInternal->getJavaBundleActivatorMethod());
+                    bundleInfoInternal->getJavaBundleActivatorMethod());
 
             m_bundles[bundleId]->setActivated(true);
         }
@@ -570,7 +621,7 @@ namespace OIC
             info_logger() << "Deactivating java bundle" << endl;
             JavaVM *vm = getJavaVM(bundleId);
             BundleInfoInternal *bundleInfoInternal = (BundleInfoInternal *) m_bundles[bundleId];
-            JNIEnv *env;
+            JNIEnv * env;
             int envStat = vm->GetEnv((void **) &env, JNI_VERSION_1_4);
 
             if (envStat == JNI_EDETACHED)
@@ -586,7 +637,7 @@ namespace OIC
             }
 
             env->CallVoidMethod(bundleInfoInternal->getJavaBundleActivatorObject(),
-                                bundleInfoInternal->getJavaBundleDeactivatorMethod());
+                    bundleInfoInternal->getJavaBundleDeactivatorMethod());
 
             m_bundles[bundleId]->setActivated(false);
         }
index 8758e5b..5be4673 100644 (file)
@@ -39,33 +39,36 @@ using namespace OIC::Service;
 
 string CONFIG_FILE = "ResourceContainerTestConfig.xml";
 
-
 /*Fake bundle resource class for testing*/
-class TestBundleResource : public BundleResource
-{
-    public:
-        string getAttribute(string attributeName)
-        {
-            return "test";
-        };
-        void setAttribute(string attributeName, string value)
-        {};
-        void initAttributes()
-        {
-            BundleResource::setAttribute("attri", "test");
-        };
+class TestBundleResource: public BundleResource
+{
+public:
+    string getAttribute(string attributeName)
+    {
+        return "test";
+    }
+    ;
+    void setAttribute(string attributeName, string value)
+    {
+    }
+    ;
+    void initAttributes()
+    {
+        BundleResource::setAttribute("attri", "test");
+    }
+    ;
 };
 
-class ResourceContainerTest : public Test
+class ResourceContainerTest: public Test
 {
-    public:
-        ResourceContainer *m_pResourceContainer;
-
-    protected:
-        void SetUp() override
-        {
-            m_pResourceContainer = ResourceContainer::getInstance();
-        }
+public:
+    ResourceContainer *m_pResourceContainer;
+
+protected:
+    void SetUp() override
+    {
+        m_pResourceContainer = ResourceContainer::getInstance();
+    }
 };
 
 TEST_F(ResourceContainerTest, BundleRegisteredWhenContainerStartedWithValidConfigFile)
@@ -73,8 +76,10 @@ TEST_F(ResourceContainerTest, BundleRegisteredWhenContainerStartedWithValidConfi
     m_pResourceContainer->startContainer(CONFIG_FILE);
 
     EXPECT_GT(m_pResourceContainer->listBundles().size(), 0);
-    EXPECT_STREQ("oic.bundle.test", (*m_pResourceContainer->listBundles().begin())->getID().c_str());
-    EXPECT_STREQ("libTestBundle.so", (*m_pResourceContainer->listBundles().begin())->getPath().c_str());
+    EXPECT_STREQ("oic.bundle.test",
+            (*m_pResourceContainer->listBundles().begin())->getID().c_str());
+    EXPECT_STREQ("libTestBundle.so",
+            (*m_pResourceContainer->listBundles().begin())->getPath().c_str());
     EXPECT_STREQ("1.0.0", (*m_pResourceContainer->listBundles().begin())->getVersion().c_str());
 
     m_pResourceContainer->stopContainer();
@@ -86,8 +91,8 @@ TEST_F(ResourceContainerTest, BundleLoadedWhenContainerStartedWithValidConfigFil
 
     EXPECT_GT(m_pResourceContainer->listBundles().size(), 0);
     EXPECT_TRUE(((BundleInfoInternal *)(*m_pResourceContainer->listBundles().begin()))->isLoaded());
-    EXPECT_NE(nullptr, ((BundleInfoInternal *)(
-                            *m_pResourceContainer->listBundles().begin()))->getBundleHandle());
+    EXPECT_NE(nullptr,
+            ((BundleInfoInternal *)( *m_pResourceContainer->listBundles().begin()))->getBundleHandle());
 
     m_pResourceContainer->stopContainer();
 }
@@ -97,9 +102,10 @@ TEST_F(ResourceContainerTest, BundleActivatedWhenContainerStartedWithValidConfig
     m_pResourceContainer->startContainer(CONFIG_FILE);
 
     EXPECT_GT(m_pResourceContainer->listBundles().size(), 0);
-    EXPECT_TRUE(((BundleInfoInternal *)(*m_pResourceContainer->listBundles().begin()))->isActivated());
-    EXPECT_NE(nullptr, ((BundleInfoInternal *)(
-                            *m_pResourceContainer->listBundles().begin()))->getBundleActivator());
+    EXPECT_TRUE(
+            ((BundleInfoInternal *)(*m_pResourceContainer->listBundles().begin()))->isActivated());
+    EXPECT_NE(nullptr,
+            ((BundleInfoInternal *)( *m_pResourceContainer->listBundles().begin()))->getBundleActivator());
 
     m_pResourceContainer->stopContainer();
 }
@@ -124,7 +130,8 @@ TEST_F(ResourceContainerTest, BundleStoppedWithStartBundleAPI)
     m_pResourceContainer->startContainer(CONFIG_FILE);
     m_pResourceContainer->stopBundle("oic.bundle.test");
 
-    EXPECT_FALSE(((BundleInfoInternal *)(*m_pResourceContainer->listBundles().begin()))->isActivated());
+    EXPECT_FALSE(
+            ((BundleInfoInternal *)(*m_pResourceContainer->listBundles().begin()))->isActivated());
 }
 
 TEST_F(ResourceContainerTest, BundleStartedWithStartBundleAPI)
@@ -133,29 +140,29 @@ TEST_F(ResourceContainerTest, BundleStartedWithStartBundleAPI)
     m_pResourceContainer->stopBundle("oic.bundle.test");
     m_pResourceContainer->startBundle("oic.bundle.test");
 
-    EXPECT_TRUE(((BundleInfoInternal *)(*m_pResourceContainer->listBundles().begin()))->isActivated());
+    EXPECT_TRUE(
+            ((BundleInfoInternal *)(*m_pResourceContainer->listBundles().begin()))->isActivated());
 }
 
-
-class ResourceContainerBundleAPITest : public Test
+class ResourceContainerBundleAPITest: public Test
 {
-    public:
-        MockRepository mocks;
-        ResourceObject *m_pResourceObject;
-        ResourceContainerBundleAPI *m_pResourceContainer;
-        TestBundleResource *m_pBundleResource;
-
-    protected:
-        void SetUp() override
-        {
-            m_pResourceObject = mocks.Mock<ResourceObject>();
-            m_pResourceContainer = ResourceContainerBundleAPI::getInstance();
-
-            m_pBundleResource = new TestBundleResource();
-            m_pBundleResource->m_bundleId = "oic.bundle.test";
-            m_pBundleResource->m_uri = "/test_resource";
-            m_pBundleResource->m_resourceType = "oic.test";
-        }
+public:
+    MockRepository mocks;
+    ResourceObject *m_pResourceObject;
+    ResourceContainerBundleAPI *m_pResourceContainer;
+    TestBundleResource *m_pBundleResource;
+
+protected:
+    void SetUp() override
+    {
+        m_pResourceObject = mocks.Mock<ResourceObject>();
+        m_pResourceContainer = ResourceContainerBundleAPI::getInstance();
+
+        m_pBundleResource = new TestBundleResource();
+        m_pBundleResource->m_bundleId = "oic.bundle.test";
+        m_pBundleResource->m_uri = "/test_resource";
+        m_pBundleResource->m_resourceType = "oic.test";
+    }
 };
 
 TEST_F(ResourceContainerBundleAPITest, ResourceServerCreatedWhenRegisterResourceCalled)
@@ -168,8 +175,9 @@ TEST_F(ResourceContainerBundleAPITest, ResourceServerCreatedWhenRegisterResource
 
 TEST_F(ResourceContainerBundleAPITest, RequestHandlerForResourceServerSetWhenRegisterResourceCalled)
 {
-    mocks.OnCallFunc(ResourceContainerImpl::buildResourceObject).Return(ResourceObject::Ptr(
-    m_pResourceObject, [](ResourceObject *) {}));
+    mocks.OnCallFunc(ResourceContainerImpl::buildResourceObject).Return(
+            ResourceObject::Ptr(m_pResourceObject, [](ResourceObject *)
+            {}));
 
     mocks.ExpectCall(m_pResourceObject, ResourceObject::setGetRequestHandler);
     mocks.ExpectCall(m_pResourceObject, ResourceObject::setSetRequestHandler);
@@ -179,8 +187,9 @@ TEST_F(ResourceContainerBundleAPITest, RequestHandlerForResourceServerSetWhenReg
 
 TEST_F(ResourceContainerBundleAPITest, BundleResourceUnregisteredWhenUnregisterResourceCalled)
 {
-    mocks.OnCallFunc(ResourceContainerImpl::buildResourceObject).Return(ResourceObject::Ptr(
-    m_pResourceObject, [](ResourceObject *) {}));
+    mocks.OnCallFunc(ResourceContainerImpl::buildResourceObject).Return(
+            ResourceObject::Ptr(m_pResourceObject, [](ResourceObject *)
+            {}));
 
     mocks.ExpectCall(m_pResourceObject, ResourceObject::setGetRequestHandler);
     mocks.ExpectCall(m_pResourceObject, ResourceObject::setSetRequestHandler);
@@ -188,15 +197,16 @@ TEST_F(ResourceContainerBundleAPITest, BundleResourceUnregisteredWhenUnregisterR
     m_pResourceContainer->registerResource(m_pBundleResource);
     m_pResourceContainer->unregisterResource(m_pBundleResource);
 
-    EXPECT_EQ(0, ((ResourceContainerImpl *)m_pResourceContainer)->listBundleResources(
-                  m_pBundleResource->m_bundleId).size());
+    EXPECT_EQ(0,
+            ((ResourceContainerImpl *)m_pResourceContainer)->listBundleResources( m_pBundleResource->m_bundleId).size());
 }
 
 TEST_F(ResourceContainerBundleAPITest,
-       ServerNotifiesToObserversWhenNotificationReceivedFromResource)
+        ServerNotifiesToObserversWhenNotificationReceivedFromResource)
 {
-    mocks.OnCallFunc(ResourceContainerImpl::buildResourceObject).Return(ResourceObject::Ptr(
-    m_pResourceObject, [](ResourceObject *) {}));
+    mocks.OnCallFunc(ResourceContainerImpl::buildResourceObject).Return(
+            ResourceObject::Ptr(m_pResourceObject, [](ResourceObject *)
+            {}));
 
     mocks.ExpectCall(m_pResourceObject, ResourceObject::setGetRequestHandler);
     mocks.ExpectCall(m_pResourceObject, ResourceObject::setSetRequestHandler);
@@ -211,7 +221,7 @@ TEST_F(ResourceContainerBundleAPITest,
 TEST_F(ResourceContainerBundleAPITest, BundleConfigurationParsedWithValidBundleId)
 {
     configInfo bundle;
-    map<string, string> results;
+    map< string, string > results;
 
     m_pResourceContainer->getBundleConfiguration("oic.bundle.test", &bundle);
 
@@ -224,7 +234,7 @@ TEST_F(ResourceContainerBundleAPITest, BundleConfigurationParsedWithValidBundleI
 
 TEST_F(ResourceContainerBundleAPITest, BundleResourceConfigurationListParsed)
 {
-    vector<resourceInfo> resourceConfig;
+    vector< resourceInfo > resourceConfig;
     resourceInfo result;
 
     m_pResourceContainer->getResourceConfiguration("oic.bundle.test", &resourceConfig);
@@ -235,26 +245,26 @@ TEST_F(ResourceContainerBundleAPITest, BundleResourceConfigurationListParsed)
     EXPECT_STREQ("oic.test", result.resourceType.c_str());
 }
 
-
-class ResourceContainerImplTest : public Test
+class ResourceContainerImplTest: public Test
 {
-    public:
-        MockRepository mocks;
-        ResourceContainerImpl *m_pResourceContainer;
-        BundleInfo *m_pBundleInfo;
-
-    protected:
-        void SetUp() override
-        {
-            m_pResourceContainer = ResourceContainerImpl::getImplInstance();
-            m_pBundleInfo = BundleInfo::build();
-        }
+public:
+    MockRepository mocks;
+    ResourceContainerImpl *m_pResourceContainer;
+    BundleInfo *m_pBundleInfo;
+
+protected:
+    void SetUp() override
+    {
+        m_pResourceContainer = ResourceContainerImpl::getImplInstance();
+        m_pBundleInfo = BundleInfo::build();
+    }
 };
 
 TEST_F(ResourceContainerImplTest, SoBundleLoadedWhenRegisteredWithRegisterBundleAPI)
 {
     m_pBundleInfo->setPath("libTestBundle.so");
     m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setLibraryPath(".");
     m_pBundleInfo->setID("oic.bundle.test");
 
     m_pResourceContainer->registerBundle(m_pBundleInfo);
@@ -262,25 +272,54 @@ TEST_F(ResourceContainerImplTest, SoBundleLoadedWhenRegisteredWithRegisterBundle
     EXPECT_NE(nullptr, ((BundleInfoInternal *)m_pBundleInfo)->getBundleHandle());
 }
 
-//TEST_F(ResourceContainerImplTest, JavaBundleLoadedWhenRegisteredWithRegisterBundleAPI)
-//{
-//}
+TEST_F(ResourceContainerImplTest, JavaBundleLoadedWhenRegisteredWithRegisterBundleAPIWrongPath)
+{
+    m_pBundleInfo->setPath("wrong_path.jar");
+    m_pBundleInfo->setActivatorName("org/iotivity/bundle/hue/HueBundleActivator");
+    m_pBundleInfo->setLibraryPath("../.");
+    m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setID("oic.bundle.java.test");
+
+    m_pResourceContainer->registerBundle(m_pBundleInfo);
+    EXPECT_FALSE(((BundleInfoInternal *)m_pBundleInfo)->isLoaded());
+}
+
+TEST_F(ResourceContainerImplTest, JavaBundleTest)
+{
+    m_pBundleInfo->setPath("TestBundleJava/hue-0.1-jar-with-dependencies.jar");
+    m_pBundleInfo->setActivatorName("org/iotivity/bundle/hue/HueBundleActivator");
+    m_pBundleInfo->setLibraryPath("../.");
+    m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setID("oic.bundle.java.test");
+
+    m_pResourceContainer->registerBundle(m_pBundleInfo);
+    EXPECT_TRUE(((BundleInfoInternal *)m_pBundleInfo)->isLoaded());
+
+    m_pResourceContainer->activateBundle(m_pBundleInfo);
+    EXPECT_TRUE(((BundleInfoInternal *) m_pBundleInfo)->isActivated());
+
+    m_pResourceContainer->deactivateBundle(m_pBundleInfo);
+    EXPECT_FALSE(((BundleInfoInternal *) m_pBundleInfo)->isActivated());
+}
 
 TEST_F(ResourceContainerImplTest, BundleNotRegisteredIfBundlePathIsInvalid)
 {
     m_pBundleInfo->setPath("");
     m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setLibraryPath("../.");
     m_pBundleInfo->setID("oic.bundle.test");
 
     m_pResourceContainer->registerBundle(m_pBundleInfo);
 
     EXPECT_EQ(nullptr, ((BundleInfoInternal *)m_pBundleInfo)->getBundleHandle());
+
 }
 
 TEST_F(ResourceContainerImplTest, SoBundleActivatedWithValidBundleInfo)
 {
     m_pBundleInfo->setPath("libTestBundle.so");
     m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setLibraryPath("../.");
     m_pBundleInfo->setID("oic.bundle.test");
 
     m_pResourceContainer->registerBundle(m_pBundleInfo);
@@ -289,14 +328,25 @@ TEST_F(ResourceContainerImplTest, SoBundleActivatedWithValidBundleInfo)
     EXPECT_NE(nullptr, ((BundleInfoInternal *)m_pBundleInfo)->getBundleActivator());
 }
 
-//TEST_F(ResourceContainerImplTest, JavaBundleActivatedWithValidBundleInfo)
-//{
-//}
+/*TEST_F(ResourceContainerImplTest, JavaBundleActivatedWithValidBundleInfo)
+{
+    m_pBundleInfo->setPath("TestBundleJava/hue-0.1-jar-with-dependencies.jar");
+    m_pBundleInfo->setActivatorName("org/iotivity/bundle/hue/HueBundleActivator");
+    m_pBundleInfo->setLibraryPath("../.");
+    m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setID("oic.bundle.java.test2");
+
+    m_pResourceContainer->registerBundle(m_pBundleInfo);
+    m_pResourceContainer->activateBundle(m_pBundleInfo);
+    EXPECT_TRUE(((BundleInfoInternal *) m_pBundleInfo)->isActivated());
+
+}*/
 
 TEST_F(ResourceContainerImplTest, BundleNotActivatedWhenNotRegistered)
 {
     m_pBundleInfo->setPath("libTestBundle.so");
     m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setLibraryPath("../.");
     m_pBundleInfo->setID("oic.bundle.test");
 
     m_pResourceContainer->activateBundle(m_pBundleInfo);
@@ -308,6 +358,7 @@ TEST_F(ResourceContainerImplTest, SoBundleActivatedWithBundleID)
 {
     m_pBundleInfo->setPath("libTestBundle.so");
     m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setLibraryPath("../.");
     m_pBundleInfo->setID("oic.bundle.test");
 
     m_pResourceContainer->registerBundle(m_pBundleInfo);
@@ -317,14 +368,11 @@ TEST_F(ResourceContainerImplTest, SoBundleActivatedWithBundleID)
     EXPECT_TRUE(((BundleInfoInternal *)m_pBundleInfo)->isActivated());
 }
 
-//TEST_F(ResourceContainerImplTest, JavaBundleActivatedWithBundleID)
-//{
-//}
-
 TEST_F(ResourceContainerImplTest, BundleDeactivatedWithBundleInfo)
 {
     m_pBundleInfo->setPath("libTestBundle.so");
     m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setLibraryPath("../.");
     m_pBundleInfo->setID("oic.bundle.test");
 
     m_pResourceContainer->registerBundle(m_pBundleInfo);
@@ -335,14 +383,25 @@ TEST_F(ResourceContainerImplTest, BundleDeactivatedWithBundleInfo)
     EXPECT_FALSE(((BundleInfoInternal *)m_pBundleInfo)->isActivated());
 }
 
-//TEST_F(ResourceContainerImplTest, DeactivateBundleNotWorkingIfBundleNotDeactivated)
-//{
-//}
+TEST_F(ResourceContainerImplTest, BundleDeactivatedWithBundleInfoJava)
+{
+    m_pBundleInfo->setPath("TestBundle/hue-0.1-jar-with-dependencies.jar");
+    m_pBundleInfo->setActivatorName("org/iotivity/bundle/hue/HueBundleActivator");
+    m_pBundleInfo->setLibraryPath("../.");
+    m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setID("oic.bundle.java.test");
+
+    m_pResourceContainer->registerBundle(m_pBundleInfo);
+    m_pResourceContainer->activateBundle(m_pBundleInfo);
+    m_pResourceContainer->deactivateBundle(m_pBundleInfo);
+    EXPECT_FALSE(((BundleInfoInternal *) m_pBundleInfo)->isActivated());
+}
 
 TEST_F(ResourceContainerImplTest, SoBundleDeactivatedWithBundleID)
 {
     m_pBundleInfo->setPath("libTestBundle.so");
     m_pBundleInfo->setVersion("1.0");
+    m_pBundleInfo->setLibraryPath("../.");
     m_pBundleInfo->setID("oic.bundle.test");
 
     m_pResourceContainer->registerBundle(m_pBundleInfo);
@@ -357,9 +416,7 @@ TEST_F(ResourceContainerImplTest, SoBundleDeactivatedWithBundleID)
 //{
 //}
 
-
-/* Test for Configuration */
-TEST(ConfigurationTest, ConfigFileLoadedWithValidPath)
+/* Test for Configuration */TEST(ConfigurationTest, ConfigFileLoadedWithValidPath)
 {
     Configuration *config = new Configuration(CONFIG_FILE);
 
@@ -378,7 +435,7 @@ TEST(ConfigurationTest, BundleConfigurationListParsed)
     Configuration *config = new Configuration(CONFIG_FILE);
 
     configInfo bundles;
-    map<string, string> results;
+    map< string, string > results;
 
     config->getConfiguredBundles(&bundles);
 
@@ -394,7 +451,7 @@ TEST(ConfigurationTest, BundleConfigurationParsedWithValidBundleId)
     Configuration *config = new Configuration(CONFIG_FILE);
 
     configInfo bundle;
-    map<string, string> results;
+    map< string, string > results;
 
     config->getBundleConfiguration("oic.bundle.test", &bundle);
 
@@ -419,7 +476,7 @@ TEST(ConfigurationTest, BundleResourceConfigurationListParsed)
 {
     Configuration *config = new Configuration(CONFIG_FILE);
 
-    vector<resourceInfo> resourceConfig;
+    vector< resourceInfo > resourceConfig;
     resourceInfo result;
 
     config->getResourceConfiguration("oic.bundle.test", &resourceConfig);
@@ -435,8 +492,8 @@ TEST(ConfigurationTest, BundleResourceConfigurationNotParsedWithInvalidBundleId)
     Configuration *config = new Configuration(CONFIG_FILE);
 
     configInfo bundles;
-    vector<resourceInfo> resourceConfig;
+    vector< resourceInfo > resourceConfig;
     config->getResourceConfiguration("test", &resourceConfig);
 
     EXPECT_TRUE(bundles.empty());
-}
\ No newline at end of file
+}
index 4904bba..d7e4671 100644 (file)
@@ -3,6 +3,7 @@
     <bundle>
         <id>oic.bundle.test</id>
         <path>libTestBundle.so</path>
+        <libraryPath>.</libraryPath>
         <version>1.0.0</version>
                <resources>
                        <resourceInfo>
index 59e1d3f..f20b732 100644 (file)
 import os
 Import('env')
 
+import os.path
+
+def filtered_glob(env, pattern, omit=[],
+  ondisk=True, source=False, strings=False):
+    return filter(
+      lambda f: os.path.basename(f.path) not in omit,
+      env.Glob(pattern))
+
+env.AddMethod(filtered_glob, "FilteredGlob");
+
 try:
        print 'Java Home: ', os.environ['JAVA_HOME']
        print 'Java Lib: ', os.environ['JAVA_LIB']
@@ -144,4 +154,6 @@ env.AppendTarget('container_test')
 Command("./ResourceContainerTestConfig.xml","./ResourceContainerTestConfig.xml", Copy("$TARGET", "$SOURCE"))
 Ignore("./ResourceContainerTestConfig.xml", "./ResourceContainerTestConfig.xml")
 Command("./ResourceContainerInvalidConfig.xml","./ResourceContainerInvalidConfig.xml", Copy("$TARGET", "$SOURCE"))
-Ignore("./ResourceContainerInvalidConfig.xml", "./ResourceContainerInvalidConfig.xml")
\ No newline at end of file
+Ignore("./ResourceContainerInvalidConfig.xml", "./ResourceContainerInvalidConfig.xml")
+Command("./TestBundleJava/hue-0.1-jar-with-dependencies.jar","./TestBundleJava/hue-0.1-jar-with-dependencies.jar", Copy("$TARGET", "$SOURCE"))
+Ignore("./TestBundleJava/hue-0.1-jar-with-dependencies.jar", "./TestBundleJava/hue-0.1-jar-with-dependencies.jar")
\ No newline at end of file
diff --git a/service/resource-manipulation/modules/resourceContainer/unittests/TestBundleJava/hue-0.1-jar-with-dependencies.jar b/service/resource-manipulation/modules/resourceContainer/unittests/TestBundleJava/hue-0.1-jar-with-dependencies.jar
new file mode 100644 (file)
index 0000000..be303a1
Binary files /dev/null and b/service/resource-manipulation/modules/resourceContainer/unittests/TestBundleJava/hue-0.1-jar-with-dependencies.jar differ