[jboss-svn-commits] JBL Code SVN: r6793 - in labs/jbossesb/trunk/product: core/rosetta/tests/src/org/jboss/soa/esb/common/tests core/services/src/org/jboss/soa/esb/services/registry core/services/tests/src core/services/tests/src/org/jboss/soa/esb/services core/services/tests/src/org/jboss/soa/esb/services/registry core/services/tests/src/org/jboss/soa/esb/services/util install/jUDDI-registry install/jUDDI-registry/sql/hsqldb lib/ext
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Oct 13 15:30:33 EDT 2006
Author: kurt.stam at jboss.com
Date: 2006-10-13 15:29:46 -0400 (Fri, 13 Oct 2006)
New Revision: 6793
Added:
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/HsqldbUtil.java
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgUnitTest.java
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/juddi-unittest.properties
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java
labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/drop_database.sql
labs/jbossesb/trunk/product/lib/ext/juddi-client-embedded.jar
labs/jbossesb/trunk/product/lib/ext/junit-4.1.jar
labs/jbossesb/trunk/product/lib/ext/xbean-1.0.4.jar
Removed:
labs/jbossesb/trunk/product/core/services/tests/src/juddi.properties
labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgTest.java
labs/jbossesb/trunk/product/lib/ext/junit.jar
Modified:
labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java
labs/jbossesb/trunk/product/install/jUDDI-registry/juddi.war
labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/create_database.sql
labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/insert_publishers.sql
labs/jbossesb/trunk/product/lib/ext/juddi-embedded.jar
Log:
Adding juddi unittest, switching to junit-4.1
Added: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/HsqldbUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/HsqldbUtil.java 2006-10-13 19:25:47 UTC (rev 6792)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/common/tests/HsqldbUtil.java 2006-10-13 19:29:46 UTC (rev 6793)
@@ -0,0 +1,64 @@
+package org.jboss.soa.esb.common.tests;
+
+import java.sql.DriverManager;
+import java.sql.Statement;
+
+import org.hsqldb.Server;
+/**
+ * Utility to start and stop a hsql Database.
+ *
+ * @author <a href="mailto:kurt.stam at jboss.com">Kurt Stam</a>
+ *
+ */
+public class HsqldbUtil
+{
+ final private static String THREAD_NAME = "hypersonic-unittest";
+ /**
+ * Starts the hsql database in it's own thread.
+ * Don't forget to shut it down when you're done.
+ *
+ * @param databaseFile - i.e. build/hsqltestdb
+ * @param databaseName - i.e. jbossesb
+ * @throws Exception
+ */
+ public static void startHsqldb(final String databaseFile,
+ final String databaseName) throws Exception
+ {
+ // Start DB in new thread, or else it will block us
+ Thread serverThread = new Thread(THREAD_NAME) {
+ public void run() {
+ try {
+ // Create startup arguments
+ String[] args = new String[4];
+ args[0] = "-database.0";
+ args[1] = databaseFile;
+ args[2] = "-dbname.0";
+ args[3] = databaseName;
+
+ // Start server
+ Server.main(args);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ //log.error("Failed to start database", e);
+ }
+ };
+ serverThread.start();
+ }
+ /**
+ *
+ * @param url
+ * @param username
+ * @param password
+ * @throws Exception
+ */
+ public static void stopHsqldb(String url, String username, String password) throws Exception {
+ java.sql.Connection connection = DriverManager.getConnection(
+ url, username, password);
+ Statement statement = connection.createStatement();
+ String shutdownCommand = "SHUTDOWN COMPACT";
+ statement.executeQuery(shutdownCommand);
+ }
+
+
+}
Modified: labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java 2006-10-13 19:25:47 UTC (rev 6792)
+++ labs/jbossesb/trunk/product/core/services/src/org/jboss/soa/esb/services/registry/Registry.java 2006-10-13 19:29:46 UTC (rev 6793)
@@ -1,3 +1,24 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
package org.jboss.soa.esb.services.registry;
import java.net.PasswordAuthentication;
@@ -12,9 +33,11 @@
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.jboss.soa.esb.common.Configuration;
-/*
+/**
* Utility class for the Registry.
* Right now the connection properties are static. We'll have to see if we need to make this dynamic.
+ *
+ * @author Kurt Stam
*/
public class Registry
{
Deleted: labs/jbossesb/trunk/product/core/services/tests/src/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/juddi.properties 2006-10-13 19:25:47 UTC (rev 6792)
+++ labs/jbossesb/trunk/product/core/services/tests/src/juddi.properties 2006-10-13 19:29:46 UTC (rev 6793)
@@ -1,69 +0,0 @@
-# jUDDI Registry Properties (used by RegistryServer)
-# see http://www.juddi.org for more information
-
-# The UDDI Operator Name
-juddi.operatorName = jUDDI.org
-
-# The i18n locale default codes
-juddi.i18n.languageCode = en
-juddi.i18n.countryCode = US
-
-# The UDDI DiscoveryURL Prefix
-juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
-
-# The UDDI Operator Contact Email Address
-juddi.operatorEmailAddress = admin at juddi.org
-
-# The maximum name size and maximum number
-# of name elements allows in several of the
-# FindXxxx and SaveXxxx UDDI functions.
-juddi.maxNameLength=255
-juddi.maxNameElementsAllowed=5
-
-# The maximum number of UDDI artifacts allowed
-# per publisher. A value of '-1' indicates any
-# number of artifacts is valid (These values can be
-# overridden at the individual publisher level).
-juddi.maxBusinessesPerPublisher=25
-juddi.maxServicesPerBusiness=20
-juddi.maxBindingsPerService=10
-juddi.maxTModelsPerPublisher=100
-
-# jUDDI Authentication module to use
-juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
-
-# jUDDI DataStore module currently to use
-juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
-
-# use a dataSource (if set to false a direct
-# jdbc connection will be used.
-juddi.isUseDataSource=false
-juddi.jdbcDriver=com.mysql.jdbc.Driver
-juddi.jdbcUrl=jdbc:mysql://localhost/juddi
-juddi.jdbcUsername=juddi
-juddi.jdbcPassword=juddi
-# jUDDI DataSource to use
-juddi.dataSource=java:comp/env/jdbc/juddiDB
-
-# jUDDI UUIDGen implementation to use
-juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
-
-# jUDDI Cryptor implementation to use
-juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
-
-# jUDDI Validator to use
-juddi.validator=org.apache.juddi.validator.DefaultValidator
-
-# jUDDI Proxy Properties (used by RegistryProxy)
-juddi.proxy.adminURL = http://localhost:8080/juddi/admin
-juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
-juddi.proxy.publishURL = http://localhost:8080/juddi/publish
-juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
-juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
-juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
-
-# JNDI settings (used by RMITransport)
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming
-
Deleted: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgTest.java 2006-10-13 19:25:47 UTC (rev 6792)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgTest.java 2006-10-13 19:29:46 UTC (rev 6793)
@@ -1,130 +0,0 @@
-package org.jboss.soa.esb.services.registry;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.xml.registry.BusinessLifeCycleManager;
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.infomodel.Classification;
-import javax.xml.registry.infomodel.ClassificationScheme;
-import javax.xml.registry.infomodel.EmailAddress;
-import javax.xml.registry.infomodel.ExternalIdentifier;
-import javax.xml.registry.infomodel.Key;
-import javax.xml.registry.infomodel.Organization;
-import javax.xml.registry.infomodel.PersonName;
-import javax.xml.registry.infomodel.PostalAddress;
-import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.TelephoneNumber;
-import javax.xml.registry.infomodel.User;
-
-import junit.framework.TestCase;
-
-public class PublishOrgTest extends TestCase
-{
- public void testPublish()
- {
-// try
-// {
-//No test for now. This work in eclipse though.
-// Connection connection = Registry.getConnection();
-// connection.setCredentials(Registry.creds);
-// RegistryService rs = connection.getRegistryService();
-//
-// BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
-//
-// Collection<Organization> orgs = new ArrayList<Organization>();
-// Organization org = createOrganization(blm);
-// orgs.add(org);
-// BulkResponse br = blm.saveOrganizations(orgs);
-//
-//
-// if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
-// {
-// System.out.println("Organization Saved");
-// Collection coll = br.getCollection();
-// Iterator iter = coll.iterator();
-// while (iter.hasNext())
-// {
-// Key key = (Key) iter.next();
-// System.out.println("Saved Key=" + key.getId());
-// }
-// } else {
-// System.err.println("JAXRExceptions " +
-// "occurred during save:");
-// Collection exceptions = br.getExceptions();
-// Iterator iter = exceptions.iterator();
-// while (iter.hasNext())
-// {
-// Exception e = (Exception) iter.next();
-// System.err.println(e.toString());
-// }
-// }
-// } catch (JAXRException e)
-// {
-// e.printStackTrace();
-// fail(e.getMessage());
-// }
- }
-
- /**
- * Creates a Jaxr Organization with 1 or more services
- * @return
- * @throws JAXRException
- */
- @SuppressWarnings("unused")
- private Organization createOrganization(BusinessLifeCycleManager blm)
- throws JAXRException
- {
- Organization org = blm.createOrganization(blm.createInternationalString("USA -- JBOSS ORG"));
- org.setDescription(blm.createInternationalString("JBoss Professional Open Source"));
- Service service = blm.createService(blm.createInternationalString("JBossESB TEST Service"));
- service.setDescription(blm.createInternationalString( "Services of the ESB UDDI Registry"));
- User user = blm.createUser();
- org.setPrimaryContact(user);
- PersonName personName = blm.createPersonName("Kurt Stam");
- TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
- telephoneNumber.setNumber("404 467-8555");
- telephoneNumber.setType(null);
- PostalAddress address
- = blm.createPostalAddress("3340",
- "Peachtree Road, NE, Suite 1200", "Atlanta",
- "GA", "USA", "30326", "");
- Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
- postalAddresses.add(address);
- Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
- EmailAddress emailAddress = blm.createEmailAddress("kurt.stam at jboss.org");
- emailAddresses.add(emailAddress);
-
- Collection<TelephoneNumber> numbers = new ArrayList<TelephoneNumber>();
- numbers.add(telephoneNumber);
- user.setPersonName(personName);
- user.setPostalAddresses(postalAddresses);
- user.setEmailAddresses(emailAddresses);
- user.setTelephoneNumbers(numbers);
-
- ClassificationScheme cScheme = getClassificationScheme(blm, "ntis-gov:naics", "");
- Key cKey = blm.createKey("uuid:C0B9FE13-324F-413D-5A5B-2004DB8E5CC2");
- cScheme.setKey(cKey);
- Classification classification = blm.createClassification(cScheme,
- "Professional Open Source",
- "5415");
- org.addClassification(classification);
- ClassificationScheme cScheme1 = getClassificationScheme(blm, "D-U-N-S", "");
- Key cKey1 = blm.createKey("uuid:3367C81E-FF1F-4D5A-B202-3EB13AD02423");
- cScheme1.setKey(cKey1);
- ExternalIdentifier ei =
- blm.createExternalIdentifier(cScheme1, "D-U-N-S number",
- "08-146-6849");
- org.addExternalIdentifier(ei);
- org.addService(service);
- return org;
- }
-
- private ClassificationScheme getClassificationScheme(BusinessLifeCycleManager blm, String str1, String str2)
- throws JAXRException
- {
- ClassificationScheme cs = blm.createClassificationScheme(blm.createInternationalString(str1),
- blm.createInternationalString(str2));
- return cs;
- }
-}
Copied: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgUnitTest.java (from rev 6745, labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgTest.java)
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgTest.java 2006-10-11 13:36:19 UTC (rev 6745)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/PublishOrgUnitTest.java 2006-10-13 19:29:46 UTC (rev 6793)
@@ -0,0 +1,263 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.services.registry;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.InputStream;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessLifeCycleManager;
+import javax.xml.registry.Connection;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.EmailAddress;
+import javax.xml.registry.infomodel.ExternalIdentifier;
+import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.PersonName;
+import javax.xml.registry.infomodel.PostalAddress;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
+import org.jboss.soa.esb.common.tests.HsqldbUtil;
+import org.jboss.soa.esb.services.util.FileUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+/**
+ * Testing the registry.
+ *
+ * @author kstam
+ *
+ */
+public class PublishOrgUnitTest
+{
+ private static Logger log = Logger.getLogger(PublishOrgUnitTest.class);
+ private static String mDbDriver;
+ private static String mDbUrl;
+ private static String mDbUsername;
+ private static String mDbPassword;
+
+ @Test
+ public void testPublishOrganization() {
+ try { //Getting the connection to the Registry (reading config)
+ Connection connection = Registry.getConnection();
+ connection.setCredentials(Registry.creds);
+ RegistryService rs = connection.getRegistryService();
+ //Building organization
+ BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
+ Collection<Organization> orgs = new ArrayList<Organization>();
+ Organization org = createOrganization(blm);
+ orgs.add(org);
+ //Saving the organization (this make the actual calls)
+ BulkResponse br = blm.saveOrganizations(orgs);
+
+ //Verify the return
+ if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
+ log.info("Organization Saved");
+ Collection coll = br.getCollection();
+ Iterator iter = coll.iterator();
+ while (iter.hasNext()) {
+ Key key = (Key) iter.next();
+ log.info("Saved Key=" + key.getId());
+ }
+ } else {
+ log.error("JAXRExceptions " + "occurred during save:");
+ Collection exceptions = br.getExceptions();
+ Iterator iter = exceptions.iterator();
+ while (iter.hasNext()) {
+ Exception e = (Exception) iter.next();
+ log.error(e.toString());
+ }
+ assertTrue(false);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ /**
+ * Creates a Jaxr Organization with 1 or more services
+ * @return
+ * @throws JAXRException
+ */
+ @SuppressWarnings("unused")
+ private Organization createOrganization(BusinessLifeCycleManager blm)
+ throws JAXRException {
+ Organization org = blm.createOrganization(blm
+ .createInternationalString("USA -- JBOSS ORG"));
+ org.setDescription(blm
+ .createInternationalString("JBoss Professional Open Source"));
+ Service service = blm.createService(blm
+ .createInternationalString("JBossESB TEST Service"));
+ service
+ .setDescription(blm
+ .createInternationalString("Services of the ESB UDDI Registry"));
+ User user = blm.createUser();
+ org.setPrimaryContact(user);
+ PersonName personName = blm.createPersonName("Kurt Stam");
+ TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
+ telephoneNumber.setNumber("404 467-8555");
+ telephoneNumber.setType(null);
+ PostalAddress address = blm.createPostalAddress("3340",
+ "Peachtree Road, NE, Suite 1200", "Atlanta", "GA", "USA",
+ "30326", "");
+ Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
+ postalAddresses.add(address);
+ Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
+ EmailAddress emailAddress = blm
+ .createEmailAddress("kurt.stam at jboss.org");
+ emailAddresses.add(emailAddress);
+
+ Collection<TelephoneNumber> numbers = new ArrayList<TelephoneNumber>();
+ numbers.add(telephoneNumber);
+ user.setPersonName(personName);
+ user.setPostalAddresses(postalAddresses);
+ user.setEmailAddresses(emailAddresses);
+ user.setTelephoneNumbers(numbers);
+
+ ClassificationScheme cScheme = getClassificationScheme(blm,
+ "ntis-gov:naics", "");
+ Key cKey = blm.createKey("uuid:C0B9FE13-324F-413D-5A5B-2004DB8E5CC2");
+ cScheme.setKey(cKey);
+ Classification classification = blm.createClassification(cScheme,
+ "Professional Open Source", "5415");
+ org.addClassification(classification);
+ ClassificationScheme cScheme1 = getClassificationScheme(blm, "D-U-N-S",
+ "");
+ Key cKey1 = blm.createKey("uuid:3367C81E-FF1F-4D5A-B202-3EB13AD02423");
+ cScheme1.setKey(cKey1);
+ ExternalIdentifier ei = blm.createExternalIdentifier(cScheme1,
+ "D-U-N-S number", "08-146-6849");
+ org.addExternalIdentifier(ei);
+ org.addService(service);
+ return org;
+ }
+
+ private ClassificationScheme getClassificationScheme(
+ BusinessLifeCycleManager blm, String str1, String str2)
+ throws JAXRException {
+ ClassificationScheme cs = blm.createClassificationScheme(blm
+ .createInternationalString(str1), blm
+ .createInternationalString(str2));
+ return cs;
+ }
+
+
+ /**
+ * Setup the database.
+ * @throws Exception
+ */
+ @BeforeClass
+ public static void runBeforeAllTests() throws Exception {
+ try {
+ //Set the juddi properties file in System so juddi will pick it up later and use the test values.
+ String juddiPropertiesFile = "/org/jboss/soa/esb/services/registry/juddi-unittest.properties";
+ System.setProperty("juddi.propertiesFile", juddiPropertiesFile);
+ //Read this properties file to get the db connection string
+ Properties props = new Properties();
+ InputStream inStream = Class.class.getResourceAsStream(juddiPropertiesFile);
+ props.load(inStream);
+ mDbDriver = props.getProperty("juddi.jdbcDriver");
+ mDbUrl = props.getProperty("juddi.jdbcUrl");
+ mDbUsername = props.getProperty("juddi.jdbcUsername");
+ mDbPassword = props.getProperty("juddi.jdbcPassword");
+
+ String database="not tested yet";
+ if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
+ database = "hsqldb";
+ //Bring up hsql on default port 9001
+ HsqldbUtil.startHsqldb(getPrefix() + "build/hsqltestdb", "juddi");
+ } else if ("com.mysql.jdbc.Driver".equals(mDbDriver)) {
+ database = "mysql";
+ } //add and test your own database..
+
+ //Get the registry-schema create scripts
+ String sqlDir = getPrefix() + "install/jUDDI-registry/sql/" + database + "/";
+ //Drop what is there now, if exists. We want to start fresh.
+ String sqlDropCmd = FileUtil.readTextFile(new File(sqlDir + "drop_database.sql"));
+ String sqlCreateCmd = FileUtil.readTextFile(new File(sqlDir + "create_database.sql"));
+ String sqlInsertPubCmd = FileUtil.readTextFile(new File(sqlDir + "insert_publishers.sql"));
+
+ try {
+ Class.forName(mDbDriver);
+ } catch (Exception e) {
+ System.out.println("ERROR: failed to load " + database + " JDBC driver.");
+ e.printStackTrace();
+ return;
+ }
+ java.sql.Connection con = DriverManager.getConnection(mDbUrl, mDbUsername, mDbPassword);
+ Statement stmnt = con.createStatement();
+ stmnt.execute(sqlDropCmd);
+ stmnt.execute(sqlCreateCmd);
+ stmnt.execute(sqlInsertPubCmd);
+ } catch (Exception e) {
+ log.log(Priority.ERROR, e.getMessage(), e);
+ }
+ }
+ /**
+ * Shutdown the database
+ * @throws Exception
+ */
+ @AfterClass
+ public static void runAfterAllTests() throws Exception {
+ if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
+ HsqldbUtil.stopHsqldb(mDbUrl, mDbUsername, mDbPassword);
+ }
+ }
+ /**
+ * When performing file system interaction, the user.dir may differ (i.e. running the
+ * tests from within eclipse).
+ */
+ private static String getPrefix()
+ {
+ String prefix="";
+ String baseDir = System.getProperty("user.dir");
+ log.log(Priority.INFO, baseDir);
+ if (!baseDir.endsWith("product")) {
+ prefix = "product/";
+ }
+ return prefix;
+ }
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(PublishOrgUnitTest.class);
+ }
+
+}
Added: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/juddi-unittest.properties
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/juddi-unittest.properties 2006-10-13 19:25:47 UTC (rev 6792)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/registry/juddi-unittest.properties 2006-10-13 19:29:46 UTC (rev 6793)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=org.hsqldb.jdbcDriver
+juddi.jdbcUrl=jdbc:hsqldb:hsql://localhost/juddi
+juddi.jdbcUsername=sa
+juddi.jdbcPassword=
+# jUDDI DataSource to use
+juddi.dataSource=java:comp/env/jdbc/juddiDB
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+
Added: labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java 2006-10-13 19:25:47 UTC (rev 6792)
+++ labs/jbossesb/trunk/product/core/services/tests/src/org/jboss/soa/esb/services/util/FileUtil.java 2006-10-13 19:29:46 UTC (rev 6793)
@@ -0,0 +1,83 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.services.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+/**
+ * Utility class for reading a file into a String and back.
+ * @author kstam
+ */
+public class FileUtil {
+ /**
+ * Read the file into a String.
+ * @param file - the file to be read
+ * @return String with the content of the file
+ * @throws IOException - when we can't read the file
+ */
+ public static String readTextFile(File file) throws IOException
+ {
+ StringBuffer sb = new StringBuffer(1024);
+ BufferedReader reader = new BufferedReader(new FileReader(file.getPath()));
+ char[] chars = new char[1];
+ while( (reader.read(chars)) > -1){
+ sb.append(String.valueOf(chars));
+ chars = new char[1];
+ }
+ reader.close();
+ return sb.toString();
+ }
+ /**
+ *
+ */
+ public static String readStream(InputStream inputStream) throws IOException
+ {
+ StringBuffer sb = new StringBuffer(1024);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+ char[] chars = new char[1];
+ while( (reader.read(chars)) > -1){
+ sb.append(String.valueOf(chars));
+ chars = new char[1];
+ }
+ reader.close();
+ return sb.toString();
+ }
+ /**
+ * Write a String into a file.
+ * @param file - File to which we write the String
+ * @param str - string which will be written
+ * @throws IOException - when we can't write to the file
+ */
+ public static void writeTextFile(File file, String str) throws IOException
+ {
+ BufferedWriter writer = new BufferedWriter(new FileWriter(file.getPath()));
+ writer.write(str);
+ writer.close();
+ }
+
+}
Modified: labs/jbossesb/trunk/product/install/jUDDI-registry/juddi.war
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/create_database.sql
===================================================================
--- labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/create_database.sql 2006-10-13 19:25:47 UTC (rev 6792)
+++ labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/create_database.sql 2006-10-13 19:29:46 UTC (rev 6793)
@@ -1,34 +1,34 @@
--- DROP TABLE BUSINESS_DESCR;
--- DROP TABLE BUSINESS_CATEGORY;
--- DROP TABLE BUSINESS_IDENTIFIER;
--- DROP TABLE BUSINESS_NAME;
--- DROP TABLE DISCOVERY_URL;
--- DROP TABLE ADDRESS_LINE;
--- DROP TABLE ADDRESS;
--- DROP TABLE PHONE;
--- DROP TABLE EMAIL;
--- DROP TABLE CONTACT_DESCR;
--- DROP TABLE CONTACT;
--- DROP TABLE SERVICE_DESCR;
--- DROP TABLE SERVICE_CATEGORY;
--- DROP TABLE SERVICE_NAME;
--- DROP TABLE BINDING_DESCR;
--- DROP TABLE BINDING_CATEGORY;
--- DROP TABLE INSTANCE_DETAILS_DESCR;
--- DROP TABLE INSTANCE_DETAILS_DOC_DESCR;
--- DROP TABLE TMODEL_CATEGORY;
--- DROP TABLE TMODEL_DESCR;
--- DROP TABLE TMODEL_DOC_DESCR;
--- DROP TABLE TMODEL_IDENTIFIER;
--- DROP TABLE TMODEL_INSTANCE_INFO_DESCR;
--- DROP TABLE TMODEL_INSTANCE_INFO;
--- DROP TABLE PUBLISHER_ASSERTION;
--- DROP TABLE TMODEL;
--- DROP TABLE BINDING_TEMPLATE;
--- DROP TABLE BUSINESS_SERVICE;
--- DROP TABLE BUSINESS_ENTITY;
--- DROP TABLE PUBLISHER;
--- DROP TABLE AUTH_TOKEN;
+-- DROP TABLE BUSINESS_DESCR IF EXISTS;
+-- DROP TABLE BUSINESS_CATEGORY IF EXISTS;
+-- DROP TABLE BUSINESS_IDENTIFIER IF EXISTS;
+-- DROP TABLE BUSINESS_NAME IF EXISTS;
+-- DROP TABLE DISCOVERY_URL IF EXISTS;
+-- DROP TABLE ADDRESS_LINE IF EXISTS;
+-- DROP TABLE ADDRESS IF EXISTS;
+-- DROP TABLE PHONE IF EXISTS;
+-- DROP TABLE EMAIL IF EXISTS;
+-- DROP TABLE CONTACT_DESCR IF EXISTS;
+-- DROP TABLE CONTACT IF EXISTS;
+-- DROP TABLE SERVICE_DESCR IF EXISTS;
+-- DROP TABLE SERVICE_CATEGORY IF EXISTS;
+-- DROP TABLE SERVICE_NAME IF EXISTS;
+-- DROP TABLE BINDING_DESCR IF EXISTS;
+-- DROP TABLE BINDING_CATEGORY IF EXISTS;
+-- DROP TABLE INSTANCE_DETAILS_DESCR IF EXISTS;
+-- DROP TABLE INSTANCE_DETAILS_DOC_DESCR IF EXISTS;
+-- DROP TABLE TMODEL_CATEGORY IF EXISTS;
+-- DROP TABLE TMODEL_DESCR IF EXISTS;
+-- DROP TABLE TMODEL_DOC_DESCR IF EXISTS;
+-- DROP TABLE TMODEL_IDENTIFIER IF EXISTS;
+-- DROP TABLE TMODEL_INSTANCE_INFO_DESCR IF EXISTS;
+-- DROP TABLE TMODEL_INSTANCE_INFO IF EXISTS;
+-- DROP TABLE PUBLISHER_ASSERTION IF EXISTS;
+-- DROP TABLE TMODEL IF EXISTS;
+-- DROP TABLE BINDING_TEMPLATE IF EXISTS;
+-- DROP TABLE BUSINESS_SERVICE IF EXISTS;
+-- DROP TABLE BUSINESS_ENTITY IF EXISTS;
+-- DROP TABLE PUBLISHER IF EXISTS;
+-- DROP TABLE AUTH_TOKEN IF EXISTS;
CREATE TABLE BUSINESS_ENTITY
(
Added: labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/drop_database.sql
===================================================================
--- labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/drop_database.sql 2006-10-13 19:25:47 UTC (rev 6792)
+++ labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/drop_database.sql 2006-10-13 19:29:46 UTC (rev 6793)
@@ -0,0 +1,31 @@
+DROP TABLE BUSINESS_DESCR IF EXISTS;
+DROP TABLE BUSINESS_CATEGORY IF EXISTS;
+DROP TABLE BUSINESS_IDENTIFIER IF EXISTS;
+DROP TABLE BUSINESS_NAME IF EXISTS;
+DROP TABLE DISCOVERY_URL IF EXISTS;
+DROP TABLE ADDRESS_LINE IF EXISTS;
+DROP TABLE ADDRESS IF EXISTS;
+DROP TABLE PHONE IF EXISTS;
+DROP TABLE EMAIL IF EXISTS;
+DROP TABLE CONTACT_DESCR IF EXISTS;
+DROP TABLE CONTACT IF EXISTS;
+DROP TABLE SERVICE_DESCR IF EXISTS;
+DROP TABLE SERVICE_CATEGORY IF EXISTS;
+DROP TABLE SERVICE_NAME IF EXISTS;
+DROP TABLE BINDING_DESCR IF EXISTS;
+DROP TABLE BINDING_CATEGORY IF EXISTS;
+DROP TABLE INSTANCE_DETAILS_DESCR IF EXISTS;
+DROP TABLE INSTANCE_DETAILS_DOC_DESCR IF EXISTS;
+DROP TABLE TMODEL_CATEGORY IF EXISTS;
+DROP TABLE TMODEL_DESCR IF EXISTS;
+DROP TABLE TMODEL_DOC_DESCR IF EXISTS;
+DROP TABLE TMODEL_IDENTIFIER IF EXISTS;
+DROP TABLE TMODEL_INSTANCE_INFO_DESCR IF EXISTS;
+DROP TABLE TMODEL_INSTANCE_INFO IF EXISTS;
+DROP TABLE PUBLISHER_ASSERTION IF EXISTS;
+DROP TABLE TMODEL IF EXISTS;
+DROP TABLE BINDING_TEMPLATE IF EXISTS;
+DROP TABLE BUSINESS_SERVICE IF EXISTS;
+DROP TABLE BUSINESS_ENTITY IF EXISTS;
+DROP TABLE PUBLISHER IF EXISTS;
+DROP TABLE AUTH_TOKEN IF EXISTS;
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/insert_publishers.sql
===================================================================
--- labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/insert_publishers.sql 2006-10-13 19:25:47 UTC (rev 6792)
+++ labs/jbossesb/trunk/product/install/jUDDI-registry/sql/hsqldb/insert_publishers.sql 2006-10-13 19:29:46 UTC (rev 6793)
@@ -1,3 +1,3 @@
-- *** SAMPLE PUBLISHER ***
--- INSERT INTO PUBLISHER (PUBLISHER_ID,PUBLISHER_NAME,EMAIL_ADDRESS,IS_ENABLED,IS_ADMIN,MAX_BUSINESSES,MAX_SERVICES_PER_BUSINESS,MAX_BINDINGS_PER_SERVICE,MAX_TMODELS)
--- VALUES ('jdoe','John Doe','john.doe at apache.org','true','true',25,20,10,100);
+INSERT INTO PUBLISHER (PUBLISHER_ID,PUBLISHER_NAME,EMAIL_ADDRESS,IS_ENABLED,IS_ADMIN,MAX_BUSINESSES,MAX_SERVICES_PER_BUSINESS,MAX_BINDINGS_PER_SERVICE,MAX_TMODELS)
+VALUES ('jbossesb','JBoss ESB User','kurt.stam at jboss.org','true','true',25,20,10,100);
Added: labs/jbossesb/trunk/product/lib/ext/juddi-client-embedded.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/lib/ext/juddi-client-embedded.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: labs/jbossesb/trunk/product/lib/ext/juddi-embedded.jar
===================================================================
(Binary files differ)
Added: labs/jbossesb/trunk/product/lib/ext/junit-4.1.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/lib/ext/junit-4.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: labs/jbossesb/trunk/product/lib/ext/junit.jar
===================================================================
(Binary files differ)
Added: labs/jbossesb/trunk/product/lib/ext/xbean-1.0.4.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/lib/ext/xbean-1.0.4.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the jboss-svn-commits
mailing list