Initial Contribution
Signed-off-by: Vinay Vishal <vinay.vishal@oracle.com>
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/README b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/README
new file mode 100644
index 0000000..2593c75
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/README
@@ -0,0 +1,12 @@
+Tests init sql feature by setting case sensitivity related session parameters as initSQL attribute.
+
+ALTER SESSION set NLS_SORT=BINARY will return case sensitive results from a table. This init sql query is executed before fetching the results from a table.
+
+The results of a same fetch will be different when a init sql query ALTER SESSION set NLS_SORT=BINARY_CI NLS_COMP=LINGUISTIC is executed.
+
+Based on this (for oracle 10g) this test executes to test the init sql functionality.
+
+Oracle 10g and above is needed to execute this test case successfully.
+
+Server would be restarted after the initsql attribute change.
+
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/build.properties b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/build.properties
new file mode 100755
index 0000000..0338c97
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/build.properties
@@ -0,0 +1,33 @@
+<!--
+
+ Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+
+<property name="module" value="jdbc-initsql"/>
+<property name="appname" value="${module}"/>
+<property name="application.xml" value="descriptor/application.xml"/>
+<property name="sun-application.xml" value="descriptor/sun-application.xml"/>
+<property name="ejb-jar.xml" value="descriptor/ejb-jar.xml"/>
+<property name="sun-ejb-jar.xml" value="descriptor/sun-ejb-jar.xml"/>
+<property name="application-client.xml"
+ value="descriptor/application-client.xml"/>
+<property name="sun-application-client.xml"
+ value="descriptor/sun-application-client.xml"/>
+<property name="appclientjar.files" value="${build.classes.dir}"/>
+<property name="appclient.jar" value="${assemble.dir}/${appname}-client.jar"/>
+<property name="app.type" value="application"/>
+<property name="appclient.application.args" value="12"/>
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/build.xml b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/build.xml
new file mode 100755
index 0000000..22fa0e4
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/build.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0"?>
+<!DOCTYPE project [
+<!--
+
+ Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!ENTITY commonSetup SYSTEM "./../../../config/common.xml">
+<!ENTITY commonBuild SYSTEM "./../../../config/properties.xml">
+<!ENTITY jdbcCommon SYSTEM "./../JdbcCommon.xml">
+<!ENTITY jdbcCommonProps SYSTEM "./../JdbcCommon.properties">
+<!ENTITY testproperties SYSTEM "./build.properties">
+]>
+
+<project name="init-sql" basedir="." default="usage">
+
+ &commonSetup;
+ &commonBuild;
+ &testproperties;
+ &jdbcCommon;
+ &jdbcCommonProps;
+
+ <target name="all" depends="clean,build,deploy,run,undeploy"/>
+
+ <target name="clean" depends="init-common">
+ <delete dir="${build.classes.dir}"/>
+ <delete dir="${assemble.dir}"/>
+ </target>
+
+ <target name="compile" depends="clean">
+ <antcall target="compile-common">
+ <param name="src" value="ejb"/>
+ </antcall>
+
+ <antcall target="compile-common">
+ <param name="src" value="client"/>
+ </antcall>
+ </target>
+
+ <target name="build" depends="compile">
+ <antcall target="build-ear-common">
+ <param name="ejbjar.classes" value="**/*.class"/>
+ <param name="appclientjar.classes"
+ value="**/*.class"/>
+ </antcall>
+ <antcall target="ear-common"/>
+ </target>
+
+ <target name="deploy" depends="init-common">
+ <antcall target="deploy-jdbc-oracle-common">
+ <param name="oracle.pool.name" value="jdbc-oracle-pool-initsql"/>
+ <param name="oracle.resource.name" value="jdbc/oracleres-initsql"/>
+ </antcall>
+ <antcall target="asadmin-common">
+ <param name="admin.command" value="set"/>
+ <param name="operand.props"
+ value="${resources.dottedname.prefix}.jdbc-connection-pool.jdbc-oracle-pool-initsql.init-sql='ALTER SESSION SET NLS_COMP=LINGUISTIC NLS_SORT=BINARY_CI'"/>
+ </antcall>
+ <antcall target="deploy-common"/>
+ <antcall target="execute-sql-oracle-common">
+ <param name="sql.file" value="sql/create.sql"/>
+ </antcall>
+ </target>
+
+ <target name="undeploy" depends="init-common">
+ <antcall target="undeploy-jdbc-oracle-common">
+ <param name="oracle.pool.name" value="jdbc-oracle-pool-initsql"/>
+ <param name="oracle.resource.name" value="jdbc/oracleres-initsql"/>
+ </antcall>
+ <antcall target="undeploy-common"/>
+ <antcall target="execute-sql-oracle-common">
+ <param name="sql.file" value="sql/drop.sql"/>
+ </antcall>
+ </target>
+
+ <target name="run">
+ <antcall target="runclient-common">
+ <param name="appclient.application.args" value="1"/>
+ </antcall>
+ <antcall target="asadmin-common">
+ <param name="admin.command" value="set"/>
+ <param name="operand.props"
+ value="${resources.dottedname.prefix}.jdbc-connection-pool.jdbc-oracle-pool-initsql.init-sql='ALTER SESSION SET NLS_SORT=BINARY'"/>
+ </antcall>
+ <antcall target="restart-server"/>
+ <antcall target="runclient-common">
+ <param name="appclient.application.args" value="2"/>
+ </antcall>
+ </target>
+
+ <target name="usage">
+ <antcall target="usage-common"/>
+ </target>
+
+</project>
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/client/Client.java b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/client/Client.java
new file mode 100644
index 0000000..23b7afe
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/client/Client.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.s1asdev.jdbc.initsql.client;
+
+import javax.naming.*;
+import java.rmi.*;
+import java.util.*;
+import javax.sql.DataSource;
+import com.sun.s1asdev.jdbc.initsql.ejb.SimpleSessionHome;
+import com.sun.s1asdev.jdbc.initsql.ejb.SimpleSession;
+import com.sun.ejte.ccl.reporter.SimpleReporterAdapter;
+
+public class Client {
+
+ private static SimpleReporterAdapter stat = new SimpleReporterAdapter();
+ private static String testSuite = "initsql-test";
+
+ private static InitialContext ic;
+ public static void main(String[] args)
+ throws Exception {
+
+ try {
+ ic = new InitialContext();
+ } catch(NamingException ex) {
+ ex.printStackTrace();
+ }
+
+ Object objRef = ic.lookup("java:comp/env/ejb/SimpleSessionHome");
+ SimpleSessionHome simpleSessionHome = (SimpleSessionHome)
+ javax.rmi.PortableRemoteObject.narrow(objRef, SimpleSessionHome.class);
+ stat.addDescription("Running initsql testSuite ");
+ SimpleSession simpleSession = simpleSessionHome.create();
+
+ if (args != null && args.length > 0) {
+ String param = args[0];
+
+ switch (Integer.parseInt(param)) {
+ case 1: {
+ if (simpleSession.test1(false)) { //Case sensitive test
+ stat.addStatus(testSuite + "test-1 ", stat.PASS);
+ } else {
+ stat.addStatus(testSuite + "test-1 ", stat.FAIL);
+ }
+ break;
+ }
+ case 2: {
+ if (simpleSession.test1(true)) { //Case insensitivity test
+ stat.addStatus(testSuite + "test-2 ", stat.PASS);
+ } else {
+ stat.addStatus(testSuite + "test-2 ", stat.FAIL);
+ }
+ break;
+ }
+ }
+ }
+
+ stat.printSummary();
+ }
+}
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/client/MANIFEST.MF b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/client/MANIFEST.MF
new file mode 100644
index 0000000..07e6f32
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/client/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Main-Class: com.sun.s1asdev.jdbc.initsql.client.Client
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/application-client.xml b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/application-client.xml
new file mode 100755
index 0000000..9cbf249
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/application-client.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!-- -->
+
+<!DOCTYPE application-client PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN' 'http://java.sun.com/dtd/application-client_1_3.dtd'>
+
+<application-client>
+ <display-name>jdbc-initsqlClient</display-name>
+ <ejb-ref>
+ <ejb-ref-name>ejb/SimpleSessionHome</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>com.sun.s1asdev.jdbc.initsql.ejb.SimpleSessionHome</home>
+ <remote>com.sun.s1asdev.jdbc.initsql.ejb.SimpleSession</remote>
+ </ejb-ref>
+</application-client>
+
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/application.xml b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/application.xml
new file mode 100755
index 0000000..7272844
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/application.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!-- -->
+
+<!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
+
+<application>
+ <display-name>SimpleSessionClient</display-name>
+ <description>Application description</description>
+ <module>
+ <ejb>jdbc-initsql-ejb.jar</ejb>
+ </module>
+ <module>
+ <java>jdbc-initsql-client.jar</java>
+ </module>
+</application>
+
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/ejb-jar.xml b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/ejb-jar.xml
new file mode 100755
index 0000000..fc6e9fb
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/ejb-jar.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!-- -->
+
+<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
+
+<ejb-jar>
+ <display-name>SimpleSessionJAR</display-name>
+ <enterprise-beans>
+
+<!-- Simple EJB -->
+ <session>
+ <display-name>SimpleSessionEJB</display-name>
+ <ejb-name>SimpleSessionEJB</ejb-name>
+ <home>com.sun.s1asdev.jdbc.initsql.ejb.SimpleSessionHome</home>
+ <remote>com.sun.s1asdev.jdbc.initsql.ejb.SimpleSession</remote>
+ <ejb-class>com.sun.s1asdev.jdbc.initsql.ejb.SimpleSessionBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Bean</transaction-type>
+ <resource-ref>
+ <res-ref-name>DataSource1</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+ </session>
+ </enterprise-beans>
+
+ <assembly-descriptor>
+ <container-transaction>
+ <method>
+ <ejb-name>SimpleSessionEJB</ejb-name>
+ <method-name>*</method-name>
+ </method>
+ <trans-attribute>Required</trans-attribute>
+ </container-transaction>
+ </assembly-descriptor>
+
+</ejb-jar>
+
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/sun-application-client.xml b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/sun-application-client.xml
new file mode 100755
index 0000000..ecf90b4
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/sun-application-client.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sun-application-client PUBLIC '-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 Application Client 1.3//EN' 'http://www.sun.com/software/sunone/appserver/dtds/sun-application-client_1_3-0.dtd'>
+<!--
+
+ Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!-- -->
+
+<sun-application-client>
+ <ejb-ref>
+ <ejb-ref-name>ejb/SimpleSessionHome</ejb-ref-name>
+ <jndi-name>com.sun.s1asdev.jdbc.initsql.ejb.SimpleSessionHome</jndi-name>
+ </ejb-ref>
+</sun-application-client>
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/sun-ejb-jar.xml b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/sun-ejb-jar.xml
new file mode 100755
index 0000000..fd04412
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/descriptor/sun-ejb-jar.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v. 2.0, which is available at
+ http://www.eclipse.org/legal/epl-2.0.
+
+ This Source Code may also be made available under the following Secondary
+ Licenses when the conditions for such availability set forth in the
+ Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ version 2 with the GNU Classpath Exception, which is available at
+ https://www.gnu.org/software/classpath/license.html.
+
+ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
+
+<!-- -->
+<!DOCTYPE sun-ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 EJB 2.0//EN' 'http://www.sun.com/software/sunone/appserver/dtds/sun-ejb-jar_2_0-0.dtd'>
+
+<sun-ejb-jar>
+ <enterprise-beans>
+ <ejb>
+ <ejb-name>SimpleSessionEJB</ejb-name>
+ <jndi-name>com.sun.s1asdev.jdbc.initsql.ejb.SimpleSessionHome</jndi-name>
+ <resource-ref>
+ <res-ref-name>DataSource1</res-ref-name>
+ <jndi-name>jdbc/oracleres-initsql</jndi-name>
+ </resource-ref>
+ </ejb>
+ </enterprise-beans>
+</sun-ejb-jar>
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/ejb/SimpleSession.java b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/ejb/SimpleSession.java
new file mode 100644
index 0000000..7d18d55
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/ejb/SimpleSession.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.s1asdev.jdbc.initsql.ejb;
+
+import javax.ejb.*;
+import java.rmi.*;
+import javax.sql.DataSource;
+
+public interface SimpleSession extends EJBObject {
+ public boolean test1(boolean caseSensitive) throws RemoteException;
+}
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/ejb/SimpleSessionBean.java b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/ejb/SimpleSessionBean.java
new file mode 100644
index 0000000..2daf55f
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/ejb/SimpleSessionBean.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.s1asdev.jdbc.initsql.ejb;
+
+import javax.ejb.*;
+import javax.naming.*;
+import javax.sql.*;
+import java.rmi.*;
+import java.util.*;
+import java.sql.*;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+public class SimpleSessionBean implements SessionBean
+{
+
+ private SessionContext context;
+ private InitialContext ic;
+ private DataSource ds1;
+
+ public void setSessionContext(SessionContext ctxt) {
+ this.context = ctxt;
+ try {
+ ic = new InitialContext();
+ ds1 = (com.sun.appserv.jdbc.DataSource)ic.lookup("java:comp/env/DataSource1");
+ } catch( Exception ne ) {
+ ne.printStackTrace();
+ }
+ }
+
+ public void ejbCreate() throws CreateException {
+ }
+
+ /**
+ * Test to select the names from a table.
+ *
+ * The result set would contain different number of rows based on
+ * a session property set during the initialization sql phase.
+ * Based on the property set, the number of rows are compared to
+ * test the feature.
+ */
+ public boolean test1(boolean caseSensitive) {
+ Connection con = null;
+ Statement stmt = null;
+ ResultSet rs = null;
+ String query = "Select name from WORKERS where name='Joy Joy'";
+ boolean result = false;
+ int size = 0;
+ try {
+ con = ds1.getConnection();
+ stmt = con.createStatement();
+ rs = stmt.executeQuery(query);
+ if(rs != null) {
+ while(rs.next()) {
+ size++;
+ }
+ }
+ if(caseSensitive) {
+ result = size == 1;
+ } else {
+ result = size == 3;
+ }
+ } catch (SQLException ex) {
+ result = false;
+ ex.printStackTrace();
+ } finally {
+ if(rs != null) {
+ try {
+ rs.close();
+ } catch(Exception ex) {}
+ }
+ if(stmt != null) {
+ try {
+ stmt.close();
+ } catch(Exception ex) {}
+ }
+ if(con != null) {
+ try {
+ stmt.close();
+ } catch(Exception ex) {}
+ }
+ }
+ return result;
+ }
+
+ public void ejbStore() {}
+ public void ejbRemove() {}
+ public void ejbActivate() {}
+ public void ejbPassivate() {}
+ public void unsetEntityContext() {}
+ public void ejbPostCreate() {}
+}
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/ejb/SimpleSessionHome.java b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/ejb/SimpleSessionHome.java
new file mode 100644
index 0000000..03959a2
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/ejb/SimpleSessionHome.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package com.sun.s1asdev.jdbc.initsql.ejb;
+
+import javax.ejb.*;
+import java.rmi.*;
+
+public interface SimpleSessionHome extends EJBHome
+{
+ SimpleSession create()
+ throws RemoteException, CreateException;
+
+}
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/sql/create.sql b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/sql/create.sql
new file mode 100644
index 0000000..34c8dc1
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/sql/create.sql
@@ -0,0 +1,7 @@
+DROP TABLE WORKERS;
+CREATE TABLE WORKERS(
+ name char(20)
+);
+INSERT INTO WORKERS VALUES('Joy Joy');
+INSERT INTO WORKERS VALUES('joy joy');
+INSERT INTO WORKERS VALUES('JOY JOY');
diff --git a/appserver/tests/appserv-tests/devtests/jdbc/init-sql/sql/drop.sql b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/sql/drop.sql
new file mode 100644
index 0000000..7b92bdc
--- /dev/null
+++ b/appserver/tests/appserv-tests/devtests/jdbc/init-sql/sql/drop.sql
@@ -0,0 +1 @@
+DROP TABLE WORKERS;