Author: richard.opalka(a)jboss.com
Date: 2008-04-24 06:01:13 -0400 (Thu, 24 Apr 2008)
New Revision: 6651
Removed:
common/trunk/src/main/java/org/jboss/wsf/test/TCK14ToJunitReportConverter.java
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
common/trunk/src/main/java/org/jboss/wsf/test/TestDeployerJBoss.java
Log:
Remove TCK staff + fix compiler warnings
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java
===================================================================
---
common/trunk/src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java 2008-04-24
09:46:43 UTC (rev 6650)
+++
common/trunk/src/main/java/org/jboss/wsf/common/management/AbstractServerConfig.java 2008-04-24
10:01:13 UTC (rev 6651)
@@ -180,6 +180,7 @@
getMbeanServer().unregisterMBean(AbstractServerConfigMBean.OBJECT_NAME);
}
+ @SuppressWarnings("unchecked")
private int getConnectorPort(final String protocol, final boolean secure)
{
int port = -1;
Modified: common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java 2008-04-24 09:46:43 UTC
(rev 6650)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java 2008-04-24 10:01:13 UTC
(rev 6651)
@@ -66,7 +66,7 @@
public MBeanServerConnection getServer() throws NamingException
{
- return delegate.getServer();
+ return JBossWSTestHelper.getServer();
}
public boolean isTargetJBoss50()
@@ -116,7 +116,7 @@
public String getServerHost()
{
- return delegate.getServerHost();
+ return JBossWSTestHelper.getServerHost();
}
public File getArchiveFile(String archive)
@@ -141,6 +141,7 @@
/** Get the client's env context for a given name.
*/
+ @SuppressWarnings("unchecked")
protected InitialContext getInitialContext(String clientName) throws NamingException
{
InitialContext iniCtx = new InitialContext();
@@ -269,9 +270,8 @@
private static void normalizeWhitespace(Element element, boolean ignoreWhitespace)
{
boolean hasChildElement = false;
- ArrayList toDetach = new ArrayList();
+ ArrayList<Node> toDetach = new ArrayList<Node>();
- String nodeName = element.getNodeName();
NodeList childNodes = element.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++)
{
@@ -292,11 +292,11 @@
// remove whitespace nodes
if (hasChildElement || ignoreWhitespace)
{
- Iterator it = toDetach.iterator();
+ Iterator<Node> it = toDetach.iterator();
while (it.hasNext())
{
- Node node = (Node)it.next();
- element.removeChild(node);
+ Node whiteSpaceNode = it.next();
+ element.removeChild(whiteSpaceNode);
}
}
}
Modified: common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2008-04-24
09:46:43 UTC (rev 6650)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2008-04-24
10:01:13 UTC (rev 6651)
@@ -153,10 +153,10 @@
*/
public static String getServerHost()
{
- String hostName = System.getProperty(SYSPROP_JBOSS_BIND_ADDRESS,
"localhost");
- return hostName;
+ return System.getProperty(SYSPROP_JBOSS_BIND_ADDRESS, "localhost");
}
+ @SuppressWarnings("unchecked")
public static MBeanServerConnection getServer()
{
if (server == null)
Modified: common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java 2008-04-24
09:46:43 UTC (rev 6650)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java 2008-04-24
10:01:13 UTC (rev 6651)
@@ -52,7 +52,7 @@
private JBossWSTestHelper delegate = new JBossWSTestHelper();
private String[] archives = new String[0];
- public JBossWSTestSetup(Class testClass, String archiveList)
+ public JBossWSTestSetup(Class<?> testClass, String archiveList)
{
super(new TestSuite(testClass));
getArchiveArray(archiveList);
@@ -107,7 +107,7 @@
String integrationTarget = delegate.getIntegrationTarget();
log.debug("Integration target: " + integrationTarget);
- List clientJars = new ArrayList();
+ List<URL> clientJars = new ArrayList<URL>();
for (int i = 0; i < archives.length; i++)
{
String archive = archives[i];
@@ -128,14 +128,14 @@
}
}
- // add the client jars to the classloader
+ // add client jars to the class loader
if (!clientJars.isEmpty())
{
ClassLoader parent = Thread.currentThread().getContextClassLoader();
URL[] urls = new URL[clientJars.size()];
for (int i = 0; i < clientJars.size(); i++)
{
- urls[i] = (URL)clientJars.get(i);
+ urls[i] = clientJars.get(i);
}
URLClassLoader cl = new URLClassLoader(urls, parent);
Thread.currentThread().setContextClassLoader(cl);
@@ -153,6 +153,6 @@
public MBeanServerConnection getServer() throws NamingException
{
- return delegate.getServer();
+ return JBossWSTestHelper.getServer();
}
}
Deleted: common/trunk/src/main/java/org/jboss/wsf/test/TCK14ToJunitReportConverter.java
===================================================================
---
common/trunk/src/main/java/org/jboss/wsf/test/TCK14ToJunitReportConverter.java 2008-04-24
09:46:43 UTC (rev 6650)
+++
common/trunk/src/main/java/org/jboss/wsf/test/TCK14ToJunitReportConverter.java 2008-04-24
10:01:13 UTC (rev 6651)
@@ -1,187 +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.wsf.test;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-
-/**
- * TCK Report to JUnit Report Converter Utility
- *
- * @author richard.opalka(a)jboss.com
- *
- * @since Jan 23, 2008
- */
-public final class TCK14ToJunitReportConverter
-{
-
- private static final FileFilter filter = new TCKReportFileFilter();
- private static File junitReportDir = null;
-
- private static final class TCKReportFileFilter implements FileFilter
- {
- public boolean accept(File f)
- {
- return f.isDirectory() ? true : f.getName().endsWith(".jtr");
- }
- }
-
- public static void main(String[] args) throws IOException
- {
- if (args.length != 2)
- {
- throw new IllegalArgumentException();
- }
-
- File tckReportDir = new File(args[0]);
- junitReportDir = new File(args[1]);
- if (!tckReportDir.exists() && !tckReportDir.isDirectory())
- {
- throw new IllegalArgumentException("TCK report directory '" +
tckReportDir.getAbsolutePath() + "' doesn't exist or is not
directory");
- }
- if (!junitReportDir.mkdir() || (!junitReportDir.exists() &&
!junitReportDir.isDirectory()))
- {
- throw new IllegalArgumentException("JUnit report Directory '" +
junitReportDir.getAbsolutePath() + "' doesn't exist or is not
directory");
- }
-
- File[] files = tckReportDir.listFiles(filter);
- for (File f : files)
- {
- if (f.isDirectory())
- {
- convertDirectory("", f);
- }
- else
- {
- convertFile("", f);
- }
- }
- }
-
- private static void convertDirectory(String pckg, File dir) throws IOException
- {
- File[] files = dir.listFiles(filter);
- for (File f : files)
- {
- if (f.isDirectory())
- {
- convertDirectory((pckg.length() == 0 ? "" : (pckg + "/"))
+ f.getName(), f);
- }
- else
- {
- convertFile(pckg, f);
- }
- }
- }
-
- /**
- * Converts TCK log to Junit report file
- * @param pckg package of the test
- * @param f TCK report file
- * @throws IOException if some I/O problem occurs
- */
- private static void convertFile(String pckg, File f) throws IOException
- {
- BufferedReader reader = new BufferedReader(new FileReader(f));
- StringBuilder sb = new StringBuilder();
- boolean testPassed = false;
- try
- {
- String line = reader.readLine();
- while (line != null)
- {
- if ((line.trim().length() > 0) && testPassed)
- {
- // TCK test passed if and only if the last line in log is 'test
result: Passed'
- testPassed = false;
- }
- sb.append(line);
- sb.append("\n");
- if (line.indexOf("test result: Passed") != -1)
- {
- testPassed = true;
- }
- line = reader.readLine();
- }
- }
- finally
- {
- reader.close();
- }
- createJunitReport(sb.toString(), testPassed, pckg, f);
- }
-
- /**
- * Flushes Junit report to the file system
- * @param consoleOutput TCK log
- * @param passed indicates whether TCK test passed
- * @param pckg test package
- * @param file TCK log file
- * @throws IOException if some I/O problem occurs
- */
- private static void createJunitReport(String consoleOutput, boolean passed, String
pckg, File file) throws IOException
- {
- String fileName = file.getName().substring(0, file.getName().length() - 4);
- StringBuilder sb = new StringBuilder();
- String nl = "\n";
- sb.append("<?xml version='1.0' encoding='UTF-8'?>"
+ nl);
- sb.append("<testsuite errors='0' failures='" + (passed ? 0
: 1) + "' name='" + pckg.replace('/', '.') +
"." + fileName + "' tests='1' time='1'>" +
nl);
- sb.append(" <properties/>" + nl);
- sb.append(" <testcase classname='" + pckg.replace('/',
'.') + "' name='" + fileName + "'
time='1'/>" + nl);
- sb.append(" <system-out><![CDATA[" +
replace("]]>", "] ]>", consoleOutput) +
"]]></system-out>" + nl);
- sb.append(" <system-err><![CDATA[]]></system-err>" +
nl);
- sb.append("</testsuite>" + nl);
- File junitReportFile = new File(junitReportDir, "TEST-" +
pckg.replace('/', '.') + "." + fileName + ".xml");
- System.out.println("Creating JUnit report file: " +
junitReportFile.getAbsolutePath());
- FileOutputStream os = null;
- try
- {
- os = new FileOutputStream(junitReportFile);
- os.write(sb.toString().getBytes());
- }
- finally
- {
- if (os != null) os.close();
- }
- }
-
- private static String replace(String oldString, String newString, String data)
- {
- int fromIndex = 0;
- int index = 0;
- StringBuilder result = new StringBuilder();
-
- while ((index = data.indexOf(oldString, fromIndex)) >= 0)
- {
- result.append(data.substring(fromIndex, index));
- result.append(newString);
- fromIndex = index + oldString.length();
- }
- result.append(data.substring(fromIndex));
- return result.toString();
- }
-
-}
Modified: common/trunk/src/main/java/org/jboss/wsf/test/TestDeployerJBoss.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/TestDeployerJBoss.java 2008-04-24
09:46:43 UTC (rev 6650)
+++ common/trunk/src/main/java/org/jboss/wsf/test/TestDeployerJBoss.java 2008-04-24
10:01:13 UTC (rev 6651)
@@ -21,17 +21,12 @@
*/
package org.jboss.wsf.test;
-import java.io.IOException;
import java.io.Serializable;
import java.net.URL;
import java.security.Principal;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
import javax.management.MBeanServerConnection;
-import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
-import javax.management.ReflectionException;
import org.jboss.wsf.spi.invocation.SecurityAdaptor;
import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
@@ -104,6 +99,7 @@
}
}
+ @SuppressWarnings("serial")
public static class SimplePrincipal implements Principal, Serializable
{
private String name;