[jboss-svn-commits] JBL Code SVN: r8052 - in labs/jbossesb/workspace/b_georges/product/core: listeners/src/org/jboss/soa/esb/listeners/gateway rosetta/tests/src/org/jboss rosetta/tests/src/org/jboss/internal rosetta/tests/src/org/jboss/internal/soa rosetta/tests/src/org/jboss/internal/soa/esb rosetta/tests/src/org/jboss/internal/soa/esb/util
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Dec 4 12:26:53 EST 2006
Author: b_georges
Date: 2006-12-04 12:26:41 -0500 (Mon, 04 Dec 2006)
New Revision: 8052
Added:
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayException.java
labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/
labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/
labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/
labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/util/
labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/util/SecureFtpImplUnitTest.java
labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/util/juddi-unittest.properties
Modified:
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java
labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FtpGatewayListener.java
Log:
Working on SecureFtp testing
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2006-12-04 16:02:09 UTC (rev 8051)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/AbstractFileGateway.java 2006-12-04 17:26:41 UTC (rev 8052)
@@ -51,14 +51,15 @@
*/
public abstract class AbstractFileGateway implements Runnable
{
- abstract File[] getFileList(String suffix) throws GatewayException;
- abstract byte[] getFileContents(File file) throws GatewayException;
- abstract boolean renameFile(File from, File to) throws GatewayException;
- abstract boolean deleteFile(File file) throws GatewayException;
- abstract void seeIfOkToWorkOnDir (File p_oDir) throws GatewayException;
- abstract void getDefaultComposer () throws GatewayException;
+ abstract File[] getFileList(String suffix) throws GatewayException;
+ abstract byte[] getFileContents(File file) throws GatewayException;
+ abstract boolean renameFile(File from, File to) throws GatewayException;
+ abstract boolean deleteFile(File file) throws GatewayException;
+ abstract void seeIfOkToWorkOnDir (File p_oDir)throws GatewayException;
+ abstract void getDefaultComposer () throws GatewayException;
- protected AbstractFileGateway() {}
+ protected AbstractFileGateway() {}
+
protected AbstractFileGateway(GatewayListenerController commandListener, ConfigTree config)
throws Exception
{
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java 2006-12-04 16:02:09 UTC (rev 8051)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FileGatewayListener.java 2006-12-04 17:26:41 UTC (rev 8052)
@@ -34,10 +34,10 @@
import org.jboss.soa.esb.message.format.MessageFactory;
import org.jboss.soa.esb.util.Util;
-public class AnewFileGatewayListener extends AbstractFileGateway
+public class FileGatewayListener extends AbstractFileGateway
{
- protected AnewFileGatewayListener() {}
- public AnewFileGatewayListener(GatewayListenerController commandListener, ConfigTree config)
+ protected FileGatewayListener() {}
+ public FileGatewayListener(GatewayListenerController commandListener, ConfigTree config)
throws Exception
{
super(commandListener,config);
Modified: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FtpGatewayListener.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FtpGatewayListener.java 2006-12-04 16:02:09 UTC (rev 8051)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/FtpGatewayListener.java 2006-12-04 17:26:41 UTC (rev 8052)
@@ -30,7 +30,7 @@
import org.jboss.soa.esb.util.FtpClientUtil;
import org.jboss.soa.esb.util.Util;
-public class FtpGatewayListener extends AnewFileGatewayListener
+public class FtpGatewayListener extends FileGatewayListener
{
protected FtpGatewayListener() {}
public FtpGatewayListener(GatewayListenerController commandListener, ConfigTree config)
Added: labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayException.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayException.java 2006-12-04 16:02:09 UTC (rev 8051)
+++ labs/jbossesb/workspace/b_georges/product/core/listeners/src/org/jboss/soa/esb/listeners/gateway/GatewayException.java 2006-12-04 17:26:41 UTC (rev 8052)
@@ -0,0 +1,54 @@
+/*
+ * 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.listeners.gateway;
+
+import org.jboss.soa.esb.BaseException;
+
+/**
+ * Dispatch Exception.
+ * @author b_georges
+ * @since Version 4.0
+ */
+public class GatewayException extends BaseException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct an exception instance.
+ * @param message Exception message.
+ */
+ public GatewayException(String message) { super(message); }
+
+ /**
+ * Construct an exception instance.
+ * @param message Exception message.
+ * @param cause Exception cause.
+ */
+ public GatewayException(String message, Throwable cause) { super(message, cause); }
+
+ /**
+ * Construct an exception instance.
+ * @param cause Exception cause.
+ */
+ public GatewayException(Throwable cause) { super(cause); }
+}
Added: labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/util/SecureFtpImplUnitTest.java
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/util/SecureFtpImplUnitTest.java 2006-12-04 16:02:09 UTC (rev 8051)
+++ labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/util/SecureFtpImplUnitTest.java 2006-12-04 17:26:41 UTC (rev 8052)
@@ -0,0 +1,232 @@
+/*
+* 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.internal.soa.esb.util;
+
+import static org.junit.Assert.assertEquals;
+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.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.testutils.FileUtil;
+import org.jboss.soa.esb.testutils.HsqldbUtil;
+import org.jboss.soa.esb.testutils.TestEnvironmentUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+/**
+ * Testing the registry.
+ *
+ * @author kstam
+ *
+ */
+public class SecureFtpImplUnitTest
+{
+ private static String mDbDriver;
+ private static String mDbUrl;
+ private static String mDbUsername;
+ private static String mDbPassword;
+ private static final String SERVICE_NAME = "CommodityRates";
+ private static final String CATEGORY = "coal.API4";
+
+ private Logger logger = Logger.getLogger(this.getClass());
+
+ /**
+ * Testing the registering of an EPR.
+ */
+ @Test
+ public void publishEPR()
+ {
+ EPR epr = new EPR();
+ try {
+ Registry registry = RegistryFactory.getRegistry();
+ registry.registerEPR(CATEGORY, SERVICE_NAME, "Service for traveling",
+ epr, "Specific Service Binding for traveling");
+ } catch (RegistryException re) {
+ logger.log(Priority.ERROR, re.getLocalizedMessage(), re);
+ assertTrue(false);
+ }
+ try {
+ Registry registry = RegistryFactory.getRegistry();
+ registry.registerEPR(null, SERVICE_NAME, null,
+ epr, null);
+ } catch (RegistryException re) {
+ logger.log(Priority.ERROR, re.getLocalizedMessage(), re);
+ assertTrue(false);
+ }
+ //make sure we can handle some null arguments
+
+ }
+ /**
+ * This test will try to find all services in the "travel" category.
+ */
+ @Test
+ public void findService()
+ {
+ try {
+ Registry registry = RegistryFactory.getRegistry();
+ Collection<String> services = registry.findServices(CATEGORY);
+ for (Iterator i=services.iterator();i.hasNext();) {
+ String serviceName = (String) i.next();
+ logger.log(Priority.INFO, "Found service: " + serviceName);
+ assertEquals(CATEGORY + ":" + SERVICE_NAME, serviceName);
+ }
+ } catch (RegistryException re) {
+ logger.log(Priority.ERROR, re.getLocalizedMessage(), re);
+ assertTrue(false);
+ }
+ }
+ /**
+ * Find the EPRs for this service.
+ */
+ @Test
+ public void findEPRs()
+ {
+ try {
+ Registry registry = RegistryFactory.getRegistry();
+ Collection<EPR> eprs = registry.findEPRs(CATEGORY, SERVICE_NAME);
+ for (Iterator i=eprs.iterator();i.hasNext();) {
+ EPR epr = (EPR) i.next();
+ logger.log(Priority.INFO, "Found epr: " + epr);
+ }
+ } catch (RegistryException re) {
+ logger.log(Priority.ERROR, re.getLocalizedMessage(), re);
+ assertTrue(false);
+ }
+ }
+ @Test
+ public void unregisterEPR()
+ {
+ try {
+ Registry registry = RegistryFactory.getRegistry();
+ EPR eprToBeRemoved = new EPR();
+ registry.unRegisterEPR(CATEGORY, SERVICE_NAME, eprToBeRemoved);
+// Now make sure this EPR is really gone
+ Collection<EPR> eprs = registry.findEPRs(CATEGORY, SERVICE_NAME);
+ logger.log(Priority.INFO, "Number of Bindings left should be 0, and is: " + eprs.size());
+ assertEquals(eprs.size(),0);
+ } catch (Exception re) {
+ logger.log(Priority.ERROR, re.getLocalizedMessage(), re);
+ assertTrue(false);
+ }
+ }
+ @Test
+ public void unregisterService()
+ {
+ try {
+ Registry registry = RegistryFactory.getRegistry();
+ registry.unRegisterService(CATEGORY, SERVICE_NAME);
+ registry.unRegisterService(null, SERVICE_NAME);
+ //Make sure it's really gone
+ Collection<String> services = registry.findAllServices();
+ logger.log(Priority.INFO, "Number of Services left should be 0, and is: " + services.size());
+ assertEquals(services.size(),0);
+ } catch (Exception re) {
+ logger.log(Priority.ERROR, re.getLocalizedMessage(), re);
+ assertTrue(false);
+ }
+ }
+ /**
+ * Setup the database.
+ * @throws Exception
+ */
+ @BeforeClass
+ public static void runBeforeAllTests() {
+ try {
+ DOMConfigurator.configure(TestEnvironmentUtil.getUserDir() + "etc/test/resources/log4j.xml");
+ TestEnvironmentUtil.setESBPropertiesFileToUse();
+ //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(TestEnvironmentUtil.getUserDir() + "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 = TestEnvironmentUtil.getUserDir() + "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();
+ System.out.println("Dropping the schema if exist");
+ stmnt.execute(sqlDropCmd);
+ System.out.println("Creating the juddi-schema");
+ stmnt.execute(sqlCreateCmd);
+ System.out.println("Adding the jbossesb publisher");
+ stmnt.execute(sqlInsertPubCmd);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("We should stop testing, since we don't have a db.");
+ assertTrue(false);
+ }
+ }
+ /**
+ * Shutdown the database
+ * @throws Exception
+ */
+ @AfterClass
+ public static void runAfterAllTests() throws Exception {
+ if ("org.hsqldb.jdbcDriver".equals(mDbDriver)) {
+ HsqldbUtil.stopHsqldb(mDbUrl, mDbUsername, mDbPassword);
+ }
+ }
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(SecureFtpImplUnitTest.class);
+ }
+
+}
Added: labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/util/juddi-unittest.properties
===================================================================
--- labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/util/juddi-unittest.properties 2006-12-04 16:02:09 UTC (rev 8051)
+++ labs/jbossesb/workspace/b_georges/product/core/rosetta/tests/src/org/jboss/internal/soa/esb/util/juddi-unittest.properties 2006-12-04 17:26:41 UTC (rev 8052)
@@ -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
+
More information about the jboss-svn-commits
mailing list