Author: alessio.soldano(a)jboss.com
Date: 2010-11-27 21:20:30 -0500 (Sat, 27 Nov 2010)
New Revision: 13346
Removed:
spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/AuthMethod.java
spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/TransportGuarantee.java
spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/WebContext.java
spi/trunk/src/main/java/org/jboss/wsf/spi/binding/
spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/SecurityHandler.java
spi/trunk/src/main/java/org/jboss/wsf/spi/management/recording/
spi/trunk/src/main/java/org/jboss/wsf/spi/tools/
spi/trunk/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java
spi/trunk/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java
spi/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java
spi/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java
Modified:
spi/trunk/pom.xml
spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java
Log:
[JBWS-3115][JBWS-2709] Moving stuff out of jbossws-spi to jbossws-api and jbossws-common;
initial clean up of dependencies
Modified: spi/trunk/pom.xml
===================================================================
--- spi/trunk/pom.xml 2010-11-28 02:14:58 UTC (rev 13345)
+++ spi/trunk/pom.xml 2010-11-28 02:20:30 UTC (rev 13346)
@@ -25,23 +25,23 @@
<!-- Properties -->
<properties>
- <ant.version>1.7.1</ant.version>
- <dom4j.version>1.6.1</dom4j.version>
- <getopt.version>1.0.13</getopt.version>
- <jaxb.api.version>1.0.0.Final</jaxb.api.version>
- <jaxws.api.version>1.0.0.Final</jaxws.api.version>
<jms.api.version>1.0.0.Final</jms.api.version>
<jboss.microcontainer.version>2.0.8.GA</jboss.microcontainer.version>
<jbossxb.version>2.0.1.GA</jbossxb.version>
<jboss-logging-spi.version>2.0.5.GA</jboss-logging-spi.version>
<servlet.api.version>1.0.0.Final</servlet.api.version>
<junit.version>3.8.2</junit.version>
- <log4j.version>1.2.14</log4j.version>
</properties>
<!-- Dependencies -->
<dependencies>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-api</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+
<!-- provided apis -->
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
@@ -50,24 +50,12 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss.spec.javax.xml.bind</groupId>
- <artifactId>jboss-jaxb-api_2.2_spec</artifactId>
- <version>${jaxb.api.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.spec.javax.jms</groupId>
<artifactId>jboss-jms-api_1.1_spec</artifactId>
<version>${jms.api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss.spec.javax.xml.ws</groupId>
- <artifactId>jboss-jaxws-api_2.2_spec</artifactId>
- <version>${jaxws.api.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
<version>${jboss-logging-spi.version}</version>
@@ -86,29 +74,6 @@
</exclusions>
</dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
-
- <!-- transitive dependencies -->
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- </dependency>
- <dependency>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- <version>${dom4j.version}</version>
- </dependency>
- <dependency>
- <groupId>gnu-getopt</groupId>
- <artifactId>getopt</artifactId>
- <version>${getopt.version}</version>
- </dependency>
-
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/AuthMethod.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/AuthMethod.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/AuthMethod.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.annotation;
-
-import org.jboss.logging.Logger;
-
-/**
- * The authMethod is used to configure the authentication mechanism for the web service.
- * As a prerequisite to gaining access to any web service which are protected by an
- * authorization constraint, a user must have authenticated using the configured
mechanism.
- *
- * @author ropalka(a)redhat.com
- */
-public final class AuthMethod
-{
- private static final Logger log = Logger.getLogger(AuthMethod.class);
-
- /**
- * Basic authentication.
- */
- public static final String BASIC = "BASIC";
- /**
- * Client certificate based authentication.
- */
- public static final String CLIENT_CERT = "CLIENT-CERT";
-
- /**
- * Forbidden constructor.
- */
- private AuthMethod()
- {
- super();
- }
-
- /**
- * Returns string representing correct auth method value.
- * @param s string to convert.
- * @return correct auth method value
- * @throws IllegalArgumentException if <b>s</b> is <b>null</b>
or it contains unknown value.
- */
- public static String valueOf(final String s)
- {
- if (s != null)
- {
- if (s.equals(""))
- {
- return s;
- }
- if (s.equals(AuthMethod.BASIC))
- {
- return AuthMethod.BASIC;
- }
- if (s.equals(AuthMethod.CLIENT_CERT))
- {
- return AuthMethod.CLIENT_CERT;
- }
- log.warn("Non-standard auth method value: " + s);
- return s;
- }
-
- throw new IllegalArgumentException("Illegal auth method value: " + s);
- }
-
-}
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/TransportGuarantee.java
===================================================================
---
spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/TransportGuarantee.java 2010-11-28
02:14:58 UTC (rev 13345)
+++
spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/TransportGuarantee.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.annotation;
-
-/**
- * The transportGuarantee specifies that the communication
- * between client and server should be NONE, INTEGRAL, or
- * CONFIDENTIAL. NONE means that the application does not require any
- * transport guarantees. A value of INTEGRAL means that the application
- * requires that the data sent between the client and server be sent in
- * such a way that it can't be changed in transit. CONFIDENTIAL means
- * that the application requires that the data be transmitted in a
- * fashion that prevents other entities from observing the contents of
- * the transmission. In most cases, the presence of the INTEGRAL or
- * CONFIDENTIAL flag will indicate that the use of SSL is required.
- *
- * @author ropalka(a)redhat.com
- */
-public final class TransportGuarantee
-{
-
- /**
- * Application does not require any transport guarantees.
- */
- public static final String NONE = "NONE";
- /**
- * Application requires that the data sent between the client and
- * server be sent in such a way that it can't be changed in transit.
- */
- public static final String INTEGRAL = "INTEGRAL";
- /**
- * Application requires that the data be transmitted in a fashion that
- * prevents other entities from observing the contents of the transmission.
- */
- public static final String CONFIDENTIAL = "CONFIDENTIAL";
-
- /**
- * Forbidden constructor.
- */
- private TransportGuarantee()
- {
- super();
- }
-
- /**
- * Returns string representing correct transport guarantee value.
- * @param s string to convert.
- * @return correct transport guarantee value
- * @throws IllegalArgumentException if <b>s</b> is <b>null</b>
or it contains unknown value.
- */
- public static String valueOf(final String s)
- {
- if (s != null)
- {
- if (s.equals(""))
- {
- return s;
- }
- if (s.equals(TransportGuarantee.NONE))
- {
- return TransportGuarantee.NONE;
- }
- if (s.equals(TransportGuarantee.INTEGRAL))
- {
- return TransportGuarantee.INTEGRAL;
- }
- if (s.equals(TransportGuarantee.CONFIDENTIAL))
- {
- return TransportGuarantee.CONFIDENTIAL;
- }
- }
-
- throw new IllegalArgumentException("Illegal transport guarantee value: "
+ s);
- }
-
-}
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/WebContext.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/WebContext.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/annotation/WebContext.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Provides web context specific meta data to EJB based web service endpoints.
- *
- * @author thomas.diesler(a)jboss.org
- * @since 26-Apr-2005
- */
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.TYPE })
-public @interface WebContext {
-
- /**
- * The contextRoot element specifies the context root that the web service endpoint is
deployed to.
- * If it is not specified it will be derived from the deployment short name.
- *
- * Applies to server side port components only.
- */
- String contextRoot() default "";
-
- /**
- * The virtual hosts that the web service endpoint is deployed to.
- *
- * Applies to server side port components only.
- */
- String[] virtualHosts() default {};
-
- /**
- * Relative path that is appended to the contextRoot to form fully qualified
- * endpoint address for the web service endpoint.
- *
- * Applies to server side port components only.
- */
- String urlPattern() default "";
-
- /**
- * The authMethod is used to configure the authentication mechanism for the web
service.
- * As a prerequisite to gaining access to any web service which are protected by an
authorization
- * constraint, a user must have authenticated using the configured mechanism.
- *
- * Standard values for this element are "BASIC", or "CLIENT-CERT",
custom authMethods may also
- * be specified.
- *
- * @see AuthMethod
- */
- String authMethod() default "";
-
- /**
- * The transportGuarantee specifies that the communication
- * between client and server should be NONE, INTEGRAL, or
- * CONFIDENTIAL. NONE means that the application does not require any
- * transport guarantees. A value of INTEGRAL means that the application
- * requires that the data sent between the client and server be sent in
- * such a way that it can't be changed in transit. CONFIDENTIAL means
- * that the application requires that the data be transmitted in a
- * fashion that prevents other entities from observing the contents of
- * the transmission. In most cases, the presence of the INTEGRAL or
- * CONFIDENTIAL flag will indicate that the use of SSL is required.
- *
- * @see TransportGuarantee
- */
- String transportGuarantee() default "";
-
- /**
- * A secure endpoint does not secure wsdl access by default.
- * Explicitly setting secureWSDLAccess overrides this behaviour.
- *
- * Protect access to WSDL. See
http://jira.jboss.org/jira/browse/JBWS-723
- */
- boolean secureWSDLAccess() default false;
-
-}
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/SecurityHandler.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/SecurityHandler.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/deployment/SecurityHandler.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.deployment;
-
-import org.dom4j.Element;
-
-public interface SecurityHandler
-{
- /** Add the security domain to jboss-web.xml */
- void addSecurityDomain(Element jbossWeb, Deployment dep);
-
- /** Add the security roles to web.xml */
- void addSecurityRoles(Element webApp, Deployment dep);
-}
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java 2010-11-28 02:14:58 UTC
(rev 13345)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/Log4JUtil.java 2010-11-28 02:20:30 UTC
(rev 13346)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.util;
-
-import java.net.URL;
-
-import org.apache.log4j.helpers.Loader;
-
-/**
- *
- * @author alessio.soldano(a)jboss.com
- * @since 10-Jun-2010
- *
- */
-public class Log4JUtil
-{
- public static final String LOG4J_CONFIGURATION = "log4j.configuration";
- public static final String LOG4J_PROPERTIES = "log4j.properties";
-
- /**
- * Returns true if a log4j configuration can be found given the current environment.
- * See
http://logging.apache.org/log4j/1.2/manual.html (Default Initialization
Procedure)
- * @return
- */
- public static boolean isLog4jConfigurationAvailable()
- {
- String log4jConfiguration = System.getProperty(LOG4J_CONFIGURATION);
- String resource = log4jConfiguration != null ? log4jConfiguration :
LOG4J_PROPERTIES;
- URL url = null;
- try
- {
- url = new URL(resource);
- }
- catch (Exception e1)
- {
- try
- {
- url = Loader.getResource(resource);
- }
- catch (Exception e2)
- {
- //ignore
- }
- }
- return url != null;
- }
-}
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/Log4jOutputStream.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,220 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.util;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import org.apache.log4j.Category;
-import org.apache.log4j.Priority;
-
-/**
- * An OutputStream that flushes out to a Category.<p>
- * A simple port of <a href="mailto://Jim.Moore@rocketmail.com">Jim
Moore</a>'s
- * LoggingOutputStream contribution to log4j.
- *
- * Note that no data is written out to the Category until the stream is
- * flushed or closed.<p>
- *
- * Example:<pre>
- * // make sure everything sent to System.err is logged
- * System.setErr(new PrintStream(new LoggingOutputStream(Category.getRoot(),
Priority.WARN), true));
- *
- * // make sure everything sent to System.out is also logged
- * System.setOut(new PrintStream(new LoggingOutputStream(Category.getRoot(),
Priority.INFO), true));
- * </pre>
- *
- */
-public class Log4jOutputStream extends OutputStream
-{
- protected static final String LINE_SEPERATOR =
System.getProperty("line.separator");
-
- /**
- * Used to maintain the contract of {@link #close()}.
- */
- protected boolean hasBeenClosed = false;
-
- /**
- * The internal buffer where data is stored.
- */
- protected byte[] buf;
-
- /**
- * The number of valid bytes in the buffer. This value is always
- * in the range <tt>0</tt> through <tt>buf.length</tt>;
elements
- * <tt>buf[0]</tt> through <tt>buf[count-1]</tt> contain
valid
- * byte data.
- */
- protected int count;
-
- /**
- * Remembers the size of the buffer for speed.
- */
- private int bufLength;
-
- /**
- * The default number of bytes in the buffer. =2048
- */
- public static final int DEFAULT_BUFFER_LENGTH = 2048;
-
- /**
- * The category to write to.
- */
- protected Category category;
-
- /**
- * The priority to use when writing to the Category.
- */
- protected Priority priority;
-
- @SuppressWarnings("unused")
- private Log4jOutputStream()
- {
- // illegal
- }
-
- /**
- * Creates the LoggingOutputStream to flush to the given Category.
- *
- * @param cat the Category to write to
- *
- * @param priority the Priority to use when writing to the Category
- *
- * @exception IllegalArgumentException
- * if cat == null or priority == null
- */
- public Log4jOutputStream(Category cat, Priority priority) throws
IllegalArgumentException
- {
- if (cat == null)
- {
- throw new IllegalArgumentException("cat == null");
- }
- if (priority == null)
- {
- throw new IllegalArgumentException("priority == null");
- }
-
- this.priority = priority;
- category = cat;
- bufLength = DEFAULT_BUFFER_LENGTH;
- buf = new byte[DEFAULT_BUFFER_LENGTH];
- count = 0;
- }
-
- /**
- * Closes this output stream and releases any system resources
- * associated with this stream. The general contract of
<code>close</code>
- * is that it closes the output stream. A closed stream cannot perform
- * output operations and cannot be reopened.
- */
- public void close()
- {
- flush();
- hasBeenClosed = true;
- }
-
- /**
- * Writes the specified byte to this output stream. The general
- * contract for <code>write</code> is that one byte is written
- * to the output stream. The byte to be written is the eight
- * low-order bits of the argument <code>b</code>. The 24
- * high-order bits of <code>b</code> are ignored.
- *
- * @param b the <code>byte</code> to write
- *
- * @exception IOException
- * if an I/O error occurs. In particular,
- * an <code>IOException</code> may be thrown if the
- * output stream has been closed.
- */
- public void write(final int b) throws IOException
- {
- if (hasBeenClosed)
- {
- throw new IOException("The stream has been closed.");
- }
-
- // don't log nulls
- if (b == 0)
- {
- return;
- }
-
- // would this be writing past the buffer?
- if (count == bufLength)
- {
- // grow the buffer
- final int newBufLength = bufLength + DEFAULT_BUFFER_LENGTH;
- final byte[] newBuf = new byte[newBufLength];
-
- System.arraycopy(buf, 0, newBuf, 0, bufLength);
-
- buf = newBuf;
- bufLength = newBufLength;
- }
-
- buf[count] = (byte)b;
- count++;
- }
-
- /**
- * Flushes this output stream and forces any buffered output bytes
- * to be written out. The general contract of <code>flush</code> is
- * that calling it is an indication that, if any bytes previously
- * written have been buffered by the implementation of the output
- * stream, such bytes should immediately be written to their
- * intended destination.
- */
- public void flush()
- {
- if (count == 0)
- {
- return;
- }
-
- // don't print out blank lines; flushing from PrintStream puts out these
- if (count == LINE_SEPERATOR.length())
- {
- if (((char)buf[0]) == LINE_SEPERATOR.charAt(0) && ((count == 1) || //
<- Unix & Mac, -> Windows
- ((count == 2) && ((char)buf[1]) == LINE_SEPERATOR.charAt(1))))
- {
- reset();
- return;
- }
- }
-
- final byte[] theBytes = new byte[count];
-
- System.arraycopy(buf, 0, theBytes, 0, count);
-
- category.log(priority, new String(theBytes));
-
- reset();
- }
-
- private void reset()
- {
- // not resetting the buffer -- assuming that if it grew that it
- // will likely grow similarly again
- count = 0;
- }
-
-}
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/SecurityActions.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,142 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.util;
-
-import java.io.InputStream;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * Security actions for this package
- *
- * @author alessio.soldano(a)jboss.com
- * @since 19-Jun-2009
- *
- */
-class SecurityActions
-{
- /**
- * Get context classloader.
- *
- * @return the current context classloader
- */
- static ClassLoader getContextClassLoader()
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- return Thread.currentThread().getContextClassLoader();
- }
- else
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
- public ClassLoader run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
- }
-
- /**
- * Set context classloader.
- *
- */
- static void setContextClassLoader(final ClassLoader cl)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- Thread.currentThread().setContextClassLoader(cl);
- }
- else
- {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run()
- {
- Thread.currentThread().setContextClassLoader(cl);
- return null;
- }
- });
- }
- }
-
- /**
- * Get resource as stream
- *
- * @param cl
- * @param filename
- * @return input stream
- * @throws PrivilegedActionException
- */
- static InputStream getResourceAsStream(final ClassLoader cl, final String filename)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- return cl.getResourceAsStream(filename);
- }
- else
- {
- return AccessController.doPrivileged(new PrivilegedAction<InputStream>()
{
- public InputStream run()
- {
- return cl.getResourceAsStream(filename);
- }
- });
- }
- }
-
- /**
- * Load a class using the provided classloader
- *
- * @param name
- * @return
- * @throws PrivilegedActionException
- */
- static Class<?> loadClass(final ClassLoader cl, final String name) throws
PrivilegedActionException, ClassNotFoundException
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- return cl.loadClass(name);
- }
- else
- {
- return AccessController.doPrivileged(new
PrivilegedExceptionAction<Class<?>>() {
- public Class<?> run() throws PrivilegedActionException
- {
- try
- {
- return cl.loadClass(name);
- }
- catch (Exception e)
- {
- throw new PrivilegedActionException(e);
- }
- }
- });
- }
- }
-}
Deleted: spi/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java 2010-11-28 02:14:58
UTC (rev 13345)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/ServiceLoader.java 2010-11-28 02:20:30
UTC (rev 13346)
@@ -1,306 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.util;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Properties;
-import java.util.WeakHashMap;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Load a service class using this ordered lookup procedure
- *
- * @author Thomas.Diesler(a)jboss.com
- * @author alessio.soldano(a)jboss.com
- * @since 14-Dec-2006
- */
-public abstract class ServiceLoader
-{
- /**
- * A synchronized weak hash map that keeps factory names retrieved using Service API
(META-INF/services/*) for each classloader.
- * Weak keys are used to remove entries when classloaders are garbage collected;
values are service-property-name -> factory name maps.
- */
- private static Map<ClassLoader, Map<String, String>> serviceMap =
Collections.synchronizedMap(new WeakHashMap<ClassLoader, Map<String,
String>>());
-
- /**
- * This method uses the algorithm below using the JAXWS Provider as an example.
- *
- * 1. If a resource with the name of META-INF/services/javax.xml.ws.spi.Provider
exists, then
- * its first line, if present, is used as the UTF-8 encoded name of the implementation
class.
- *
- * 2. If the ${java.home}/lib/jaxws.properties file exists and it is readable by the
- * java.util.Properties.load(InputStream) method and it contains an entry whose key is
- * javax.xml.ws.spi.Provider, then the value of that entry is used as the name of the
implementation class.
- *
- * 3. If a system property with the name javax.xml.ws.spi.Provider is defined, then
its value is used
- * as the name of the implementation class.
- *
- * 4. Finally, a default implementation class name is used.
- */
- public static Object loadService(String propertyName, String defaultFactory)
- {
- Object factory = loadFromServices(propertyName, null);
- if (factory == null)
- {
- factory = loadFromPropertiesFile(propertyName, null);
- }
- if (factory == null)
- {
- factory = loadFromSystemProperty(propertyName, defaultFactory);
- }
- return factory;
- }
-
- /** Use the Services API (as detailed in the JAR specification), if available, to
determine the classname.
- */
- public static Object loadFromServices(String propertyName, String defaultFactory)
- {
- Object factory = null;
- String factoryName = null;
- ClassLoader loader = SecurityActions.getContextClassLoader();
-
- // Use the Services API (as detailed in the JAR specification), if available, to
determine the classname.
- String filename = "META-INF/services/" + propertyName;
-
- try
- {
- factoryName = getServiceNameUsingCache(loader, filename);
- if (factoryName != null)
- {
- Class factoryClass = SecurityActions.loadClass(loader, factoryName);
- factory = factoryClass.newInstance();
- }
- }
- catch (Throwable t)
- {
- throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
- }
-
- // Use the default factory implementation class.
- if (factory == null && defaultFactory != null)
- {
- factory = loadDefault(defaultFactory);
- }
-
- return factory;
- }
-
- private static String getServiceNameUsingCache(ClassLoader loader, String filename)
throws IOException
- {
- Map<String, String> map = serviceMap.get(loader);
- if (map != null && map.containsKey(filename))
- {
- return map.get(filename);
- }
- else
- {
- if (map == null)
- {
- map = new ConcurrentHashMap<String, String>();
- serviceMap.put(loader, map);
- }
- InputStream inStream = SecurityActions.getResourceAsStream(loader, filename);
- String factoryName = null;
- if (inStream != null)
- {
- BufferedReader br = new BufferedReader(new InputStreamReader(inStream,
"UTF-8"));
- factoryName = br.readLine();
- br.close();
- map.put(filename, factoryName);
- }
- return factoryName;
- }
- }
-
- /** Use the system property
- */
- public static Object loadFromSystemProperty(String propertyName, String
defaultFactory)
- {
- Object factory = null;
- ClassLoader loader = SecurityActions.getContextClassLoader();
-
- PrivilegedAction action = new PropertyAccessAction(propertyName);
- String factoryName = (String)AccessController.doPrivileged(action);
- if (factoryName != null)
- {
- try
- {
- //if(log.isDebugEnabled()) log.debug("Load from system property: "
+ factoryName);
- Class factoryClass = SecurityActions.loadClass(loader, factoryName);
- factory = factoryClass.newInstance();
- }
- catch (Throwable t)
- {
- throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
- }
- }
-
- // Use the default factory implementation class.
- if (factory == null && defaultFactory != null)
- {
- factory = loadDefault(defaultFactory);
- }
-
- return factory;
- }
-
- /**
- * Use the properties file "${java.home}/lib/jaxws.properties" in the JRE
directory.
- * This configuration file is in standard java.util.Properties format and contains the
- * fully qualified name of the implementation class with the key being the system
property defined above.
- */
- public static Object loadFromPropertiesFile(String propertyName, String
defaultFactory)
- {
- Object factory = null;
- String factoryName = null;
- ClassLoader loader = SecurityActions.getContextClassLoader();
-
- // Use the properties file "lib/jaxm.properties" in the JRE directory.
- // This configuration file is in standard java.util.Properties format and contains
the fully qualified name of the implementation class with the key being the system
property defined above.
- PrivilegedAction action = new PropertyAccessAction("java.home");
- String javaHome = (String)AccessController.doPrivileged(action);
- File jaxmFile = new File(javaHome + "/lib/jaxws.properties");
- if ((Boolean)AccessController.doPrivileged(new PropertyFileExistAction(jaxmFile)))
- {
- try
- {
- action = new PropertyFileAccessAction(jaxmFile.getCanonicalPath());
- Properties jaxmProperties =
(Properties)AccessController.doPrivileged(action);
- factoryName = jaxmProperties.getProperty(propertyName);
- if (factoryName != null)
- {
- //if(log.isDebugEnabled()) log.debug("Load from " + jaxmFile +
": " + factoryName);
- Class<?> factoryClass = SecurityActions.loadClass(loader,
factoryName);
- factory = factoryClass.newInstance();
- }
- }
- catch (Throwable t)
- {
- throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
- }
- }
-
- // Use the default factory implementation class.
- if (factory == null && defaultFactory != null)
- {
- factory = loadDefault(defaultFactory);
- }
-
- return factory;
- }
-
- private static Object loadDefault(String defaultFactory)
- {
- Object factory = null;
- ClassLoader loader = SecurityActions.getContextClassLoader();
-
- // Use the default factory implementation class.
- if (defaultFactory != null)
- {
- try
- {
- //if(log.isDebugEnabled()) log.debug("Load from default: " +
factoryName);
- Class factoryClass = SecurityActions.loadClass(loader, defaultFactory);
- factory = factoryClass.newInstance();
- }
- catch (Throwable t)
- {
- throw new IllegalStateException("Failed to load: " +
defaultFactory, t);
- }
- }
-
- return factory;
- }
-
- private static class PropertyAccessAction implements PrivilegedAction
- {
- private String name;
-
- PropertyAccessAction(String name)
- {
- this.name = name;
- }
-
- public Object run()
- {
- return System.getProperty(name);
- }
- }
-
- private static class PropertyFileAccessAction implements PrivilegedAction
- {
- private String filename;
-
- PropertyFileAccessAction(String filename)
- {
- this.filename = filename;
- }
-
- public Object run()
- {
- InputStream inStream = null;
- try
- {
- inStream = new FileInputStream(filename);
- Properties props = new Properties();
- props.load(inStream);
- return props;
- }
- catch (IOException ex)
- {
- throw new SecurityException("Cannot load properties: " + filename,
ex);
- }
- finally
- {
- try
- {
- inStream.close();
- }
- catch (Exception e) {} //ignore
- }
- }
- }
-
- private static class PropertyFileExistAction implements PrivilegedAction
- {
- private File file;
-
- PropertyFileExistAction(File file)
- {
- this.file = file;
- }
-
- public Object run()
- {
- return file.exists();
- }
- }
-}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/util/URLLoaderAdapter.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -23,7 +23,6 @@
import java.io.File;
import java.io.IOException;
-import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
@@ -36,7 +35,6 @@
import java.util.jar.JarFile;
import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
/**
Deleted: spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java
===================================================================
---
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java 2010-11-28
02:14:58 UTC (rev 13345)
+++
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntConsumeTestCase.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-/**
- * Test the WSConsumeTask.
- * This test needs to be executed in 'SPI_HOME/output/tests',
- * because it works with relative paths.
- *
- * @author Heiko.Braun(a)jboss.com
- */
-public class AntConsumeTestCase extends BuildFileTest
-{
- protected void setUp() throws Exception
- {
- super.setUp();
-
- // cleanup events
- CmdConsumeTracker.LAST_EVENT = "";
-
- // enforce loading of the tracker implemenation
- System.setProperty("org.jboss.wsf.spi.tools.ConsumerFactoryImpl",
"org.jboss.test.wsf.spi.tools.CmdConsumeTrackerFactory");
-
- configureProject("src/test/resources/smoke/tools/consume-test.xml");
- }
-
- public void testPlainInvocation()
- {
- executeTarget("plainInvocation");
- assertTrue("consume() not invoked",
CmdConsumeTracker.LAST_EVENT.indexOf("consume") != -1);
- }
-
-}
Deleted: spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java
===================================================================
---
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java 2010-11-28
02:14:58 UTC (rev 13345)
+++
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/AntProvideTestCase.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-/**
- * @author Heiko.Braun(a)jboss.com
- */
-public class AntProvideTestCase extends BuildFileTest
-{
- protected void setUp() throws Exception
- {
- super.setUp();
-
- // cleanup events
- CmdProvideTracker.LAST_EVENT = "";
-
- // enforce loading of the tracker implemenation
- System.setProperty("org.jboss.wsf.spi.tools.ProviderFactoryImpl",
"org.jboss.test.wsf.spi.tools.CmdProvideTrackerFactory");
-
- configureProject("src/test/resources/smoke/tools/provide-test.xml");
- }
-
- public void testPlainInvocation()
- {
- executeTarget("plainInvocation");
- assertTrue("provide() not invoked",
CmdProvideTracker.LAST_EVENT.indexOf("provide") != -1);
- }
-
- public void testIncludeWSDL()
- {
- executeTarget("includeWSDL");
- assertTrue("setGenerateWsdl() not invoked",
CmdProvideTracker.LAST_EVENT.indexOf("setGenerateWsdl") != -1);
- }
-
- public void testExtraClasspath()
- {
- executeTarget("extraClasspath");
-
- }
-
-}
Deleted: spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java
===================================================================
--- spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/BuildFileTest.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,543 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.jboss.test.wsf.spi.tools;
-
-import junit.framework.TestCase;
-import org.apache.tools.ant.BuildEvent;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.BuildListener;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectHelper;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.net.URL;
-
-/**
- * A BuildFileTest is a TestCase which executes targets from an Ant buildfile
- * for testing.
- *
- * This class provides a number of utility methods for particular build file
- * tests which extend this class.
- *
- * @author Apache Ant contributors
- */
-public abstract class BuildFileTest extends TestCase {
-
- protected Project project;
-
- private StringBuffer logBuffer;
- private StringBuffer fullLogBuffer;
- private StringBuffer outBuffer;
- private StringBuffer errBuffer;
- private BuildException buildException;
-
- /**
- * Default constructor for the BuildFileTest object.
- */
- public BuildFileTest() {
- super();
- }
-
- /**
- * Constructor for the BuildFileTest object.
- *
- * @param name string to pass up to TestCase constructor
- */
- public BuildFileTest(String name) {
- super(name);
- }
-
- /**
- * Automatically calls the target called "tearDown"
- * from the build file tested if it exits.
- *
- * This allows to use Ant tasks directly in the build file
- * to clean up after each test. Note that no "setUp" target
- * is automatically called, since it's trivial to have a
- * test target depend on it.
- */
- protected void tearDown() throws Exception {
- if (project == null) {
- /*
- * Maybe the BuildFileTest was subclassed and there is
- * no initialized project. So we could avoid getting a
- * NPE.
- * If there is an initialized project getTargets() does
- * not return null as it is initialized by an empty
- * HashSet.
- */
- return;
- }
- final String tearDown = "tearDown";
- if (project.getTargets().containsKey(tearDown)) {
- project.executeTarget(tearDown);
- }
- }
-
- /**
- * run a target, expect for any build exception
- *
- * @param target target to run
- * @param cause information string to reader of report
- */
- public void expectBuildException(String target, String cause) {
- expectSpecificBuildException(target, cause, null);
- }
-
- /**
- * Assert that only the given message has been logged with a
- * priority <= INFO when running the given target.
- */
- public void expectLog(String target, String log) {
- executeTarget(target);
- String realLog = getLog();
- assertEquals(log, realLog);
- }
-
- /**
- * Assert that the given substring is in the log messages.
- */
- public void assertLogContaining(String substring) {
- String realLog = getLog();
- assertTrue("expecting log to contain \"" + substring + "\"
log was \""
- + realLog + "\"",
- realLog.indexOf(substring) >= 0);
- }
-
- /**
- * Assert that the given substring is in the output messages.
- * @since Ant1.7
- */
- public void assertOutputContaining(String substring) {
- String realOutput = getOutput();
- assertTrue("expecting output to contain \"" + substring
- + "\" output was \"" + realOutput + "\"",
- realOutput.indexOf(substring) >= 0);
- }
-
- /**
- * Assert that the given message has been logged with a priority
- * <= INFO when running the given target.
- */
- public void expectLogContaining(String target, String log) {
- executeTarget(target);
- assertLogContaining(log);
- }
-
- /**
- * Gets the log the BuildFileTest object.
- * Only valid if configureProject() has been called.
- *
- * @pre logBuffer!=null
- * @return The log value
- */
- public String getLog() {
- return logBuffer.toString();
- }
-
- /**
- * Assert that the given message has been logged with a priority
- * >= VERBOSE when running the given target.
- */
- public void expectDebuglog(String target, String log) {
- executeTarget(target);
- String realLog = getFullLog();
- assertEquals(log, realLog);
- }
-
- /**
- * Assert that the given substring is in the log messages.
- */
- public void assertDebuglogContaining(String substring) {
- String realLog = getFullLog();
- assertTrue("expecting debug log to contain \"" + substring
- + "\" log was \""
- + realLog + "\"",
- realLog.indexOf(substring) >= 0);
- }
-
- /**
- * Gets the log the BuildFileTest object.
- *
- * Only valid if configureProject() has been called.
- *
- * @pre fullLogBuffer!=null
- * @return The log value
- */
- public String getFullLog() {
- return fullLogBuffer.toString();
- }
-
- /**
- * execute the target, verify output matches expectations
- *
- * @param target target to execute
- * @param output output to look for
- */
- public void expectOutput(String target, String output) {
- executeTarget(target);
- String realOutput = getOutput();
- assertEquals(output, realOutput.trim());
- }
-
- /**
- * Executes the target, verify output matches expectations
- * and that we got the named error at the end
- *
- * @param target target to execute
- * @param output output to look for
- * @param error Description of Parameter
- */
- public void expectOutputAndError(String target, String output, String error) {
- executeTarget(target);
- String realOutput = getOutput();
- assertEquals(output, realOutput);
- String realError = getError();
- assertEquals(error, realError);
- }
-
- public String getOutput() {
- return cleanBuffer(outBuffer);
- }
-
- public String getError() {
- return cleanBuffer(errBuffer);
- }
-
- public BuildException getBuildException() {
- return buildException;
- }
-
- private String cleanBuffer(StringBuffer buffer) {
- StringBuffer cleanedBuffer = new StringBuffer();
- boolean cr = false;
- for (int i = 0; i < buffer.length(); i++) {
- char ch = buffer.charAt(i);
- if (ch == '\r') {
- cr = true;
- continue;
- }
-
- if (!cr) {
- cleanedBuffer.append(ch);
- } else {
- cleanedBuffer.append(ch);
- }
- }
- return cleanedBuffer.toString();
- }
-
- /**
- * Sets up to run the named project
- *
- * @param filename name of project file to run
- */
- public void configureProject(String filename) throws BuildException {
- configureProject(filename, Project.MSG_DEBUG);
- }
-
- /**
- * Sets up to run the named project
- *
- * @param filename name of project file to run
- */
- public void configureProject(String filename, int logLevel)
- throws BuildException {
- logBuffer = new StringBuffer();
- fullLogBuffer = new StringBuffer();
- project = new Project();
- project.init();
- File antFile = new File(System.getProperty("root"), filename);
- project.setUserProperty("ant.file" , antFile.getAbsolutePath());
- project.addBuildListener(new AntTestListener(logLevel));
- ProjectHelper.configureProject(project, antFile);
- }
-
- /**
- * Executes a target we have set up
- *
- * @pre configureProject has been called
- * @param targetName target to run
- */
- public void executeTarget(String targetName) {
- PrintStream sysOut = System.out;
- PrintStream sysErr = System.err;
- try {
- sysOut.flush();
- sysErr.flush();
- outBuffer = new StringBuffer();
- PrintStream out = new PrintStream(new AntOutputStream(outBuffer));
- System.setOut(out);
- errBuffer = new StringBuffer();
- PrintStream err = new PrintStream(new AntOutputStream(errBuffer));
- System.setErr(err);
- logBuffer = new StringBuffer();
- fullLogBuffer = new StringBuffer();
- buildException = null;
- project.executeTarget(targetName);
- } finally {
- System.setOut(sysOut);
- System.setErr(sysErr);
- }
-
- }
-
- /**
- * Get the project which has been configured for a test.
- *
- * @return the Project instance for this test.
- */
- public Project getProject() {
- return project;
- }
-
- /**
- * Gets the directory of the project.
- *
- * @return the base dir of the project
- */
- public File getProjectDir() {
- return project.getBaseDir();
- }
-
- /**
- * Runs a target, wait for a build exception.
- *
- * @param target target to run
- * @param cause information string to reader of report
- * @param msg the message value of the build exception we are waiting
- * for set to null for any build exception to be valid
- */
- public void expectSpecificBuildException(String target, String cause, String msg) {
- try {
- executeTarget(target);
- } catch (org.apache.tools.ant.BuildException ex) {
- buildException = ex;
- if ((null != msg) && (!ex.getMessage().equals(msg))) {
- fail("Should throw BuildException because '" + cause
- + "' with message '" + msg
- + "' (actual message '" + ex.getMessage() + "'
instead)");
- }
- return;
- }
- fail("Should throw BuildException because: " + cause);
- }
-
- /**
- * run a target, expect an exception string
- * containing the substring we look for (case sensitive match)
- *
- * @param target target to run
- * @param cause information string to reader of report
- * @param contains substring of the build exception to look for
- */
- public void expectBuildExceptionContaining(String target, String cause, String
contains) {
- try {
- executeTarget(target);
- } catch (org.apache.tools.ant.BuildException ex) {
- buildException = ex;
- if ((null != contains) && (ex.getMessage().indexOf(contains) == -1)) {
- fail("Should throw BuildException because '" + cause +
"' with message containing '" + contains + "' (actual message
'" + ex.getMessage() + "' instead)");
- }
- return;
- }
- fail("Should throw BuildException because: " + cause);
- }
-
- /**
- * call a target, verify property is as expected
- *
- * @param target build file target
- * @param property property name
- * @param value expected value
- */
- public void expectPropertySet(String target, String property, String value) {
- executeTarget(target);
- assertPropertyEquals(property, value);
- }
-
- /**
- * assert that a property equals a value; comparison is case sensitive.
- *
- * @param property property name
- * @param value expected value
- */
- public void assertPropertyEquals(String property, String value) {
- String result = project.getProperty(property);
- assertEquals("property " + property,value,result);
- }
-
- /**
- * assert that a property equals "true".
- *
- * @param property property name
- */
- public void assertPropertySet(String property) {
- assertPropertyEquals(property, "true");
- }
-
- /**
- * assert that a property is null.
- *
- * @param property property name
- */
- public void assertPropertyUnset(String property) {
- assertPropertyEquals(property, null);
- }
-
- /**
- * call a target, verify named property is "true".
- *
- * @param target build file target
- * @param property property name
- */
- public void expectPropertySet(String target, String property) {
- expectPropertySet(target, property, "true");
- }
-
- /**
- * Call a target, verify property is null.
- *
- * @param target build file target
- * @param property property name
- */
- public void expectPropertyUnset(String target, String property) {
- expectPropertySet(target, property, null);
- }
-
- /**
- * Retrieve a resource from the caller classloader to avoid
- * assuming a vm working directory. The resource path must be
- * relative to the package name or absolute from the root path.
- *
- * @param resource the resource to retrieve its url.
- * @throws junit.framework.AssertionFailedError if the resource is not found.
- */
- public URL getResource(String resource){
- URL url = getClass().getResource(resource);
- assertNotNull("Could not find resource :" + resource, url);
- return url;
- }
-
- /**
- * an output stream which saves stuff to our buffer.
- */
- private static class AntOutputStream extends java.io.OutputStream {
- private StringBuffer buffer;
-
- public AntOutputStream( StringBuffer buffer ) {
- this.buffer = buffer;
- }
-
- public void write(int b) {
- buffer.append((char)b);
- }
- }
-
- /**
- * Our own personal build listener.
- */
- private class AntTestListener implements BuildListener
- {
- private int logLevel;
-
- /**
- * Constructs a test listener which will ignore log events
- * above the given level.
- */
- public AntTestListener(int logLevel) {
- this.logLevel = logLevel;
- }
-
- /**
- * Fired before any targets are started.
- */
- public void buildStarted(BuildEvent event) {
- }
-
- /**
- * Fired after the last target has finished. This event
- * will still be thrown if an error occurred during the build.
- *
- * @see BuildEvent#getException()
- */
- public void buildFinished(BuildEvent event) {
- }
-
- /**
- * Fired when a target is started.
- *
- * @see BuildEvent#getTarget()
- */
- public void targetStarted(BuildEvent event) {
- System.out.println("targetStarted " + event.getTarget().getName());
- }
-
- /**
- * Fired when a target has finished. This event will
- * still be thrown if an error occurred during the build.
- *
- * @see BuildEvent#getException()
- */
- public void targetFinished(BuildEvent event) {
- System.out.println("targetFinished " + event.getTarget().getName());
- }
-
- /**
- * Fired when a task is started.
- *
- * @see BuildEvent#getTask()
- */
- public void taskStarted(BuildEvent event) {
- //System.out.println("taskStarted " + event.getTask().getTaskName());
- }
-
- /**
- * Fired when a task has finished. This event will still
- * be throw if an error occurred during the build.
- *
- * @see BuildEvent#getException()
- */
- public void taskFinished(BuildEvent event) {
- //System.out.println("taskFinished " +
event.getTask().getTaskName());
- }
-
- /**
- * Fired whenever a message is logged.
- *
- * @see BuildEvent#getMessage()
- * @see BuildEvent#getPriority()
- */
- public void messageLogged(BuildEvent event) {
- if (event.getPriority() > logLevel) {
- // ignore event
- return;
- }
-
- if (event.getPriority() == Project.MSG_INFO ||
- event.getPriority() == Project.MSG_WARN ||
- event.getPriority() == Project.MSG_ERR) {
- logBuffer.append(event.getMessage());
- }
- fullLogBuffer.append(event.getMessage());
- }
- }
-
-}
-
Deleted: spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java
===================================================================
--- spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CalculatorBean.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-// We just need to load it, therefore we skip the JSR 181 annotations here
-public class CalculatorBean
-{
- public int add(int a, int b)
- {
- return a+b;
- }
-
- public int subtract(int a, int b)
- {
- return a-b;
- }
-}
Deleted: spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java
===================================================================
---
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java 2010-11-28
02:14:58 UTC (rev 13345)
+++
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTestCase.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-import org.jboss.wsf.spi.tools.cmd.WSConsume;
-
-import java.security.Permission;
-
-import junit.framework.TestCase;
-
-/**
- * Test the command line interface to WSConsume.
- *
- * @author Heiko.Braun(a)jboss.com
- */
-public class CmdConsumeTestCase extends CommandlineTestBase
-{
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- // cleanup events
- CmdConsumeTracker.LAST_EVENT = "";
-
- // enforce loading of the tracker implemenation
- System.setProperty(
- "org.jboss.wsf.spi.tools.ConsumerFactoryImpl",
- "org.jboss.test.wsf.spi.tools.CmdConsumeTrackerFactory"
- );
- }
-
- public void testInvalidBindingOption() throws Exception
- {
- executeCmd("-b", true);
- }
-
- public void testValidBindingOption() throws Exception
- {
- executeCmd("-b binding-file.xml Service.wsdl", false);
- assertTrue("setBindingFiles() not invoked",
CmdConsumeTracker.LAST_EVENT.indexOf("setBindingFiles")!=-1);
- }
-
- public void testMissingOptions() throws Exception
- {
- executeCmd(null, true);
- }
-
- // TODO: add arbitrary combinations on a case by case basis
-
-
- void runDelegate(String[] args) throws Exception
- {
- WSConsume.main(args);
- }
-}
Deleted: spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java
===================================================================
--- spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTracker.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,121 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-import org.jboss.wsf.spi.tools.WSContractConsumer;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.util.List;
-import java.net.URL;
-
-/**
- * @author Heiko.Braun(a)jboss.com
- */
-public class CmdConsumeTracker extends WSContractConsumer
-{
- public static String LAST_EVENT = "";
-
- @Override
- public void setBindingFiles(List<File> bindingFiles)
- {
- LAST_EVENT += "setBindingFiles";
- }
-
- @Override
- public void setCatalog(File catalog)
- {
- LAST_EVENT += "setCatalog";
- }
-
- @Override
- public void setOutputDirectory(File directory)
- {
- LAST_EVENT += "setOutputDirectory";
- }
-
- @Override
- public void setSourceDirectory(File directory)
- {
- LAST_EVENT += "setSourceDirectory";
- }
-
- @Override
- public void setGenerateSource(boolean generateSource)
- {
- LAST_EVENT += "setGenerateSource";
- }
-
- @Override
- public void setTargetPackage(String targetPackage)
- {
- LAST_EVENT += "setTargetPackage";
- }
-
- @Override
- public void setWsdlLocation(String wsdlLocation)
- {
- LAST_EVENT += "setWsdlLocation";
- }
-
- @Override
- public void setMessageStream(PrintStream messageStream)
- {
- LAST_EVENT += "setMessageStream";
- }
-
- @Override
- public void setAdditionalCompilerClassPath(List<String> classPath)
- {
- LAST_EVENT += "setAdditionalCompilerClassPath";
- }
-
- @Override
- public void setAdditionalHeaders(boolean additionalHeaders)
- {
- LAST_EVENT += "setAdditionalHeaders";
- }
-
- @Override
- public void setTarget(String target)
- {
- LAST_EVENT += "setTarget";
- }
-
- @Override
- public void consume(URL wsdl)
- {
- LAST_EVENT += "consume";
- }
-
- @Override
- public void setExtension(boolean extension)
- {
- LAST_EVENT += "setExtension";
- }
-
- @Override
- public void setNoCompile(boolean nocompile)
- {
- LAST_EVENT += "setNoCompile";
- }
-}
Deleted:
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java
===================================================================
---
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java 2010-11-28
02:14:58 UTC (rev 13345)
+++
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdConsumeTrackerFactory.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-import org.jboss.wsf.spi.tools.WSContractConsumerFactory;
-import org.jboss.wsf.spi.tools.WSContractConsumer;
-
-/**
- * @author Heiko.Braun(a)jboss.com
- */
-public class CmdConsumeTrackerFactory implements WSContractConsumerFactory
-{
-
- public WSContractConsumer createConsumer()
- {
- return new CmdConsumeTracker();
- }
-}
Deleted: spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java
===================================================================
---
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java 2010-11-28
02:14:58 UTC (rev 13345)
+++
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTestCase.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-import org.jboss.wsf.spi.tools.cmd.WSProvide;
-
-/**
- * @author Heiko.Braun(a)jboss.com
- */
-public class CmdProvideTestCase extends CommandlineTestBase
-{
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- // clear events
- CmdProvideTracker.LAST_EVENT = "";
-
- // enforce loading of the tracker implemenation
- System.setProperty(
- "org.jboss.wsf.spi.tools.ProviderFactoryImpl",
- "org.jboss.test.wsf.spi.tools.CmdProvideTrackerFactory"
- );
- }
-
- /** <pre>
- * usage: WSProvideTask [options] <endpoint class name>
- * options:
- * -h, --help Show this help message
- * -k, --keep Keep/Generate Java source
- * -w, --wsdl Enable WSDL file generation
- * -c, --classpath=<path< The classpath that contains the endpoint
- * -o, --output=<directory> The directory to put generated artifacts
- * -r, --resource=<directory> The directory to put resource artifacts
- * -s, --source=<directory> The directory to put Java source
- * -q, --quiet Be somewhat more quiet
- * -t, --show-traces Show full exception stack traces
- * -l, --load-provider Load the provider and exit (debug utility)
- * </pre>
- * */
-
- public void testMissingOptions() throws Exception
- {
- executeCmd(null, true);
- }
-
- public void testValidOutputDir() throws Exception
- {
- executeCmd("-o outputDir org.jboss.test.wsf.spi.tools.CalculatorBean",
false);
- assertTrue("setOutputDirectory() not invoked",
CmdProvideTracker.LAST_EVENT.indexOf("setOutputDirectory")!=-1);
- }
-
- void runDelegate(String[] args) throws Exception
- {
- WSProvide.main(args);
- }
-}
Deleted: spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java
===================================================================
--- spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java 2010-11-28
02:14:58 UTC (rev 13345)
+++ spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTracker.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-import org.jboss.wsf.spi.tools.WSContractProvider;
-
-import java.io.File;
-import java.io.PrintStream;
-
-/**
- * @author Heiko.Braun(a)jboss.com
- */
-public class CmdProvideTracker extends WSContractProvider
-{
-
- public static String LAST_EVENT = "";
-
- public void setGenerateWsdl(boolean generateWsdl)
- {
- LAST_EVENT += "setGenerateWsdl";
- }
-
- public void setExtension(boolean extension)
- {
- LAST_EVENT += "setExtension";
- }
-
- public void setGenerateSource(boolean generateSource)
- {
- LAST_EVENT += "setGenerateSource";
- }
-
- public void setOutputDirectory(File directory)
- {
- LAST_EVENT += "setOutputDirectory";
- }
-
- public void setResourceDirectory(File directory)
- {
- LAST_EVENT += "setResourceDirectory";
- }
-
- public void setSourceDirectory(File directory)
- {
- LAST_EVENT += "setSourceDirectory";
- }
-
- public void setClassLoader(ClassLoader loader)
- {
- LAST_EVENT += "setClassLoader";
- }
-
- public void provide(String endpointClass)
- {
- LAST_EVENT += "provide";
- }
-
- public void provide(Class<?> endpointClass)
- {
- LAST_EVENT += "provide";
- }
-
- public void setMessageStream(PrintStream messageStream)
- {
- LAST_EVENT += "setMessageStream";
- }
-}
Deleted:
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java
===================================================================
---
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java 2010-11-28
02:14:58 UTC (rev 13345)
+++
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CmdProvideTrackerFactory.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-import org.jboss.wsf.spi.tools.WSContractProviderFactory;
-import org.jboss.wsf.spi.tools.WSContractProvider;
-
-/**
- * @author Heiko.Braun(a)jboss.com
- */
-public class CmdProvideTrackerFactory implements WSContractProviderFactory
-{
-
- public WSContractProvider createProvider(ClassLoader loader)
- {
- return new CmdProvideTracker();
- }
-}
Deleted: spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java
===================================================================
---
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java 2010-11-28
02:14:58 UTC (rev 13345)
+++
spi/trunk/src/test/java/org/jboss/test/wsf/spi/tools/CommandlineTestBase.java 2010-11-28
02:20:30 UTC (rev 13346)
@@ -1,112 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.test.wsf.spi.tools;
-
-import junit.framework.TestCase;
-
-import java.security.Permission;
-
-/**
- * @author Heiko.Braun(a)jboss.com
- */
-public abstract class CommandlineTestBase extends TestCase
-{
- SecurityManager systemDefault = System.getSecurityManager();
- SecurityManager interceptor = new InterceptedSecurity();
-
- protected void swapSecurityManager()
- {
- if(System.getSecurityManager() instanceof InterceptedSecurity)
- System.setSecurityManager(systemDefault);
- else
- System.setSecurityManager(interceptor);
- }
-
- class InterceptedSecurity extends SecurityManager
- {
- private final SecurityManager parent = systemDefault;
-
- public void checkPermission(Permission perm)
- {
- if (parent != null)
- {
- parent.checkPermission(perm);
- }
- }
-
- public void checkExit(int status)
- {
- String msg = (status == 0) ? "Delegate did exit without errors" :
"Delegate did exit with an error";
- throw new InterceptedExit(msg, status);
- }
- }
-
- static protected class InterceptedExit extends SecurityException
- {
- private int exitCode;
-
- public InterceptedExit(String s, int code)
- {
- super(s);
- this.exitCode = code;
- }
-
-
- public int getExitCode()
- {
- return exitCode;
- }
- }
-
- protected void executeCmd(String arguments, boolean expectedException) throws
Exception
- {
- swapSecurityManager();
-
- String[] args = arguments!=null ? arguments.split("\\s"): new String[0];
- try
- {
- runDelegate(args);
- if(expectedException)
- fail("Did expect exception on args: " +args);
- }
- catch (CommandlineTestBase.InterceptedExit e)
- {
- boolean positivStatus = (e.getExitCode() == 0);
- if( (expectedException && positivStatus)
- || (!expectedException && !positivStatus) )
- {
- String s = expectedException ? "Did expect an exception, but " :
"Did not expect an exception, but ";
- String s2 = positivStatus ? "status was positiv" : "status was
negativ";
- throw new Exception(s+s2);
- }
-
- }
- finally
- {
- swapSecurityManager();
- }
- }
-
- // the actual tools execution
- abstract void runDelegate(String[] args) throws Exception;
-
-}