You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/06/14 23:14:49 UTC
svn commit: r190657 [22/23] - in /incubator/beehive/trunk/system-controls:
./ ant/ samples/ejb/
samples/ejb/client/org/apache/beehive/controls/system/ejb/sample/client/
samples/ejb/control/org/apache/beehive/controls/system/ejb/sample/control/
samples/ejb/ejb/META-INF/
samples/ejb/ejb/org/apache/beehive/controls/system/ejb/sample/bean/
samples/jdbc/jdbcControlSample/ samples/jdbc/jdbcControlSample/META-INF/
samples/jdbc/jdbcControlSample/WEB-INF/
samples/jdbc/jdbcControlSample/WEB-INF/src/
samples/jdbc/jdbcControlSample/WEB-INF/src/controls/
samples/jdbc/jdbcControlSample/WEB-INF/src/servlet/
samples/jdbc/jdbcControlSample/WEB-INF/src/shared/ samples/jms/
samples/jms/src/org/apache/beehive/controls/system/jms/samples/
samples/webservice/amazon/ samples/webservice/amazon/junit/
samples/webservice/amazon/schemas/ samples/webservice/common/src/test/
samples/webservice/google/ samples/webservice/google/junit/model/
samples/webservice/google/rpc_schemas/ samples/webservice/google/servlet/
samples/webservice/wsm_samples_client/
samples/webservice/wsm_samples_client/junit/
samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/
samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/
samples/webservice/xmlbeans/ samples/webservice/xmlbeans/junit/ src/ejb/
src/ejb/org/apache/beehive/controls/system/ejb/ src/ejb/schema/ src/jdbc/
src/jdbc/org/apache/beehive/controls/system/jdbc/
src/jdbc/org/apache/beehive/controls/system/jdbc/parser/ src/jms/
src/jms/org/apache/beehive/controls/system/jms/
src/jms/org/apache/beehive/controls/system/jms/impl/
src/jms/org/apache/beehive/controls/system/jndi/
src/jms/org/apache/beehive/controls/system/jndi/impl/ src/webservice/
src/webservice/org/apache/beehive/controls/system/webservice/
src/webservice/org/apache/beehive/controls/system/webservice/generator/
src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/
src/webservice/org/apache/beehive/controls/system/webservice/utils/
test/ant/ test/conf/ test/src/jdbc/controls/
test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/
test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/errors/
test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/
test/src/jdbc/controls/schemas/badusers/
test/src/jdbc/controls/schemas/users/ test/src/jdbc/jdbc-container/
test/src/jdbc/jdbc-container/application/
test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/jdbc/containertest/
test/src/jdbc/jdbc-container/webapp/WEB-INF/
test/src/jdbc/jdbc-container/webapp/conf/Catalina/localhost/
test/src/jdbc/junitTests/
test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/dbconnection/
test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/errors/
test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/
test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/
test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/
test/src/webservice/ test/src/webservice/jcxgen-tests/
test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/
test/src/webservice/schemas/ test/src/webservice/servers/webapp/WEB-INF/
test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/
test/src/webservice/servers/webapp/WEB-INF/src/web/
test/src/webservice/servers/webapp/WEB-INF/webservices/web/complex/
test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/dlwservice/
Modified: incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/SqlParserTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/SqlParserTest.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/SqlParserTest.java (original)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/SqlParserTest.java Tue Jun 14 14:14:42 2005
@@ -1,421 +1,421 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-
-package org.apache.beehive.controls.system.jdbc.units.sqlparser;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.beehive.controls.api.ControlException;
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Logger;
-import org.apache.beehive.controls.system.jdbc.parser.SqlParser;
-import org.apache.beehive.controls.system.jdbc.parser.SqlStatement;
-
-/**
- *
- */
-public class SqlParserTest extends TestCase {
- private static final Logger _logger = Logger.getLogger(SqlParserTest.class);
-
- private static final String SimpleREFLECTPARAMS = "create table users (username VARCHAR(50), password VARCHAR(50))";
- private static final String SimpleREFLECTPARAMS_2 = "INSERT INTO USERS (username, password) \nVALUES({username},{password})";
- private static final String SimpleREFLECTPARAMS_2_RESULT = "INSERT INTO USERS (username, password) \nVALUES(?,?)";
- private static final String SimpleREFLECTPARAMS_3 = "UPDATE USERS SET USERNAME = {username}, PASSWORD = {password} WHERE USERNAME = {username}";
- private static final String SimpleREFLECTPARAMS_3_RESULT = "UPDATE USERS SET USERNAME = ?, PASSWORD = ? WHERE USERNAME = ?";
- private static final String SimpleREFLECTPARAMS_4 = "UPDATE USERS SET USERNAME = {username|VARCHAR}, PASSWORD = {password|VARCHAR} WHERE USERNAME = {username|BIGINT}";
- private static final String SimpleREFLECTPARAMS_5 = "SELECT * FROM USERS WHERE NAME={ param}";
- private static final String SimpleREFLECTPARAMS_5_RESULT = "SELECT * FROM USERS WHERE NAME=?";
- private static final String SimpleREFLECTPARAMS_6 = "SELECT * FROM users WHERE foo='{' AND";
-
-
- private static final String SimpleJDBCPARAMS_1 = "INSERT INTO USERS (username, password) \nVALUES({call username(x)},{password})";
- private static final String SimpleJDBCPARAMS_1_RESULT = "INSERT INTO USERS (username, password) \nVALUES({call username(x)},?)";
- private static final String SimpleJDBCPARAMS_2 = "INSERT INTO USERS (username, password) \nVALUES({?= username()},{password})";
- private static final String SimpleJDBCPARAMS_2_RESULT = "INSERT INTO USERS (username, password) \nVALUES({?= username()},?)";
- private static final String SimpleJDBCPARAMS_3 = "INSERT INTO USERS (username, password) \nVALUES({d {foo}},{password})";
- private static final String SimpleJDBCPARAMS_3_RESULT = "INSERT INTO USERS (username, password) \nVALUES({d ?},?)";
- private static final String SimpleJDBCPARAMS_4 = "SELECT name FROM Identifiers WHERE Id LIKE '\\%' {escape '\\'})";
- private static final String SimpleJDBCPARAMS_5 = "{fn user()}{fn concat('Hot', 'Java')}";
- private static final String SimpleJDBCPARAMS_6 = "{d 'yyyy-mm-dd'}{t 'hh:mm:ss'}{ts 'yyyy-mm-dd hh:mm:ss.f'}{d {foo}}";
- private static final String SimpleJDBCPARAMS_6_RESULT = "{d 'yyyy-mm-dd'}{t 'hh:mm:ss'}{ts 'yyyy-mm-dd hh:mm:ss.f'}{d ?}";
- private static final String SimpleJDBCPARAMS_7 = "SELECT * FROM {oj TABLE1 LEFT OUTER JOIN TABLE2 ON DEPT_NO = 003420930}";
-
-
- private static final String SimpleSQLPARAMS_1 = "INSERT INTO USERS (username, password) \nVALUES({sql:fn in(x,{y})},{password})";
- private static final String SimpleSQLPARAMS_1_RESULT = "INSERT INTO USERS (username, password) \nVALUES((x IN (?)),?)";
- private static final String SimpleSQLPARAMS_2 = "INSERT INTO USERS (username, password) \nVALUES({sql:subst x}),{password})";
- private static final String SimpleSQLPARAMS_2_RESULT = "INSERT INTO USERS (username, password) \nVALUES(?),?)";
- private static final String SimpleSQLPARAMS_3 = "INSERT INTO USERS (username, password) \nVALUES({sql: x}),{password})";
- private static final String SimpleSQLPARAMS_3_RESULT = "INSERT INTO USERS (username, password) \nVALUES(?),?)";
-
-
- private static final String BADLY_FORMED_1 = "INSERT INTO USERS (username, password) \nVALUES({sql: x}),{password)";
- private static final String BADLY_FORMED_2 = "INSERT INTO USERS (username, password) \nVALUES(sql: x}),{password})";
- private static final String BADLY_FORMED_3 = "INSERT INTO USERS (username, password) VALUES(({sql: 'x}),{password})";
- private static final String BADLY_FORMED_4 = "INSERT INTO USERS (username, password) \nVALUES(({sqlxxx: x}),{password})";
- private static final String BADLY_FORMED_5 = "INSERT INTO USERS (username, password) \nVALUES(({sql:badfunc x}),{password})";
- private static final String BADLY_FORMED_6 = "INSERT INTO USERS (username, password) \nVALUES(({sql: x),{password})";
- private static final String BADLY_FORMED_7 = "INSERT INTO USERS (username, password) \nVALUES(({sql: x}),{})";
- private static final String BADLY_FORMED_8 = "INSERT INTO USERS (username, password) \nVALUES(({sql: x}),{p)";
-
-// private static final String CORE_SQL_1 = "create table users (username VARCHAR(50), password VARCHAR(50))";
-// private static final String CORE_SQL_2 = "INSERT INTO USERS (username, password) \nVALUES(({x}),{p})";
-// private static final String CORE_SQL_3 = "INSERT INTO USERS (username, password) \nVALUES(({sql:x}),{p})";
-// private static final String CORE_SQL_4 = "INSERT INTO USERS (username, password) \nVALUES({sql:fn in(x,{y})},{password})";
-// private static final String CORE_SQL_4_OUT = "INSERT INTO USERS (username, password) \nVALUES({x IN (y)},{password})";
-// private static final String CORE_SQL_5 = "INSERT INTO USERS (username, password) \nVALUES({call {foo}},{password})";
-// private static final String CORE_SQL_6 = "INSERT INTO USERS (username, password) \nVALUES({?= username},{password})";
-
- private SqlParser _parser;
-
- public void setUp() throws Exception {
-// BasicConfigurator.configure();
- _parser = new SqlParser();
- }
-
- public void tearDown() throws Exception { }
-
- //
- // tests for basic param sub parsing
- //
-
-
- //
- // parse with no substitutions
- //
- public void testSimpleParse() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleREFLECTPARAMS);
- assertEquals(SimpleREFLECTPARAMS, frag.toString());
- }
-
- //
- // test parsing with several reflected params
- //
- public void testParamReflection() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleREFLECTPARAMS_2);
- assertEquals(SimpleREFLECTPARAMS_2_RESULT, frag.toString());
- }
-
- //
- // test parsing with several reflected params
- //
- public void testParamReflection2() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleREFLECTPARAMS_3);
- assertEquals(SimpleREFLECTPARAMS_3_RESULT, frag.toString());
- }
-
- //
- // test parsing with several reflected params which specify types
- //
- public void testParamReflectionWithTypes() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleREFLECTPARAMS_4);
- assertEquals(SimpleREFLECTPARAMS_3_RESULT, frag.toString());
- }
-
- //
- // test parsing with several reflected params + whitespace
- //
- public void testParamReflectionWhitespace() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleREFLECTPARAMS_5);
- assertEquals(SimpleREFLECTPARAMS_5_RESULT, frag.toString());
- }
-
- //
- // test parsing with several reflected params + a literal brace
- //
- public void testParamReflectionLiteralBrace() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleREFLECTPARAMS_6);
- assertEquals(SimpleREFLECTPARAMS_6, frag.toString());
- }
-
-// //////////////////////////////////////// END REFLECTION TESTS //////////////////////////////////////////////////
-
- //
- // tests for jdbc escape parsing
- //
-
-
- //
- // JDBC call cmd
- //
- public void testJdbcCall() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleJDBCPARAMS_1);
- assertEquals(SimpleJDBCPARAMS_1_RESULT, frag.toString());
- }
-
- //
- // JDBC ?= cmd
- //
- public void testJdbcReturnCmd() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleJDBCPARAMS_2);
- assertEquals(SimpleJDBCPARAMS_2_RESULT, frag.toString());
- }
-
- //
- // JDBC d cmd
- //
- public void testJdbcDateCmd() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleJDBCPARAMS_3);
- assertEquals(SimpleJDBCPARAMS_3_RESULT, frag.toString());
- }
-
- //
- // JDBC escape cmd
- //
- public void testJdbcEscapeCmd() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleJDBCPARAMS_4);
- assertEquals(SimpleJDBCPARAMS_4, frag.toString());
- }
-
- //
- // JDBC fn cmd
- //
- public void testJdbcFnCmd() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleJDBCPARAMS_5);
- assertEquals(SimpleJDBCPARAMS_5, frag.toString());
- }
-
- //
- // JDBC d, t, ts cmds
- //
- public void testJdbcTimeCmds() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleJDBCPARAMS_6);
- assertEquals(SimpleJDBCPARAMS_6_RESULT, frag.toString());
- }
-
- //
- // JDBC outerjoin cmds
- //
- public void testJdbcOuterJoinCmd() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleJDBCPARAMS_7);
- assertEquals(SimpleJDBCPARAMS_7, frag.toString());
- }
-
- // ///////////////////////////////////////// End of JDBC cmd tests ////////////////////////////////////////////
-
- //
- // tests for sql escape parsing
- //
-
-
- //
- // tests sql:fn sub
- //
- public void testSqlFn() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleSQLPARAMS_1);
- assertEquals(SimpleSQLPARAMS_1_RESULT, frag.toString());
- }
-
- //
- // tests sql:subst
- //
- public void testSqlSubst() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleSQLPARAMS_2);
- assertEquals(SimpleSQLPARAMS_2_RESULT, frag.toString());
- }
-
- //
- // tests implicit sql:subst
- //
- public void testSqlImplicitSubst() {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- frag = _parser.parse(SimpleSQLPARAMS_3);
- assertEquals(SimpleSQLPARAMS_3_RESULT, frag.toString());
- }
-
- // ///////////////////////////////////////////// End of Sql Subst Tests ////////////////////////////////////////
-
- //
- // tests for badly formed sql expression parsing
- //
-
- //
- // statement missing '}'
- //
- public void testParseErrorMissingCloseBrace() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- try {
- frag = _parser.parse(BADLY_FORMED_1);
- fail("SQL statements missing '}' should raise SqlException");
- } catch (ControlException spe) {
- assertTrue(true);
- }
- }
-
- //
- // statement missing '{'
- //
- public void testParseErrorMissingOpenBrace() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- try {
- frag = _parser.parse(BADLY_FORMED_2);
- fail("SQL statements with unbalanced '{}'s should raise SqlException");
- } catch (ControlException spe) {
- assertTrue(true);
- }
- }
-
- //
- // statement has unbalanced 's
- //
- public void testParseErrorUnbalancedSquotes() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- try {
- frag = _parser.parse(BADLY_FORMED_3);
- fail("SQL statements with unbalanced 's should raise SqlException");
- } catch (ControlException spe) {
- assertTrue(true);
- }
- }
-
- //
- // statement has unbalanced invalid escape sequence 'sqlxxxx:'
- //
- public void testParseErrorInvalidEscape() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- try {
- frag = _parser.parse(BADLY_FORMED_4);
- fail("SQL statements with invalid escape sequences should raise SqlException");
- } catch (ControlException spe) {
- assertTrue(true);
- }
- }
-
- //
- // SQLEscapeFragment: statement has unbalanced invalid sql: keyword, must be either fn or subst
- //
- public void testParseErrorInvalidKeyWord() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- try {
- frag = _parser.parse(BADLY_FORMED_5);
- fail("SQL statements with sql: escapes can only map to 'fn' or 'subst' functions");
- } catch (ControlException spe) {
- assertTrue(true);
- }
- }
-
- //
- // SQLEscapeFragment: statement missing '}'
- //
- public void testParseErrorMissingEscapeBrace() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- try {
- frag = _parser.parse(BADLY_FORMED_6);
- fail("SQL statements with unbalanced 's should raise SqlException");
- } catch (ControlException spe) {
- assertTrue(true);
- }
- }
-
- //
- // ReflectFragment: statement missing param name
- //
- public void testParseErrorMissingParamName() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- try {
- frag = _parser.parse(BADLY_FORMED_7);
- fail("SQL statements with empty '{}'s should raise SqlException");
- } catch (ControlException spe) {
- assertTrue(true);
- }
- }
-
- //
- // ReflectFragment: statement missing '}'
- //
- public void testParseErrorMissingReflectBrace() throws Exception {
- SqlStatement frag = null;
- assertNotNull(_parser);
-
- try {
- frag = _parser.parse(BADLY_FORMED_8);
- fail("SQL statements with unbalanced {}'s should raise SqlException");
- } catch (ControlException spe) {
- assertTrue(true);
- }
- }
-
- public SqlParserTest(String name) { super(name); }
-
- public static Test suite() { return new TestSuite(SqlParserTest.class); }
-
- public static void main(String[] args) { junit.textui.TestRunner.run(suite()); }
-}
-
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.units.sqlparser;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Logger;
+import org.apache.beehive.controls.system.jdbc.parser.SqlParser;
+import org.apache.beehive.controls.system.jdbc.parser.SqlStatement;
+
+/**
+ *
+ */
+public class SqlParserTest extends TestCase {
+ private static final Logger _logger = Logger.getLogger(SqlParserTest.class);
+
+ private static final String SimpleREFLECTPARAMS = "create table users (username VARCHAR(50), password VARCHAR(50))";
+ private static final String SimpleREFLECTPARAMS_2 = "INSERT INTO USERS (username, password) \nVALUES({username},{password})";
+ private static final String SimpleREFLECTPARAMS_2_RESULT = "INSERT INTO USERS (username, password) \nVALUES(?,?)";
+ private static final String SimpleREFLECTPARAMS_3 = "UPDATE USERS SET USERNAME = {username}, PASSWORD = {password} WHERE USERNAME = {username}";
+ private static final String SimpleREFLECTPARAMS_3_RESULT = "UPDATE USERS SET USERNAME = ?, PASSWORD = ? WHERE USERNAME = ?";
+ private static final String SimpleREFLECTPARAMS_4 = "UPDATE USERS SET USERNAME = {username|VARCHAR}, PASSWORD = {password|VARCHAR} WHERE USERNAME = {username|BIGINT}";
+ private static final String SimpleREFLECTPARAMS_5 = "SELECT * FROM USERS WHERE NAME={ param}";
+ private static final String SimpleREFLECTPARAMS_5_RESULT = "SELECT * FROM USERS WHERE NAME=?";
+ private static final String SimpleREFLECTPARAMS_6 = "SELECT * FROM users WHERE foo='{' AND";
+
+
+ private static final String SimpleJDBCPARAMS_1 = "INSERT INTO USERS (username, password) \nVALUES({call username(x)},{password})";
+ private static final String SimpleJDBCPARAMS_1_RESULT = "INSERT INTO USERS (username, password) \nVALUES({call username(x)},?)";
+ private static final String SimpleJDBCPARAMS_2 = "INSERT INTO USERS (username, password) \nVALUES({?= username()},{password})";
+ private static final String SimpleJDBCPARAMS_2_RESULT = "INSERT INTO USERS (username, password) \nVALUES({?= username()},?)";
+ private static final String SimpleJDBCPARAMS_3 = "INSERT INTO USERS (username, password) \nVALUES({d {foo}},{password})";
+ private static final String SimpleJDBCPARAMS_3_RESULT = "INSERT INTO USERS (username, password) \nVALUES({d ?},?)";
+ private static final String SimpleJDBCPARAMS_4 = "SELECT name FROM Identifiers WHERE Id LIKE '\\%' {escape '\\'})";
+ private static final String SimpleJDBCPARAMS_5 = "{fn user()}{fn concat('Hot', 'Java')}";
+ private static final String SimpleJDBCPARAMS_6 = "{d 'yyyy-mm-dd'}{t 'hh:mm:ss'}{ts 'yyyy-mm-dd hh:mm:ss.f'}{d {foo}}";
+ private static final String SimpleJDBCPARAMS_6_RESULT = "{d 'yyyy-mm-dd'}{t 'hh:mm:ss'}{ts 'yyyy-mm-dd hh:mm:ss.f'}{d ?}";
+ private static final String SimpleJDBCPARAMS_7 = "SELECT * FROM {oj TABLE1 LEFT OUTER JOIN TABLE2 ON DEPT_NO = 003420930}";
+
+
+ private static final String SimpleSQLPARAMS_1 = "INSERT INTO USERS (username, password) \nVALUES({sql:fn in(x,{y})},{password})";
+ private static final String SimpleSQLPARAMS_1_RESULT = "INSERT INTO USERS (username, password) \nVALUES((x IN (?)),?)";
+ private static final String SimpleSQLPARAMS_2 = "INSERT INTO USERS (username, password) \nVALUES({sql:subst x}),{password})";
+ private static final String SimpleSQLPARAMS_2_RESULT = "INSERT INTO USERS (username, password) \nVALUES(?),?)";
+ private static final String SimpleSQLPARAMS_3 = "INSERT INTO USERS (username, password) \nVALUES({sql: x}),{password})";
+ private static final String SimpleSQLPARAMS_3_RESULT = "INSERT INTO USERS (username, password) \nVALUES(?),?)";
+
+
+ private static final String BADLY_FORMED_1 = "INSERT INTO USERS (username, password) \nVALUES({sql: x}),{password)";
+ private static final String BADLY_FORMED_2 = "INSERT INTO USERS (username, password) \nVALUES(sql: x}),{password})";
+ private static final String BADLY_FORMED_3 = "INSERT INTO USERS (username, password) VALUES(({sql: 'x}),{password})";
+ private static final String BADLY_FORMED_4 = "INSERT INTO USERS (username, password) \nVALUES(({sqlxxx: x}),{password})";
+ private static final String BADLY_FORMED_5 = "INSERT INTO USERS (username, password) \nVALUES(({sql:badfunc x}),{password})";
+ private static final String BADLY_FORMED_6 = "INSERT INTO USERS (username, password) \nVALUES(({sql: x),{password})";
+ private static final String BADLY_FORMED_7 = "INSERT INTO USERS (username, password) \nVALUES(({sql: x}),{})";
+ private static final String BADLY_FORMED_8 = "INSERT INTO USERS (username, password) \nVALUES(({sql: x}),{p)";
+
+// private static final String CORE_SQL_1 = "create table users (username VARCHAR(50), password VARCHAR(50))";
+// private static final String CORE_SQL_2 = "INSERT INTO USERS (username, password) \nVALUES(({x}),{p})";
+// private static final String CORE_SQL_3 = "INSERT INTO USERS (username, password) \nVALUES(({sql:x}),{p})";
+// private static final String CORE_SQL_4 = "INSERT INTO USERS (username, password) \nVALUES({sql:fn in(x,{y})},{password})";
+// private static final String CORE_SQL_4_OUT = "INSERT INTO USERS (username, password) \nVALUES({x IN (y)},{password})";
+// private static final String CORE_SQL_5 = "INSERT INTO USERS (username, password) \nVALUES({call {foo}},{password})";
+// private static final String CORE_SQL_6 = "INSERT INTO USERS (username, password) \nVALUES({?= username},{password})";
+
+ private SqlParser _parser;
+
+ public void setUp() throws Exception {
+// BasicConfigurator.configure();
+ _parser = new SqlParser();
+ }
+
+ public void tearDown() throws Exception { }
+
+ //
+ // tests for basic param sub parsing
+ //
+
+
+ //
+ // parse with no substitutions
+ //
+ public void testSimpleParse() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleREFLECTPARAMS);
+ assertEquals(SimpleREFLECTPARAMS, frag.toString());
+ }
+
+ //
+ // test parsing with several reflected params
+ //
+ public void testParamReflection() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleREFLECTPARAMS_2);
+ assertEquals(SimpleREFLECTPARAMS_2_RESULT, frag.toString());
+ }
+
+ //
+ // test parsing with several reflected params
+ //
+ public void testParamReflection2() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleREFLECTPARAMS_3);
+ assertEquals(SimpleREFLECTPARAMS_3_RESULT, frag.toString());
+ }
+
+ //
+ // test parsing with several reflected params which specify types
+ //
+ public void testParamReflectionWithTypes() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleREFLECTPARAMS_4);
+ assertEquals(SimpleREFLECTPARAMS_3_RESULT, frag.toString());
+ }
+
+ //
+ // test parsing with several reflected params + whitespace
+ //
+ public void testParamReflectionWhitespace() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleREFLECTPARAMS_5);
+ assertEquals(SimpleREFLECTPARAMS_5_RESULT, frag.toString());
+ }
+
+ //
+ // test parsing with several reflected params + a literal brace
+ //
+ public void testParamReflectionLiteralBrace() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleREFLECTPARAMS_6);
+ assertEquals(SimpleREFLECTPARAMS_6, frag.toString());
+ }
+
+// //////////////////////////////////////// END REFLECTION TESTS //////////////////////////////////////////////////
+
+ //
+ // tests for jdbc escape parsing
+ //
+
+
+ //
+ // JDBC call cmd
+ //
+ public void testJdbcCall() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleJDBCPARAMS_1);
+ assertEquals(SimpleJDBCPARAMS_1_RESULT, frag.toString());
+ }
+
+ //
+ // JDBC ?= cmd
+ //
+ public void testJdbcReturnCmd() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleJDBCPARAMS_2);
+ assertEquals(SimpleJDBCPARAMS_2_RESULT, frag.toString());
+ }
+
+ //
+ // JDBC d cmd
+ //
+ public void testJdbcDateCmd() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleJDBCPARAMS_3);
+ assertEquals(SimpleJDBCPARAMS_3_RESULT, frag.toString());
+ }
+
+ //
+ // JDBC escape cmd
+ //
+ public void testJdbcEscapeCmd() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleJDBCPARAMS_4);
+ assertEquals(SimpleJDBCPARAMS_4, frag.toString());
+ }
+
+ //
+ // JDBC fn cmd
+ //
+ public void testJdbcFnCmd() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleJDBCPARAMS_5);
+ assertEquals(SimpleJDBCPARAMS_5, frag.toString());
+ }
+
+ //
+ // JDBC d, t, ts cmds
+ //
+ public void testJdbcTimeCmds() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleJDBCPARAMS_6);
+ assertEquals(SimpleJDBCPARAMS_6_RESULT, frag.toString());
+ }
+
+ //
+ // JDBC outerjoin cmds
+ //
+ public void testJdbcOuterJoinCmd() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleJDBCPARAMS_7);
+ assertEquals(SimpleJDBCPARAMS_7, frag.toString());
+ }
+
+ // ///////////////////////////////////////// End of JDBC cmd tests ////////////////////////////////////////////
+
+ //
+ // tests for sql escape parsing
+ //
+
+
+ //
+ // tests sql:fn sub
+ //
+ public void testSqlFn() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleSQLPARAMS_1);
+ assertEquals(SimpleSQLPARAMS_1_RESULT, frag.toString());
+ }
+
+ //
+ // tests sql:subst
+ //
+ public void testSqlSubst() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleSQLPARAMS_2);
+ assertEquals(SimpleSQLPARAMS_2_RESULT, frag.toString());
+ }
+
+ //
+ // tests implicit sql:subst
+ //
+ public void testSqlImplicitSubst() {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ frag = _parser.parse(SimpleSQLPARAMS_3);
+ assertEquals(SimpleSQLPARAMS_3_RESULT, frag.toString());
+ }
+
+ // ///////////////////////////////////////////// End of Sql Subst Tests ////////////////////////////////////////
+
+ //
+ // tests for badly formed sql expression parsing
+ //
+
+ //
+ // statement missing '}'
+ //
+ public void testParseErrorMissingCloseBrace() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ try {
+ frag = _parser.parse(BADLY_FORMED_1);
+ fail("SQL statements missing '}' should raise SqlException");
+ } catch (ControlException spe) {
+ assertTrue(true);
+ }
+ }
+
+ //
+ // statement missing '{'
+ //
+ public void testParseErrorMissingOpenBrace() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ try {
+ frag = _parser.parse(BADLY_FORMED_2);
+ fail("SQL statements with unbalanced '{}'s should raise SqlException");
+ } catch (ControlException spe) {
+ assertTrue(true);
+ }
+ }
+
+ //
+ // statement has unbalanced 's
+ //
+ public void testParseErrorUnbalancedSquotes() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ try {
+ frag = _parser.parse(BADLY_FORMED_3);
+ fail("SQL statements with unbalanced 's should raise SqlException");
+ } catch (ControlException spe) {
+ assertTrue(true);
+ }
+ }
+
+ //
+ // statement has unbalanced invalid escape sequence 'sqlxxxx:'
+ //
+ public void testParseErrorInvalidEscape() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ try {
+ frag = _parser.parse(BADLY_FORMED_4);
+ fail("SQL statements with invalid escape sequences should raise SqlException");
+ } catch (ControlException spe) {
+ assertTrue(true);
+ }
+ }
+
+ //
+ // SQLEscapeFragment: statement has unbalanced invalid sql: keyword, must be either fn or subst
+ //
+ public void testParseErrorInvalidKeyWord() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ try {
+ frag = _parser.parse(BADLY_FORMED_5);
+ fail("SQL statements with sql: escapes can only map to 'fn' or 'subst' functions");
+ } catch (ControlException spe) {
+ assertTrue(true);
+ }
+ }
+
+ //
+ // SQLEscapeFragment: statement missing '}'
+ //
+ public void testParseErrorMissingEscapeBrace() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ try {
+ frag = _parser.parse(BADLY_FORMED_6);
+ fail("SQL statements with unbalanced 's should raise SqlException");
+ } catch (ControlException spe) {
+ assertTrue(true);
+ }
+ }
+
+ //
+ // ReflectFragment: statement missing param name
+ //
+ public void testParseErrorMissingParamName() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ try {
+ frag = _parser.parse(BADLY_FORMED_7);
+ fail("SQL statements with empty '{}'s should raise SqlException");
+ } catch (ControlException spe) {
+ assertTrue(true);
+ }
+ }
+
+ //
+ // ReflectFragment: statement missing '}'
+ //
+ public void testParseErrorMissingReflectBrace() throws Exception {
+ SqlStatement frag = null;
+ assertNotNull(_parser);
+
+ try {
+ frag = _parser.parse(BADLY_FORMED_8);
+ fail("SQL statements with unbalanced {}'s should raise SqlException");
+ } catch (ControlException spe) {
+ assertTrue(true);
+ }
+ }
+
+ public SqlParserTest(String name) { super(name); }
+
+ public static Test suite() { return new TestSuite(SqlParserTest.class); }
+
+ public static void main(String[] args) { junit.textui.TestRunner.run(suite()); }
+}
+
Propchange: incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/SqlParserTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/StoredProcedures.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/StoredProcedures.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/StoredProcedures.java (original)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/StoredProcedures.java Tue Jun 14 14:14:42 2005
@@ -1,99 +1,99 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-
-package org.apache.beehive.controls.system.jdbc.units.utils;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.Statement;
-import java.sql.ResultSet;
-
-/**
- * Stored procedures for testing with Derby
- */
-public final class StoredProcedures {
-
-
- /**
- * Stored procedure which selects all products whose price is over $1000.00
- * @param outProducts
- * @throws Exception
- */
- public static void getExpensiveProductsSP(String[] outProducts) throws Exception {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- Connection conn = DriverManager.getConnection("jdbc:derby:MyDB");
-
- Statement s = conn.createStatement();
- ResultSet rs = s.executeQuery("SELECT PRODUCT_NAME from PRODUCTS WHERE PRICE > 1000.00");
-
- rs.next();
- outProducts[0] = rs.getString(1);
-
- rs.close();
- s.close();
- conn.close();
- }
-
- /**
- * Simple stored procedure which doesn't make a query into the database
- * @param outProduct
- * @throws Exception
- */
- public static void getExpensiveProductSP(String[] outProduct) throws Exception {
- outProduct[0] = "foo";
- }
-
- /**
- * This stored procedure has an in and an out parameter, queries the db for all product names whose color
- * matches the inColor parameter.
- * @param inColor
- * @param outProducts
- * @throws Exception
- */
- public static void getProductsByColorSP(String inColor, String[] outProducts) throws Exception {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- Connection conn = DriverManager.getConnection("jdbc:derby:MyDB");
-
- Statement s = conn.createStatement();
- ResultSet rs = s.executeQuery("SELECT PRODUCT_NAME from PRODUCTS WHERE COLOR='" + inColor +"'");
-
- StringBuilder sb = new StringBuilder();
- while (rs.next()) {
- sb.append(rs.getString(1));
- sb.append(',');
- }
-
- outProducts[0] = sb.toString();
-
- rs.close();
- s.close();
- conn.close();
- }
-
- /**
- *
- * @param inColor
- * @param inSku
- */
- public static void getProductSP(String inColor, int inSku) {
- // noop
- assert "red".equals(inColor);
- assert inSku == 1234;
- }
-}
-
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jdbc.units.utils;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.sql.ResultSet;
+
+/**
+ * Stored procedures for testing with Derby
+ */
+public final class StoredProcedures {
+
+
+ /**
+ * Stored procedure which selects all products whose price is over $1000.00
+ * @param outProducts
+ * @throws Exception
+ */
+ public static void getExpensiveProductsSP(String[] outProducts) throws Exception {
+ Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+ Connection conn = DriverManager.getConnection("jdbc:derby:MyDB");
+
+ Statement s = conn.createStatement();
+ ResultSet rs = s.executeQuery("SELECT PRODUCT_NAME from PRODUCTS WHERE PRICE > 1000.00");
+
+ rs.next();
+ outProducts[0] = rs.getString(1);
+
+ rs.close();
+ s.close();
+ conn.close();
+ }
+
+ /**
+ * Simple stored procedure which doesn't make a query into the database
+ * @param outProduct
+ * @throws Exception
+ */
+ public static void getExpensiveProductSP(String[] outProduct) throws Exception {
+ outProduct[0] = "foo";
+ }
+
+ /**
+ * This stored procedure has an in and an out parameter, queries the db for all product names whose color
+ * matches the inColor parameter.
+ * @param inColor
+ * @param outProducts
+ * @throws Exception
+ */
+ public static void getProductsByColorSP(String inColor, String[] outProducts) throws Exception {
+ Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+ Connection conn = DriverManager.getConnection("jdbc:derby:MyDB");
+
+ Statement s = conn.createStatement();
+ ResultSet rs = s.executeQuery("SELECT PRODUCT_NAME from PRODUCTS WHERE COLOR='" + inColor +"'");
+
+ StringBuilder sb = new StringBuilder();
+ while (rs.next()) {
+ sb.append(rs.getString(1));
+ sb.append(',');
+ }
+
+ outProducts[0] = sb.toString();
+
+ rs.close();
+ s.close();
+ conn.close();
+ }
+
+ /**
+ *
+ * @param inColor
+ * @param inSku
+ */
+ public static void getProductSP(String inColor, int inSku) {
+ // noop
+ assert "red".equals(inColor);
+ assert inSku == 1234;
+ }
+}
+
Propchange: incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/StoredProcedures.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/TestContextInitializer.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/TestContextInitializer.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/TestContextInitializer.java (original)
+++ incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/TestContextInitializer.java Tue Jun 14 14:14:42 2005
@@ -1,46 +1,46 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-package org.apache.beehive.controls.system.jdbc.units.utils;
-
-import org.apache.beehive.controls.api.context.ControlBeanContext;
-import org.apache.beehive.controls.runtime.bean.ControlContainerContext;
-
-import java.lang.reflect.Method;
-
-public class TestContextInitializer {
-
-
- public static ControlContainerContext initContext(Object caller)
- throws Exception {
- ControlContainerContext context = new ControlContainerContext();
- final Class forClass = caller.getClass();
-
- context.beginContext();
- Class init = forClass.getClassLoader().loadClass(forClass.getName() + "ClientInitializer");
-
- Method m = init.getMethod("initialize",
- new Class[]
- {
- ControlBeanContext.class,
- forClass
- });
-
- m.invoke(null, new Object[]{context, caller});
- return context;
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.jdbc.units.utils;
+
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.runtime.bean.ControlContainerContext;
+
+import java.lang.reflect.Method;
+
+public class TestContextInitializer {
+
+
+ public static ControlContainerContext initContext(Object caller)
+ throws Exception {
+ ControlContainerContext context = new ControlContainerContext();
+ final Class forClass = caller.getClass();
+
+ context.beginContext();
+ Class init = forClass.getClassLoader().loadClass(forClass.getName() + "ClientInitializer");
+
+ Method m = init.getMethod("initialize",
+ new Class[]
+ {
+ ControlBeanContext.class,
+ forClass
+ });
+
+ m.invoke(null, new Object[]{context, caller});
+ return context;
+ }
+}
Propchange: incubator/beehive/trunk/system-controls/test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/TestContextInitializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/test/src/webservice/README.txt
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/webservice/README.txt?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/webservice/README.txt (original)
+++ incubator/beehive/trunk/system-controls/test/src/webservice/README.txt Tue Jun 14 14:14:42 2005
@@ -1,37 +1,37 @@
-Webservice System Control DRTs
--------------------------------
-
-Adding New Tests
------------------
-
-Depending on what you are testing:
-
-
- * add new jcx generation tests to the jcxgen-tests area, these tests are run standalone without tomcat
-
- * For new web services control runtime tests:
- - Junit tests go in the 'tests' subdirectory, maintain the existing package structure
- 'org.apache.beehive.controls.system.webservice.units' (even though its alot of package names) and
- add you JUnit test to a new subpackage of 'units' or add to an existing subpackage of 'units' if
- that seems more appropriate. NOTE: All JUnit test class names must end with 'Test' (ex. MyJunitTest.class)
- in order to be run by the ant scripts.
-
- - Add new WebService controls (if not generating from a wsdl) to the 'webservice-controls' subdirectory - this is
- where web service controls go that have been created from hand (are not wsdl generated).
-
- - Add new wsdl's to the 'schemas' subdirectory. Wsdl files placed here will be used to automatically generate
- web service controls at build time.
-
- - Add new test web services to the 'servers' subdirectory.
-
-
-
-
-
-
-
-
-
-
-
-
+Webservice System Control DRTs
+-------------------------------
+
+Adding New Tests
+-----------------
+
+Depending on what you are testing:
+
+
+ * add new jcx generation tests to the jcxgen-tests area, these tests are run standalone without tomcat
+
+ * For new web services control runtime tests:
+ - Junit tests go in the 'tests' subdirectory, maintain the existing package structure
+ 'org.apache.beehive.controls.system.webservice.units' (even though its alot of package names) and
+ add you JUnit test to a new subpackage of 'units' or add to an existing subpackage of 'units' if
+ that seems more appropriate. NOTE: All JUnit test class names must end with 'Test' (ex. MyJunitTest.class)
+ in order to be run by the ant scripts.
+
+ - Add new WebService controls (if not generating from a wsdl) to the 'webservice-controls' subdirectory - this is
+ where web service controls go that have been created from hand (are not wsdl generated).
+
+ - Add new wsdl's to the 'schemas' subdirectory. Wsdl files placed here will be used to automatically generate
+ web service controls at build time.
+
+ - Add new test web services to the 'servers' subdirectory.
+
+
+
+
+
+
+
+
+
+
+
+
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/build.xml?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/build.xml (original)
+++ incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/build.xml Tue Jun 14 14:14:42 2005
@@ -1,141 +1,141 @@
-<?xml version="1.0" ?>
-<project name="Beehive/ServiceControl DRT For JCX Generation" default="drt" basedir=".">
-
- <property environment="os"/>
- <import file="../../../../systemcontrols-imports.xml"/>
-
- <property name="junit-source.dir" location="tests"/>
- <property name="wsdls.dir" location="wsdls"/>
-
- <property name="jcxgen.build.dir" location="../build/jcxgen"/>
- <property name="jcxgen.beansrc" location="${jcxgen.build.dir}/beansrc"/>
- <property name="jcxgen.classes" location="${jcxgen.build.dir}/classes"/>
- <property name="jcxgen.gensrc" location="${jcxgen.build.dir}/jcxsrc"/>
- <property name="jcxgen.package.name" value="jcxgentest"/>
- <property name="log.dir" location="${basedir}/../build/logs/jcxgen"/>
-
- <property name="beehive-webservice-control.jar"
- location="${beehive.home}/system-controls/build/jars/beehive-webservice-control.jar"/>
-
- <path id="beehive.classpath">
- <path refid="webservices.dependency.path"/>
- <path refid="controls.dependency.path"/>
- <path refid="junit.dependency.path"/>
- </path>
-
- <path id="jcxgen.classpath">
- <pathelement path="${jcxgen.classes}"/>
- <pathelement path="${beehive-webservice-control.jar}"/>
- <path refid="beehive.classpath"/>
- <path refid="xbean.dependency.path"/>
- <path refid="log4j.dependency.path"/>
- <path refid="velocity.dependency.path"/>
- <path refid="commons-logging.dependency.path"/>
- <path refid="commons-discovery.dependency.path"/>
- </path>
-
- <!-- =================================================================== -->
- <!-- drt - run the webservice control DRTs -->
- <!-- =================================================================== -->
- <target name="drt" depends="clean, build" description="Run the web service control drts.">
- <echo message="-----------------------------------------------------"/>
- <echo message="| Web service control generation DRTs starting |"/>
- <echo message="-----------------------------------------------------"/>
-
- <echo message="** junit logfiles written to ${log.dir} **"/>
- <junit failureproperty="drtfailed"
- printsummary="on"
- tempdir="${jcxgen.build.dir}"
- fork="yes">
- <classpath>
- <path refid="jcxgen.classpath"/>
- <pathelement location="${jcxgen.classes}"/>
- </classpath>
- <formatter type="plain"/>
- <batchtest filtertrace="off" todir="${log.dir}">
- <fileset dir="${junit-source.dir}">
- <include name="**/*Test.java"/>
- </fileset>
- </batchtest>
- </junit>
-
- <echo message="-----------------------------------------------------"/>
- <echo message="| Web service control generation DRTs completed |"/>
- <echo message="-----------------------------------------------------"/>
-
- <fail if="drtfailed" message="One or more tests in the ServiceControl DRT failed."/>
- </target>
-
-
- <!-- =================================================================== -->
- <!-- build - build the junit tests and webservice controls -->
- <!-- =================================================================== -->
- <target name="build" depends="dirs, generate_jcxs" description="Build the tests and controls for the drts.">
-
- <build-controls srcdir="${jcxgen.gensrc}"
- destdir="${jcxgen.classes}"
- tempdir="${jcxgen.beansrc}"
- classpathref="jcxgen.classpath"/>
-
- <copy todir="${jcxgen.classes}">
- <fileset dir="${jcxgen.gensrc}">
- <include name="**/*.wsdl"/>
- </fileset>
- </copy>
-
- <!-- build the client junit tests, use apt since they may access controls -->
- <build-controls srcdir="${junit-source.dir}"
- destdir="${jcxgen.classes}"
- tempdir="${jcxgen.beansrc}"
- classpathref="jcxgen.classpath"/>
- </target>
-
-
- <!-- =================================================================== -->
- <!-- generate_jcxs - Generate webservice controls from wsdls -->
- <!-- =================================================================== -->
- <target name="generate_jcxs" depends="gen_xmlbeans">
-
- <java classname="org.apache.beehive.controls.system.webservice.generator.ExtensionMaker"
- dir="${basedir}" fork="true" failOnError="true">
- <classpath>
- <path refid="jcxgen.classpath"/>
- </classpath>
- <arg line="-gen_root ${jcxgen.gensrc}
- -wsdl ${wsdls.dir}
- -pkg ${jcxgen.package.name} "/>
- </java>
-
- <copy todir="${jcxgen.gensrc}/${jcxgen.package.name}">
- <fileset dir="${wsdls.dir}">
- <include name="**/*.wsdl"/>
- </fileset>
- </copy>
- </target>
-
- <target name="gen_xmlbeans" depends="checkxbean" unless="noxbeanrebuild">
- <build-schemas srcdir="${wsdls.dir}" destdir="${jcxgen.classes}"/>
- </target>
-
- <target name="checkxbean">
- <uptodate property="noxbeanrebuild" targetfile="${xbeangen.dir}">
- <srcfiles dir="${wsdls.dir}" includes="*.wsdl,*.xsd"/>
- </uptodate>
- </target>
-
- <!-- =================================================================== -->
- <!-- clean -->
- <!-- =================================================================== -->
- <target name="clean">
- <delete dir="${jcxgen.build.dir}"/>
- <delete dir="${log.dir}"/>
- </target>
-
- <!-- =================================================================== -->
- <!-- create directories for the build -->
- <!-- =================================================================== -->
- <target name="dirs">
- <mkdir dir="${log.dir}"/>
- </target>
-
-</project>
+<?xml version="1.0" ?>
+<project name="Beehive/ServiceControl DRT For JCX Generation" default="drt" basedir=".">
+
+ <property environment="os"/>
+ <import file="../../../../systemcontrols-imports.xml"/>
+
+ <property name="junit-source.dir" location="tests"/>
+ <property name="wsdls.dir" location="wsdls"/>
+
+ <property name="jcxgen.build.dir" location="../build/jcxgen"/>
+ <property name="jcxgen.beansrc" location="${jcxgen.build.dir}/beansrc"/>
+ <property name="jcxgen.classes" location="${jcxgen.build.dir}/classes"/>
+ <property name="jcxgen.gensrc" location="${jcxgen.build.dir}/jcxsrc"/>
+ <property name="jcxgen.package.name" value="jcxgentest"/>
+ <property name="log.dir" location="${basedir}/../build/logs/jcxgen"/>
+
+ <property name="beehive-webservice-control.jar"
+ location="${beehive.home}/system-controls/build/jars/beehive-webservice-control.jar"/>
+
+ <path id="beehive.classpath">
+ <path refid="webservices.dependency.path"/>
+ <path refid="controls.dependency.path"/>
+ <path refid="junit.dependency.path"/>
+ </path>
+
+ <path id="jcxgen.classpath">
+ <pathelement path="${jcxgen.classes}"/>
+ <pathelement path="${beehive-webservice-control.jar}"/>
+ <path refid="beehive.classpath"/>
+ <path refid="xbean.dependency.path"/>
+ <path refid="log4j.dependency.path"/>
+ <path refid="velocity.dependency.path"/>
+ <path refid="commons-logging.dependency.path"/>
+ <path refid="commons-discovery.dependency.path"/>
+ </path>
+
+ <!-- =================================================================== -->
+ <!-- drt - run the webservice control DRTs -->
+ <!-- =================================================================== -->
+ <target name="drt" depends="clean, build" description="Run the web service control drts.">
+ <echo message="-----------------------------------------------------"/>
+ <echo message="| Web service control generation DRTs starting |"/>
+ <echo message="-----------------------------------------------------"/>
+
+ <echo message="** junit logfiles written to ${log.dir} **"/>
+ <junit failureproperty="drtfailed"
+ printsummary="on"
+ tempdir="${jcxgen.build.dir}"
+ fork="yes">
+ <classpath>
+ <path refid="jcxgen.classpath"/>
+ <pathelement location="${jcxgen.classes}"/>
+ </classpath>
+ <formatter type="plain"/>
+ <batchtest filtertrace="off" todir="${log.dir}">
+ <fileset dir="${junit-source.dir}">
+ <include name="**/*Test.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+
+ <echo message="-----------------------------------------------------"/>
+ <echo message="| Web service control generation DRTs completed |"/>
+ <echo message="-----------------------------------------------------"/>
+
+ <fail if="drtfailed" message="One or more tests in the ServiceControl DRT failed."/>
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- build - build the junit tests and webservice controls -->
+ <!-- =================================================================== -->
+ <target name="build" depends="dirs, generate_jcxs" description="Build the tests and controls for the drts.">
+
+ <build-controls srcdir="${jcxgen.gensrc}"
+ destdir="${jcxgen.classes}"
+ tempdir="${jcxgen.beansrc}"
+ classpathref="jcxgen.classpath"/>
+
+ <copy todir="${jcxgen.classes}">
+ <fileset dir="${jcxgen.gensrc}">
+ <include name="**/*.wsdl"/>
+ </fileset>
+ </copy>
+
+ <!-- build the client junit tests, use apt since they may access controls -->
+ <build-controls srcdir="${junit-source.dir}"
+ destdir="${jcxgen.classes}"
+ tempdir="${jcxgen.beansrc}"
+ classpathref="jcxgen.classpath"/>
+ </target>
+
+
+ <!-- =================================================================== -->
+ <!-- generate_jcxs - Generate webservice controls from wsdls -->
+ <!-- =================================================================== -->
+ <target name="generate_jcxs" depends="gen_xmlbeans">
+
+ <java classname="org.apache.beehive.controls.system.webservice.generator.ExtensionMaker"
+ dir="${basedir}" fork="true" failOnError="true">
+ <classpath>
+ <path refid="jcxgen.classpath"/>
+ </classpath>
+ <arg line="-gen_root ${jcxgen.gensrc}
+ -wsdl ${wsdls.dir}
+ -pkg ${jcxgen.package.name} "/>
+ </java>
+
+ <copy todir="${jcxgen.gensrc}/${jcxgen.package.name}">
+ <fileset dir="${wsdls.dir}">
+ <include name="**/*.wsdl"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="gen_xmlbeans" depends="checkxbean" unless="noxbeanrebuild">
+ <build-schemas srcdir="${wsdls.dir}" destdir="${jcxgen.classes}"/>
+ </target>
+
+ <target name="checkxbean">
+ <uptodate property="noxbeanrebuild" targetfile="${xbeangen.dir}">
+ <srcfiles dir="${wsdls.dir}" includes="*.wsdl,*.xsd"/>
+ </uptodate>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- clean -->
+ <!-- =================================================================== -->
+ <target name="clean">
+ <delete dir="${jcxgen.build.dir}"/>
+ <delete dir="${log.dir}"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- create directories for the build -->
+ <!-- =================================================================== -->
+ <target name="dirs">
+ <mkdir dir="${log.dir}"/>
+ </target>
+
+</project>
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitBareWsdlTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java (original)
+++ incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java Tue Jun 14 14:14:42 2005
@@ -1,85 +1,85 @@
-/*
- *
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.beehive.controls.system.webservice.units.jcxgen;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.beehive.controls.system.webservice.ServiceControl;
-import org.apache.beehive.wsm.databinding.GenericHolder;
-
-import javax.xml.rpc.holders.IntHolder;
-import java.lang.reflect.Method;
-
-public class JcxGenFromDocLitWrapWsdlTest extends TestCase {
-
- private final Class genJcx = jcxgentest.DocumentLiteralWrappedSampleService.class;
-
- public void testLocationAnnotation() throws Exception {
- ServiceControl.Location loc =
- (ServiceControl.Location) genJcx.getAnnotation(ServiceControl.Location.class);
-
- assertEquals(1, loc.urls().length);
- assertEquals("http://localhost:8080/wsm-samplesWS/web/complex/DocumentLiteralWrappedSample.jws", loc.urls()[0]);
- }
-
- public void testWSDLAnnotation() throws Exception {
- ServiceControl.WSDL wsdl =
- (ServiceControl.WSDL) genJcx.getAnnotation(ServiceControl.WSDL.class);
-
- assertEquals("DocumentLiteralWrappedSample.wsdl", wsdl.path());
- assertEquals("DocumentLiteralWrappedSampleService", wsdl.service());
- }
-
- public void testMethodSignatures() throws Exception {
- testMethodSignature("changeAddressInBody", "int", GenericHolder.class);
- testMethodSignature("changeAddressInHeader", "int", GenericHolder.class);
- testMethodSignature("createAddressInBody", "void", GenericHolder.class, IntHolder.class);
- testMethodSignature("createAddressInHeader", "void", GenericHolder.class, IntHolder.class);
- testMethodSignature("returnAddressFromBody", "doclitwrap.web.complex.Address", doclitwrap.web.complex.Address.class);
- testMethodSignature("returnAddressFromHeader", "doclitwrap.web.complex.Address", doclitwrap.web.complex.Address.class);
- testMethodSignature("throwAddressException", "int", int.class);
-
- }
-
- private void testMethodSignature(String methodName, String returnClassName, Class... params) throws Exception {
- Method m = null;
- try {
- m = genJcx.getMethod(methodName, params);
- } catch (NoSuchMethodException e) {
- fail("Could not find method '" + methodName + "(" + params + ")");
- }
- assertEquals(returnClassName, m.getReturnType().getName());
- }
-
-
- public JcxGenFromDocLitWrapWsdlTest(String name) throws Exception {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(JcxGenFromDocLitWrapWsdlTest.class);
- }
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
- }
-}
-
-
-
+/*
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.beehive.controls.system.webservice.units.jcxgen;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.beehive.controls.system.webservice.ServiceControl;
+import org.apache.beehive.wsm.databinding.GenericHolder;
+
+import javax.xml.rpc.holders.IntHolder;
+import java.lang.reflect.Method;
+
+public class JcxGenFromDocLitWrapWsdlTest extends TestCase {
+
+ private final Class genJcx = jcxgentest.DocumentLiteralWrappedSampleService.class;
+
+ public void testLocationAnnotation() throws Exception {
+ ServiceControl.Location loc =
+ (ServiceControl.Location) genJcx.getAnnotation(ServiceControl.Location.class);
+
+ assertEquals(1, loc.urls().length);
+ assertEquals("http://localhost:8080/wsm-samplesWS/web/complex/DocumentLiteralWrappedSample.jws", loc.urls()[0]);
+ }
+
+ public void testWSDLAnnotation() throws Exception {
+ ServiceControl.WSDL wsdl =
+ (ServiceControl.WSDL) genJcx.getAnnotation(ServiceControl.WSDL.class);
+
+ assertEquals("DocumentLiteralWrappedSample.wsdl", wsdl.path());
+ assertEquals("DocumentLiteralWrappedSampleService", wsdl.service());
+ }
+
+ public void testMethodSignatures() throws Exception {
+ testMethodSignature("changeAddressInBody", "int", GenericHolder.class);
+ testMethodSignature("changeAddressInHeader", "int", GenericHolder.class);
+ testMethodSignature("createAddressInBody", "void", GenericHolder.class, IntHolder.class);
+ testMethodSignature("createAddressInHeader", "void", GenericHolder.class, IntHolder.class);
+ testMethodSignature("returnAddressFromBody", "doclitwrap.web.complex.Address", doclitwrap.web.complex.Address.class);
+ testMethodSignature("returnAddressFromHeader", "doclitwrap.web.complex.Address", doclitwrap.web.complex.Address.class);
+ testMethodSignature("throwAddressException", "int", int.class);
+
+ }
+
+ private void testMethodSignature(String methodName, String returnClassName, Class... params) throws Exception {
+ Method m = null;
+ try {
+ m = genJcx.getMethod(methodName, params);
+ } catch (NoSuchMethodException e) {
+ fail("Could not find method '" + methodName + "(" + params + ")");
+ }
+ assertEquals(returnClassName, m.getReturnType().getName());
+ }
+
+
+ public JcxGenFromDocLitWrapWsdlTest(String name) throws Exception {
+ super(name);
+ }
+
+ public static Test suite() {
+ return new TestSuite(JcxGenFromDocLitWrapWsdlTest.class);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}
+
+
+
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromDocLitWrapWsdlTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java (original)
+++ incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java Tue Jun 14 14:14:42 2005
@@ -1,83 +1,83 @@
-/*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.beehive.controls.system.webservice.units.jcxgen;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.beehive.controls.system.webservice.ServiceControl;
-import org.apache.beehive.wsm.databinding.GenericHolder;
-
-import javax.xml.rpc.holders.IntHolder;
-import java.lang.reflect.Method;
-
-public class JcxGenFromRpcLitWsdlTest extends TestCase {
-
- private final Class genJcx = jcxgentest.RpcLiteralSampleService.class;
-
- public void testLocationAnnotation() throws Exception {
- ServiceControl.Location loc =
- (ServiceControl.Location) genJcx.getAnnotation(ServiceControl.Location.class);
-
- assertEquals(1, loc.urls().length);
- assertEquals("http://localhost:8080/wsm-samplesWS/web/complex/RpcLiteralSample.jws", loc.urls()[0]);
- }
-
- public void testWSDLAnnotation() throws Exception {
- ServiceControl.WSDL wsdl =
- (ServiceControl.WSDL) genJcx.getAnnotation(ServiceControl.WSDL.class);
-
- assertEquals("RpcLiteralSample.wsdl", wsdl.path());
- assertEquals("RpcLiteralSampleService", wsdl.service());
- }
-
- public void testMethodSignatures() throws Exception {
- testMethodSignature("changeAddressInBody", "int", GenericHolder.class);
- testMethodSignature("changeAddressInHeader", "int", GenericHolder.class);
- testMethodSignature("createAddressInBody", "void", GenericHolder.class, IntHolder.class);
- testMethodSignature("createAddressInHeader", "void", GenericHolder.class, IntHolder.class);
- testMethodSignature("returnAddressFromBody", "org.apache.beehive.web.webservice.rpcExamples.Address", org.apache.beehive.web.webservice.rpcExamples.Address.class);
- testMethodSignature("returnAddressFromHeader", "org.apache.beehive.web.webservice.rpcExamples.Address", org.apache.beehive.web.webservice.rpcExamples.Address.class);
- testMethodSignature("throwAddressException", "int", int.class);
- }
-
- private void testMethodSignature(String methodName, String returnClassName, Class... params) throws Exception {
- Method m = null;
- try {
- m = genJcx.getMethod(methodName, params);
- } catch (NoSuchMethodException e) {
- fail("Could not find method '" + methodName + "(" + params + ")");
- }
- assertEquals(returnClassName, m.getReturnType().getName());
- }
-
-
- public JcxGenFromRpcLitWsdlTest(String name) throws Exception {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(JcxGenFromRpcLitWsdlTest.class);
- }
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
- }
-}
-
-
-
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.beehive.controls.system.webservice.units.jcxgen;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.beehive.controls.system.webservice.ServiceControl;
+import org.apache.beehive.wsm.databinding.GenericHolder;
+
+import javax.xml.rpc.holders.IntHolder;
+import java.lang.reflect.Method;
+
+public class JcxGenFromRpcLitWsdlTest extends TestCase {
+
+ private final Class genJcx = jcxgentest.RpcLiteralSampleService.class;
+
+ public void testLocationAnnotation() throws Exception {
+ ServiceControl.Location loc =
+ (ServiceControl.Location) genJcx.getAnnotation(ServiceControl.Location.class);
+
+ assertEquals(1, loc.urls().length);
+ assertEquals("http://localhost:8080/wsm-samplesWS/web/complex/RpcLiteralSample.jws", loc.urls()[0]);
+ }
+
+ public void testWSDLAnnotation() throws Exception {
+ ServiceControl.WSDL wsdl =
+ (ServiceControl.WSDL) genJcx.getAnnotation(ServiceControl.WSDL.class);
+
+ assertEquals("RpcLiteralSample.wsdl", wsdl.path());
+ assertEquals("RpcLiteralSampleService", wsdl.service());
+ }
+
+ public void testMethodSignatures() throws Exception {
+ testMethodSignature("changeAddressInBody", "int", GenericHolder.class);
+ testMethodSignature("changeAddressInHeader", "int", GenericHolder.class);
+ testMethodSignature("createAddressInBody", "void", GenericHolder.class, IntHolder.class);
+ testMethodSignature("createAddressInHeader", "void", GenericHolder.class, IntHolder.class);
+ testMethodSignature("returnAddressFromBody", "org.apache.beehive.web.webservice.rpcExamples.Address", org.apache.beehive.web.webservice.rpcExamples.Address.class);
+ testMethodSignature("returnAddressFromHeader", "org.apache.beehive.web.webservice.rpcExamples.Address", org.apache.beehive.web.webservice.rpcExamples.Address.class);
+ testMethodSignature("throwAddressException", "int", int.class);
+ }
+
+ private void testMethodSignature(String methodName, String returnClassName, Class... params) throws Exception {
+ Method m = null;
+ try {
+ m = genJcx.getMethod(methodName, params);
+ } catch (NoSuchMethodException e) {
+ fail("Could not find method '" + methodName + "(" + params + ")");
+ }
+ assertEquals(returnClassName, m.getReturnType().getName());
+ }
+
+
+ public JcxGenFromRpcLitWsdlTest(String name) throws Exception {
+ super(name);
+ }
+
+ public static Test suite() {
+ return new TestSuite(JcxGenFromRpcLitWsdlTest.class);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}
+
+
+
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/JcxGenFromRpcLitWsdlTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/schemas/DocumentLiteralBareSample.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/schemas/RpcLiteralSample.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/schemas/ServiceWS.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/schemas/WebParamDocumentLiteralSample.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/server-config.wsdd
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/server-config.wsdd?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/server-config.wsdd (original)
+++ incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/server-config.wsdd Tue Jun 14 14:14:42 2005
@@ -1,68 +1,68 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
- <globalConfiguration>
- <parameter name="adminPassword" value="admin"/>
- <parameter name="disablePrettyXML" value="true"/>
- <parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>
- <parameter name="sendXsiTypes" value="true"/>
- <parameter name="sendXMLDeclaration" value="true"/>
- <requestFlow>
- <handler type="java:org.apache.beehive.wsm.axis.util.DebugPrintMessageHandler">
- </handler>
- <handler name="soapmonitor"
- type="java:org.apache.axis.handlers.SOAPMonitorHandler">
- <parameter name="wsdlURL"
- value="/testws/SOAPMonitorService-impl.wsdl"/>
- <parameter name="namespace"
- value="http://tempuri.org/wsdl/2001/12/SOAPMonitorService-impl.wsdl"/>
- <parameter name="serviceName" value="SOAPMonitorService"/>
- <parameter name="portName" value="Demo"/>
- </handler>
- <service name="SOAPMonitorService" provider="java:RPC">
- <parameter name="allowedMethods" value="publishMessage"/>
- <parameter name="className"
- value="org.apache.axis.monitor.SOAPMonitorService"/>
- <parameter name="scope" value="Application"/>
- </service>
-
-
- <handler type="java:org.apache.beehive.wsm.axis.handlers.AnnotatedWebServiceDeploymentHandler">
- <parameter name="scope" value="session"/>
- </handler>
- <handler type="java:org.apache.axis.handlers.JWSHandler">
- <parameter name="scope" value="session"/>
- </handler>
- </requestFlow>
- </globalConfiguration>
- <handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/>
- <handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/>
- <handler name="Authenticate" type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
- <service name="AdminService" provider="java:MSG">
- <parameter name="allowedMethods" value="AdminService"/>
- <parameter name="enableRemoteAdmin" value="false"/>
- <parameter name="className" value="org.apache.axis.utils.Admin"/>
- <namespace>http://xml.apache.org/axis/wsdd/</namespace>
- </service>
-
-
-
- <service name="Version" provider="java:RPC">
- <parameter name="allowedMethods" value="getVersion"/>
- <parameter name="className" value="org.apache.axis.Version"/>
- </service>
- <transport name="http">
- <requestFlow>
- <handler type="URLMapper"/>
- <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
- </requestFlow>
- <parameter name="qs:list" value="org.apache.axis.transport.http.QSListHandler"/>
- <parameter name="qs:wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
- <parameter name="qs:method" value="org.apache.axis.transport.http.QSMethodHandler"/>
- </transport>
- <transport name="local">
- <responseFlow>
- <handler type="LocalResponder"/>
- </responseFlow>
- </transport>
-</deployment>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
+ <globalConfiguration>
+ <parameter name="adminPassword" value="admin"/>
+ <parameter name="disablePrettyXML" value="true"/>
+ <parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>
+ <parameter name="sendXsiTypes" value="true"/>
+ <parameter name="sendXMLDeclaration" value="true"/>
+ <requestFlow>
+ <handler type="java:org.apache.beehive.wsm.axis.util.DebugPrintMessageHandler">
+ </handler>
+ <handler name="soapmonitor"
+ type="java:org.apache.axis.handlers.SOAPMonitorHandler">
+ <parameter name="wsdlURL"
+ value="/testws/SOAPMonitorService-impl.wsdl"/>
+ <parameter name="namespace"
+ value="http://tempuri.org/wsdl/2001/12/SOAPMonitorService-impl.wsdl"/>
+ <parameter name="serviceName" value="SOAPMonitorService"/>
+ <parameter name="portName" value="Demo"/>
+ </handler>
+ <service name="SOAPMonitorService" provider="java:RPC">
+ <parameter name="allowedMethods" value="publishMessage"/>
+ <parameter name="className"
+ value="org.apache.axis.monitor.SOAPMonitorService"/>
+ <parameter name="scope" value="Application"/>
+ </service>
+
+
+ <handler type="java:org.apache.beehive.wsm.axis.handlers.AnnotatedWebServiceDeploymentHandler">
+ <parameter name="scope" value="session"/>
+ </handler>
+ <handler type="java:org.apache.axis.handlers.JWSHandler">
+ <parameter name="scope" value="session"/>
+ </handler>
+ </requestFlow>
+ </globalConfiguration>
+ <handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/>
+ <handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/>
+ <handler name="Authenticate" type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
+ <service name="AdminService" provider="java:MSG">
+ <parameter name="allowedMethods" value="AdminService"/>
+ <parameter name="enableRemoteAdmin" value="false"/>
+ <parameter name="className" value="org.apache.axis.utils.Admin"/>
+ <namespace>http://xml.apache.org/axis/wsdd/</namespace>
+ </service>
+
+
+
+ <service name="Version" provider="java:RPC">
+ <parameter name="allowedMethods" value="getVersion"/>
+ <parameter name="className" value="org.apache.axis.Version"/>
+ </service>
+ <transport name="http">
+ <requestFlow>
+ <handler type="URLMapper"/>
+ <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
+ </requestFlow>
+ <parameter name="qs:list" value="org.apache.axis.transport.http.QSListHandler"/>
+ <parameter name="qs:wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
+ <parameter name="qs:method" value="org.apache.axis.transport.http.QSMethodHandler"/>
+ </transport>
+ <transport name="local">
+ <responseFlow>
+ <handler type="LocalResponder"/>
+ </responseFlow>
+ </transport>
+</deployment>
+
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/server-config.wsdd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/Address.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/AddressException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/AddressHolder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/MessageHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/Phone.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/StateType.java
------------------------------------------------------------------------------
svn:eol-style = native