external library testcases: checkpoint 2
diff --git a/asterix-app/src/test/resources/logging.properties b/asterix-app/src/test/resources/logging.properties
index deb88307..77da7cd 100644
--- a/asterix-app/src/test/resources/logging.properties
+++ b/asterix-app/src/test/resources/logging.properties
@@ -63,3 +63,5 @@
#edu.uci.ics.asterix.level = FINE
#edu.uci.ics.algebricks.level = FINE
#edu.uci.ics.hyracks.level = INFO
+edu.uci.ics.asterix.test = INFO
+edu.uci.ics.asterix.installer.test = INFO
diff --git a/asterix-external-data/pom.xml b/asterix-external-data/pom.xml
index 9aac883..de106aa 100644
--- a/asterix-external-data/pom.xml
+++ b/asterix-external-data/pom.xml
@@ -41,18 +41,20 @@
</executions>
</plugin>
<plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-5</version>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <includes>
+ <include>**/*.class</include>
+ </includes>
+ </configuration>
<executions>
<execution>
- <configuration>
- <descriptor>src/main/assembly/binary-assembly-libjar.xml</descriptor>
- <finalName>testlib</finalName>
- </configuration>
- <phase>verify</phase>
<goals>
- <goal>attached</goal>
+ <goal>test-jar</goal>
</goals>
+ <phase>package</phase>
</execution>
</executions>
</plugin>
@@ -63,9 +65,9 @@
<execution>
<configuration>
<descriptor>src/main/assembly/binary-assembly-libzip.xml</descriptor>
- <finalName>testlib</finalName>
+ <finalName>testlib-zip</finalName>
</configuration>
- <phase>verify</phase>
+ <phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
diff --git a/asterix-external-data/src/main/assembly/binary-assembly-libzip.xml b/asterix-external-data/src/main/assembly/binary-assembly-libzip.xml
index 6116b39..bec6e32 100644
--- a/asterix-external-data/src/main/assembly/binary-assembly-libzip.xml
+++ b/asterix-external-data/src/main/assembly/binary-assembly-libzip.xml
@@ -9,7 +9,7 @@
<directory>target</directory>
<outputDirectory></outputDirectory>
<includes>
- <include>*external*.jar</include>
+ <include>*test*.jar</include>
</includes>
</fileSet>
<fileSet>
diff --git a/asterix-external-data/src/test/resources/text_functions.xml b/asterix-external-data/src/test/resources/text_functions.xml
index 2efd88a..e70d4a0 100644
--- a/asterix-external-data/src/test/resources/text_functions.xml
+++ b/asterix-external-data/src/test/resources/text_functions.xml
@@ -1,33 +1,37 @@
<library xmlns="library">
-<language>JAVA</language>
- <functions>
- <function>
- <function_type>SCALAR</function_type>
- <name>parseTweet</name>
- <arguments>TweetType</arguments>
- <return_type>TweetType</return_type>
- <definition>com.external.ParseTweetFactory</definition>
- </function>
- <function>
- <function_type>SCALAR</function_type>
- <name>mysum</name>
- <arguments>AINT32,AINT32</arguments>
- <return_type>AINT32</return_type>
- <definition>com.external.SumFactory</definition>
- </function>
- <function>
- <function_type>SCALAR</function_type>
- <name>toUpper</name>
- <arguments>TextType</arguments>
- <return_type>TextType</return_type>
- <definition>com.external.UpperCaseFactory</definition>
- </function>
- <function>
- <function_type>SCALAR</function_type>
- <name>allTypes</name>
- <arguments>AllType</arguments>
- <return_type>AllType</return_type>
- <definition>com.external.AllTypesFactory</definition>
- </function>
-</functions>
+ <language>JAVA</language>
+ <functions>
+ <function>
+ <function_type>SCALAR</function_type>
+ <name>parseTweet</name>
+ <arguments>TweetType</arguments>
+ <return_type>TweetType</return_type>
+ <definition>edu.uci.ics.asterix.external.library.ParseTweetFactory
+ </definition>
+ </function>
+ <function>
+ <function_type>SCALAR</function_type>
+ <name>mysum</name>
+ <arguments>AINT32,AINT32</arguments>
+ <return_type>AINT32</return_type>
+ <definition>edu.uci.ics.asterix.external.library.SumFactory
+ </definition>
+ </function>
+ <function>
+ <function_type>SCALAR</function_type>
+ <name>toUpper</name>
+ <arguments>TextType</arguments>
+ <return_type>TextType</return_type>
+ <definition>edu.uci.ics.asterix.external.library.UpperCaseFactory
+ </definition>
+ </function>
+ <function>
+ <function_type>SCALAR</function_type>
+ <name>allTypes</name>
+ <arguments>AllType</arguments>
+ <return_type>AllType</return_type>
+ <definition>edu.uci.ics.asterix.external.library.AllTypesFactory
+ </definition>
+ </function>
+ </functions>
</library>
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>