[teiid-commits] teiid SVN: r1925 - in trunk: test-integration and 11 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Fri Mar 5 14:01:51 EST 2010
Author: shawkins
Date: 2010-03-05 14:01:50 -0500 (Fri, 05 Mar 2010)
New Revision: 1925
Added:
trunk/pom.xml
Removed:
trunk/pom.xml
trunk/test-integration/common/src/test/java/com/metamatrix/cdk/TestConnectorShell.java
trunk/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestConnectorResultUtility.java
trunk/test-integration/common/src/test/java/com/metamatrix/server/integration/TestAdminApi.java
trunk/test-integration/common/src/test/java/org/teiid/runtime/adminapi/TestDqpReDeployment.java
trunk/test-integration/common/src/test/java/org/teiid/runtime/adminapi/TestEmbeddedAdmin.java
Modified:
trunk/test-integration/
trunk/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestTranslationUtility.java
trunk/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java
trunk/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java
trunk/test-integration/common/src/test/java/com/metamatrix/jdbc/TestResultsMetadataWithProvider.java
trunk/test-integration/common/src/test/java/com/metamatrix/jdbc/TestStaticMetadataProvider.java
trunk/test-integration/common/src/test/java/com/metamatrix/server/integration/BaseQueryTest.java
trunk/test-integration/common/src/test/java/org/teiid/connector/language/TestLanguageUtil.java
trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/MockConnector.java
trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestElement.java
trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestGroup.java
trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataObject.java
trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestParams.java
trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestProcedure.java
trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestCollectorVisitor.java
trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java
trunk/test-integration/db/
trunk/test-integration/pom.xml
Log:
TEIID-833 committing JCA merge
Deleted: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/pom.xml 2010-03-05 19:01:50 UTC (rev 1925)
@@ -1,476 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid</artifactId>
- <packaging>pom</packaging>
- <name>Teiid</name>
- <version>7.0.0-SNAPSHOT</version>
- <description>Federated SQL and XML query engine.</description>
- <properties>
- <ant.version>1.7.0</ant.version>
- <site.url>http://www.jboss.org/teiid</site.url>
- </properties>
- <scm>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
- </scm>
- <licenses>
- <license>
- <name>GNU Lesser General Public License</name>
- <url>http://www.gnu.org/licenses/lgpl.html</url>
- <distribution>repo</distribution>
- <comments>A business-friendly OSS license</comments>
- </license>
- </licenses>
- <url>${site.url}</url>
- <developers>
- <developer>
- <name>Steve Hawkins</name>
- <id>steve</id>
- <email>shawkins at redhat.com</email>
- <organization>Red Hat</organization>
- <roles>
- <role>Project Lead</role>
- </roles>
- <timezone>-6</timezone>
- </developer>
- <developer>
- <name>Ramesh Reddy</name>
- <id>ramesh</id>
- <email>rareddy at redhat.com</email>
- <organization>Red Hat</organization>
- <roles>
- <role>Project Lead</role>
- </roles>
- <timezone>-6</timezone>
- </developer>
- <developer>
- <name>Van Halbert</name>
- <id>van</id>
- <email>vhalbert at redhat.com</email>
- <organization>Red Hat</organization>
- <roles>
- <role>Developer</role>
- </roles>
- <timezone>-6</timezone>
- </developer>
- <developer>
- <name>Ted Jones</name>
- <id>ted</id>
- <email>tejones at redhat.com</email>
- <organization>Red Hat</organization>
- <roles>
- <role>Developer</role>
- </roles>
- <timezone>-6</timezone>
- </developer>
- </developers>
- <profiles>
- <profile>
- <!--
- This profile is activated manually, as in "mvn ... -P release ..."
- -->
- <id>release</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <configuration>
- <descriptors>
- <descriptor>build/assembly/src.xml</descriptor>
- <descriptor>build/assembly/client-jar.xml</descriptor>
- <descriptor>build/assembly/runtime/dependencies.xml</descriptor>
- <descriptor>build/assembly/runtime/dist.xml</descriptor>
- <descriptor>build/assembly/cdk/cdk-dependencies.xml</descriptor>
- <descriptor>build/assembly/cdk/cdk-dist.xml</descriptor>
- <descriptor>build/assembly/adminshell/adminshell-dependencies.xml</descriptor>
- <descriptor>build/assembly/adminshell/adminshell-dist.xml</descriptor>
- <descriptor>documentation/assembly/docs.xml</descriptor>
- </descriptors>
- <outputDirectory>target/distribution</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <modules>
- <module>build</module>
- <module>documentation</module>
- </modules>
- </profile>
- </profiles>
- <build>
- <!-- This section defines the default plugin settings inherited by child projects. -->
- <pluginManagement>
- <plugins>
- <!-- Fixes how test resources of a project can be used in projects dependent on it -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <!-- Specify the compiler options and settings -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- <showDeprecation>false</showDeprecation>
- <showWarnings>false</showWarnings>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <includes>
- <include>**/*TestCase.java</include>
- <include>**/*Test.java</include>
- <include>**/Test*.java</include>
- </includes>
- <excludes>
- <exclude>**/Abstract*TestCase.java</exclude>
- <!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
- <include>**/Test*$*.java</include>
- </excludes>
- <systemProperties>
- <property>
- <name>user.dir</name>
- <value>${basedir}/target</value>
- </property>
- <property>
- <name>java.io.tmpdir</name>
- <value>${basedir}/target</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
- <!--
- Build a test-jar for each project, so that src/test/* resources and classes can be used
- in other projects. Also customize how the jar files are assembled.
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <archive>
- <manifest>
- <addDefaultSpecificationEntries> true</addDefaultSpecificationEntries>
- <addDefaultImplementationEntries> true</addDefaultImplementationEntries>
- </manifest>
- <manifestEntries>
- <Implementation-URL>${pom.url}</Implementation-URL>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.5</version>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <aggregate>true</aggregate>
- <maxmemory>512m</maxmemory>
- <excludePackageNames>*.internal:com.arjuna.*:*.connector.object:*.connector.sysadmin:*.connector.yahoo:*.connector.exec</excludePackageNames>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- <repositories>
- <repository>
- <id>jboss</id>
- <url>http://repository.jboss.com/maven2/</url>
- </repository>
- <repository>
- <id>jboss-snapshot</id>
- <url>http://snapshots.jboss.org/maven2</url>
- </repository>
- </repositories>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <dependencyManagement>
- <dependencies>
- <!--
- Declare all dependency versions and default scopes here, but not optional.
- Each module should declare it's direct dependency and possibily overwrite scope/optional.
- -->
-
- <!-- Internal dependencies -->
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-internal</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-internal</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-connector-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-connector-api</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-console</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-console</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client-jdbc</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client-jdbc</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-txn-jbossts</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-cache-jbosscache</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-connector-sdk</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-connector-sdk</artifactId>
- <type>test-jar</type>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- External dependencies -->
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>jboss.jbossts</groupId>
- <artifactId>jbossjta-integration</artifactId>
- <version>4.3.0.GA</version>
- </dependency>
- <dependency>
- <groupId>jboss.jbossts</groupId>
- <artifactId>jbossts-common</artifactId>
- <version>4.3.0.GA</version>
- </dependency>
- <dependency>
- <groupId>jboss.jbossts</groupId>
- <artifactId>jbossjta</artifactId>
- <version>4.3.0.GA</version>
- </dependency>
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <version>1.5</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- <exclusions>
- <exclusion>
- <groupId>logkit</groupId>
- <artifactId>logkit</artifactId>
- </exclusion>
- <exclusion>
- <groupId>avalon-framework</groupId>
- <artifactId>avalon-framework</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>jgroups</groupId>
- <artifactId>jgroups</artifactId>
- <version>2.6.10.GA</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <version>3.1.0.GA</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.guice</groupId>
- <artifactId>guice</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>beanshell</groupId>
- <artifactId>bsh</artifactId>
- <version>2.0b4</version>
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>8.7</version>
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-dom</artifactId>
- <version>8.7</version>
- </dependency>
- <dependency>
- <groupId>antlr</groupId>
- <artifactId>stringtemplate</artifactId>
- <version>3.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.netty</groupId>
- <artifactId>netty</artifactId>
- <version>3.0.2.GA</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <modules>
- <module>common-core</module>
- <module>common-internal</module>
- <module>connector-api</module>
- <module>client</module>
- <module>client-jdbc</module>
- <module>engine</module>
- <module>connectors</module>
- <module>console</module>
- <module>metadata</module>
- <module>txn-jbossts</module>
- <module>connector-sdk</module>
- <module>runtime</module>
- <module>adminshell</module>
- <module>test-integration</module>
- <module>cache-jbosscache</module>
- <module>hibernate-dialect</module>
- </modules>
- <distributionManagement>
- <repository>
- <id>repository.jboss.org</id>
- <url>${jboss.repository.root}</url>
- </repository>
- </distributionManagement>
-</project>
Copied: trunk/pom.xml (from rev 1923, branches/JCA/pom.xml)
===================================================================
--- trunk/pom.xml (rev 0)
+++ trunk/pom.xml 2010-03-05 19:01:50 UTC (rev 1925)
@@ -0,0 +1,536 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid</artifactId>
+ <packaging>pom</packaging>
+ <name>Teiid</name>
+ <version>7.0.0-SNAPSHOT</version>
+ <description>Federated SQL and XML query engine.</description>
+ <properties>
+ <ant.version>1.7.0</ant.version>
+ <site.url>http://www.jboss.org/teiid</site.url>
+ </properties>
+ <scm>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
+ </scm>
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License</name>
+ <url>http://www.gnu.org/licenses/lgpl.html</url>
+ <distribution>repo</distribution>
+ <comments>A business-friendly OSS license</comments>
+ </license>
+ </licenses>
+ <url>${site.url}</url>
+ <developers>
+ <developer>
+ <name>Steve Hawkins</name>
+ <id>steve</id>
+ <email>shawkins at redhat.com</email>
+ <organization>Red Hat</organization>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ <timezone>-6</timezone>
+ </developer>
+ <developer>
+ <name>Ramesh Reddy</name>
+ <id>ramesh</id>
+ <email>rareddy at redhat.com</email>
+ <organization>Red Hat</organization>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ <timezone>-6</timezone>
+ </developer>
+ <developer>
+ <name>Van Halbert</name>
+ <id>van</id>
+ <email>vhalbert at redhat.com</email>
+ <organization>Red Hat</organization>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>-6</timezone>
+ </developer>
+ <developer>
+ <name>Ted Jones</name>
+ <id>ted</id>
+ <email>tejones at redhat.com</email>
+ <organization>Red Hat</organization>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>-6</timezone>
+ </developer>
+ </developers>
+ <profiles>
+ <profile>
+ <!--
+ This profile is activated manually, as in "mvn ... -P release ..."
+ -->
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <configuration>
+ <descriptors>
+ <!--
+ <descriptor>build/assembly/src.xml</descriptor>
+ -->
+ <descriptor>build/assembly/client-jar.xml</descriptor>
+ <descriptor>build/assembly/jboss-container/dist.xml</descriptor>
+ <descriptor>build/assembly/adminshell/adminshell-dependencies.xml</descriptor>
+ <descriptor>build/assembly/adminshell/adminshell-dist.xml</descriptor>
+
+ <!--
+ <descriptor>build/assembly/runtime/dependencies.xml</descriptor>
+ <descriptor>build/assembly/runtime/dist.xml</descriptor>
+ <descriptor>build/assembly/cdk/cdk-dependencies.xml</descriptor>
+ <descriptor>build/assembly/cdk/cdk-dist.xml</descriptor>
+
+ <descriptor>documentation/assembly/docs.xml</descriptor>
+ -->
+ </descriptors>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <modules>
+ <module>build</module>
+ <!--
+ <module>documentation</module>
+ -->
+ </modules>
+ </profile>
+ </profiles>
+ <build>
+ <!-- This section defines the default plugin settings inherited by child projects. -->
+ <pluginManagement>
+ <plugins>
+ <!-- Fixes how test resources of a project can be used in projects dependent on it -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ <include>**/*Test.java</include>
+ <include>**/Test*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/Abstract*TestCase.java</exclude>
+ <!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
+ <include>**/Test*$*.java</include>
+ </excludes>
+ <systemProperties>
+ <property>
+ <name>user.dir</name>
+ <value>${basedir}/target</value>
+ </property>
+ <property>
+ <name>java.io.tmpdir</name>
+ <value>${basedir}/target</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <!--
+ Build a test-jar for each project, so that src/test/* resources and classes can be used
+ in other projects. Also customize how the jar files are assembled.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultSpecificationEntries> true</addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries> true</addDefaultImplementationEntries>
+ </manifest>
+ <manifestEntries>
+ <Implementation-URL>${pom.url}</Implementation-URL>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.5</version>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ <maxmemory>512m</maxmemory>
+ <excludePackageNames>*.internal:com.arjuna.*:*.connector.object:*.connector.sysadmin:*.connector.yahoo:*.connector.exec</excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <url>http://repository.jboss.com/maven2/</url>
+ </repository>
+ <repository>
+ <id>jboss-snapshot</id>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <!--
+ Declare all dependency versions and default scopes here, but not optional.
+ Each module should declare it's direct dependency and possibily overwrite scope/optional.
+ -->
+
+ <!-- Internal dependencies -->
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-internal</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-internal</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-api</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-console</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-console</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client-jdbc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client-jdbc</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-txn-jbossts</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-cache-jbosscache</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-sdk</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-connector-sdk</artifactId>
+ <type>test-jar</type>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-jboss-integration</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-runtime</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-jboss-embedded</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <version>1.5</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>logkit</groupId>
+ <artifactId>logkit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>2.6.10.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <version>3.1.0.GA</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <version>2.1.0.SP1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-metatype</artifactId>
+ <version>2.1.0.SP1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-profileservice-spi</artifactId>
+ <version>5.1.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>2.1.2.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <version>2.0.7.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>2.0.7.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-connector</artifactId>
+ <version>5.1.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-reflect</artifactId>
+ <version>2.0.2.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.remoting</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ <version>2.5.1</version>
+ </dependency>
+ <dependency>
+ <groupId>beanshell</groupId>
+ <artifactId>bsh</artifactId>
+ <version>2.0b4</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>8.7</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-dom</artifactId>
+ <version>8.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.netty</groupId>
+ <artifactId>netty</artifactId>
+ <version>3.0.2.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${ant.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <modules>
+ <!--
+ <module>txn-jbossts</module>
+ -->
+ <module>test-integration</module>
+ <module>common-core</module>
+ <module>common-internal</module>
+ <module>connector-api</module>
+ <module>client</module>
+ <module>client-jdbc</module>
+ <module>engine</module>
+ <module>connectors</module>
+ <module>console</module>
+ <module>metadata</module>
+ <module>runtime</module>
+ <module>adminshell</module>
+ <module>cache-jbosscache</module>
+ <module>hibernate-dialect</module>
+ <module>jboss-integration</module>
+ <module>connector-sdk</module>
+ <module>jboss-embedded</module>
+
+ </modules>
+ <distributionManagement>
+ <repository>
+ <id>repository.jboss.org</id>
+ <url>${jboss.repository.root}</url>
+ </repository>
+ </distributionManagement>
+</project>
Property changes on: trunk/test-integration
___________________________________________________________________
Name: svn:mergeinfo
-
Deleted: trunk/test-integration/common/src/test/java/com/metamatrix/cdk/TestConnectorShell.java
===================================================================
--- trunk/test-integration/common/src/test/java/com/metamatrix/cdk/TestConnectorShell.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/com/metamatrix/cdk/TestConnectorShell.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -1,266 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.cdk;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-
-import com.metamatrix.core.commandshell.CommandShell;
-import com.metamatrix.core.commandshell.CommandShellTest;
-import com.metamatrix.core.util.StringUtil;
-import com.metamatrix.core.util.StringUtilities;
-import com.metamatrix.core.util.UnitTestUtil;
-
-public class TestConnectorShell extends CommandShellTest {
- private ConnectorShell connectorShell;
- private ConnectorShellCommandTarget commandTarget;
-
- public TestConnectorShell(String name) {
- super(name);
- }
-
- /*
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- commandTarget = new ConnectorShellCommandTarget();
- connectorShell = new ConnectorShell(commandTarget);
- connectorShell.setSilent(true);
- connectorShell.setPrintStackTraceOnException(false);
- connectorShell.setDefaultFilePath(UnitTestUtil.getTestDataPath() + File.separator);
- }
-
- public void testLoad() {
- String result = loadLoopBackConnector();
- assertNull(result);
- }
-
- private String loadLoopBackConnector() {
- return connectorShell.execute("load com.metamatrix.connector.loopback.LoopbackConnector partssupplier/PartsSupplier.vdb"); //$NON-NLS-1$
- }
-
- private void start() {
- connectorShell.execute("start"); //$NON-NLS-1$
- }
-
- public void testSelect() {
- loadLoopBackConnector();
- start();
- String result = connectorShell.execute("select * from partssupplier.partssupplier.parts;"); //$NON-NLS-1$
- assertEquals("PART_ID\tPART_NAME\tPART_COLOR\tPART_WEIGHT" + StringUtil.LINE_SEPARATOR + "ABCDEFGHIJ\tABCDEFGHIJ\tABCDEFGHIJ\tABCDEFGHIJ" + StringUtil.LINE_SEPARATOR, result); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- public void testRun() {
- loadLoopBackConnector();
- start();
- setScriptFile();
- connectorShell.turnOffExceptionHandling();
- String result = connectorShell.execute("run test1"); //$NON-NLS-1$
- assertEquals("Test " + UnitTestUtil.getTestDataPath() + File.separator + "script.txt.test1 failed. CompareResults Error: Expected 1 records but received 2\n", result); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private void setScriptFile() {
- setScriptFile( "script.txt" ); //$NON-NLS-1$
- }
-
- private void setScriptFile(String fileName) {
- connectorShell.execute("setScriptFile " + UnitTestUtil.getTestDataPath() + File.separator + fileName); //$NON-NLS-1$
- }
-
- public void testCallingScriptFromAnotherScriptFile() {
- commandTarget.setFailOnError(true);
- connectorShell.execute( "setscriptfile " + UnitTestUtil.getTestDataPath() + File.separator + "/cdk/s1.txt" ); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertEquals( "", connectorShell.execute( "s3" ) ); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals( "", connectorShell.execute( "s1" ) ); //$NON-NLS-1$ //$NON-NLS-2$
- connectorShell.execute( "s4" ); //$NON-NLS-1$
- connectorShell.execute( "s2" ); //$NON-NLS-1$
- }
-
- public void testCallingScriptFromAnotherScriptFileThatCallsAScript() {
- commandTarget.setFailOnError(true);
- connectorShell.setDefaultFilePath(""); //$NON-NLS-1$
- connectorShell.execute( "setscriptfile " + UnitTestUtil.getTestDataPath() + File.separator + "/cdk/s3.txt" ); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertEquals( "", connectorShell.execute( "s3_3" ) ); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testRunAllTests() {
- loadLoopBackConnector();
- start();
- setScriptFile();
- String result = connectorShell.execute("runAll"); //$NON-NLS-1$
- assertEquals("Test " + UnitTestUtil.getTestDataPath() + File.separator + "script.txt.test1 failed. CompareResults Error: Expected 1 records but received 2\nTest " + UnitTestUtil.getTestDataPath() + File.separator +"script.txt.testBadData failed. CompareResults Error: Value mismatch at row 1 and column 2: expected = XX, actual = ABCDEFGHIJ\nTests run: 14 test failures: 2", result); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- public void testSetProperty() {
- connectorShell.setDefaultFilePath(UnitTestUtil.getTestDataPath() + File.separator);
- setScriptFile();
- String result = connectorShell.execute("run testSetProperty"); //$NON-NLS-1$
- assertEquals("", result); //$NON-NLS-1$
- }
-
- public void testSetPropertyAfterConnectorHostStart() {
- connectorShell.setDefaultFilePath(UnitTestUtil.getTestDataPath() + File.separator);
- setScriptFile();
- start();
- String result = connectorShell.execute("run testSetPropertyAfterConnectorHostStart"); //$NON-NLS-1$
- assertEquals("", result); //$NON-NLS-1$
- }
-
- public void testLoadingClearsProperties() {
- connectorShell.setDefaultFilePath(UnitTestUtil.getTestDataPath() + File.separator);
- setScriptFile();
- String result = connectorShell.execute("run testLoadingClearsProperties"); //$NON-NLS-1$
- assertEquals("", result); //$NON-NLS-1$
- }
-
- public void testRunAllTestsWithoutSetup() {
- loadLoopBackConnector();
- start();
- setScriptFile("scriptWithoutSetup.txt"); //$NON-NLS-1$
- String result = connectorShell.execute("runAll"); //$NON-NLS-1$
- assertEquals("Test " + UnitTestUtil.getTestDataPath() + File.separator + "scriptWithoutSetup.txt.test1 failed. CompareResults Error: Expected 1 records but received 2\nTests run: 3 test failures: 1", result); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void testCaseInsensitiveCommands() {
- loadLoopBackConnector();
- setScriptFile();
- String result = connectorShell.execute("run testCaseInsensitiveCommands"); //$NON-NLS-1$
- assertEquals("", result); //$NON-NLS-1$
- }
-
- public void testInvokingAsCommandLine() {
- new ConnectorShell(new ConnectorShellCommandTarget()).run(new String[] {"quit"}, UnitTestUtil.getTestScratchPath() + "/connector_shell.log"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- /*
- * @see com.metamatrix.core.commandshell.CommandShellTest#getCommandShell()
- */
- protected CommandShell getCommandShell() {
- return connectorShell;
- }
-
- public void testLoadArchive() {
- runTest("testLoadArchive"); //$NON-NLS-1$
- }
-
- public void testCreateArchive() {
- File f = UnitTestUtil.getTestScratchFile("foo.caf");
- f.delete();
- connectorShell.execute("createArchive "+UnitTestUtil.getTestScratchPath()+"/foo.caf "+UnitTestUtil.getTestDataPath()+"/sample/sample2.cdk "+UnitTestUtil.getTestDataPath()+"/sample");
- assertTrue("failed to create archive file", f.exists());
- }
-
- public void testHelp() {
- runTest("testHelp"); //$NON-NLS-1$
- }
-
- public void testNotLoadingConnector() {
- runTest("testNotLoadingConnector"); //$NON-NLS-1$
- }
-
- public void testStart() {
- loadLoopBackConnector();
- connectorShell.execute("start"); //$NON-NLS-1$
- }
-
- public void testStop() {
- loadLoopBackConnector();
- start();
- connectorShell.execute("stop"); //$NON-NLS-1$
- }
-
- public void testLoadXMLProperties() {
- loadLoopBackConnector();
- connectorShell.execute("loadProperties " + UnitTestUtil.getTestDataPath() + File.separator+ "properties.cdk"); //$NON-NLS-1$ //$NON-NLS-2$
- start();
- String loadedProperties = connectorShell.execute("getProperties"); //$NON-NLS-1$
- String expected = new StringBuffer("property1=PropVal1") //$NON-NLS-1$
- .append(StringUtilities.LINE_SEPARATOR)
- .append("property2=PropVal2") //$NON-NLS-1$
- .append(StringUtilities.LINE_SEPARATOR)
- .append("property3=com.metamatrix.cdk.propertyVal") //$NON-NLS-1$
- .append(StringUtilities.LINE_SEPARATOR)
- .toString();
- assertEquals(expected, loadedProperties);
- }
-
- public void testLoadPropertiesFromPropertiesFile() {
- loadLoopBackConnector();
- connectorShell.execute("loadProperties " + UnitTestUtil.getTestDataPath() + File.separator+ "/cdk/connector.properties"); //$NON-NLS-1$ //$NON-NLS-2$
- start();
- String loadedProperties = connectorShell.execute("getProperties"); //$NON-NLS-1$
- assertNotNull(loadedProperties);
- String expected = new StringBuffer("property1=PropVal1") //$NON-NLS-1$
- .append(StringUtilities.LINE_SEPARATOR)
- .append("property2=PropVal2") //$NON-NLS-1$
- .append(StringUtilities.LINE_SEPARATOR)
- .append("property3=com.metamatrix.cdk.propertyVal") //$NON-NLS-1$
- .append(StringUtilities.LINE_SEPARATOR)
- .toString();
- assertEquals(expected, loadedProperties);
- }
-
-
- public void testCreateTemplateFileDoesNotExistNoPath() throws FileNotFoundException, IOException {
- //Create a template file. The file does not exist yet. The filename does not include a path.
- runTemplateTestAndDeleteFile("testTemplate1"); //$NON-NLS-1$
- }
-
- public void testCreateTemplateFileDoesNotExist() throws FileNotFoundException, IOException {
- //Create a template file. The file does not exist yet. The filename does not include a path.
- runTemplateTestAndDeleteFile("testTemplate2"); //$NON-NLS-1$
- }
-
- private void runTemplateTestAndDeleteFile(String fileName) throws FileNotFoundException, IOException {
- fileName = UnitTestUtil.getTestScratchPath() + File.separator + fileName;
- new File(fileName).delete();
- runTemplateTest(fileName);
- }
-
- private void runTemplateTest(String tempFileName) throws FileNotFoundException, IOException {
- connectorShell.execute("setFailOnError true"); //$NON-NLS-1$
- connectorShell.execute("createTemplate " + tempFileName); //$NON-NLS-1$
-
- FileInputStream template = new FileInputStream(new File(tempFileName));
- InputStream original = getClass().getResourceAsStream("Template.cdk"); //$NON-NLS-1$
- int originalByte= 0, tempByte = 0;
- int bytesCompared = 0;
- while((originalByte = original.read()) != -1 && (tempByte = template.read()) != -1) {
- assertEquals(originalByte, tempByte);
- bytesCompared++;
- }
- assertTrue(bytesCompared>0);
- // Ensure that the end of the master template has been reached
- assertEquals(-1, originalByte);
- template.close();
- original.close();
- }
-}
Deleted: trunk/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestConnectorResultUtility.java
===================================================================
--- trunk/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestConnectorResultUtility.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestConnectorResultUtility.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -1,191 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.cdk.api;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.core.commandshell.ConnectorResultUtility;
-import com.metamatrix.core.util.StringUtil;
-
-public class TestConnectorResultUtility extends TestCase {
- List bob1;
- List bob2;
- List jim1;
- List bobShort;
- List bobMultiLineWithTabs;
-
- List nullList;
-
- List results1;
- List results2;
-
- public TestConnectorResultUtility(String name) {
- super(name);
- }
-
- public void testSame() {
- results1.add(bob1);
- results1.add(jim1);
-
- results2.add(bob1);
- results2.add(jim1);
-
- String expected = ConnectorResultUtility.resultsToString(results1);
- String actual = ConnectorResultUtility.resultsToString(results2);
- String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
- assertNull(result);
- }
-
- public void testDifferent() {
- results1.add(bob1);
- results1.add(jim1);
-
- results2.add(bob2);
- results2.add(jim1);
-
- String expected = ConnectorResultUtility.resultsToString(results1);
- String actual = ConnectorResultUtility.resultsToString(results2);
- String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
- assertEquals("CompareResults Error: Value mismatch at row 1 and column 1: expected = 45, actual = 25", result); //$NON-NLS-1$
- }
-
- public void testTooFewRows() {
- results1.add(bob1);
- results1.add(jim1);
-
- results2.add(bob1);
-
- String expected = ConnectorResultUtility.resultsToString(results1);
- String actual = ConnectorResultUtility.resultsToString(results2);
- String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
- assertEquals("CompareResults Error: Expected 3 records but received only 2", result); //$NON-NLS-1$
- }
-
- public void testTooManyRows() {
- results1.add(bob1);
-
- results2.add(bob1);
- results2.add(jim1);
-
- String expected = ConnectorResultUtility.resultsToString(results1);
- String actual = ConnectorResultUtility.resultsToString(results2);
- String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
- assertEquals("CompareResults Error: Expected 2 records but received 3", result); //$NON-NLS-1$
- }
-
- public void testNullColumns() {
- results1.add(bob1);
-
- results2.add(nullList);
-
- String expected = ConnectorResultUtility.resultsToString(results1);
- String actual = ConnectorResultUtility.resultsToString(results2);
- String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
- assertEquals("CompareResults Error: Value mismatch at row 1 and column 0: expected = bob, actual = <null>", result); //$NON-NLS-1$
- }
-
- public void testNullColumnInFirstRowWithDataLater() {
- results1.add(nullList);
- results1.add(bob1);
- String result = ConnectorResultUtility.resultsToString(results1);
- assertEquals(
- "col1\tcol2" + StringUtil.LINE_SEPARATOR + //$NON-NLS-1$
- "<null>\t<null>" + StringUtil.LINE_SEPARATOR + //$NON-NLS-1$
- "bob\t45" + StringUtil.LINE_SEPARATOR, //$NON-NLS-1$
- result);
- }
-
- public void testNullColumnInFirstRowWithNoDataLater() {
- results1.add(nullList);
- results1.add(nullList);
- String result = ConnectorResultUtility.resultsToString(results1);
- assertEquals(
- "col1\tcol2" + StringUtil.LINE_SEPARATOR + //$NON-NLS-1$
- "<null>\t<null>" + StringUtil.LINE_SEPARATOR + //$NON-NLS-1$
- "<null>\t<null>" + StringUtil.LINE_SEPARATOR, //$NON-NLS-1$
- result);
- }
-
- public void testTooFewColumns() {
- results1.add(bob1);
-
- results2.add(bobShort);
-
- String expected = ConnectorResultUtility.resultsToString(results1);
- String actual = ConnectorResultUtility.resultsToString(results2);
- String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
- assertEquals("Incorrect number of columns at row = 0, expected = 2, actual = 1", result); //$NON-NLS-1$
- }
-
- public void testTooManyColumns() {
- results1.add(bobShort);
-
- results2.add(bob1);
-
- String expected = ConnectorResultUtility.resultsToString(results1);
- String actual = ConnectorResultUtility.resultsToString(results2);
- String result = ConnectorResultUtility.compareResultsStrings(expected, actual);
- assertEquals("Incorrect number of columns at row = 0, expected = 1, actual = 2", result); //$NON-NLS-1$
- }
-
- public void testTabsAndNewLines() {
- results1.add(bobMultiLineWithTabs);
- String result = ConnectorResultUtility.resultsToString(results1);
- //tabs and newlines in Strings in the result object end up as literal "\t" and "\n" values in the string version
- assertEquals("col1\tcol2" + StringUtil.LINE_SEPARATOR + "bob\\tsmith\\nEsquire\t45" + StringUtil.LINE_SEPARATOR, result); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- bob1 = new ArrayList();
- bob1.add("bob"); //$NON-NLS-1$
- bob1.add(new Integer(45));
- jim1 = new ArrayList();
- jim1.add("jim"); //$NON-NLS-1$
- jim1.add(new Integer(19));
-
- bob2 = new ArrayList();
- bob2.add("bob"); //$NON-NLS-1$
- bob2.add(new Integer(25));
-
- bobShort = new ArrayList();
- bobShort.add("bob"); //$NON-NLS-1$
-
- bobMultiLineWithTabs = new ArrayList();
- bobMultiLineWithTabs.add("bob\tsmith\nEsquire"); //$NON-NLS-1$
- bobMultiLineWithTabs.add(new Integer(45));
-
- nullList = new ArrayList();
- nullList.add(null);
- nullList.add(null);
-
- results1 = new ArrayList();
- results2 = new ArrayList();
- }
-}
Modified: trunk/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestTranslationUtility.java
===================================================================
--- trunk/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestTranslationUtility.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestTranslationUtility.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -24,10 +24,10 @@
import junit.framework.TestCase;
-import org.teiid.connector.language.ICommand;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.metadata.runtime.MetadataObject;
+import org.teiid.connector.language.Command;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.metadata.runtime.AbstractMetadataRecord;
import com.metamatrix.core.util.UnitTestUtil;
@@ -45,36 +45,32 @@
return UnitTestUtil.getTestDataPath() + "/partssupplier/PartsSupplier.vdb"; //$NON-NLS-1$
}
- public void helpTestTranslate(String vdbFile, String sql, String expectedOutput) {
+ public void helpTestTranslate(String sql, String expectedOutput) {
TranslationUtility util = new TranslationUtility(getTestVDB());
- ICommand query = util.parseCommand(sql);
+ Command query = util.parseCommand(sql);
assertEquals(expectedOutput, query.toString());
}
public void testQuery1() {
helpTestTranslate(
- getTestVDB(),
"select * from partssupplier.parts", //$NON-NLS-1$
"SELECT PARTS.PART_ID, PARTS.PART_NAME, PARTS.PART_COLOR, PARTS.PART_WEIGHT FROM PARTS"); //$NON-NLS-1$
}
public void testInsert1() {
helpTestTranslate(
- getTestVDB(),
- "insert into partssupplier.parts (part_name, part_color) values ('P100', 'Red')", //$NON-NLS-1$
+ "insert into partssupplier.parts (part_name, part_color) values ('P100', 'Red')", //$NON-NLS-1$
"INSERT INTO PARTS (PART_NAME, PART_COLOR) VALUES ('P100', 'Red')"); //$NON-NLS-1$
}
public void testUpdate1() {
helpTestTranslate(
- getTestVDB(),
"update partssupplier.parts set part_name = 'P100' where part_color = 'Red'", //$NON-NLS-1$
"UPDATE PARTS SET PART_NAME = 'P100' WHERE PARTS.PART_COLOR = 'Red'"); //$NON-NLS-1$
}
public void testDelete1() {
helpTestTranslate(
- getTestVDB(),
"delete from partssupplier.parts where part_color = 'Red'", //$NON-NLS-1$
"DELETE FROM PARTS WHERE PARTS.PART_COLOR = 'Red'"); //$NON-NLS-1$
}
@@ -83,9 +79,9 @@
TranslationUtility util = new TranslationUtility(getTestVDB());
// Translate command to get some ids
- IQuery query = (IQuery) util.parseCommand("select * from partssupplier.parts"); //$NON-NLS-1$
- IGroup group = (IGroup) query.getFrom().getItems().get(0);
- MetadataObject mid = group.getMetadataObject();
+ Select query = (Select) util.parseCommand("select * from partssupplier.parts"); //$NON-NLS-1$
+ NamedTable group = (NamedTable) query.getFrom().get(0);
+ AbstractMetadataRecord mid = group.getMetadataObject();
assertEquals("PartsSupplier.PARTSSUPPLIER.PARTS", mid.getFullName()); //$NON-NLS-1$
// Use RMD to get stuff
Modified: trunk/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java
===================================================================
--- trunk/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -24,47 +24,44 @@
import static org.junit.Assert.*;
-import java.util.Properties;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.jdbc.JDBCPropertyNames;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
import org.teiid.connector.jdbc.TranslationHelper;
import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
import org.teiid.connector.jdbc.translator.Translator;
-import org.teiid.connector.language.ILanguageObject;
+import org.teiid.connector.language.LanguageObject;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import org.teiid.dqp.internal.datamgr.impl.ExecutionContextImpl;
import org.teiid.dqp.internal.datamgr.language.TestDeleteImpl;
import org.teiid.dqp.internal.datamgr.language.TestInsertImpl;
import org.teiid.dqp.internal.datamgr.language.TestProcedureImpl;
-import org.teiid.dqp.internal.datamgr.language.TestSelectImpl;
+import org.teiid.dqp.internal.datamgr.language.TestQueryImpl;
import org.teiid.dqp.internal.datamgr.language.TestUpdateImpl;
import org.teiid.dqp.internal.datamgr.language.TstLanguageBridgeFactory;
-import com.metamatrix.cdk.api.EnvironmentUtility;
/**
*/
public class TestSQLConversionVisitor {
public static final ExecutionContext context = new ExecutionContextImpl("VDB", //$NON-NLS-1$
- "Version", //$NON-NLS-1$
- "User", //$NON-NLS-1$
- "Payload", //$NON-NLS-1$
- "ExecutionPayload", //$NON-NLS-1$
- "ConnectionID", //$NON-NLS-1$
- "Connector", //$NON-NLS-1$
- "RequestID", "PartID", "ExecCount"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ 1,
+ "Payload", //$NON-NLS-1$
+ "ConnectionID", //$NON-NLS-1$
+ "Connector", //$NON-NLS-1$
+ "RequestID", //$NON-NLS-1$
+ "PartID", //$NON-NLS-1$
+ "ExecCount"); //$NON-NLS-1$
private static Translator TRANSLATOR;
@BeforeClass public static void oneTimeSetup() throws ConnectorException {
TRANSLATOR = new Translator();
- Properties p = new Properties();
- p.setProperty(JDBCPropertyNames.TRIM_STRINGS, Boolean.TRUE.toString());
- TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(p, false));
+ JDBCManagedConnectionFactory env = new JDBCManagedConnectionFactory();
+ env.setTrimStrings(true);
+ TRANSLATOR.initialize(env);
}
public String getTestVDB() {
@@ -75,32 +72,32 @@
helpTestVisitor(vdb, input, expectedOutput, false);
}
- public void helpTestVisitor(String vdb, String input, String expectedOutput, boolean usePreparedStatement) {
+ public void helpTestVisitor(String vdb, String input, String expectedOutput, boolean usePreparedStatement) {
+ Translator trans = new Translator();
+ JDBCManagedConnectionFactory env = new JDBCManagedConnectionFactory();
+ if (usePreparedStatement) {
+ env.setUseBindVariables(true);
+ }
try {
- Translator trans = new Translator();
- Properties p = new Properties();
- if (usePreparedStatement) {
- p.setProperty(JDBCPropertyNames.USE_BIND_VARIABLES, Boolean.TRUE.toString());
- }
- trans.initialize(EnvironmentUtility.createEnvironment(p, false));
-
- TranslationHelper.helpTestVisitor(vdb, input, expectedOutput, trans);
- } catch (ConnectorException e) {
- throw new RuntimeException(e);
- }
- }
+ trans.initialize(env);
+ TranslationHelper.helpTestVisitor(vdb, input, expectedOutput, trans);
+ } catch (ConnectorException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
public static final RuntimeMetadata metadata = TstLanguageBridgeFactory.metadataFactory;
- private String getStringWithContext(ILanguageObject obj) throws ConnectorException {
- Properties props = new Properties();
- props.setProperty(JDBCPropertyNames.USE_COMMENTS_SOURCE_QUERY, Boolean.TRUE.toString());
+ private String getStringWithContext(LanguageObject obj) throws ConnectorException {
+ JDBCManagedConnectionFactory env = new JDBCManagedConnectionFactory();
+ env.setUseCommentsInSourceQuery(true);
Translator trans = new Translator();
- trans.initialize(EnvironmentUtility.createEnvironment(props, false));
+ trans.initialize(env);
SQLConversionVisitor visitor = trans.getSQLConversionVisitor();
- visitor.setExecutionContext(context);
- visitor.append(obj);
- return visitor.toString();
- }
+ visitor.setExecutionContext(context);
+ visitor.append(obj);
+ return visitor.toString();
+ }
@Test public void testSimple() {
helpTestVisitor(getTestVDB(),
@@ -387,9 +384,9 @@
@Test public void testVisitISelectWithComment() throws Exception {
String expected = "SELECT /*teiid sessionid:ConnectionID, requestid:RequestID.PartID*/ g1.e1, g1.e2, g1.e3, g1.e4"; //$NON-NLS-1$
- assertEquals(expected, getStringWithContext(TestSelectImpl.example(false)));
+ assertEquals(expected, getStringWithContext(TestQueryImpl.example(false)));
expected = "SELECT /*teiid sessionid:ConnectionID, requestid:RequestID.PartID*/ DISTINCT g1.e1, g1.e2, g1.e3, g1.e4"; //$NON-NLS-1$
- assertEquals(expected, getStringWithContext(TestSelectImpl.example(true)));
+ assertEquals(expected, getStringWithContext(TestQueryImpl.example(true)));
}
@Test public void testVisitIUpdateWithComment() throws Exception {
Modified: trunk/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java
===================================================================
--- trunk/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -29,12 +29,9 @@
import junit.framework.TestCase;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.ISelect;
-import org.teiid.dqp.internal.datamgr.language.LiteralImpl;
-import org.teiid.dqp.internal.datamgr.language.QueryImpl;
-import org.teiid.dqp.internal.datamgr.language.SelectImpl;
-import org.teiid.dqp.internal.datamgr.language.SelectSymbolImpl;
+import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.Literal;
+import org.teiid.connector.language.Select;
import com.metamatrix.common.types.DataTypeManager;
@@ -48,12 +45,11 @@
public void testGetColumnDataTypes(){
Class[] expectedResults = new Class[2];
List symbols = new ArrayList();
- symbols.add(new SelectSymbolImpl("c1", new LiteralImpl("3", DataTypeManager.DefaultDataClasses.STRING))); //$NON-NLS-1$//$NON-NLS-2$
+ symbols.add(new DerivedColumn("c1", new Literal("3", DataTypeManager.DefaultDataClasses.STRING))); //$NON-NLS-1$//$NON-NLS-2$
expectedResults[0] = DataTypeManager.DefaultDataClasses.STRING;
- symbols.add(new SelectSymbolImpl("c2", new LiteralImpl(new Integer(5), DataTypeManager.DefaultDataClasses.INTEGER))); //$NON-NLS-1$//$NON-NLS-2$
+ symbols.add(new DerivedColumn("c2", new Literal(new Integer(5), DataTypeManager.DefaultDataClasses.INTEGER))); //$NON-NLS-1$//$NON-NLS-2$
expectedResults[1] = DataTypeManager.DefaultDataClasses.INTEGER;
- ISelect select = new SelectImpl(symbols, false);
- IQuery query = new QueryImpl(select, null, null, null, null, null);
+ Select query = new Select(symbols, false, null, null, null, null, null);
Class[] results = query.getColumnTypes();
assertEquals( results[0], expectedResults[0]);
assertEquals( results[1], expectedResults[1]);
Modified: trunk/test-integration/common/src/test/java/com/metamatrix/jdbc/TestResultsMetadataWithProvider.java
===================================================================
--- trunk/test-integration/common/src/test/java/com/metamatrix/jdbc/TestResultsMetadataWithProvider.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/com/metamatrix/jdbc/TestResultsMetadataWithProvider.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -42,7 +42,7 @@
}
public StaticMetadataProvider exampleProvider() throws Exception {
- MetaDataProcessor processor = new MetaDataProcessor(null, null, null, null, "vdb", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ MetaDataProcessor processor = new MetaDataProcessor(null, null, "vdb", 1); //$NON-NLS-1$
Map col1 = processor.getDefaultColumn("table", "col1", String.class); //$NON-NLS-1$ //$NON-NLS-2$
Map col2 = processor.getDefaultColumn("table", "col2", Integer.class); //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/test-integration/common/src/test/java/com/metamatrix/jdbc/TestStaticMetadataProvider.java
===================================================================
--- trunk/test-integration/common/src/test/java/com/metamatrix/jdbc/TestStaticMetadataProvider.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/com/metamatrix/jdbc/TestStaticMetadataProvider.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -44,7 +44,7 @@
}
private StaticMetadataProvider example1() throws Exception {
- MetaDataProcessor processor = new MetaDataProcessor(null, null, null, null, "vdb", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ MetaDataProcessor processor = new MetaDataProcessor(null, null, "vdb", 1); //$NON-NLS-1$
Map[] columnMetadata = new Map[] {
processor.getDefaultColumn("table", "c1", String.class), //$NON-NLS-1$ //$NON-NLS-2$
processor.getDefaultColumn("table", "c2", Integer.class) //$NON-NLS-1$ //$NON-NLS-2$
Modified: trunk/test-integration/common/src/test/java/com/metamatrix/server/integration/BaseQueryTest.java
===================================================================
--- trunk/test-integration/common/src/test/java/com/metamatrix/server/integration/BaseQueryTest.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/com/metamatrix/server/integration/BaseQueryTest.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -22,7 +22,6 @@
package com.metamatrix.server.integration;
import java.util.List;
-import java.util.Properties;
import junit.framework.TestCase;
@@ -53,10 +52,6 @@
return VDBMetadataFactory.getVDBMetadata(vdbFile);
}
- public static QueryMetadataInterface createMetadata(String vdbFile, String systemVDBFile) {
- return VDBMetadataFactory.getVDBMetadata(new String[] {vdbFile, systemVDBFile});
- }
-
protected void doProcess(QueryMetadataInterface metadata, String sql, CapabilitiesFinder capFinder, ProcessorDataManager dataManager, List[] expectedResults, boolean debug) throws Exception {
CommandContext context = createCommandContext();
context.setProcessDebug(debug);
@@ -77,10 +72,7 @@
}
protected CommandContext createCommandContext() {
- Properties props = new Properties();
- //props.setProperty(ContextProperties.SOAP_HOST, "my.host.com"); //$NON-NLS-1$
- CommandContext context = new CommandContext("0", "test", "user", null, "myvdb", "1", props, false, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-
+ CommandContext context = new CommandContext("0", "test", "user", "myvdb", 1); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
return context;
}
Deleted: trunk/test-integration/common/src/test/java/com/metamatrix/server/integration/TestAdminApi.java
===================================================================
--- trunk/test-integration/common/src/test/java/com/metamatrix/server/integration/TestAdminApi.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/com/metamatrix/server/integration/TestAdminApi.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -1,1233 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.server.integration;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminObject;
-import org.teiid.adminapi.AdminOptions;
-import org.teiid.adminapi.ConnectorBinding;
-import org.teiid.adminapi.ConnectorType;
-import org.teiid.adminapi.EmbeddedLogger;
-import org.teiid.adminapi.ExtensionModule;
-import org.teiid.adminapi.Group;
-import org.teiid.adminapi.LogConfiguration;
-import org.teiid.adminapi.ProcessObject;
-import org.teiid.adminapi.PropertyDefinition;
-import org.teiid.adminapi.Role;
-import org.teiid.adminapi.VDB;
-import org.teiid.runtime.adminapi.Util;
-
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.util.FileUtils;
-import com.metamatrix.core.util.UnitTestUtil;
-import com.metamatrix.jdbc.MMConnection;
-import com.metamatrix.jdbc.api.AbstractMMQueryTestCase;
-
-public class TestAdminApi extends AbstractMMQueryTestCase {
-
- private static final String STAR = "*"; //$NON-NLS-1$
- private static final String PROPS_FILE = UnitTestUtil.getTestDataPath()+"/admin/dqp.properties;user=admin;password=teiid"; //$NON-NLS-1$
- private static final String MEMBERSHIP_PROPS_FILE = UnitTestUtil.getTestDataPath()+"/admin/dqp-membership.properties"; //$NON-NLS-1$
- private static final String BQT = "BQT"; //$NON-NLS-1$
- private static final String ADMIN = "admin"; //$NON-NLS-1$
- private static final String VDB_NAME = "TestEmpty"; //$NON-NLS-1$
- private static final String VDB_FILE = UnitTestUtil.getTestDataPath()+"/admin/TestEmpty.vdb"; //$NON-NLS-1$
-
-
- @Before
- public void setUp() throws Exception {
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/admin/Admin.vdb", UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/Admin.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/ServerConfig.xml", UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/configuration.xml"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private void cleanDeploy() throws Exception {
- Collection<VDB> vdbs = getAdmin().getVDBs(STAR);
- for(VDB vdb:vdbs) {
- if (!vdb.getName().equalsIgnoreCase(ADMIN)) {
- deleteVDB(vdb.getName(), vdb.getVDBVersion());
- }
- }
-
- Collection<ConnectorBinding> bindings = getAdmin().getConnectorBindings(STAR);
- for(ConnectorBinding b:bindings) {
- getAdmin().stopConnectorBinding(b.getIdentifier(), true);
- getAdmin().deleteConnectorBinding(b.getIdentifier());
- }
- }
-
- @Test public void testGetProcess() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- Collection<ProcessObject> processes = getAdmin().getProcesses(STAR);
- assertEquals(1, processes.size());
- assertNotNull(processes.iterator().next().getInetAddress());
- }
-
- // Setting AutoCommit to "false" was failing in the DQP. This was happening because
- // when auto commit is false, it loads a user transaction and that needs a Txn
- // manager which currently not available in the DQP. Currently this has been stubbed
- // not to use the txn messaging in the embedded connection.
- @Test public void testDefect19748_setAutoCommitFalse() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- getAdmin().addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- getAdmin().changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- pushConnection();
- Connection c = getConnection(VDB_NAME, PROPS_FILE);
- try {
- c.setAutoCommit(false);
- execute("select * from smalla"); //$NON-NLS-1$
- }catch(SQLException e) {
- fail("Embedded driver should have let the user set the autocommit=false"); //$NON-NLS-1$
- }
- closeConnection();
- popConnection();
-
- closeConnection();
- }
-
- @Test public void testDefect19748_setAutoCommitFalse_txnoff() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- getAdmin().addVDB(BQT, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- getAdmin().changeVDBStatus(BQT, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- pushConnection();
- Connection c = getConnection(BQT, PROPS_FILE+";txnAutoWrap=OFF"); //$NON-NLS-1$
- try {
- c.setAutoCommit(false);
- execute("select * from smalla"); //$NON-NLS-1$
- assertRowCount(10);
- }catch(SQLException e) {
- fail("Embedded driver should have let the user set the autocommit=false"); //$NON-NLS-1$
- //pass
- }
- closeConnection();
- popConnection();
- closeConnection();
- }
-
- @Test public void testDefect19748_commit_txnoff() throws Exception {
- Connection c = getConnection(ADMIN, PROPS_FILE+";txnAutoWrap=OFF"); //$NON-NLS-1$
- cleanDeploy();
- try {
- c.commit();
- }catch(SQLException e) {
- fail("Embedded driver should have have let the user commit; because of txn off"); //$NON-NLS-1$
- }
- closeConnection();
- }
-
- @Test public void testBindingNames() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- Collection bindings = getAdmin().getConnectorBindings(STAR);
-
- int size = bindings.size();
-
- assertFalse("VDB does not exist", hasVDB(BQT)); //$NON-NLS-1$
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
- assertTrue("VDB does not exist", hasVDB(BQT)); //$NON-NLS-1$
-
- bindings = getAdmin().getConnectorBindings(STAR);
- assertEquals("Two bindings should exist", 2+size, bindings.size()); //$NON-NLS-1$
-
- bindings = getAdmin().getConnectorBindingsInVDB("BQT", "1"); //$NON-NLS-1$
- assertEquals("Two bindings should exist", 2+size, bindings.size()); //$NON-NLS-1$
-
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT2 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
-
- // make sure when the VDB is gone all the enclosed bindings are gone too
- deleteVDB(BQT, "1"); //$NON-NLS-1$
-
- assertFalse("Binding must be available", hasBinding("BQT_1.BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertFalse("Binding must be available", hasBinding("BQT_1.BQT2 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- closeConnection();
- }
-
- @Test public void testDeleteBindings() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- assertFalse("VDB does not exist", hasVDB(BQT)); //$NON-NLS-1$
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- try {
- getAdmin().deleteConnectorBinding("BQT_1.BQT2 Oracle 9i Simple Cap"); //$NON-NLS-1$
- fail("must have failed to delete due to active assosiation to VDB"); //$NON-NLS-1$
- } catch(Exception e) {
- }
-
- getAdmin().assignBindingToModel("BQT_1.BQT1 Oracle 9i Simple Cap", "BQT", "1", "BQT2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- getAdmin().assignBindingToModel("BQT_1.BQT1 Oracle 9i Simple Cap", "BQT", "1", "SP"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- assertFalse("Binding not found", hasBinding("BQT_1.BQT2 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Check that config state has changed
- assertTrue("Binding must be found", hasBinding("BQT_1.BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // make sure when the VDB is gone all the enclosed bindings are gone too
- deleteVDB(BQT, "1"); //$NON-NLS-1$
-
- assertFalse("Binding must be available", hasBinding("BQT_1.BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- closeConnection();
- }
-
- @Test public void testBindingNames_sharedBinding() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- getAdmin().addConnectorBinding("BQT1 Oracle 9i Simple Cap", Util.getCharacterFile(UnitTestUtil.getTestDataPath()+"/admin/BQT1Binding.cdk"), new AdminOptions(AdminOptions.OnConflict.IGNORE)); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertTrue("Binding must be available", hasBinding("BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- assertTrue("VDB does exist", hasVDB(BQT, "1")); //$NON-NLS-1$ //$NON-NLS-2$
-
- Collection bindings = getAdmin().getConnectorBindings(STAR);
- int initialSize = bindings.size();
-
- assertTrue("Binding must be available", hasBinding("BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT2 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- assertTrue("VDB does exist", hasVDB(BQT, "2")); //$NON-NLS-1$ //$NON-NLS-2$
-
- bindings = getAdmin().getConnectorBindings(STAR);
-
- assertTrue("Addtion of the same VDB should", bindings.size()==initialSize); //$NON-NLS-1$
-
- // the bindings are shared
- assertTrue("Binding must be available", hasBinding("BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT2 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- deleteVDB(BQT, "1"); //$NON-NLS-1$
-
- //still bindings are there
- assertTrue("Binding must be available", hasBinding("BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT2 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- deleteVDB(BQT, "2"); //$NON-NLS-1$
-
- // deletion of VDB should remove the bindings specific to VDB?
- assertTrue("Binding must be available", hasBinding("BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertFalse("Binding must be available", hasBinding("BQT_1.BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertFalse("Binding must be available", hasBinding("BQT_1.BQT2 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- getAdmin().deleteConnectorBinding("BQT1 Oracle 9i Simple Cap"); //$NON-NLS-1$
- assertFalse("Binding must not available", hasBinding("BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- closeConnection();
- }
-
-
-
- @Test public void testStartStopConnectorBindings() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
- assertTrue("VDB does not exist", hasVDB(BQT, "1")); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT1 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("BQT_1.BQT2 Oracle 9i Simple Cap")); //$NON-NLS-1$ //$NON-NLS-2$
-
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- execute("SELECT * FROM BQT1.SmallA"); //$NON-NLS-1$
- assertRowCount(50);
- execute("SELECT * FROM System.schemas"); //$NON-NLS-1$
- assertRowCount(9);
- closeConnection();
- popConnection();
-
- getAdmin().stopConnectorBinding("BQT_1.BQT1 Oracle 9i Simple Cap", true); //$NON-NLS-1$
- //calling second time has no effect
- getAdmin().stopConnectorBinding("BQT_1.BQT1 Oracle 9i Simple Cap", true); //$NON-NLS-1$
-
- try {
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- execute("SELECT * FROM BQT1.SmallA"); // this should fail //$NON-NLS-1$
- fail("maust have failed, since the connector is not started."); //$NON-NLS-1$
- }catch(Exception e) {
- //pass
- }finally {
- closeConnection();
- popConnection();
- }
-
- // start the binding using un-qualified, should not start
- try {
- getAdmin().startConnectorBinding("BQT1 Oracle 9i Simple Cap"); //$NON-NLS-1$
- fail("must have failed to start"); //$NON-NLS-1$
- }catch(Exception e) {
- //pass
- }
-
- // start correctly
- getAdmin().startConnectorBinding("BQT_1.BQT1 Oracle 9i Simple Cap"); //$NON-NLS-1$
- // calling second time should have no effect
- getAdmin().startConnectorBinding("BQT_1.BQT1 Oracle 9i Simple Cap"); //$NON-NLS-1$
-
- // test again
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- execute("SELECT * FROM BQT1.SmallA"); //$NON-NLS-1$
- assertRowCount(50);
- closeConnection();
- popConnection();
-
- closeConnection();
- }
-
- @Test public void testStartStopNonExistentConnectorBindings() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- try {
- getAdmin().startConnectorBinding("fakeConnector"); //$NON-NLS-1$
- fail("must have failed to start");//$NON-NLS-1$
- }catch(Exception e) {
- }
-
- try {
- getAdmin().stopConnectorBinding("fakeConnector", true);//$NON-NLS-1$
- fail("must have failed to stop");//$NON-NLS-1$
- }catch(Exception e) {
- }
-
- try {
- getAdmin().deleteConnectorBinding("fakeConnector"); //$NON-NLS-1$
- fail("Must have failed delete a unknown connector"); //$NON-NLS-1$
- }catch(AdminException e) {
- //pass
- }
-
- try {
- getAdmin().exportConnectorBinding("fakeConnector"); //$NON-NLS-1$
- fail("Must have failed exporting a unknown connector"); //$NON-NLS-1$
- }catch(AdminException e) {
- //pass
- }
-
- try {
- getAdmin().assignBindingToModel("fakeConnector", BQT, "1", "BQT1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- fail("Must have failed assigning non-existing binding to the model"); //$NON-NLS-1$
- }catch(AdminException e) {
- //pass
- }
-
- closeConnection();
- }
-
- @Test public void testConnectorTypes() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- Collection<ConnectorType> types = getAdmin().getConnectorTypes(STAR);
- assertEquals("31 types expected", 31, types.size()); //$NON-NLS-1$
-
-
- assertTrue("Should be available", hasConnectorType("Loopback Connector")); //$NON-NLS-1$ //$NON-NLS-2$
-
- getAdmin().deleteConnectorType("Loopback Connector"); //$NON-NLS-1$
-
- assertFalse("must have been deleted", hasConnectorType("Loopback Connector")); //$NON-NLS-1$ //$NON-NLS-2$
-
- try {
- getAdmin().deleteConnectorType("Oracle ANSI JDBC Connector"); //$NON-NLS-1$
- fail("must have failed as this type in use by BQT "); //$NON-NLS-1$
- } catch(Exception e) {
- //pass
- }
-
- try {
- getAdmin().deleteConnectorType("FakeConnector"); //$NON-NLS-1$
- fail("must have failed as this type as this is unknown"); //$NON-NLS-1$
- } catch(Exception e) {
- //pass
- }
-
- getAdmin().addConnectorType("Loopback Connector", Util.getCharacterFile(UnitTestUtil.getTestDataPath()+"/admin/loopback.cdk")); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Should be available", hasConnectorType("Loopback Connector")); //$NON-NLS-1$ //$NON-NLS-2$
-
- try {
- getAdmin().addConnectorType("Loopback Connector", Util.getCharacterFile(UnitTestUtil.getTestScratchPath()+"/loopback.cdk")); //$NON-NLS-1$ //$NON-NLS-2$
- fail("must have fail to add existing type"); //$NON-NLS-1$
- } catch(Exception e) {
- //pass
- }
-
-
- // try exporting
- Util.writeToFile(UnitTestUtil.getTestScratchPath()+"/textfileexport.cdk",getAdmin().exportConnectorType("Text File Connector")); //$NON-NLS-1$ //$NON-NLS-2$
- File cdkFile = new File(UnitTestUtil.getTestScratchPath()+"/textfileexport.cdk"); //$NON-NLS-1$
- assertTrue("Connector type Export should exist", cdkFile.exists()); //$NON-NLS-1$
- cdkFile.delete();
-
- closeConnection();
- }
-
- @Test public void testUpdateConnectorBindingProperty() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
- assertTrue("VDB does not exist", hasVDB(BQT, "1")); //$NON-NLS-1$ //$NON-NLS-2$
-
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- execute("select * from BQT1.smalla"); //$NON-NLS-1$
- assertRowCount(50);
- closeConnection();
- popConnection();
-
- Collection<ConnectorBinding> bindings = getAdmin().getConnectorBindings("BQT_1.BQT1 Oracle 9i Simple Cap"); //$NON-NLS-1$
- for (ConnectorBinding binding:bindings) {
- getAdmin().setConnectorBindingProperty(binding.getIdentifier(), "RowCount", "10"); //$NON-NLS-1$ //$NON-NLS-2$
- getAdmin().stopConnectorBinding(binding.getIdentifier(), true);
- getAdmin().startConnectorBinding(binding.getIdentifier());
- }
-
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- execute("select * from BQT1.smalla"); //$NON-NLS-1$
- assertRowCount(10);
- closeConnection();
- popConnection();
-
- // changes are persistent after the restart too.
- getAdmin().restart();
-
- closeConnection();
-
- getConnection(BQT, PROPS_FILE);
- execute("select * from BQT1.smalla"); //$NON-NLS-1$
- assertRowCount(10);
- closeConnection();
-
- }
-
- @Test public void testVDBAddsConnectorTypes() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- assertFalse(hasVDB(BQT));
-
- if (hasConnectorType("Oracle ANSI JDBC Connector")) { //$NON-NLS-1$
- getAdmin().deleteConnectorType("Oracle ANSI JDBC Connector"); //$NON-NLS-1$
- }
- assertFalse("binding must exist", hasConnectorType("Oracle ANSI JDBC Connector")); //$NON-NLS-1$ //$NON-NLS-2$
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
- assertTrue("VDB does exist", hasVDB(BQT, "1")); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertTrue("connector type must exist", hasConnectorType("Oracle ANSI JDBC Connector")); //$NON-NLS-1$ //$NON-NLS-2$
- deleteVDB(BQT, "1"); //$NON-NLS-1$
- closeConnection();
- }
-
- @Test public void testAdminOptions_addvdb_conflict_ignore() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- // we start out with no bindings
- assertFalse("VDB does not exist", hasVDB("Empty")); //$NON-NLS-1$ //$NON-NLS-2$
-
- getAdmin().addConnectorBinding("Loopback", Util.getCharacterFile(UnitTestUtil.getTestDataPath()+"/admin/loopback.cdk"), new AdminOptions(AdminOptions.OnConflict.IGNORE)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("Loopback")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // we add a vdb, loop back which returns 10 rows
- addVDB("Empty", UnitTestUtil.getTestDataPath()+"/admin/TestEmpty.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("VDB does not exist", hasVDB("Empty", "1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- pushConnection();
- getConnection("Empty", PROPS_FILE); //$NON-NLS-1$
- execute("SELECT * FROM Oracle.SmallA"); //$NON-NLS-1$
- assertRowCount(1);
- closeConnection();
- popConnection();
-
- getAdmin().restart();
-
- closeConnection();
-
- getConnection("Empty", PROPS_FILE); //$NON-NLS-1$
- execute("SELECT * FROM Oracle.SmallA"); //$NON-NLS-1$
- assertRowCount(1);
- closeConnection();
-
- }
-
-
- @Test public void testAdminOptions_addvdb_conflict_overwrite() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- // we start out with no bindings
- assertFalse("VDB does not exist", hasVDB("Empty")); //$NON-NLS-1$ //$NON-NLS-2$
-
- getAdmin().addConnectorBinding("Loopback", Util.getCharacterFile(UnitTestUtil.getTestDataPath()+"/admin/loopback.cdk"), new AdminOptions(AdminOptions.OnConflict.IGNORE)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("Loopback")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // we add a vdb, loop back which returns 10 rows
- getAdmin().addVDB("Empty", Util.getBinaryFile(UnitTestUtil.getTestDataPath()+"/admin/TestEmpty.vdb"), new AdminOptions(AdminOptions.OnConflict.OVERWRITE)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("VDB does not exist", hasVDB("Empty", "1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- pushConnection();
- getConnection("Empty", PROPS_FILE); //$NON-NLS-1$
- execute("SELECT * FROM Oracle.SmallA"); //$NON-NLS-1$
- assertRowCount(10);
- closeConnection();
- popConnection();
-
- getAdmin().restart();
-
- pushConnection();
- getConnection("Empty", PROPS_FILE); //$NON-NLS-1$
- execute("SELECT * FROM Oracle.SmallA"); //$NON-NLS-1$
- assertRowCount(10);
- closeConnection();
- popConnection();
- }
-
-
- @Test public void testAdminOptions_addvdb_conflict_Exception() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- // we start out with no bindings
- assertFalse("VDB does not exist", hasVDB("Empty")); //$NON-NLS-1$ //$NON-NLS-2$
-
- getAdmin().addConnectorBinding("Loopback", Util.getCharacterFile(UnitTestUtil.getTestDataPath()+"/admin/loopback.cdk"), new AdminOptions(AdminOptions.OnConflict.IGNORE)); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Binding must be available", hasBinding("Loopback")); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertFalse("VDB does not exist", hasVDB("Empty", "1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- // we add a vdb, loop back which returns 10 rows
- try {
- // we add a vdb, loop back which returns 10 rows
- getAdmin().addVDB("Empty", Util.getBinaryFile(UnitTestUtil.getTestDataPath()+"/admin/TestEmpty.vdb"), new AdminOptions(AdminOptions.OnConflict.EXCEPTION)); //$NON-NLS-1$ //$NON-NLS-2$
- fail("Must have failed to Add a vdb, as loopback already exists"); //$NON-NLS-1$
- }catch(AdminException e) {
- // pass
- }
-
- assertFalse("VDB does not exist", hasVDB("Empty", "1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- closeConnection();
- }
-
- @Test public void testGetSessions() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- assertEquals(1, getAdmin().getSessions(STAR).size());
-
- for (int i = 0; i < 10; i++) {
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- }
-
- assertEquals(11, getAdmin().getSessions(STAR).size());
-
- for (int i = 0; i < 10; i++) {
- closeConnection();
- popConnection();
- }
-
- assertEquals(1, getAdmin().getSessions(STAR).size());
-
- closeConnection();
- }
-
- @Test public void testSessionTermination() throws Exception {
- com.metamatrix.jdbc.api.Connection c = getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- assertEquals(1, getAdmin().getSessions(STAR).size());
-
- pushConnection();
- MMConnection c2 = (MMConnection)getConnection(BQT, PROPS_FILE);
- execute("SELECT * FROM BQT1.SmallA"); //$NON-NLS-1$
- assertRowCount(50);
-
- // terminate the session
- c.getAdminAPI().terminateSession(c2.getConnectionId());
-
- // make sure it is gone
- assertEquals(1, c.getAdminAPI().getSessions(STAR).size());
-
- try {
- execute("SELECT * FROM BQT1.SmallA"); //$NON-NLS-1$
- fail("must have failed to execute"); //$NON-NLS-1$
- }catch(Exception e) {
- // success
- try {
- closeConnection();
- } catch (Exception e1) {
- }
- }
-
- popConnection();
- closeConnection();
- }
-
- @Test public void testAddExtensionModules() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- assertFalse(hasExtensionModule("Loopy.jar")); //$NON-NLS-1$
-
- getAdmin().addExtensionModule("JAR File", "Loopy.jar", Util.getBinaryFile(UnitTestUtil.getTestDataPath()+"/admin/loopbackconn.jar"), "JAR File"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- assertTrue("Expected extension module", hasExtensionModule("Loopy.jar")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // try to add a duplicate
- try {
- getAdmin().addExtensionModule("JAR File", "Loopy.jar", Util.getBinaryFile(UnitTestUtil.getTestDataPath()+"/admin/loopbackconn.jar"), "JAR File"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- fail("should have failed to add the extension module as it is duplicate"); //$NON-NLS-1$
- } catch(Exception e) {
- //pass
- }
-
- //export the extension
- Util.writeToFile(UnitTestUtil.getTestScratchPath()+"/ext.jar", getAdmin().exportExtensionModule("Loopy.jar")); //$NON-NLS-1$ //$NON-NLS-2$
- File f = new File(UnitTestUtil.getTestScratchPath()+"/ext.jar"); //$NON-NLS-1$
- assertTrue(f.exists());
- f.delete();
-
- // delete the extension
- getAdmin().deleteExtensionModule("Loopy.jar"); //$NON-NLS-1$
-
- // Assert that no vdb with this name exists
- assertFalse("Expected no prior extension module", hasExtensionModule("Loopy.jar")); //$NON-NLS-1$ //$NON-NLS-2$
-
- closeConnection();
- }
-
- @Test public void testExportConfiguration() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- Util.writeToFile(UnitTestUtil.getTestScratchPath()+"/serverconfigexport.properties", getAdmin().exportConfiguration()); //$NON-NLS-1$
- File f = new File(UnitTestUtil.getTestScratchPath()+"/serverconfigexport.properties"); //$NON-NLS-1$
- assertTrue("Exported configuration must exist", f.exists()); //$NON-NLS-1$
- //f.delete();
- closeConnection();
- }
-
- // Test exporting VDB and adding the same VDB and make sure it exported correctly
- @Test public void testExportVDB() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- // Assert that no vdb with this name exists
- assertFalse("Expected no prior VDB", hasVDB(BQT)); //$NON-NLS-1$
-
- // Add .VDB with included .DEF
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- // Check that config state has changed
- assertTrue("Expected new VDB", hasVDB(BQT)); //$NON-NLS-1$
-
- // Export the VDB
- Util.writeToFile(UnitTestUtil.getTestScratchPath()+"/bqtexport.vdb", getAdmin().exportVDB(BQT, "1")); //$NON-NLS-1$ //$NON-NLS-2$
-
- closeConnection();
-
- // Assert bqt.vdb exists
- File f = new File(UnitTestUtil.getTestScratchPath()+"/bqtexport.vdb"); //$NON-NLS-1$
- assertTrue(f.exists());
- f.delete();
- }
-
- @Test public void testVDBModified() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- // make susre it exists as file
- File vdb = new File(UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/BQT_1.vdb"); //$NON-NLS-1$
- assertTrue("Persisted VDB file does not exists", vdb.exists()); //$NON-NLS-1$
-
- // Check when it last modified
- long modified = vdb.lastModified();
- Thread.sleep(1000);
- getAdmin().assignBindingToModel("BQT_1.BQT1 Oracle 9i Simple Cap", BQT, "1", "BQT2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- // the deployed VDB is modified not the original vdb
- assertTrue(vdb.lastModified() == modified);
-
- closeConnection();
- }
-
- @Test public void testIncompleteVDB() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- VDB vdb = getAdmin().addVDB(BQT, Util.getBinaryFile(UnitTestUtil.getTestDataPath()+"/admin/Empty.vdb"), new AdminOptions (AdminOptions.OnConflict.IGNORE)); //$NON-NLS-1$
-
- assertTrue("Status must have been INCOMPLTE", !(vdb.getState() == VDB.ACTIVE)); //$NON-NLS-1$
-
- try {
- getAdmin().changeVDBStatus(BQT, "1", VDB.ACTIVE); //$NON-NLS-1$
- fail("must have failed to set status to active"); //$NON-NLS-1$
- } catch(Exception e) {
-
- }
-
- pushConnection();
- try {
- getConnection(BQT, PROPS_FILE);
- fail("must have failed to get connection"); //$NON-NLS-1$
- }catch(Exception e) {
-
- }
- popConnection();
-
- getAdmin().addConnectorBinding("Loopback", Util.getCharacterFile(UnitTestUtil.getTestDataPath()+"/admin/loopback.cdk"), new AdminOptions(AdminOptions.OnConflict.OVERWRITE)); //$NON-NLS-1$ //$NON-NLS-2$
- getAdmin().startConnectorBinding("Loopback"); //$NON-NLS-1$
- getAdmin().assignBindingToModel("Loopback", BQT, "1", "Oracle"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- getAdmin().changeVDBStatus(BQT, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- closeConnection();
- popConnection();
-
- closeConnection();
- }
-
- @Test public void testUseLatestVersion() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- // this returns 50 rows
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- // this returns 10 row
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/TestEmpty.vdb"); //$NON-NLS-1$
-
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- execute("select * from Oracle.smalla"); //$NON-NLS-1$
- assertRowCount(10);
- closeConnection();
- popConnection();
- closeConnection();
- }
-
- @Test public void testDeleteVDBHavingActiveConnection() throws Exception {
- helpDeleteVDBHavingActiveConnection(false);
- helpDeleteVDBHavingActiveConnection(true);
- }
-
- // Test to delete a VDB with active connection to it
- // 1) we should be able to delete the vdb; hasVDB should return false
- // 2) should be able to continue the old connection, as it is
- // 3) No new connections are allowed
- // 4) if you add another VDB with same name, it can be given different version
- // 5) The old one can not switch over to the new connection.
- void helpDeleteVDBHavingActiveConnection(boolean terminate) throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- // this returns 50 rows
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- assertTrue("VDB does not exist", hasVDB(BQT)); //$NON-NLS-1$
-
- // make another context and create a 2nd connection
- pushConnection();
- MMConnection vdbConn = (MMConnection)getConnection("bqt", PROPS_FILE);
- execute("SELECT * FROM BQT1.SmallA"); //$NON-NLS-1$
- assertRowCount(50);
- // we have not closed the connection here, kept active connection
- popConnection();
-
- // testcase (1) (here the file should still exist; but report as non existent from API)
- deleteVDB(BQT, "1"); //$NON-NLS-1$
- assertFalse("VDB should exist because we still have an active user", hasVDB(BQT, "1")); //$NON-NLS-1$ //$NON-NLS-2$
- File f = new File(UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/BQT_1.vdb"); //$NON-NLS-1$
- assertTrue("since the connection is still open this file should exist", f.exists()); //$NON-NLS-1$
-
- // testcase (2)
- // switch to 2nd connection and try to execute, since we did not close it should work fine
- pushConnection();
- setConnection(vdbConn);
- execute("SELECT * FROM BQT1.SmallA"); //$NON-NLS-1$
- assertRowCount(50);
- popConnection();
-
- // testcase (3)
- // try to make third connection and should fail, because we do not allow connections
- // to non-active vdbs
- pushConnection();
- try {
- getConnection(BQT, PROPS_FILE);
- fail("Must have failed to connect to the VDB as it is deleted"); //$NON-NLS-1$
- }catch(Exception e) {
- // yes failed to connect
- }
- popConnection();
-
- // testcase (4)
- // Add the VDB again to the configuration it should give new version
- getAdmin().addVDB(BQT, Util.getBinaryFile(UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"), new AdminOptions(AdminOptions.OnConflict.IGNORE)); //$NON-NLS-1$
- assertTrue("Empty VDB must exist", hasVDB(BQT, "2")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // testcase (5)
- // try to execute the 2nd connection, it should still go after the deleted vdb
- // as we keep until this connections goes dead.
- pushConnection();
- setConnection(vdbConn);
- execute("SELECT * FROM BQT1.SmallA"); //$NON-NLS-1$
- assertRowCount(50);
- popConnection();
-
- // now make a 4th new connection this should work
- pushConnection();
- getConnection(BQT, PROPS_FILE+";version=2"); //$NON-NLS-1$
- execute("SELECT * FROM BQT1.SmallA"); //$NON-NLS-1$
- assertRowCount(50);
- closeConnection();
- popConnection();
-
- if (terminate) {
- getAdmin().terminateSession(vdbConn.getConnectionId());
- }
- else {
- // clean up 2nd connection
- pushConnection();
- setConnection(vdbConn);
- closeConnection();
- assertFalse("The vdb must have deleted as the connection closed", f.exists()); //$NON-NLS-1$
- popConnection();
- }
-
- // now make a 5th new connection this should work
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- execute("SELECT * FROM BQT1.SmallA"); //$NON-NLS-1$
- assertRowCount(50);
- closeConnection();
- popConnection();
-
- // here it should be gone we call delete
- deleteVDB(BQT, "2"); //$NON-NLS-1$
- assertFalse("VDB should exist because we still have an active user", hasVDB(BQT, "2")); //$NON-NLS-1$ //$NON-NLS-2$
- f = new File(UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/BQT_2.vdb"); //$NON-NLS-1$
- assertFalse("since the connection is still open this file should exist", f.exists()); //$NON-NLS-1$
-
- // close the 1st connection
- closeConnection();
- }
-
- private void helpConnectorBindingAddTest(int option, int rows) throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- // this returns 50 rows
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/TestEmpty.vdb"); //$NON-NLS-1$
-
- getAdmin().addConnectorBinding("Loopback", Util.getCharacterFile(UnitTestUtil.getTestDataPath()+"/admin/loopback.cdk"), new AdminOptions(option)); //$NON-NLS-1$ //$NON-NLS-2$
-
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- execute("SELECT * FROM Oracle.SmallA"); //$NON-NLS-1$
- assertRowCount(rows);
- closeConnection();
- popConnection();
- }
-
- @Test public void testConnectorBindingAdd_optionIgnore() throws Exception {
- helpConnectorBindingAddTest(AdminOptions.OnConflict.IGNORE, 10);
- }
-
- @Test public void testConnectorBindingAdd_optionException() throws Exception {
- try {
- helpConnectorBindingAddTest(AdminOptions.OnConflict.EXCEPTION, 10);
- fail("Must have failed to add connector"); //$NON-NLS-1$
- } catch(Exception e) {
-
- }
- }
-
- @Test public void testConnectorBindingAdd_optionOverwrite() throws Exception {
- helpConnectorBindingAddTest(AdminOptions.OnConflict.OVERWRITE, 1);
- }
-
- @Test public void testAddConnectorBindingWithProperties() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- // this returns 50 rows
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/TestEmpty.vdb"); //$NON-NLS-1$
-
- Properties props = new Properties();
-
- props.setProperty("MaxResultRows","10000"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("ConnectorThreadTTL", "120000"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("ConnectorMaxThreads","5"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("metamatrix.service.essentialservice", "false"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("ConnectorClassPath","extensionjar:loopbackconn.jar;extensionjar:jdbcconn.jar"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("RowCount","12"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("ServiceClassName","com.metamatrix.server.connector.service.ConnectorService"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("ConnectorClass","com.metamatrix.connector.loopback.LoopbackConnector"); //$NON-NLS-1$ //$NON-NLS-2$
- props.setProperty("WaitTime", "0"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Add the connector binding
- getAdmin().addConnectorBinding("Loopy", "Loopback Connector", props, new AdminOptions(AdminOptions.OnConflict.OVERWRITE)); //$NON-NLS-1$ //$NON-NLS-2$
-
- assertTrue("Connector binding must exist", hasBinding("Loopy")); //$NON-NLS-1$ //$NON-NLS-2$
-
- getAdmin().assignBindingToModel("Loopy", "BQT", "1", "Oracle"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- getAdmin().startConnectorBinding("Loopy"); //$NON-NLS-1$
-
- pushConnection();
- getConnection(BQT, PROPS_FILE);
- execute("SELECT * FROM Oracle.SmallA"); //$NON-NLS-1$
- assertRowCount(12);
- closeConnection();
- popConnection();
-
- closeConnection();
- }
-
- @Test public void testConnectorArchive() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- // this returns 50 rows
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- assertFalse(hasConnectorType("Loopback")); //$NON-NLS-1$
- assertFalse(hasExtensionModule("jdbcconn.jar")); //$NON-NLS-1$
- assertFalse(hasExtensionModule("loopbackconn.jar")); //$NON-NLS-1$
-
- getAdmin().addConnectorArchive(Util.getBinaryFile(UnitTestUtil.getTestDataPath()+"/admin/loopback_archive.caf"), new AdminOptions(AdminOptions.OnConflict.IGNORE)); //$NON-NLS-1$
-
- assertTrue(hasConnectorType("Loopback")); //$NON-NLS-1$
- assertTrue(hasExtensionModule("jdbcconn.jar")); //$NON-NLS-1$
- assertTrue(hasExtensionModule("loopbackconn.jar")); //$NON-NLS-1$
-
- File f = new File(UnitTestUtil.getTestScratchPath()+"/loopback_archive.caf"); //$NON-NLS-1$
- Util.writeToFile(f.getCanonicalPath(), getAdmin().exportConnectorArchive("Loopback")); //$NON-NLS-1$
- assertTrue(f.exists());
- f.delete();
-
- getAdmin().deleteExtensionModule("jdbcconn.jar"); //$NON-NLS-1$
- getAdmin().deleteExtensionModule("loopbackconn.jar"); //$NON-NLS-1$
- getAdmin().deleteConnectorType("Loopback"); //$NON-NLS-1$
-
- assertFalse(hasConnectorType("Loopback")); //$NON-NLS-1$
- assertFalse(hasExtensionModule("jdbcconn.jar")); //$NON-NLS-1$
- assertFalse(hasExtensionModule("loopbackconn.jar")); //$NON-NLS-1$
-
- closeConnection();
- }
-
- public class MyLogger implements EmbeddedLogger{
- StringBuffer sb = new StringBuffer();
- public void log(int logLevel, long timestamp, String componentName, String threadName, String message, Throwable throwable) {
- sb.append("logLevel=").append(logLevel); //$NON-NLS-1$
- sb.append("message=").append(message); //$NON-NLS-1$
- }
-
- public String getLog() {
- return sb.toString();
- }
- }
-
- @Test public void testLogListener() throws Exception {
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
-
- MyLogger log = new MyLogger();
-
- getAdmin().setLogListener(log);
- //force a critical log
- LogConfiguration c = getAdmin().getLogConfiguration();
- for(String context:c.getContexts()) {
- c.setLogLevel(context, LogConfiguration.DETAIL);
- }
- getAdmin().setLogConfiguration(c);
-
- // this returns 50 rows
- addVDB(BQT, UnitTestUtil.getTestDataPath()+"/admin/QT_Ora9DSwDEF.vdb"); //$NON-NLS-1$
-
- assertTrue("Log should not be empty", log.getLog().length() > 0); //$NON-NLS-1$
- closeConnection();
- }
-
- @Test public void testPropertyDefinitions() throws Exception{
- getConnection(ADMIN, PROPS_FILE);
- cleanDeploy();
-
- Collection<ConnectorType> c = getAdmin().getConnectorTypes("Oracle Connector"); //$NON-NLS-1$
- Collection<PropertyDefinition> defs = getAdmin().getConnectorTypePropertyDefinitions(c.iterator().next().getIdentifier());
-
- for (PropertyDefinition d:defs) {
- if (d.getName().equalsIgnoreCase("URL")) { //$NON-NLS-1$
- assertTrue(d.isRequired());
- assertTrue(d.getDefaultValue() != null);
- assertEquals("JDBC URL", d.getDisplayName()); //$NON-NLS-1$
- assertEquals("String", d.getPropertyType()); //$NON-NLS-1$
- assertEquals("java.lang.String", d.getPropertyTypeClassName()); //$NON-NLS-1$
- assertTrue(d.getAllowedValues().isEmpty());
- assertTrue(!d.isMasked());
- }
-
- if (d.getName().equalsIgnoreCase("Password")) { //$NON-NLS-1$
- assertTrue(d.isMasked());
- }
- }
-
- closeConnection();
- }
-
- @Test public void testGetRolesForGroup() throws Exception {
- getConnection(ADMIN, MEMBERSHIP_PROPS_FILE, ";user=admin;password=teiid"); //$NON-NLS-1$
- cleanDeploy();
-
- Collection<Role> r = getAdmin().getRolesForGroup("group1 at file");//$NON-NLS-1$
- assertTrue(!r.isEmpty());
- assertEquals(Role.ADMIN_SYSTEM, r.iterator().next().getIdentifier());
-
- try {
- r = getAdmin().getRolesForGroup("unknown");//$NON-NLS-1$
- fail("must have failed to fetch the group"); //$NON-NLS-1$
- }catch(Exception e) {
-
- }
- assertTrue(!r.isEmpty());
-
- closeConnection();
- }
-
- @Test public void testGetGroupsForUser() throws Exception {
- getConnection(ADMIN, MEMBERSHIP_PROPS_FILE, ";user=admin;password=teiid"); //$NON-NLS-1$
- cleanDeploy();
-
- Collection<Group> g = getAdmin().getGroupsForUser("paul at file"); //$NON-NLS-1$
- assertEquals(2, g.size());
- Iterator<Group> i = g.iterator();
- assertEquals("group4 at file", i.next().getIdentifier()); //$NON-NLS-1$
- assertEquals("group1 at file", i.next().getIdentifier()); //$NON-NLS-1$
-
- // with out the @file
- g = getAdmin().getGroupsForUser("paul"); //$NON-NLS-1$
- assertEquals(2, g.size());
-
- try {
- g = getAdmin().getGroupsForUser("unknown");//$NON-NLS-1$
- fail("should failed to resolve the unknown user"); //$NON-NLS-1$
- }catch(Exception e) {
- }
-
- closeConnection();
- }
-
- @Test public void testGetGroups() throws Exception {
- getConnection(ADMIN, MEMBERSHIP_PROPS_FILE, ";user=admin;password=teiid"); //$NON-NLS-1$
- cleanDeploy();
-
- Collection<Group> g = getAdmin().getGroups("*"); //$NON-NLS-1$
- assertEquals(4, g.size());
-
- closeConnection();
- }
-
- @Test public void testGetDomainNames() throws Exception {
- getConnection(ADMIN, MEMBERSHIP_PROPS_FILE, ";user=admin;password=teiid"); //$NON-NLS-1$
- cleanDeploy();
-
- List<String> g = getAdmin().getDomainNames();
- assertEquals(1, g.size());
- assertEquals("file", g.get(0)); //$NON-NLS-1$
- closeConnection();
- }
-
- @Test public void testGetGroupsForDomain() throws Exception {
- getConnection(ADMIN, MEMBERSHIP_PROPS_FILE, ";user=admin;password=teiid"); //$NON-NLS-1$
- cleanDeploy();
-
- Collection<Group> g = getAdmin().getGroupsForDomain("file"); //$NON-NLS-1$
- assertEquals(4, g.size());
-
- g = getAdmin().getGroupsForDomain("unknown"); //$NON-NLS-1$
- assertEquals(0, g.size());
-
- closeConnection();
- }
-
-
-
- VDB addVDB(String name, String vdbFile) {
- try {
- return getAdmin().addVDB(name, Util.getBinaryFile(vdbFile), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- } catch (Exception e) {
- e.printStackTrace();
- throw new MetaMatrixRuntimeException();
- }
- }
-
- /**
- * Checks to make sure the given VDB exists in the system
- * @param vdbName - name of the VDB
- * @return boolean - true if exists; false otherwise
- */
- boolean hasVDB(String vdbName) {
- try {
- Collection<VDB> vdbs = getAdmin().getVDBs(vdbName);
- for (VDB vdb:vdbs) {
- if (vdb.getName().equals(vdbName)) {
- return true;
- }
- }
- } catch (AdminException e) {
- }
- return false;
- }
-
- /**
- * Checks to make sure the given VDB with version exists in the system
- * @param vdbName - name of the VDB
- * @param version - version of the VDB
- * @return boolean - true if exists; false otherwise
- */
- boolean hasVDB(String vdbName, String version) {
- try {
- Collection<VDB> vdbs = getAdmin().getVDBs(vdbName);
- for (VDB vdb:vdbs) {
- if (vdb.getName().equals(vdbName) && vdb.getVDBVersion().equals(version)) {
- return true;
- }
- }
- } catch (AdminException e) {
- }
- return false;
- }
-
- /**
- * Checks to make sure the given binging exists.
- * @param bindingName - Name of the Binding.
- * @return boolean - true if exists; false otherwise
- */
- boolean hasBinding(String bindingName) {
- try {
- Collection<ConnectorBinding> bindings = getAdmin().getConnectorBindings(AdminObject.WILDCARD + AdminObject.DELIMITER + bindingName);
- for (ConnectorBinding binding:bindings) {
- if (binding.getName().equals(bindingName)) {
- return true;
- }
- }
- } catch (AdminException e) {
- e.printStackTrace();
- }
- return false;
- }
-
- /**
- * Checks if given Connector Type exists in system
- * @param typeName - Binding type name
- * @return boolean - true if exists; false otherwise
- */
- boolean hasConnectorType(String typeName) {
- try {
- Collection<ConnectorType> types = getAdmin().getConnectorTypes(typeName);
- for (ConnectorType type:types) {
- if (type.getName().equals(typeName)) {
- return true;
- }
- }
- } catch (AdminException e) {
- }
- return false;
- }
-
- /**
- * Checks if given Extension Module exists in system
- * @param name - Extension Module name
- * @return boolean - true if exists; false otherwise
- */
- boolean hasExtensionModule(String name) {
- try {
- Collection<ExtensionModule> modules = getAdmin().getExtensionModules(name);
- for(ExtensionModule module:modules) {
- if (module.getName().equals(name)) {
- return true;
- }
- }
- }catch(Exception e) {}
- return false;
- }
-
- void deleteVDB(String name, String version) {
- try {
- getAdmin().changeVDBStatus(name, version, VDB.DELETED);
- } catch (AdminException e) {
- throw new MetaMatrixRuntimeException();
- }
- }
-}
Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/language/TestLanguageUtil.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/language/TestLanguageUtil.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/language/TestLanguageUtil.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -26,13 +26,9 @@
import java.util.List;
import java.util.Set;
-import org.teiid.connector.language.ICriteria;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.LanguageUtil;
-import org.teiid.dqp.internal.datamgr.language.LanguageFactoryImpl;
-
import junit.framework.TestCase;
+
import com.metamatrix.cdk.api.TranslationUtility;
import com.metamatrix.cdk.unittest.FakeTranslationFactory;
@@ -48,17 +44,17 @@
super(name);
}
- private ICriteria convertCriteria(String criteriaStr) {
+ private Condition convertCriteria(String criteriaStr) {
// Create ICriteria from criteriaStr
TranslationUtility util = FakeTranslationFactory.getInstance().getBQTTranslationUtility();
String sql = "SELECT IntKey FROM BQT1.SmallA WHERE " + criteriaStr; //$NON-NLS-1$
- IQuery query = (IQuery) util.parseCommand(sql);
- ICriteria criteria = query.getWhere();
+ Select query = (Select) util.parseCommand(sql);
+ Condition criteria = query.getWhere();
return criteria;
}
public void helpTestSeparateByAnd(String criteriaStr, String[] expected) throws Exception {
- ICriteria criteria = convertCriteria(criteriaStr);
+ Condition criteria = convertCriteria(criteriaStr);
// Execute
List crits = LanguageUtil.separateCriteriaByAnd(criteria);
@@ -101,11 +97,11 @@
}
public void helpTestCombineCriteria(String primaryStr, String additionalStr, String expected) throws Exception {
- ICriteria primaryCrit = (primaryStr == null ? null : convertCriteria(primaryStr));
- ICriteria additionalCrit = (additionalStr == null ? null : convertCriteria(additionalStr));
+ Condition primaryCrit = (primaryStr == null ? null : convertCriteria(primaryStr));
+ Condition additionalCrit = (additionalStr == null ? null : convertCriteria(additionalStr));
// Execute
- ICriteria crit = LanguageUtil.combineCriteria(primaryCrit, additionalCrit, LanguageFactoryImpl.INSTANCE);
+ Condition crit = LanguageUtil.combineCriteria(primaryCrit, additionalCrit, LanguageFactory.INSTANCE);
// Compare
String critStr = (crit == null ? null : crit.toString());
Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/MockConnector.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/MockConnector.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/MockConnector.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -7,7 +7,6 @@
import org.mockito.Mockito;
import org.teiid.connector.api.Connection;
import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.ProcedureExecution;
@@ -15,14 +14,13 @@
import org.teiid.connector.basic.BasicConnection;
import org.teiid.connector.basic.BasicConnector;
import org.teiid.connector.basic.BasicConnectorCapabilities;
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQueryCommand;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.metadata.runtime.Element;
-import org.teiid.connector.metadata.runtime.MetadataObject;
-import org.teiid.connector.metadata.runtime.RuntimeMetadata;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.QueryExpression;
+import org.teiid.connector.metadata.runtime.BaseColumn.NullType;
+import org.teiid.connector.metadata.runtime.Column.SearchType;
public class MockConnector extends BasicConnector {
@@ -33,7 +31,7 @@
}
@Override
- public Connection getConnection(ExecutionContext context) throws ConnectorException {
+ public Connection getConnection() throws ConnectorException {
return new BasicConnection() {
@Override
public void close() {
@@ -42,12 +40,12 @@
@Override
public ProcedureExecution createProcedureExecution(
- IProcedure procedure, ExecutionContext executionContext,
+ Call procedure, ExecutionContext executionContext,
RuntimeMetadata metadata) throws ConnectorException {
Properties props = new Properties();
props.setProperty("customBehaviour", "SkipExecute");//$NON-NLS-1$ //$NON-NLS-2$
- MetadataObject metaObject = procedure.getMetadataObject();
+ AbstractMetadataRecord metaObject = procedure.getMetadataObject();
TestCase.assertEquals("AnyModel.ProcedureB",procedure.getProcedureName()); //$NON-NLS-1$
TestCase.assertEquals("PROC", metaObject.getNameInSource()); //$NON-NLS-1$
@@ -59,18 +57,18 @@
@Override
public ResultSetExecution createResultSetExecution(
- IQueryCommand query, ExecutionContext executionContext,
+ QueryExpression query, ExecutionContext executionContext,
RuntimeMetadata metadata) throws ConnectorException {
Properties groupProps = new Properties();
groupProps.setProperty("customName", "CustomTableA");//$NON-NLS-1$ //$NON-NLS-2$
- IGroup group = (IGroup)query.getProjectedQuery().getFrom().getItems().get(0);
- MetadataObject groupMD = group.getMetadataObject();
+ NamedTable group = (NamedTable)query.getProjectedQuery().getFrom().get(0);
+ AbstractMetadataRecord groupMD = group.getMetadataObject();
TestCase.assertEquals(groupProps, groupMD.getProperties());
- ISelectSymbol symbl = (ISelectSymbol)query.getProjectedQuery().getSelect().getSelectSymbols().get(0);
- IElement element = (IElement)symbl.getExpression();
- Element elementMD = element.getMetadataObject();
+ DerivedColumn symbl = query.getProjectedQuery().getDerivedColumns().get(0);
+ ColumnReference element = (ColumnReference)symbl.getExpression();
+ Column elementMD = element.getMetadataObject();
Properties elementProps = new Properties();
elementProps.setProperty("customPosition", "11");//$NON-NLS-1$ //$NON-NLS-2$
@@ -81,24 +79,24 @@
TestCase.assertEquals(String.class, elementMD.getJavaType());
TestCase.assertEquals(null, elementMD.getMaximumValue());
TestCase.assertEquals(null, elementMD.getMinimumValue());
- TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#anySimpleType", elementMD.getModeledBaseType()); //$NON-NLS-1$
- TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#string", elementMD.getModeledPrimitiveType()); //$NON-NLS-1$
- TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#string", elementMD.getModeledType()); //$NON-NLS-1$
+ TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#anySimpleType", elementMD.getBaseTypeID()); //$NON-NLS-1$
+ TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#string", elementMD.getPrimitiveTypeID()); //$NON-NLS-1$
+ TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#string", elementMD.getDatatypeID()); //$NON-NLS-1$
TestCase.assertEquals("COLUMN1", elementMD.getNameInSource()); //$NON-NLS-1$
TestCase.assertEquals("STR", elementMD.getNativeType()); //$NON-NLS-1$
- TestCase.assertEquals(1, elementMD.getNullability());
+ TestCase.assertEquals(NullType.Nullable, elementMD.getNullType());
TestCase.assertEquals(0, elementMD.getPosition());
TestCase.assertEquals(0, elementMD.getPrecision());
TestCase.assertEquals(0, elementMD.getScale());
- TestCase.assertEquals(3, elementMD.getSearchability());
+ TestCase.assertEquals(SearchType.Searchable, elementMD.getSearchType());
TestCase.assertEquals(false, elementMD.isAutoIncremented());
TestCase.assertEquals(true, elementMD.isCaseSensitive());
TestCase.assertEquals(elementProps, elementMD.getProperties());
- ISelectSymbol symbl2 = (ISelectSymbol)query.getProjectedQuery().getSelect().getSelectSymbols().get(1);
- IElement element2 = (IElement)symbl2.getExpression();
- Element elementMD2 = element2.getMetadataObject();
+ DerivedColumn symbl2 = query.getProjectedQuery().getDerivedColumns().get(1);
+ ColumnReference element2 = (ColumnReference)symbl2.getExpression();
+ Column elementMD2 = element2.getMetadataObject();
Properties elementProps2 = new Properties();
elementProps2.setProperty("customPosition", "12");//$NON-NLS-1$ //$NON-NLS-2$
@@ -109,16 +107,16 @@
TestCase.assertEquals(Integer.class, elementMD2.getJavaType());
TestCase.assertEquals("1", elementMD2.getMaximumValue()); //$NON-NLS-1$
TestCase.assertEquals("100", elementMD2.getMinimumValue()); //$NON-NLS-1$
- TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#long", elementMD2.getModeledBaseType()); //$NON-NLS-1$
- TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#decimal", elementMD2.getModeledPrimitiveType()); //$NON-NLS-1$
- TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#int", elementMD2.getModeledType()); //$NON-NLS-1$
+ TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#long", elementMD2.getBaseTypeID()); //$NON-NLS-1$
+ TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#decimal", elementMD2.getPrimitiveTypeID()); //$NON-NLS-1$
+ TestCase.assertEquals("http://www.w3.org/2001/XMLSchema#int", elementMD2.getDatatypeID()); //$NON-NLS-1$
TestCase.assertEquals("COLUMN2", elementMD2.getNameInSource()); //$NON-NLS-1$
TestCase.assertEquals("INT", elementMD2.getNativeType()); //$NON-NLS-1$
- TestCase.assertEquals(0, elementMD2.getNullability());
+ TestCase.assertEquals(NullType.No_Nulls, elementMD2.getNullType());
TestCase.assertEquals(1, elementMD2.getPosition());
TestCase.assertEquals(0, elementMD2.getPrecision());
TestCase.assertEquals(10, elementMD2.getScale());
- TestCase.assertEquals(3, elementMD2.getSearchability());
+ TestCase.assertEquals(SearchType.Searchable, elementMD2.getSearchType());
TestCase.assertEquals(true, elementMD2.isAutoIncremented());
TestCase.assertEquals(false, elementMD2.isCaseSensitive());
@@ -131,13 +129,4 @@
};
}
- @Override
- public void start(ConnectorEnvironment environment)
- throws ConnectorException {
- }
-
- @Override
- public void stop() {
- }
-
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestElement.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestElement.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestElement.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -22,15 +22,17 @@
package org.teiid.connector.metadata.runtime;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.metadata.runtime.Element;
-
import junit.framework.TestCase;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.metadata.runtime.BaseColumn.NullType;
+import org.teiid.connector.metadata.runtime.Column.SearchType;
+
import com.metamatrix.cdk.api.TranslationUtility;
import com.metamatrix.core.util.UnitTestUtil;
@@ -39,7 +41,7 @@
public class TestElement extends TestCase {
private static TranslationUtility CONNECTOR_METADATA_UTILITY = createTranslationUtility(getTestVDBName());
- Properties props;
+ Map<String, String> props;
/**
* @param name
*/
@@ -55,41 +57,41 @@
return new TranslationUtility(vdbName);
}
- public Element getElement(String groupName, String elementName, TranslationUtility transUtil) throws Exception {
- IQuery query = (IQuery) transUtil.parseCommand("SELECT " + elementName + " FROM " + groupName); //$NON-NLS-1$ //$NON-NLS-2$
- ISelectSymbol symbol = query.getSelect().getSelectSymbols().get(0);
- IElement element = (IElement) symbol.getExpression();
+ public Column getElement(String groupName, String elementName, TranslationUtility transUtil) throws Exception {
+ Select query = (Select) transUtil.parseCommand("SELECT " + elementName + " FROM " + groupName); //$NON-NLS-1$ //$NON-NLS-2$
+ DerivedColumn symbol = query.getDerivedColumns().get(0);
+ ColumnReference element = (ColumnReference) symbol.getExpression();
return element.getMetadataObject();
}
public void helpTestElement(String fullGroupName, String elementShortName, TranslationUtility transUtil,
String nameInSource, Object defaultValue, Object minValue, Object maxValue,
- Class javaType, int length, int nullable, int position, int searchable,
- boolean autoIncrement, boolean caseSensitive, Properties expectedProps,
+ Class<?> javaType, int length, NullType nullable, int position, SearchType searchable,
+ boolean autoIncrement, boolean caseSensitive, Map<String, String> expectedProps,
String modeledType, String modeledBaseType, String modeledPrimitiveType)
throws Exception {
- Element element = getElement(fullGroupName, elementShortName, transUtil);
+ Column element = getElement(fullGroupName, elementShortName, transUtil);
assertEquals(nameInSource, element.getNameInSource());
assertEquals(defaultValue, element.getDefaultValue());
assertEquals(minValue, element.getMinimumValue());
assertEquals(maxValue, element.getMaximumValue());
assertEquals(javaType, element.getJavaType());
assertEquals(length, element.getLength());
- assertEquals(nullable, element.getNullability());
+ assertEquals(nullable, element.getNullType());
assertEquals(position, element.getPosition());
- assertEquals(searchable, element.getSearchability());
+ assertEquals(searchable, element.getSearchType());
assertEquals(autoIncrement, element.isAutoIncremented());
assertEquals(caseSensitive, element.isCaseSensitive());
//System.out.println("\n" + element.getModeledType() + "\n" + element.getModeledBaseType() + "\n" + element.getModeledPrimitiveType());
- assertEquals(modeledType, element.getModeledType());
- assertEquals(modeledBaseType, element.getModeledBaseType());
- assertEquals(modeledPrimitiveType, element.getModeledPrimitiveType());
+ assertEquals(modeledType, element.getDatatypeID());
+ assertEquals(modeledBaseType, element.getBaseTypeID());
+ assertEquals(modeledPrimitiveType, element.getPrimitiveTypeID());
- Properties extProps = element.getProperties();
+ Map<String, String> extProps = element.getProperties();
assertEquals(expectedProps, extProps);
}
@@ -104,9 +106,9 @@
null, // maximum value
String.class, // java type
10, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
0, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -127,9 +129,9 @@
null, // maximum value
Integer.class, // java type
0, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
1, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -150,9 +152,9 @@
"25000", // maximum value //$NON-NLS-1$
Integer.class, // java type
0, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
2, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -173,9 +175,9 @@
null, // maximum value
Long.class, // java type
0, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
3, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
true, // auto incremented
true, // case sensitive
props, // extension properties
@@ -196,9 +198,9 @@
null, // maximum value
String.class, // java type
10, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
4, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
false, // case sensitive
props, // extension properties
@@ -219,9 +221,9 @@
null, // maximum value
Integer.class, // java type
0, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
5, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -242,9 +244,9 @@
null, // maximum value
String.class, // java type
0, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
6, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -265,9 +267,9 @@
null, // maximum value
Integer.class, // java type
0, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
0, // position
- Element.NOT_SEARCHABLE, // searchable
+ SearchType.Unsearchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -288,9 +290,9 @@
null, // maximum value
String.class, // java type
10, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
1, // position
- Element.SEARCHABLE_LIKE, // searchable
+ SearchType.Like_Only, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -311,9 +313,9 @@
null, // maximum value
Integer.class, // java type
0, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
2, // position
- Element.SEARCHABLE_COMPARE, // searchable
+ SearchType.All_Except_Like, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -334,9 +336,9 @@
null, // maximum value
String.class, // java type
10, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
3, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -357,9 +359,9 @@
null, // maximum value
Integer.class, // java type
0, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
0, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -380,9 +382,9 @@
null, // maximum value
String.class, // java type
10, // length
- Element.NOT_NULLABLE, // nullable
+ NullType.No_Nulls, // nullable
1, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -403,9 +405,9 @@
null, // maximum value
String.class, // java type
10, // length
- Element.NULLABLE_UNKNOWN, // nullable
+ NullType.Unknown, // nullable
2, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -426,9 +428,9 @@
null, // maximum value
Integer.class, // java type
0, // length
- Element.NULLABLE, // nullable
+ NullType.Nullable, // nullable
0, // position
- Element.SEARCHABLE, // searchable
+ SearchType.Searchable, // searchable
false, // auto incremented
true, // case sensitive
props, // extension properties
@@ -441,7 +443,7 @@
@Override
protected void setUp() throws Exception {
- props = new Properties();
- props.setProperty("ColProp", "defaultvalue"); //$NON-NLS-1$ //$NON-NLS-2$
+ props = new HashMap<String, String>();
+ props.put("ColProp", "defaultvalue"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestGroup.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestGroup.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestGroup.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -22,14 +22,14 @@
package org.teiid.connector.metadata.runtime;
+import java.util.Map;
import java.util.Properties;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.metadata.runtime.Group;
-
import junit.framework.TestCase;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Select;
+
import com.metamatrix.cdk.api.TranslationUtility;
import com.metamatrix.core.util.UnitTestUtil;
@@ -57,17 +57,17 @@
// ################ TEST GROUP METADATAID ######################
- public Group getGroup(String groupName, TranslationUtility transUtil) throws Exception {
- IQuery query = (IQuery) transUtil.parseCommand("SELECT 1 FROM " + groupName); //$NON-NLS-1$
- IGroup group = (IGroup) query.getFrom().getItems().get(0);
+ public Table getGroup(String groupName, TranslationUtility transUtil) throws Exception {
+ Select query = (Select) transUtil.parseCommand("SELECT 1 FROM " + groupName); //$NON-NLS-1$
+ NamedTable group = (NamedTable) query.getFrom().get(0);
return group.getMetadataObject();
}
public void helpTestGroup(String fullGroupName, String nameInSource, Properties expectedProps, TranslationUtility transUtil) throws Exception {
- Group group = getGroup(fullGroupName, transUtil);
+ Table group = getGroup(fullGroupName, transUtil);
assertEquals("table name in source", group.getNameInSource()); //$NON-NLS-1$
- Properties extProps = group.getProperties();
+ Map<String, String> extProps = group.getProperties();
assertEquals(expectedProps, extProps);
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataObject.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataObject.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataObject.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -27,14 +27,11 @@
import java.util.List;
import java.util.Set;
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.metadata.runtime.Element;
-import org.teiid.connector.metadata.runtime.Group;
-import org.teiid.connector.metadata.runtime.Parameter;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.metadata.runtime.Procedure;
import junit.framework.TestCase;
@@ -67,21 +64,20 @@
// ################ TEST GROUP METADATAID ######################
- public Group getGroupID(String groupName, TranslationUtility transUtil) {
- IQuery query = (IQuery) transUtil.parseCommand("SELECT 1 FROM " + groupName); //$NON-NLS-1$
- IGroup group = (IGroup) query.getFrom().getItems().get(0);
+ public Table getGroupID(String groupName, TranslationUtility transUtil) {
+ Select query = (Select) transUtil.parseCommand("SELECT 1 FROM " + groupName); //$NON-NLS-1$
+ NamedTable group = (NamedTable) query.getFrom().get(0);
return group.getMetadataObject();
}
public void helpTestGroupID(String fullGroupName, String shortGroupName, int elementCount, TranslationUtility transUtil) throws Exception {
- Group groupID = getGroupID(fullGroupName, transUtil);
+ Table groupID = getGroupID(fullGroupName, transUtil);
assertEquals(fullGroupName, groupID.getFullName());
assertEquals(shortGroupName, groupID.getName());
-
// Check children
- List<Element> children = groupID.getChildren();
+ List<Column> children = groupID.getColumns();
assertEquals(elementCount, children.size());
- for (Element element : children) {
+ for (Column element : children) {
assertEquals(groupID, element.getParent());
assertTrue(element.getFullName().startsWith(groupID.getFullName()));
}
@@ -97,15 +93,15 @@
// ################ TEST ELEMENT METADATAID ######################
- public Element getElementID(String groupName, String elementName, TranslationUtility transUtil) {
- IQuery query = (IQuery) transUtil.parseCommand("SELECT " + elementName + " FROM " + groupName); //$NON-NLS-1$ //$NON-NLS-2$
- ISelectSymbol symbol = query.getSelect().getSelectSymbols().get(0);
- IElement element = (IElement) symbol.getExpression();
+ public Column getElementID(String groupName, String elementName, TranslationUtility transUtil) {
+ Select query = (Select) transUtil.parseCommand("SELECT " + elementName + " FROM " + groupName); //$NON-NLS-1$ //$NON-NLS-2$
+ DerivedColumn symbol = query.getDerivedColumns().get(0);
+ ColumnReference element = (ColumnReference) symbol.getExpression();
return element.getMetadataObject();
}
public void helpTestElementID(String groupName, String elementName, TranslationUtility transUtil) throws Exception {
- Element elementID = getElementID(groupName, elementName, transUtil);
+ Column elementID = getElementID(groupName, elementName, transUtil);
assertEquals(groupName + "." + elementName, elementID.getFullName()); //$NON-NLS-1$
assertEquals(elementName, elementID.getName());
assertNotNull(elementID.getParent());
@@ -134,7 +130,7 @@
}
sql.append(")"); //$NON-NLS-1$
- IProcedure proc = (IProcedure) transUtil.parseCommand(sql.toString());
+ Call proc = (Call) transUtil.parseCommand(sql.toString());
return proc.getMetadataObject();
}
@@ -144,10 +140,10 @@
assertEquals(shortName, procID.getName());
// Check children
- List<Parameter> children = procID.getChildren();
+ List<ProcedureParameter> children = procID.getParameters();
assertEquals(paramNames.length, children.size());
Set actualParamNames = new HashSet();
- for (Parameter childID : children) {
+ for (ProcedureParameter childID : children) {
assertEquals(procID, childID.getParent());
assertTrue(childID.getFullName() + " " + procID.getFullName(), childID.getFullName().startsWith(procID.getFullName())); //$NON-NLS-1$
actualParamNames.add(childID.getName());
Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestParams.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestParams.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestParams.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -27,9 +27,10 @@
import junit.framework.TestCase;
-import org.teiid.connector.language.IParameter;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IParameter.Direction;
+import org.teiid.connector.language.Argument;
+import org.teiid.connector.language.Call;
+import org.teiid.connector.language.Argument.Direction;
+import org.teiid.connector.metadata.runtime.BaseColumn.NullType;
import com.metamatrix.cdk.api.TranslationUtility;
import com.metamatrix.core.util.UnitTestUtil;
@@ -58,7 +59,7 @@
return new TranslationUtility(vdbName);
}
- public IProcedure getProcedure(String procName, int inputArgs, TranslationUtility transUtil) throws Exception {
+ public Call getProcedure(String procName, int inputArgs, TranslationUtility transUtil) throws Exception {
StringBuffer sql = new StringBuffer("EXEC " + procName + "("); //$NON-NLS-1$ //$NON-NLS-2$
if(inputArgs > 0) {
sql.append("null"); //$NON-NLS-1$
@@ -67,60 +68,58 @@
}
}
sql.append(")"); //$NON-NLS-1$
- IProcedure proc = (IProcedure) transUtil.parseCommand(sql.toString());
+ Call proc = (Call) transUtil.parseCommand(sql.toString());
return proc;
}
- private void checkParameter(IParameter param,
+ private void checkParameter(Argument param,
String name,
String fullName,
int index,
Direction direction,
String nameInSource,
String defaultValue,
- int nullability,
+ NullType nullability,
Class javaType,
int length,
int precision,
int scale,
TranslationUtility transUtil, String modeledType, String modeledBaseType, String modeledPrimitiveType) throws Exception {
- Parameter p = param.getMetadataObject();
+ ProcedureParameter p = param.getMetadataObject();
assertEquals(name, p.getName());
assertEquals(fullName, p.getFullName());
- assertEquals(index, param.getIndex());
assertEquals(direction, param.getDirection());
assertEquals(nameInSource, p.getNameInSource());
assertEquals(defaultValue, p.getDefaultValue());
- assertEquals(nullability, p.getNullability());
+ assertEquals(nullability, p.getNullType());
assertEquals(javaType, p.getJavaType());
assertEquals(javaType, param.getType());
assertEquals(length, p.getLength());
assertEquals(precision, p.getPrecision());
assertEquals(scale, p.getScale());
- assertEquals(null, param.getValue());
- assertEquals(false, param.getValueSpecified());
+ assertEquals(null, param.getArgumentValue());
//System.out.println("\n" + p.getModeledType() + "\n" + p.getModeledBaseType() + "\n" + p.getModeledPrimitiveType());
- assertEquals(modeledType, p.getModeledType());
- assertEquals(modeledBaseType, p.getModeledBaseType());
- assertEquals(modeledPrimitiveType, p.getModeledPrimitiveType());
+ assertEquals(modeledType, p.getDatatypeID());
+ assertEquals(modeledBaseType, p.getBaseTypeID());
+ assertEquals(modeledPrimitiveType, p.getPrimitiveTypeID());
}
public void testProcedureWithResultSet() throws Exception {
- IProcedure proc = getProcedure("sptest.proc1", 4, CONNECTOR_METADATA_UTILITY); //$NON-NLS-1$
- List params = proc.getParameters();
+ Call proc = getProcedure("sptest.proc1", 4, CONNECTOR_METADATA_UTILITY); //$NON-NLS-1$
+ List params = proc.getArguments();
assertEquals(4, params.size());
- checkParameter((IParameter)params.get(0),
+ checkParameter((Argument)params.get(0),
"in1", //$NON-NLS-1$
"sptest.proc1.in1", //$NON-NLS-1$
1,
Direction.IN,
null,
"sample default", //$NON-NLS-1$
- TypeModel.NOT_NULLABLE,
+ NullType.No_Nulls,
String.class,
20,
10,
@@ -130,14 +129,14 @@
"http://www.w3.org/2001/XMLSchema#anySimpleType", //$NON-NLS-1$
"http://www.w3.org/2001/XMLSchema#string"); //$NON-NLS-1$
- checkParameter((IParameter)params.get(1),
+ checkParameter((Argument)params.get(1),
"in2", //$NON-NLS-1$
"sptest.proc1.in2", //$NON-NLS-1$
2,
Direction.IN,
null,
"15", //$NON-NLS-1$
- TypeModel.NULLABLE,
+ NullType.Nullable,
Integer.class,
0,
10,
@@ -147,14 +146,14 @@
"http://www.w3.org/2001/XMLSchema#long", //$NON-NLS-1$
"http://www.w3.org/2001/XMLSchema#decimal"); //$NON-NLS-1$
- checkParameter((IParameter)params.get(2),
+ checkParameter((Argument)params.get(2),
"in3", //$NON-NLS-1$
"sptest.proc1.in3", //$NON-NLS-1$
3,
Direction.IN,
null,
"2003-04-23 09:30:00", //$NON-NLS-1$
- TypeModel.NULLABLE_UNKNOWN,
+ NullType.Unknown,
Timestamp.class,
22,
10,
@@ -164,14 +163,14 @@
"http://www.w3.org/2001/XMLSchema#dateTime", //$NON-NLS-1$
"http://www.w3.org/2001/XMLSchema#dateTime"); //$NON-NLS-1$
- checkParameter((IParameter)params.get(3),
+ checkParameter((Argument)params.get(3),
"inOptional", //$NON-NLS-1$
"sptest.proc1.inOptional", //$NON-NLS-1$
4,
Direction.IN,
"optionalName", //$NON-NLS-1$
null,
- TypeModel.NULLABLE,
+ NullType.Nullable,
String.class,
0,
0,
Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestProcedure.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestProcedure.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestProcedure.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -27,10 +27,7 @@
import junit.framework.TestCase;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.metadata.runtime.Element;
-import org.teiid.connector.metadata.runtime.Parameter;
-import org.teiid.connector.metadata.runtime.Procedure;
+import org.teiid.connector.language.Call;
import com.metamatrix.cdk.api.TranslationUtility;
import com.metamatrix.core.util.UnitTestUtil;
@@ -66,7 +63,7 @@
}
}
sql.append(")"); //$NON-NLS-1$
- IProcedure proc = (IProcedure) transUtil.parseCommand(sql.toString());
+ Call proc = (Call) transUtil.parseCommand(sql.toString());
return proc.getMetadataObject();
}
@@ -75,16 +72,16 @@
assertEquals("Procedure name in source", proc.getNameInSource()); //$NON-NLS-1$
String[] nameInSource = new String[] { "Param name in source", null, null, null }; //$NON-NLS-1$
- int[] direction = new int[] { Parameter.IN, Parameter.OUT, Parameter.INOUT, Parameter.RETURN };
+ ProcedureParameter.Type[] direction = new ProcedureParameter.Type[] { ProcedureParameter.Type.In, ProcedureParameter.Type.Out, ProcedureParameter.Type.InOut, ProcedureParameter.Type.ReturnValue };
int[] index = new int[] { 1, 2, 3, 4 };
Class[] type = new Class[] { Integer.class, Long.class, Short.class, java.sql.Date.class };
- List<Parameter> params = proc.getChildren();
+ List<ProcedureParameter> params = proc.getParameters();
for (int i = 0; i < params.size(); i++) {
- Parameter param = params.get(i);
+ ProcedureParameter param = params.get(i);
assertEquals(nameInSource[i], param.getNameInSource());
- assertEquals(direction[i], param.getDirection());
- assertEquals(index[i], param.getIndex());
+ assertEquals(direction[i], param.getType());
+ assertEquals(index[i], param.getPosition());
assertEquals(type[i], param.getJavaType());
}
@@ -95,31 +92,31 @@
assertEquals(null, proc.getNameInSource());
String[] nameInSource = new String[] { null, "Result set name in source" }; //$NON-NLS-1$
- int[] direction = new int[] { Parameter.IN, Parameter.RESULT_SET };
+ ProcedureParameter.Type[] direction = new ProcedureParameter.Type[] { ProcedureParameter.Type.In, ProcedureParameter.Type.ResultSet };
int[] index = new int[] { 1, 2 };
Class[] type = new Class[] { String.class, java.sql.ResultSet.class };
- List<Parameter> params = proc.getChildren();
+ List<ProcedureParameter> params = proc.getParameters();
for (int i = 0; i < params.size(); i++) {
- Parameter param = params.get(i);
+ ProcedureParameter param = params.get(i);
assertEquals(nameInSource[i], param.getNameInSource());
- assertEquals(direction[i], param.getDirection());
- assertEquals(index[i], param.getIndex());
+ assertEquals(direction[i], param.getType());
+ assertEquals(index[i], param.getPosition());
assertEquals(type[i], param.getJavaType());
}
- Parameter param = params.get(1);
- List<Element> rsCols = param.getChildren();
+ ProcedureParameter param = params.get(1);
+ List<Column> rsCols = param.getResultSetColumns();
// Check first column of result set
assertEquals(2, rsCols.size());
- Element elemID = rsCols.get(0);
+ Column elemID = rsCols.get(0);
assertEquals("RSCol1", elemID.getName()); //$NON-NLS-1$
assertEquals("ConnectorMetadata.TestProc2.RSParam.RSCol1", elemID.getFullName()); //$NON-NLS-1$
assertEquals("Result set column name in source", elemID.getNameInSource()); //$NON-NLS-1$
assertEquals(java.sql.Timestamp.class, elemID.getJavaType());
assertEquals(0, elemID.getPosition());
- Element elemID2 = rsCols.get(1);
+ Column elemID2 = rsCols.get(1);
assertEquals("RSCol2", elemID2.getName()); //$NON-NLS-1$
assertEquals("ConnectorMetadata.TestProc2.RSParam.RSCol2", elemID2.getFullName()); //$NON-NLS-1$
assertEquals(null, elemID2.getNameInSource());
Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestCollectorVisitor.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestCollectorVisitor.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestCollectorVisitor.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -22,16 +22,25 @@
package org.teiid.connector.visitor.util;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
-import org.teiid.connector.language.*;
-import org.teiid.connector.language.ICompareCriteria.Operator;
-import org.teiid.connector.visitor.util.CollectorVisitor;
-import org.teiid.dqp.internal.datamgr.language.*;
+import junit.framework.TestCase;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.Comparison;
+import org.teiid.connector.language.Expression;
+import org.teiid.connector.language.Function;
+import org.teiid.connector.language.LanguageObject;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.language.Comparison.Operator;
-import junit.framework.TestCase;
-
/**
*/
public class TestCollectorVisitor extends TestCase {
@@ -60,42 +69,40 @@
return strings;
}
- public void helpTestCollection(ILanguageObject obj, Class type, String[] objects) {
+ public void helpTestCollection(LanguageObject obj, Class type, String[] objects) {
Set actualObjects = getStringSet(CollectorVisitor.collectObjects(type, obj));
Set expectedObjects = new HashSet(Arrays.asList(objects));
assertEquals("Did not get expected objects", expectedObjects, actualObjects); //$NON-NLS-1$
}
- public ILanguageObject example1() {
- GroupImpl g = new GroupImpl("g1", null, null); //$NON-NLS-1$
+ public LanguageObject example1() {
+ NamedTable g = new NamedTable("g1", null, null); //$NON-NLS-1$
List symbols = new ArrayList();
- symbols.add(new ElementImpl(g, "e1", null, String.class)); //$NON-NLS-1$
- IFunction function = new FunctionImpl("length", Arrays.asList(new ElementImpl(g, "e2", null, String.class)), Integer.class); //$NON-NLS-1$ //$NON-NLS-2$
+ symbols.add(new ColumnReference(g, "e1", null, String.class)); //$NON-NLS-1$
+ Function function = new Function("length", Arrays.asList(new ColumnReference(g, "e2", null, String.class)), Integer.class); //$NON-NLS-1$ //$NON-NLS-2$
symbols.add(function);
- SelectImpl s = new SelectImpl(symbols, false);
List groups = new ArrayList();
groups.add(g);
- FromImpl f = new FromImpl(groups);
- QueryImpl q = new QueryImpl(s, f, null, null, null, null);
+ Select q = new Select(symbols, false, groups, null, null, null, null);
return q;
}
public void testCollection1() {
- helpTestCollection(example1(), IElement.class, new String[] {"g1.e1", "g1.e2" }); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTestCollection(example1(), ColumnReference.class, new String[] {"g1.e1", "g1.e2" }); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testCollection2() {
- helpTestCollection(example1(), IFunction.class, new String[] {"length(g1.e2)" }); //$NON-NLS-1$
+ helpTestCollection(example1(), Function.class, new String[] {"length(g1.e2)" }); //$NON-NLS-1$
}
public void testCollection3() {
- helpTestCollection(example1(), IExpression.class, new String[] {"g1.e1", "g1.e2", "length(g1.e2)" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpTestCollection(example1(), Expression.class, new String[] {"g1.e1", "g1.e2", "length(g1.e2)" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- public void helpTestElementsUsedByGroups(ILanguageObject obj, String[] elements, String[] groups) {
+ public void helpTestElementsUsedByGroups(LanguageObject obj, String[] elements, String[] groups) {
Set actualElements = getStringSet(CollectorVisitor.collectElements(obj));
Set actualGroups = getStringSet(CollectorVisitor.collectGroupsUsedByElements(obj));
@@ -107,17 +114,17 @@
}
public void test1() {
- GroupImpl g1 = new GroupImpl("g1", null, null); //$NON-NLS-1$
- ElementImpl e1 = new ElementImpl(g1, "e1", null, String.class); //$NON-NLS-1$
+ NamedTable g1 = new NamedTable("g1", null, null); //$NON-NLS-1$
+ ColumnReference e1 = new ColumnReference(g1, "e1", null, String.class); //$NON-NLS-1$
helpTestElementsUsedByGroups(e1, new String[] {"g1.e1"}, new String[] {"g1"}); //$NON-NLS-1$ //$NON-NLS-2$
}
public void test2() {
- GroupImpl g1 = new GroupImpl("g1", null, null); //$NON-NLS-1$
- ElementImpl e1 = new ElementImpl(g1, "e1", null, String.class); //$NON-NLS-1$
- ElementImpl e2 = new ElementImpl(g1, "e2", null, String.class); //$NON-NLS-1$
- CompareCriteriaImpl cc = new CompareCriteriaImpl(e1, e2, Operator.EQ);
+ NamedTable g1 = new NamedTable("g1", null, null); //$NON-NLS-1$
+ ColumnReference e1 = new ColumnReference(g1, "e1", null, String.class); //$NON-NLS-1$
+ ColumnReference e2 = new ColumnReference(g1, "e2", null, String.class); //$NON-NLS-1$
+ Comparison cc = new Comparison(e1, e2, Operator.EQ);
helpTestElementsUsedByGroups(cc, new String[] {"g1.e1", "g1.e2"}, new String[] {"g1"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -31,26 +31,23 @@
import java.util.List;
import org.junit.Test;
-import org.teiid.connector.language.ICommand;
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.ILanguageObject;
-import org.teiid.connector.language.IQuery;
+import org.teiid.connector.language.AggregateFunction;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.Command;
+import org.teiid.connector.language.Expression;
+import org.teiid.connector.language.Function;
+import org.teiid.connector.language.Insert;
+import org.teiid.connector.language.LanguageObject;
+import org.teiid.connector.language.Literal;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.SQLReservedWords;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.dqp.internal.datamgr.language.AggregateImpl;
-import org.teiid.dqp.internal.datamgr.language.ElementImpl;
-import org.teiid.dqp.internal.datamgr.language.FunctionImpl;
-import org.teiid.dqp.internal.datamgr.language.GroupImpl;
-import org.teiid.dqp.internal.datamgr.language.LiteralImpl;
import org.teiid.dqp.internal.datamgr.language.TestAggregateImpl;
import org.teiid.dqp.internal.datamgr.language.TestCompareCriteriaImpl;
import org.teiid.dqp.internal.datamgr.language.TestDeleteImpl;
import org.teiid.dqp.internal.datamgr.language.TestElementImpl;
import org.teiid.dqp.internal.datamgr.language.TestExistsCriteriaImpl;
-import org.teiid.dqp.internal.datamgr.language.TestFromImpl;
import org.teiid.dqp.internal.datamgr.language.TestFunctionImpl;
import org.teiid.dqp.internal.datamgr.language.TestGroupByImpl;
import org.teiid.dqp.internal.datamgr.language.TestGroupImpl;
@@ -66,7 +63,6 @@
import org.teiid.dqp.internal.datamgr.language.TestQueryImpl;
import org.teiid.dqp.internal.datamgr.language.TestScalarSubqueryImpl;
import org.teiid.dqp.internal.datamgr.language.TestSearchedCaseExpressionImpl;
-import org.teiid.dqp.internal.datamgr.language.TestSelectImpl;
import org.teiid.dqp.internal.datamgr.language.TestSelectSymbolImpl;
import org.teiid.dqp.internal.datamgr.language.TestSetQueryImpl;
import org.teiid.dqp.internal.datamgr.language.TestSubqueryCompareCriteriaImpl;
@@ -78,7 +74,6 @@
import com.metamatrix.cdk.unittest.FakeTranslationFactory;
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.query.metadata.QueryMetadataInterface;
-import com.metamatrix.query.sql.ReservedWords;
import com.metamatrix.query.sql.lang.CompareCriteria;
import com.metamatrix.query.sql.lang.JoinType;
import com.metamatrix.query.unittest.FakeMetadataFacade;
@@ -90,11 +85,11 @@
public static final RuntimeMetadata metadata = TstLanguageBridgeFactory.metadataFactory;
- private String getString(ILanguageObject obj) {
+ private String getString(LanguageObject obj) {
return SQLStringVisitor.getSQLString(obj);
}
- private String getString(ILanguageObject obj, RuntimeMetadata metadata) {
+ private String getString(LanguageObject obj, RuntimeMetadata metadata) {
return SQLStringVisitor.getSQLString(obj);
}
@@ -124,12 +119,12 @@
*/
@Test public void testVisitIAggregate() throws Exception {
String expected = "COUNT(42)"; //$NON-NLS-1$
- assertEquals(expected, getString(TestAggregateImpl.example("COUNT", ReservedWords.COUNT, false, 42))); //$NON-NLS-1$
+ assertEquals(expected, getString(TestAggregateImpl.example("COUNT", SQLReservedWords.COUNT, false, 42))); //$NON-NLS-1$
}
@Test public void testVisitIAggregateDistinct() throws Exception {
String expected = "COUNT(DISTINCT *)"; //$NON-NLS-1$
- AggregateImpl impl = new AggregateImpl("COUNT", true, null, Integer.class); //$NON-NLS-1$
+ AggregateFunction impl = new AggregateFunction("COUNT", true, null, Integer.class); //$NON-NLS-1$
assertEquals(expected, getString(impl));
}
@@ -192,14 +187,6 @@
}
/*
- * Test for void visit(IFrom)
- */
- @Test public void testVisitIFrom() throws Exception {
- String expected = "FROM g1, g2 AS myAlias, g3, g4"; //$NON-NLS-1$
- assertEquals(expected, getString(TestFromImpl.example()));
- }
-
- /*
* Test for void visit(IFunction)
*/
@Test public void testVisitIFunction() throws Exception {
@@ -213,12 +200,12 @@
FakeMetadataFacade facade = new FakeMetadataFacade(exampleMetadataStore());
RuntimeMetadataImpl metadata = exampleRuntimeMetadata(facade);
- IGroup g = new GroupImpl("SmallA", null, metadata.getGroup("BQT1.SmallA")); //$NON-NLS-1$
- IElement e = new ElementImpl(g, "DoubleNum", metadata.getElement("DoubleNum"), Double.class); //$NON-NLS-1$ //$NON-NLS-2$
- List<? extends IExpression> params = Arrays.asList(e, new LiteralImpl("integer", String.class)); //$NON-NLS-1$
+ NamedTable g = new NamedTable("SmallA", null, metadata.getGroup("BQT1.SmallA")); //$NON-NLS-1$
+ ColumnReference e = new ColumnReference(g, "DoubleNum", metadata.getElement("DoubleNum"), Double.class); //$NON-NLS-1$ //$NON-NLS-2$
+ List<? extends Expression> params = Arrays.asList(e, new Literal("integer", String.class)); //$NON-NLS-1$
final String expected = "convert(SmallishA.doublishNum, integer)"; //$NON-NLS-1$
- IFunction test = new FunctionImpl("convert", params, Integer.class); //$NON-NLS-1$
+ Function test = new Function("convert", params, Integer.class); //$NON-NLS-1$
assertEquals(expected, getString(test, metadata ));
}
@@ -226,8 +213,8 @@
@Test public void testVisitConvertFunctionOracleStyle() throws Exception {
String expected = "convert(columnA, integer)"; //$NON-NLS-1$
- List<? extends IExpression> params = Arrays.asList(new ElementImpl(null, "columnA", null, String.class), new LiteralImpl("integer", String.class));
- IFunction test = new FunctionImpl("convert", params, Integer.class); //$NON-NLS-1$
+ List<? extends Expression> params = Arrays.asList(new ColumnReference(null, "columnA", null, String.class), new Literal("integer", String.class));
+ Function test = new Function("convert", params, Integer.class); //$NON-NLS-1$
assertEquals(expected, getString(test));
}
@@ -355,7 +342,7 @@
*/
@Test public void testVisitIQuery() throws Exception {
String expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS myAlias, g3, g4 WHERE (100 >= 200) AND (500 < 600) GROUP BY g1.e1, g1.e2, g1.e3, g1.e4 HAVING (100 >= 200) AND (500 < 600) ORDER BY e1, e2 DESC, e3, e4 DESC"; //$NON-NLS-1$
- assertEquals(expected, getString(TestQueryImpl.example()));
+ assertEquals(expected, getString(TestQueryImpl.example(true)));
}
/*
@@ -379,9 +366,9 @@
*/
@Test public void testVisitISelect() throws Exception {
String expected = "SELECT g1.e1, g1.e2, g1.e3, g1.e4"; //$NON-NLS-1$
- assertEquals(expected, getString(TestSelectImpl.example(false)));
+ assertEquals(expected, getString(TestQueryImpl.example(false)));
expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4"; //$NON-NLS-1$
- assertEquals(expected, getString(TestSelectImpl.example(true)));
+ assertEquals(expected, getString(TestQueryImpl.example(true)));
}
@@ -444,16 +431,16 @@
@Test public void testTimestampAddFunction() throws Exception {
String sql = "select timestampadd(" +SQLReservedWords.SQL_TSI_DAY+ ", 2, timestampvalue) from bqt1.smalla"; //$NON-NLS-1$ //$NON-NLS-2$
- ICommand command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql);
+ Command command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql);
assertEquals("SELECT timestampadd(SQL_TSI_DAY, 2, SmallA.TimestampValue) FROM SmallA", command.toString()); //$NON-NLS-1$
}
@Test public void testInsertWithQuery() throws Exception {
String sql = "insert into pm1.g1 values (null, null, null, null)"; //$NON-NLS-1$
- IInsert insert = (IInsert)FakeTranslationFactory.getInstance().getExampleTranslationUtility().parseCommand(sql);
+ Insert insert = (Insert)FakeTranslationFactory.getInstance().getExampleTranslationUtility().parseCommand(sql);
- IQuery command = (IQuery)FakeTranslationFactory.getInstance().getExampleTranslationUtility().parseCommand("select * from pm1.g2"); //$NON-NLS-1$
+ Select command = (Select)FakeTranslationFactory.getInstance().getExampleTranslationUtility().parseCommand("select * from pm1.g2"); //$NON-NLS-1$
insert.setValueSource(command);
assertEquals("INSERT INTO g1 (e1, e2, e3, e4) SELECT g2.e1, g2.e2, g2.e3, g2.e4 FROM g2", insert.toString()); //$NON-NLS-1$
}
@@ -461,21 +448,21 @@
@Test public void testUnrelatedOrderBy() throws Exception {
String sql = "select intkey from bqt1.smalla order by stringkey"; //$NON-NLS-1$
- ICommand command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql, true, true);
+ Command command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql, true, true);
assertEquals("SELECT g_0.IntKey AS c_0 FROM SmallA AS g_0 ORDER BY g_0.StringKey", command.toString()); //$NON-NLS-1$
}
@Test public void testOrderByDerivedColumn() throws Exception {
String sql = "select intkey as x from bqt1.smalla order by intkey"; //$NON-NLS-1$
- ICommand command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql, true, true);
+ Command command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql, true, true);
assertEquals("SELECT g_0.IntKey AS c_0 FROM SmallA AS g_0 ORDER BY c_0", command.toString()); //$NON-NLS-1$
}
@Test public void testOrderByAlias() throws Exception {
String sql = "select intkey as x from bqt1.smalla order by x"; //$NON-NLS-1$
- ICommand command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql, true, true);
+ Command command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql, true, true);
assertEquals("SELECT g_0.IntKey AS c_0 FROM SmallA AS g_0 ORDER BY c_0", command.toString()); //$NON-NLS-1$
}
Deleted: trunk/test-integration/common/src/test/java/org/teiid/runtime/adminapi/TestDqpReDeployment.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/runtime/adminapi/TestDqpReDeployment.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/runtime/adminapi/TestDqpReDeployment.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -1,287 +0,0 @@
-package org.teiid.runtime.adminapi;
-
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.Iterator;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.*;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminOptions;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.VDB;
-
-import com.metamatrix.core.util.FileUtils;
-import com.metamatrix.core.util.UnitTestUtil;
-
-public class TestDqpReDeployment {
-
- String DEPLOY_FILE = UnitTestUtil.getTestDataPath()+"/admin/dqp.properties;user=admin;password=teiid"; //$NON-NLS-1$
- String ADMIN_URL_PREFIX = "jdbc:teiid:admin@"; //$NON-NLS-1$
-
- @Before
- public void setUp() throws Exception {
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/admin/Admin.vdb", UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/Admin.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/ServerConfig.xml", UnitTestUtil.getTestScratchPath()+"/adminapi/deploy/configuration.xml"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @After
- public void tearDown() throws Exception {
- Connection conn = null;
-
- conn = Util.getConnection(ADMIN_URL_PREFIX + DEPLOY_FILE);
- com.metamatrix.jdbc.api.Connection mmconn = (com.metamatrix.jdbc.api.Connection) conn;
- Admin admin = mmconn.getAdminAPI();
-
- // Remove any existing VDBs from the previous tests.
- Iterator iter = admin.getVDBs("*").iterator(); //$NON-NLS-1$
- while (iter.hasNext()) {
- VDB vdb = (VDB)iter.next();
- if (!vdb.getName().equalsIgnoreCase("admin")){ //$NON-NLS-1$
- admin.changeVDBStatus(vdb.getName(), vdb.getVDBVersion(), VDB.DELETED);
- }
- }
- }
-
-
- /**
- * Opens connection to the VDB and tries to deploy when conn is open.
- * The redeployment should not affect the current connection.
- * @throws Exception
- */
- @Test public void testKeepConnectionReplaceVdb () throws Exception {
- Connection conn = null;
- Connection testConn = null;
- String VDB_NAME = "ReplaceActive"; //$NON-NLS-1$
- try {
- conn = Util.getConnection(ADMIN_URL_PREFIX + DEPLOY_FILE);
- com.metamatrix.jdbc.api.Connection mmconn = (com.metamatrix.jdbc.api.Connection) conn;
- Admin admin = mmconn.getAdminAPI();
-
- VDB vdb = deployVdbClean(admin, VDB_NAME, UnitTestUtil.getTestDataPath()+"/admin/TestORS.vdb"); //$NON-NLS-1$
- String currentVersion = vdb.getVDBVersion();
- assertEquals("1", currentVersion); //$NON-NLS-1$
-
- // Connect and run test query
- testConn = Util.getConnection("jdbc:teiid:" + VDB_NAME + "@" + DEPLOY_FILE); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "SELECT * FROM C_REPOS_DB_RELEASE", true, "Initial Test"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Redeploy the VDB while the connection is open. New VDB has A_CCOUNT table
- vdb = deployVdbClean(admin, VDB_NAME, UnitTestUtil.getTestDataPath()+"/admin/TestORS1.vdb"); //$NON-NLS-1$
-
- testConnection(testConn, "select * from C_ACCOUNT", false, "Redeploy V2 Test"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (Exception x) {
- fail("Failed with exception " + Util.getStackTraceAsString(x)); //$NON-NLS-1$
- } finally {
- Util.closeQuietly(conn);
- }
- }
-
- /**
- * Redeploy while there is an opened connection. Restart the DQP to have the changes take effect
- * Validate that the open connection becomes invalid and a new connection gets the latest VDB
- * @throws Exception
- */
- @Test public void testReplaceVdbWithDqpRestart() throws Exception {
- Connection conn = null;
- Connection testConn = null;
- Connection newTestConn = null;
-
- String VDB_NAME = "ReplaceRestart"; //$NON-NLS-1$
- try {
- conn = Util.getConnection(ADMIN_URL_PREFIX + DEPLOY_FILE);
- com.metamatrix.jdbc.api.Connection mmconn = (com.metamatrix.jdbc.api.Connection) conn;
- Admin admin = mmconn.getAdminAPI();
- VDB vdb = deployVdbClean(admin, VDB_NAME, UnitTestUtil.getTestDataPath()+"/admin/TestORS.vdb"); //$NON-NLS-1$
- String currentVersion = vdb.getVDBVersion();
- assertEquals("1", currentVersion); //$NON-NLS-1$
-
- // Connect and run test query
- testConn = Util.getConnection("jdbc:teiid:" + VDB_NAME + "@" + DEPLOY_FILE); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "SELECT * FROM C_REPOS_DB_RELEASE", true, "Initial V1 Test"); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "select * from C_ACCOUNT", false, "Initial V2 Test"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // Redeploy the VDB while the connection is open. New VDB has A_CCOUNT table
- vdb = deployVdbClean(admin, VDB_NAME, UnitTestUtil.getTestDataPath()+"/admin/TestORS1.vdb"); //$NON-NLS-1$
-
- admin.restart();
- Thread.sleep(2000);
-
- newTestConn = Util.getConnection("jdbc:teiid:" + VDB_NAME + "@" + DEPLOY_FILE); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(newTestConn, "select * from C_ACCOUNT", true, "Redeploy V2 Test"); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "SELECT 1", false, "Stale Conn test"); //$NON-NLS-1$ //$NON-NLS-2$
-
- } catch (Exception x) {
- fail("Failed with exception " + Util.getStackTraceAsString(x)); //$NON-NLS-1$
- } finally {
- Util.closeQuietly(conn);
- Util.closeQuietly(testConn);
- Util.closeQuietly(newTestConn);
- }
- }
-
- /**
- * SIP53 Scenario 1
- * Redeployment when there are no active connections. The new connection should get the latest version
- * @throws Exception
- */
- @Test public void testReplaceNonActiveVdb () throws Exception {
- Connection conn = null;
- Connection testConn = null;
- String VDB_NAME = "ReplaceNonActive"; //$NON-NLS-1$
- try {
- conn = Util.getConnection(ADMIN_URL_PREFIX + DEPLOY_FILE);
- com.metamatrix.jdbc.api.Connection mmconn = (com.metamatrix.jdbc.api.Connection) conn;
- Admin admin = mmconn.getAdminAPI();
-
- VDB vdb = deployVdbClean(admin, VDB_NAME, UnitTestUtil.getTestDataPath()+"/admin/TestORS.vdb"); //$NON-NLS-1$
- String currentVersion = vdb.getVDBVersion();
- assertEquals("1", currentVersion); //$NON-NLS-1$
-
- // Connect and run test query
- testConn = Util.getConnection("jdbc:teiid:" + VDB_NAME + "@" + DEPLOY_FILE); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "SELECT * FROM C_REPOS_DB_RELEASE", true, "Initial V1 Test"); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "select * from C_ACCOUNT", false, "Initial V2 Test"); //$NON-NLS-1$ //$NON-NLS-2$
- Util.closeQuietly(testConn);
-
- // Verify that there are no sessions left reset all sessions to the VDB
- Iterator sessionIter = admin.getSessions("*").iterator(); //$NON-NLS-1$
- while(sessionIter.hasNext()) {
- Session session = (Session)sessionIter.next();
- if (VDB_NAME.equals(session.getVDBName()) && currentVersion.equals(session.getVDBVersion())) {
- fail("There should not be any sessions open against the VDB"); //$NON-NLS-1$
- }
- }
-
- // Redeploy the VDB while the connection is open. New VDB has A_CCOUNT table
- vdb = deployVdbClean(admin, VDB_NAME, UnitTestUtil.getTestDataPath()+"/admin/TestORS1.vdb"); //$NON-NLS-1$
-
- testConn = Util.getConnection("jdbc:teiid:" + VDB_NAME + "@" + DEPLOY_FILE); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "select * from C_ACCOUNT", true, "Redeploy V2 Test"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (Exception x) {
- fail("Failed with exception " + Util.getStackTraceAsString(x)); //$NON-NLS-1$
- } finally {
- Util.closeQuietly(conn);
- Util.closeQuietly(testConn);
- }
- }
-
- /**
- * SIP53 Scenario 2
- * Similar to the <code>testReplaceNonActiveVdb</code>. Uses the session shutdown instead of
- * expecting connections to be closed
- * @throws Exception
- */
- @Test public void testReplaceVdbWithSessionClose() throws Exception {
- Connection conn = null;
- Connection testConn = null;
- Connection newTestConn = null;
- String VDB_NAME = "ReplaceSessionClose"; //$NON-NLS-1$
- try {
- conn = Util.getConnection(ADMIN_URL_PREFIX + DEPLOY_FILE);
- com.metamatrix.jdbc.api.Connection mmconn = (com.metamatrix.jdbc.api.Connection) conn;
- Admin admin = mmconn.getAdminAPI();
- VDB vdb = deployVdbClean(admin, VDB_NAME, UnitTestUtil.getTestDataPath()+"/admin/TestORS.vdb"); //$NON-NLS-1$
- String currentVersion = vdb.getVDBVersion();
-
- // Connect and run test query
- testConn = Util.getConnection("jdbc:teiid:" + VDB_NAME + "@" + DEPLOY_FILE); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "SELECT * FROM C_REPOS_DB_RELEASE", true, "Initial V1 Test"); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "select * from C_ACCOUNT", false, "Initial V2 Test"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // reset all sessions to the VDB
- Iterator sessionIter = admin.getSessions("*").iterator(); //$NON-NLS-1$
- boolean sessionFound = false;
- while(sessionIter.hasNext()) {
- Session session = (Session)sessionIter.next();
- if (VDB_NAME.equals(session.getVDBName()) && currentVersion.equals(session.getVDBVersion())) {
- admin.terminateSession(session.getSessionID());
- sessionFound = true;
- }
- }
- if ( ! sessionFound ) {
- fail("Did not find the expected connection to terminate"); //$NON-NLS-1$
- }
-
- // Redeploy the VDB while the connection is open. New VDB has A_CCOUNT table
- vdb = deployVdbClean(admin, VDB_NAME, UnitTestUtil.getTestDataPath()+"/admin/TestORS1.vdb"); //$NON-NLS-1$
-
- newTestConn = Util.getConnection("jdbc:teiid:" + VDB_NAME + "@" + DEPLOY_FILE); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(newTestConn, "select * from C_ACCOUNT", true, "Redeploy V2 Test"); //$NON-NLS-1$ //$NON-NLS-2$
- testConnection(testConn, "SELECT 1", false, "Stale Conn test"); //$NON-NLS-1$ //$NON-NLS-2$
-
- } catch (Exception x) {
- fail("Failed with exception " + Util.getStackTraceAsString(x)); //$NON-NLS-1$
- } finally {
- Util.closeQuietly(conn);
- Util.closeQuietly(testConn);
- Util.closeQuietly(newTestConn);
- }
- }
-
- /**
- * SIP51, SIP52
- * @throws Exception
- */
- @Test public void testDeleteInvalidVdb() throws Exception {
- Connection conn = null;
- String VDB_NAME = "DeleteInvalid"; //$NON-NLS-1$
- try {
- conn = Util.getConnection(ADMIN_URL_PREFIX + DEPLOY_FILE);
- com.metamatrix.jdbc.api.Connection mmconn = (com.metamatrix.jdbc.api.Connection) conn;
- Admin admin = mmconn.getAdminAPI();
- // Try clean deployment twice
- try {
- deployVdbClean(admin, VDB_NAME, UnitTestUtil.getTestDataPath()+"/admin/TestORSInvalid.vdb"); //$NON-NLS-1$
- fail("Failed with exception "); //$NON-NLS-1$
- } catch (Exception e) {
- //pass
- }
- } catch (Exception x) {
- fail("Failed with exception " + Util.getStackTraceAsString(x)); //$NON-NLS-1$
- } finally {
- Util.closeQuietly(conn);
- }
- }
-
-
- private VDB deployVdbClean(Admin admin, String vdbName, String vdbFile) throws Exception{
-
- VDB vdb;
- // Remove any existing VDBs from the previous tests.
- Iterator iter = admin.getVDBs(vdbName).iterator();
- while (iter.hasNext()) {
- vdb = (VDB)iter.next();
- admin.changeVDBStatus(vdb.getName(), vdb.getVDBVersion(), VDB.DELETED);
- }
-
- vdb = admin.addVDB(vdbName,Util.getBinaryFile(vdbFile), new AdminOptions(AdminOptions.OnConflict.OVERWRITE));
- return vdb;
- }
-
- void testConnection(Connection conn, String sql, boolean expectSuccess, String testName) {
- Statement stmt = null;
- ResultSet rs = null;
- try {
- stmt = conn.createStatement();
- rs = stmt.executeQuery(sql);
- if ( ! rs.next() ) {
- fail(sql + "executed with 0 rows returned"); //$NON-NLS-1$
- }
- } catch (Exception e) {
- if (expectSuccess) {
- fail(testName + " failed for [" + sql + "] with " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- } finally {
- Util.closeQuietly(null, stmt, rs);
- }
- }
-
-
-
-
-}
Deleted: trunk/test-integration/common/src/test/java/org/teiid/runtime/adminapi/TestEmbeddedAdmin.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/runtime/adminapi/TestEmbeddedAdmin.java 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/common/src/test/java/org/teiid/runtime/adminapi/TestEmbeddedAdmin.java 2010-03-05 19:01:50 UTC (rev 1925)
@@ -1,540 +0,0 @@
-/*
- * Copyright (c) 2000-2005 MetaMatrix, Inc.
- * All rights reserved.
- */
-package org.teiid.runtime.adminapi;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminOptions;
-import org.teiid.adminapi.ConnectorBinding;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.VDB;
-import org.teiid.jdbc.TeiidDriver;
-
-import com.metamatrix.core.util.FileUtils;
-import com.metamatrix.core.util.UnitTestUtil;
-import com.metamatrix.jdbc.MMConnection;
-import com.metamatrix.jdbc.api.Connection;
-
-/**
- * @since 4.3
- */
-public class TestEmbeddedAdmin {
-
- private static final String VDB_FILE = UnitTestUtil.getTestDataPath()+"/admin/TestEmpty.vdb"; //$NON-NLS-1$
- private static final String VDB_NAME = "TestEmpty"; //$NON-NLS-1$
-
- String configFile = UnitTestUtil.getTestDataPath()+"/admin/dqp.properties"; //$NON-NLS-1$
- Connection conn = null;
- Connection adminConn = null;
- Admin admin = null;
- Statement stmt = null;
- ResultSet result = null;
-
- /* Utility methods */
- private Connection getConnection(String vdb, String configFile) throws SQLException {
- String url = "jdbc:teiid:"+vdb+"@"+configFile+";user=admin;password=teiid"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new TeiidDriver();
- Connection conn = (Connection)DriverManager.getConnection(url);
- return conn;
- }
-
- Admin getAdmin() throws Exception{
- adminConn = getConnection("admin", configFile); //$NON-NLS-1$
- return adminConn.getAdminAPI();
- }
-
- @Before
- public void setUp() throws Exception {
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/admin/Admin.vdb", UnitTestUtil.getTestScratchPath()+"/Admin.vdb"); //$NON-NLS-1$ //$NON-NLS-2$
- FileUtils.copy(UnitTestUtil.getTestDataPath()+"/ServerConfig.xml", UnitTestUtil.getTestScratchPath()+"/configuration.xml"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- @After
- public void tearDown() throws Exception {
- if (result != null) {
- result.close();
- }
- if (stmt != null) {
- stmt.close();
- }
- if (adminConn != null) {
- adminConn.close();
- }
- if (conn != null) {
- conn.close();
- }
- }
-
- void cleanupVDB(Admin admin, String name, String version) {
- try {
- // make sure we delete any
- admin.changeVDBStatus(name, version, VDB.DELETED);
- }catch(Exception e) {
- //ignore it might say not found
- }
- }
-
- /* Test methods */
- @Test public void testGetConnectionToAdmin() throws Exception {
- conn = getConnection("admin", configFile); //$NON-NLS-1$
- assertFalse("Found a Closed Connection to Admin", conn.isClosed()); //$NON-NLS-1$
- }
-
- @Test public void testAddTwoVDBsWithSameNameandVersion() throws Exception {
- admin = getAdmin();
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
-
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- admin.changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- boolean found = false;
- Collection vdbs = admin.getVDBs(VDB_NAME);
- for (Iterator i = vdbs.iterator(); i.hasNext();) {
- VDB vdb = (VDB)i.next();
- if (vdb.getName().equals(VDB_NAME) && vdb.getVDBVersion().equals("1")) { //$NON-NLS-1$
- found = true;
- }
- }
- assertTrue("Deployed VDB not found in the configuration", found); //$NON-NLS-1$
-
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- admin.changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- found = false;
- vdbs = admin.getVDBs(VDB_NAME);
- for (Iterator i = vdbs.iterator(); i.hasNext();) {
- VDB vdb = (VDB)i.next();
- if (vdb.getName().equals(VDB_NAME) && vdb.getVDBVersion().equals("2")) { //$NON-NLS-1$
- found = true;
- }
- }
- assertTrue("Deployed VDB not found in the configuration", found); //$NON-NLS-1$
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- cleanupVDB(admin, VDB_NAME, "2"); //$NON-NLS-1$
- }
-
- @Test public void testDeployVdbImbeddedDef() throws Exception {
- admin = getAdmin();
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
-
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- admin.changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- boolean found = false;
- Collection vdbs = admin.getVDBs(VDB_NAME);
- for (Iterator i = vdbs.iterator(); i.hasNext();) {
- VDB vdb = (VDB)i.next();
- if (vdb.getName().equals(VDB_NAME)) {
- found = true;
- }
- }
- assertTrue("Deployed VDB not found in the configuration", found); //$NON-NLS-1$
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testUndeployVdb() throws Exception {
- admin = getAdmin();
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
-
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- admin.changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- boolean found = false;
- Collection vdbs = admin.getVDBs(VDB_NAME);
- for (Iterator i = vdbs.iterator(); i.hasNext();) {
- VDB vdb = (VDB)i.next();
- if (vdb.getName().equals(VDB_NAME)) {
- found = true;
- }
- }
- assertTrue("Deployed VDB not found in the configuration", found); //$NON-NLS-1$
-
- admin.changeVDBStatus(VDB_NAME, "1", VDB.DELETED); //$NON-NLS-1$
-
- found = false;
- vdbs = admin.getVDBs(VDB_NAME);
- for (Iterator i = vdbs.iterator(); i.hasNext();) {
- VDB vdb = (VDB)i.next();
- if (vdb.getName().equals(VDB_NAME)) {
- found = true;
- }
- }
- assertFalse("Deployed VDB found in the configuration after delete", found); //$NON-NLS-1$
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testUndeployNonExistantVdb() throws Exception {
- admin = getAdmin();
- try {
- admin.changeVDBStatus("DoesNotExist", "1", VDB.DELETED); //$NON-NLS-1$ //$NON-NLS-2$
- fail("Must have failed to delete a non existing VDB"); //$NON-NLS-1$
- } catch (AdminException err) {
- assertEquals("VDB \"DoesNotExist\" version \"1\" is not active.", err.getMessage()); //$NON-NLS-1$
- }
- }
-
- @Test public void testGetConnectionToExistingVdb() throws Exception {
- admin = getAdmin();
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
-
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- admin.changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- conn = getConnection(VDB_NAME, configFile);
- assertFalse("found a closed connection", conn.isClosed()); //$NON-NLS-1$
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testGetConnectionToNonExistingVdb() throws Exception {
- try {
- getConnection("DoesNotExist", configFile); //$NON-NLS-1$
- fail("found a Connection to a non avtive VDB"); //$NON-NLS-1$
- } catch (SQLException err) {
- assertEquals("VDB \"DoesNotExist\" version \"latest\" is not active.", err.getMessage()); //$NON-NLS-1$
- }
- }
-
- @Test public void testGetConnectionToNotActiveVdb() throws Exception {
- admin = getAdmin();
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
-
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- admin.changeVDBStatus(VDB_NAME, "1", VDB.INACTIVE); //$NON-NLS-1$
-
- try {
- conn = getConnection(VDB_NAME, configFile);
- fail("found a Connection to a non avtive VDB"); //$NON-NLS-1$
- } catch (SQLException err) {
- assertEquals("VDB \"TestEmpty\" version \"latest\" is not active.", err.getMessage()); //$NON-NLS-1$
- } finally {
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
- }
-
- @Test public void testGetConnectionToActiveDefault() throws Exception {
- admin = getAdmin();
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- try {
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
-
- admin.changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE_DEFAULT); //$NON-NLS-1$
-
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
-
- admin.changeVDBStatus(VDB_NAME, "2", VDB.ACTIVE); //$NON-NLS-1$
-
- conn = getConnection(VDB_NAME, configFile);
- assertEquals("1", conn.getVDBVersion()); //$NON-NLS-1$
- } finally {
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- cleanupVDB(admin, VDB_NAME, "2"); //$NON-NLS-1$
- }
- }
-
- @Test public void testSelectNonPrepared() throws Exception {
- admin = getAdmin();
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
-
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- admin.changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- conn = getConnection(VDB_NAME, configFile);
- Statement stmt = conn.createStatement();
- ResultSet rs = stmt.executeQuery("SELECT * FROM smalla"); //$NON-NLS-1$
- if (!rs.next()) {
- fail("SELECT * FROM smalla failed"); //$NON-NLS-1$
- }
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testSelectPrepared() throws Exception {
- admin = getAdmin();
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- admin.changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- conn = getConnection(VDB_NAME, configFile);
- executePreparedStatement("SELECT * FROM smalla"); //$NON-NLS-1$
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testStopConnectorBinding() throws Exception {
- addVDB();
-
- admin.stopConnectorBinding("Loopback", true); //$NON-NLS-1$
-
- try {
- executeStatement("SELECT * FROM smalla"); //$NON-NLS-1$
- fail("Ran statement on closed connector binding! Wrong!"); //$NON-NLS-1$
- }catch(Exception e) {
- // pass good
- }
-
- admin.startConnectorBinding("Loopback"); //$NON-NLS-1$
- executeStatement("SELECT * FROM smalla"); //$NON-NLS-1$
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
-
- @Test public void testStopNonExistingConnectorBinding() throws Exception {
- addVDB();
-
- try {
- admin.stopConnectorBinding("NO_CONNECTORS", true); //$NON-NLS-1$
- fail("stopped a unknown connector Wow!"); //$NON-NLS-1$
- } catch(AdminException e) {
- assertEquals("Connector Binding with name \"NO_CONNECTORS\" does not exist in the configuration", e.getMessage()); //$NON-NLS-1$
- }
-
- executeStatement("SELECT * FROM smalla"); //$NON-NLS-1$
-
- admin.startConnectorBinding("Loopback"); //$NON-NLS-1$
- executeStatement("SELECT * FROM smalla"); //$NON-NLS-1$
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testAddConnectorBinding() throws Exception {
- addVDB();
- String LOOPBACK = "loopy"; //$NON-NLS-1$
- admin.addConnectorBinding(LOOPBACK, Util.getCharacterFile(UnitTestUtil.getTestDataPath()+"/admin/loopback.cdk"), new AdminOptions(AdminOptions.OnConflict.OVERWRITE)); //$NON-NLS-1$
- admin.startConnectorBinding(LOOPBACK);
-
- boolean found = true;
- Collection c = admin.getConnectorBindings(LOOPBACK);
- for (Iterator i = c.iterator(); i.hasNext();) {
- ConnectorBinding binding = (ConnectorBinding)i.next();
- if (binding.getName().equals(LOOPBACK)) {
- found = true;
- }
- }
- assertTrue("Connector LOOPBACK not found after adding", found); //$NON-NLS-1$
-
- admin.assignBindingToModel(LOOPBACK, VDB_NAME, "1", "Oracle"); //$NON-NLS-1$ //$NON-NLS-2$
- stmt = conn.createStatement();
- result = stmt.executeQuery("Select * from smalla"); //$NON-NLS-1$
- int count = 0;
- while (result.next()) {
- count++;
- }
- assertEquals("Expected one row", 1, count); //$NON-NLS-1$
-
-
- Collection cbindings = admin.getConnectorBindings("*"); //$NON-NLS-1$
- ConnectorBinding binding = null;
- for (Iterator i = cbindings.iterator(); i.hasNext();) {
- ConnectorBinding current = (ConnectorBinding)i.next();
- if (current.getName().equals(LOOPBACK)) {
- binding = current;
- }
- }
- admin.setConnectorBindingProperty(binding.getIdentifier(), "RowCount", "10"); //$NON-NLS-1$ //$NON-NLS-2$
- admin.stopConnectorBinding(LOOPBACK, true);
- admin.startConnectorBinding(LOOPBACK);
-
- stmt = conn.createStatement();
- result = stmt.executeQuery("Select * from smalla"); //$NON-NLS-1$
-
- count = 0;
- while (result.next()) {
- count++;
- }
- assertEquals("Expected ten rows", 10, count); //$NON-NLS-1$
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testAddUnknownConnectorBinding() throws Exception {
- addVDB();
- try {
- admin.startConnectorBinding("UNKNOWN"); //$NON-NLS-1$
- fail("Started a unknown connector, BAD"); //$NON-NLS-1$
- } catch(AdminException e) {
- assertEquals("Connector Binding with name \"UNKNOWN\" does not exist in the configuration", e.getMessage()); //$NON-NLS-1$
- }
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
-
- @Test public void testExtensionModules() throws Exception {
- addVDB();
-
- Collection c = admin.getExtensionModules("*"); //$NON-NLS-1$
- assertEquals(0, c.size());
-
- admin.addExtensionModule("jar", "loopbackconn.jar", Util.getBinaryFile(UnitTestUtil.getTestDataPath()+"/admin/loopbackconn.jar"), "Loopback Jar"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- c = admin.getExtensionModules("*"); //$NON-NLS-1$
- assertEquals(1, c.size());
-
- admin.deleteExtensionModule("loopbackconn.jar"); //$NON-NLS-1$
-
- c = admin.getExtensionModules("*"); //$NON-NLS-1$
- assertEquals(0, c.size());
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testGetSessions() throws Exception {
- adminConn = getConnection("admin", configFile); //$NON-NLS-1$
- admin = adminConn.getAdminAPI();
- admin.restart();
-
- addVDB();
- Collection<Session> c = admin.getSessions("*"); //$NON-NLS-1$
- assertEquals(2, c.size());
-
- MMConnection myconn = (MMConnection)this.conn;
-
- admin.terminateSession(myconn.getConnectionId());
- this.result = null;
- this.stmt = null;
- this.conn = null;
-
- c = admin.getSessions("*"); //$NON-NLS-1$
- assertEquals(1, c.size());
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
-
- @Test public void testExportVDB() throws Exception {
- addVDB();
-
- Util.writeToFile("Test.VDB", admin.exportVDB(VDB_NAME, "1")); //$NON-NLS-1$ //$NON-NLS-2$
- File f = new File("Test.VDB"); //$NON-NLS-1$
- assertTrue("failed to export vdb", f.exists()); //$NON-NLS-1$
-
- f.delete();
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testExportConnectorBinging() throws Exception {
- addVDB();
-
- Util.writeToFile("Oracle.cdk", admin.exportConnectorBinding("Loopback")); //$NON-NLS-1$ //$NON-NLS-2$
- File f = new File("Oracle.cdk"); //$NON-NLS-1$
- assertTrue("failed to export connector binding", f.exists()); //$NON-NLS-1$
-
- f.delete();
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testExportConnectorType() throws Exception {
- addVDB();
-
- Util.writeToFile(UnitTestUtil.getTestScratchPath()+"/loopy.cdk", admin.exportConnectorType("Loopback Connector")); //$NON-NLS-1$ //$NON-NLS-2$
- File f = new File(UnitTestUtil.getTestScratchPath()+"/loopy.cdk"); //$NON-NLS-1$
- assertTrue("failed to export connector binding", f.exists()); //$NON-NLS-1$
-
- f.delete();
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testExportServerConfig() throws Exception {
- addVDB();
-
- Util.writeToFile(UnitTestUtil.getTestScratchPath()+"/serverconfig.xml", admin.exportConfiguration()); //$NON-NLS-1$
- File f = new File(UnitTestUtil.getTestScratchPath()+"/serverconfig.xml"); //$NON-NLS-1$
- assertTrue("failed to export connector binding", f.exists()); //$NON-NLS-1$
-
- f.delete();
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
- @Test public void testExportExtensionModule() throws Exception {
- addVDB();
- admin.addExtensionModule("jar", "loopback.jar", Util.getBinaryFile(UnitTestUtil.getTestDataPath()+"/admin/loopbackconn.jar"), ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- Util.writeToFile(UnitTestUtil.getTestScratchPath()+"/loop.jar", admin.exportExtensionModule("loopback.jar")); //$NON-NLS-1$ //$NON-NLS-2$
- File f = new File(UnitTestUtil.getTestScratchPath()+"/loop.jar"); //$NON-NLS-1$
- assertTrue("failed to export connector binding", f.exists()); //$NON-NLS-1$
-
- f.delete();
-
- admin.deleteExtensionModule("loopback.jar"); //$NON-NLS-1$
-
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
- }
-
-
- @Test public void testUDF() throws Exception {
- addVDB();
- stmt = conn.createStatement();
- result = stmt.executeQuery("SELECT GetSystemProperty('path.separator')"); //$NON-NLS-1$
-
- assertTrue(result.next());
- assertEquals(System.getProperty("path.separator"), result.getObject(1)); //$NON-NLS-1$
- assertTrue(!result.next());
-
- result.close();
- stmt.close();
-
- stmt = conn.createStatement();
- result = stmt.executeQuery("SELECT getxyz()"); //$NON-NLS-1$
-
- assertTrue(result.next());
- assertEquals("xyz", result.getObject(1)); //$NON-NLS-1$
- assertTrue(!result.next());
- }
-
- /**
- * @throws Exception
- * @throws AdminException
- * @since 4.3
- */
- private void addVDB() throws Exception{
- admin = getAdmin();
- cleanupVDB(admin, VDB_NAME, "1"); //$NON-NLS-1$
-
- admin.addVDB(VDB_NAME, Util.getBinaryFile(VDB_FILE), new AdminOptions(AdminOptions.OnConflict.IGNORE));
- admin.changeVDBStatus(VDB_NAME, "1", VDB.ACTIVE); //$NON-NLS-1$
-
- conn = getConnection(VDB_NAME, configFile);
- executeStatement("SELECT * FROM smalla"); //$NON-NLS-1$
- }
-
-
- private void executePreparedStatement(String query) throws Exception{
- PreparedStatement pstmt = conn.prepareStatement(query);
- pstmt.execute();
- result = pstmt.getResultSet();
- if (!result.next()) {
- fail("SELECT * FROM smalla"); //$NON-NLS-1$
- }
- stmt = pstmt;
- }
-
- private void executeStatement(String query) throws Exception{
- stmt = conn.createStatement();
- result = stmt.executeQuery(query);
- if (!result.next()) {
- fail("SELECT * FROM smalla"); //$NON-NLS-1$
- }
- }
-}
Property changes on: trunk/test-integration/db
___________________________________________________________________
Name: svn:ignore
- target
.settings
+ target
.settings
bin
Modified: trunk/test-integration/pom.xml
===================================================================
--- trunk/test-integration/pom.xml 2010-03-05 18:58:44 UTC (rev 1924)
+++ trunk/test-integration/pom.xml 2010-03-05 19:01:50 UTC (rev 1925)
@@ -62,6 +62,10 @@
<dependency>
<groupId>org.jboss.teiid</groupId>
<artifactId>teiid-client-jdbc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client-jdbc</artifactId>
<type>test-jar</type>
</dependency>
<dependency>
@@ -122,10 +126,17 @@
<version>${derby.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
<modules>
<module>common</module>
- <module>db</module>
+ <!-- <module>db</module> -->
</modules>
</project>
\ No newline at end of file
More information about the teiid-commits
mailing list