external library testcases: checkpoint 2
diff --git a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java
index f41df87..8973e08 100644
--- a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java
+++ b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixExternalLibraryIT.java
@@ -32,6 +32,7 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
 import edu.uci.ics.asterix.test.aql.TestsUtils;
 import edu.uci.ics.asterix.testframework.context.TestCaseContext;
 import edu.uci.ics.asterix.testframework.context.TestFileContext;
@@ -40,19 +41,24 @@
 public class AsterixExternalLibraryIT {
 
     private static final String LIBRARY_NAME = "testlib";
-    private static final String LIBRARY_DATAVERSE = "external";
+    private static final String LIBRARY_DATAVERSE = "externallibtest";
     private static final String PATH_BASE = "src/test/resources/integrationts/";
     private static final String PATH_ACTUAL = "ittest/";
     private static final String LIBRARY_PATH = "asterix-external-data" + File.separator + "target" + File.separator
-            + "testlib-binary-assembly.zip";
+            + "testlib-zip-binary-assembly.zip";
     private static final Logger LOGGER = Logger.getLogger(AsterixExternalLibraryIT.class.getName());
     private static List<TestCaseContext> testCaseCollection;
 
     @BeforeClass
     public static void setUp() throws Exception {
         AsterixInstallerIntegrationUtil.init();
-        String libraryPath = AsterixInstallerIntegrationUtil.getManagixHome() + File.separator + LIBRARY_PATH;
-        AsterixInstallerIntegrationUtil.installLibrary(LIBRARY_NAME, LIBRARY_DATAVERSE, libraryPath);
+        File asterixInstallerProjectDir = new File(System.getProperty("user.dir"));
+        String asterixExternalLibraryPath = asterixInstallerProjectDir.getParentFile().getAbsolutePath()
+                + File.separator + LIBRARY_PATH;
+        LOGGER.info("Installing library :" + LIBRARY_NAME + " located at " + asterixExternalLibraryPath
+                + " in dataverse " + LIBRARY_DATAVERSE);
+        AsterixInstallerIntegrationUtil.installLibrary(LIBRARY_NAME, LIBRARY_DATAVERSE, asterixExternalLibraryPath);
+        AsterixInstallerIntegrationUtil.transformIntoRequiredState(State.ACTIVE);
         TestCaseContext.Builder b = new TestCaseContext.Builder();
         testCaseCollection = b.build(new File(PATH_BASE));
     }
@@ -239,4 +245,15 @@
         }
     }
 
+    public static void main(String[] args) throws Exception {
+        try {
+            setUp();
+            new AsterixExternalLibraryIT().test();
+        } catch (Exception e) {
+            LOGGER.info("TEST CASES FAILED");
+        } finally {
+            tearDown();
+        }
+    }
+
 }
diff --git a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java
index 9586b50..d5e22ac 100644
--- a/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java
+++ b/asterix-installer/src/test/java/edu/uci/ics/asterix/installer/test/AsterixInstallerIntegrationUtil.java
@@ -21,6 +21,7 @@
 import java.io.IOException;
 import java.math.BigInteger;
 import java.util.Map;
+import java.util.logging.Logger;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
@@ -47,6 +48,9 @@
     private static final String CC_IP_ADDRESS = "127.0.0.1";
     private static final int DEFAULT_HYRACKS_CC_CLIENT_PORT = 1098;
     private static IHyracksClientConnection hcc;
+    
+    private static final Logger LOGGER = Logger.getLogger(AsterixInstallerIntegrationUtil.class.getName());
+
 
     public static void deinit() throws Exception {
         deleteInstance();
@@ -162,7 +166,7 @@
                 command = "stop -n " + ASTERIX_INSTANCE_NAME;
                 break;
             case INACTIVE:
-                command = "start -n" + ASTERIX_INSTANCE_NAME;
+                command = "start -n " + ASTERIX_INSTANCE_NAME;
                 break;
         }
         cmdHandler.processCommand(command.split(" "));
@@ -199,14 +203,14 @@
 
     public static void installLibrary(String libraryName, String libraryDataverse, String libraryPath) throws Exception {
         transformIntoRequiredState(State.INACTIVE);
-        String command = "install -n " + ASTERIX_INSTANCE_NAME + " " + "-d " + libraryDataverse + "-l " + "libraryName"
-                + " " + libraryName + " " + "-p" + " " + libraryPath;
+        String command = "install -n " + ASTERIX_INSTANCE_NAME + " -d " + libraryDataverse + " -l " + libraryName
+                + " -p " + libraryPath;
         cmdHandler.processCommand(command.split(" "));
     }
 
     public static void uninstallLibrary(String dataverseName, String libraryName) throws Exception {
         transformIntoRequiredState(State.INACTIVE);
-        String command = "uninstall -n " + ASTERIX_INSTANCE_NAME + " " + "-d" + dataverseName + "-l " + "libraryName";
+        String command = "uninstall -n " + ASTERIX_INSTANCE_NAME + " -d " + dataverseName + " -l " + "libraryName";
         cmdHandler.processCommand(command.split(" "));
     }
 
diff --git a/asterix-installer/src/test/resources/integrationts/queries/library/mysum/mysum.1.query.aql b/asterix-installer/src/test/resources/integrationts/queries/library/mysum/mysum.1.query.aql
index c979528..4f1bdc6 100644
--- a/asterix-installer/src/test/resources/integrationts/queries/library/mysum/mysum.1.query.aql
+++ b/asterix-installer/src/test/resources/integrationts/queries/library/mysum/mysum.1.query.aql
@@ -1,4 +1,4 @@
-use dataverse external
+use dataverse externallibtest;
 
 let $x:=testlib:mysum(3,4)
 return $x
diff --git a/asterix-installer/src/test/resources/integrationts/testsuite.xml b/asterix-installer/src/test/resources/integrationts/testsuite.xml
index 610f576..e8acf15 100644
--- a/asterix-installer/src/test/resources/integrationts/testsuite.xml
+++ b/asterix-installer/src/test/resources/integrationts/testsuite.xml
@@ -1,6 +1,6 @@
 <test-suite xmlns="urn:xml.testframework.asterix.ics.uci.edu" ResultOffsetPath="results" QueryOffsetPath="queries" QueryFileExtension=".aql">
   <test-group name="library">
-    <test-case FilePath="testlibrary">
+    <test-case FilePath="library">
       <compilation-unit name="mysum">
         <output-dir compare="Text">mysum</output-dir>
       </compilation-unit>