Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 94484 invoked from network); 15 Sep 2006 02:15:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Sep 2006 02:15:46 -0000 Received: (qmail 15774 invoked by uid 500); 15 Sep 2006 02:15:46 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 15669 invoked by uid 500); 15 Sep 2006 02:15:46 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 15658 invoked by uid 99); 15 Sep 2006 02:15:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2006 19:15:45 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2006 19:15:39 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 434B21A981A; Thu, 14 Sep 2006 19:15:13 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r446462 [1/4] - in /incubator/harmony/enhanced/classlib/trunk/support: .settings/ META-INF/ src/test/java/tests/resources/ src/test/java/tests/resources/manifest/ src/test/java/tests/resources/subfolder/tests/resources/ src/test/java/tests/... Date: Fri, 15 Sep 2006 02:15:12 -0000 To: harmony-commits@incubator.apache.org From: ndbeyer@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20060915021513.434B21A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ndbeyer Date: Thu Sep 14 19:15:10 2006 New Revision: 446462 URL: http://svn.apache.org/viewvc?view=rev&rev=446462 Log: Set eol-style = native for support files. Modified: incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.core.prefs (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.ui.prefs (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.pde.core.prefs (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/META-INF/MANIFEST.MF (props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_PropertiesTest.properties (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_checkInput.txt (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_htmltest.html (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_resource.properties (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/manifest/hyts_MANIFEST.MF (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/subfolder/tests/resources/hyts_resource.properties (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/config/excludes.xsd (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/config/jcltest-excludes.xml (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/config/localhosttest.ini (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/config/testing.policy (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/hyts_Foo.c (props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/net.resources/FTP/jcltest/nettest.txt (props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/net.resources/HTTP/cgi-bin/test.pl (props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/net.resources/HTTP/html/testres231/RESOURCE.TXT (props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/net.resources/HTTP/html/testres231/URLConnectionTest/Harmony.html (contents, props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/net.resources/HTTP/html/testres231/subdir1/RESOURCE.TXT (props changed) incubator/harmony/enhanced/classlib/trunk/support/src/test/resources/net.resources/README.txt (contents, props changed) Modified: incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.core.prefs URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.core.prefs?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.core.prefs (original) +++ incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.core.prefs Thu Sep 14 19:15:10 2006 @@ -1,12 +1,12 @@ -#Wed May 03 13:10:22 BST 2006 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 +#Wed May 03 13:10:22 BST 2006 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 Propchange: incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.core.prefs ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.ui.prefs URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.ui.prefs?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.ui.prefs (original) +++ incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.ui.prefs Thu Sep 14 19:15:10 2006 @@ -1,3 +1,3 @@ -#Wed May 03 13:10:00 BST 2006 -eclipse.preferences.version=1 -internal.default.compliance=user +#Wed May 03 13:10:00 BST 2006 +eclipse.preferences.version=1 +internal.default.compliance=user Propchange: incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.jdt.ui.prefs ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.pde.core.prefs URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.pde.core.prefs?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.pde.core.prefs (original) +++ incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.pde.core.prefs Thu Sep 14 19:15:10 2006 @@ -1,4 +1,4 @@ -#Fri Apr 28 11:46:41 BST 2006 -eclipse.preferences.version=1 -pluginProject.equinox=false -pluginProject.extensions=false +#Fri Apr 28 11:46:41 BST 2006 +eclipse.preferences.version=1 +pluginProject.equinox=false +pluginProject.extensions=false Propchange: incubator/harmony/enhanced/classlib/trunk/support/.settings/org.eclipse.pde.core.prefs ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/harmony/enhanced/classlib/trunk/support/META-INF/MANIFEST.MF ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_PropertiesTest.properties URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_PropertiesTest.properties?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_PropertiesTest.properties (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_PropertiesTest.properties Thu Sep 14 19:15:10 2006 @@ -1,29 +1,29 @@ - - - - - \ \r \n \t \f - - -! dshfjklahfjkldashgjl;as - #jdfagdfjagkdjfghksdajfd - -!!properties - -a=a -b bb as,dn -c\r\ \t\nu =:: cu -bu= b\ - u -d=d\r\ne=e -f :f\ -f\ - f -g g -h\u0020h -\ i=i -j=\ j -space=\ c - -dblbackslash=\\ + + + + + \ \r \n \t \f + + +! dshfjklahfjkldashgjl;as + #jdfagdfjagkdjfghksdajfd + +!!properties + +a=a +b bb as,dn +c\r\ \t\nu =:: cu +bu= b\ + u +d=d\r\ne=e +f :f\ +f\ + f +g g +h\u0020h +\ i=i +j=\ j +space=\ c + +dblbackslash=\\ Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_PropertiesTest.properties ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_checkInput.txt URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_checkInput.txt?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_checkInput.txt (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_checkInput.txt Thu Sep 14 19:15:10 2006 @@ -1,4 +1,4 @@ - crc.reset(); - crc.update(1); - //System.out.print("value of crc"+crc.getValue()); + crc.reset(); + crc.update(1); + //System.out.print("value of crc"+crc.getValue()); Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_checkInput.txt ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_htmltest.html URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_htmltest.html?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_htmltest.html (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_htmltest.html Thu Sep 14 19:15:10 2006 @@ -1,38 +1,38 @@ - -Test HTML Document - -

Test HTML Document

-This file is used by the Test_java_net_URL.test_getContent(). -

-It contains the string A Seemingly Non Important String. Which is -looked for in the testcase.

-

    -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
  • A Line of text
  • -
-

-A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph.

- -The End. - + +Test HTML Document + +

Test HTML Document

+This file is used by the Test_java_net_URL.test_getContent(). +

+It contains the string A Seemingly Non Important String. Which is +looked for in the testcase.

+

    +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
  • A Line of text
  • +
+

+A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph. A bunch of text representing part of a paragraph.

+ +The End. + Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_htmltest.html ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_resource.properties URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_resource.properties?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_resource.properties (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_resource.properties Thu Sep 14 19:15:10 2006 @@ -1,2 +1,2 @@ -property=parent +property=parent Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/hyts_resource.properties ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/manifest/hyts_MANIFEST.MF URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/manifest/hyts_MANIFEST.MF?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/manifest/hyts_MANIFEST.MF (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/manifest/hyts_MANIFEST.MF Thu Sep 14 19:15:10 2006 @@ -1,26 +1,26 @@ -Manifest-Version: 1.0 -Bundle-Name: ClientSupport -Bundle-Description: Provides SessionService, AuthenticationService. Extends RegistryService. -Bundle-Activator: com.ibm.ive.eccomm.client.support.ClientSupportActivator -Import-Package: com.ibm.ive.eccomm.client.services.log, - com.ibm.ive.eccomm.client.services.registry, - com.ibm.ive.eccomm.service.registry; specification-version=1.0.0, - com.ibm.ive.eccomm.service.session; specification-version=1.0.0, - com.ibm.ive.eccomm.service.framework; specification-version=1.2.0, - org.osgi.framework; specification-version=1.0.0, - org.osgi.service.log; specification-version=1.0.0, - com.ibm.ive.eccomm.flash; specification-version=1.2.0, - com.ibm.ive.eccomm.client.xml, - com.ibm.ive.eccomm.client.http.common, - com.ibm.ive.eccomm.client.http.client -Import-Service: org.osgi.service.log.LogReaderService - org.osgi.service.log.LogService, - com.ibm.ive.eccomm.service.registry.RegistryService -Export-Package: com.ibm.ive.eccomm.client.services.authentication; specification-version=1.0.0, - com.ibm.ive.eccomm.service.authentication; specification-version=1.0.0, - com.ibm.ive.eccomm.common; specification-version=1.0.0, - com.ibm.ive.eccomm.client.services.registry.store; specification-version=1.0.0 -Export-Service: com.ibm.ive.eccomm.service.authentication.AuthenticationService, - com.ibm.ive.eccomm.service.session.SessionService -Bundle-Vendor: IBM -Bundle-Version: 1.2.0 +Manifest-Version: 1.0 +Bundle-Name: ClientSupport +Bundle-Description: Provides SessionService, AuthenticationService. Extends RegistryService. +Bundle-Activator: com.ibm.ive.eccomm.client.support.ClientSupportActivator +Import-Package: com.ibm.ive.eccomm.client.services.log, + com.ibm.ive.eccomm.client.services.registry, + com.ibm.ive.eccomm.service.registry; specification-version=1.0.0, + com.ibm.ive.eccomm.service.session; specification-version=1.0.0, + com.ibm.ive.eccomm.service.framework; specification-version=1.2.0, + org.osgi.framework; specification-version=1.0.0, + org.osgi.service.log; specification-version=1.0.0, + com.ibm.ive.eccomm.flash; specification-version=1.2.0, + com.ibm.ive.eccomm.client.xml, + com.ibm.ive.eccomm.client.http.common, + com.ibm.ive.eccomm.client.http.client +Import-Service: org.osgi.service.log.LogReaderService + org.osgi.service.log.LogService, + com.ibm.ive.eccomm.service.registry.RegistryService +Export-Package: com.ibm.ive.eccomm.client.services.authentication; specification-version=1.0.0, + com.ibm.ive.eccomm.service.authentication; specification-version=1.0.0, + com.ibm.ive.eccomm.common; specification-version=1.0.0, + com.ibm.ive.eccomm.client.services.registry.store; specification-version=1.0.0 +Export-Service: com.ibm.ive.eccomm.service.authentication.AuthenticationService, + com.ibm.ive.eccomm.service.session.SessionService +Bundle-Vendor: IBM +Bundle-Version: 1.2.0 Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/manifest/hyts_MANIFEST.MF ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/subfolder/tests/resources/hyts_resource.properties URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/subfolder/tests/resources/hyts_resource.properties?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/subfolder/tests/resources/hyts_resource.properties (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/subfolder/tests/resources/hyts_resource.properties Thu Sep 14 19:15:10 2006 @@ -1,2 +1,2 @@ -property=resource +property=resource Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/resources/subfolder/tests/resources/hyts_resource.properties ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java Thu Sep 14 19:15:10 2006 @@ -1,151 +1,151 @@ -/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package tests.support.resource; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; - -import tests.support.Support_Configuration; - -public class Support_Resources { - - public static final String RESOURCE_PACKAGE = "/tests/resources/"; - - public static final String RESOURCE_PACKAGE_NAME = "tests.resources"; - - public static InputStream getStream(String name) { - return Support_Resources.class.getResourceAsStream(RESOURCE_PACKAGE - + name); - } - - public static String getURL(String name) { - String folder = null; - String fileName = name; - File resources = createTempFolder(); - int index = name.lastIndexOf("/"); - if (index != -1) { - folder = name.substring(0, index); - name = name.substring(index + 1); - } - copyFile(resources, folder, name); - URL url = null; - String resPath = resources.toString(); - if (resPath.charAt(0) == '/' || resPath.charAt(0) == '\\') - resPath = resPath.substring(1); - try { - url = new URL("file:/" + resPath + "/" + fileName); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return url.toString(); - } - - public static File createTempFolder() { - - File folder = null; - try { - folder = File.createTempFile("hyts_resources", "", null); - folder.delete(); - folder.mkdirs(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - folder.deleteOnExit(); - return folder; - } - - public static void copyFile(File root, String folder, String file) { - File f; - if (folder != null) { - f = new File(root.toString() + "/" + folder); - if (!f.exists()) { - f.mkdirs(); - f.deleteOnExit(); - } - } else - f = root; - - File dest = new File(f.toString() + "/" + file); - - InputStream in = Support_Resources.getStream(folder == null ? file - : folder + "/" + file); - try { - copyLocalFileto(dest, in); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public static File createTempFile(String suffix) throws IOException { - return File.createTempFile("hyts_", suffix, null); - } - - public static void copyLocalFileto(File dest, InputStream in) - throws FileNotFoundException, IOException { - if (!dest.exists()) { - FileOutputStream out = new FileOutputStream(dest); - int result; - byte[] buf = new byte[4096]; - while ((result = in.read(buf)) != -1) - out.write(buf, 0, result); - in.close(); - out.close(); - dest.deleteOnExit(); - } - } - - public static File getExternalLocalFile(String url) throws IOException, - MalformedURLException { - File resources = createTempFolder(); - InputStream in = new URL(url).openStream(); - File temp = new File(resources.toString() + "/local.tmp"); - copyLocalFileto(temp, in); - return temp; - } - - public static String getResourceURL(String resource) { - return "http://" + Support_Configuration.TestResources + resource; - } - - /** - * Util method to load resource files - * - * @param name - name of resource file - * @return - resource input stream - */ - public static InputStream getResourceStream(String name) { - - InputStream is = ClassLoader.getSystemClassLoader() - .getResourceAsStream(name); - - if (is == null) { - throw new RuntimeException("Failed to load resource: " + name); - } - - return is; - } -} +/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.support.resource; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; + +import tests.support.Support_Configuration; + +public class Support_Resources { + + public static final String RESOURCE_PACKAGE = "/tests/resources/"; + + public static final String RESOURCE_PACKAGE_NAME = "tests.resources"; + + public static InputStream getStream(String name) { + return Support_Resources.class.getResourceAsStream(RESOURCE_PACKAGE + + name); + } + + public static String getURL(String name) { + String folder = null; + String fileName = name; + File resources = createTempFolder(); + int index = name.lastIndexOf("/"); + if (index != -1) { + folder = name.substring(0, index); + name = name.substring(index + 1); + } + copyFile(resources, folder, name); + URL url = null; + String resPath = resources.toString(); + if (resPath.charAt(0) == '/' || resPath.charAt(0) == '\\') + resPath = resPath.substring(1); + try { + url = new URL("file:/" + resPath + "/" + fileName); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return url.toString(); + } + + public static File createTempFolder() { + + File folder = null; + try { + folder = File.createTempFile("hyts_resources", "", null); + folder.delete(); + folder.mkdirs(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + folder.deleteOnExit(); + return folder; + } + + public static void copyFile(File root, String folder, String file) { + File f; + if (folder != null) { + f = new File(root.toString() + "/" + folder); + if (!f.exists()) { + f.mkdirs(); + f.deleteOnExit(); + } + } else + f = root; + + File dest = new File(f.toString() + "/" + file); + + InputStream in = Support_Resources.getStream(folder == null ? file + : folder + "/" + file); + try { + copyLocalFileto(dest, in); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static File createTempFile(String suffix) throws IOException { + return File.createTempFile("hyts_", suffix, null); + } + + public static void copyLocalFileto(File dest, InputStream in) + throws FileNotFoundException, IOException { + if (!dest.exists()) { + FileOutputStream out = new FileOutputStream(dest); + int result; + byte[] buf = new byte[4096]; + while ((result = in.read(buf)) != -1) + out.write(buf, 0, result); + in.close(); + out.close(); + dest.deleteOnExit(); + } + } + + public static File getExternalLocalFile(String url) throws IOException, + MalformedURLException { + File resources = createTempFolder(); + InputStream in = new URL(url).openStream(); + File temp = new File(resources.toString() + "/local.tmp"); + copyLocalFileto(temp, in); + return temp; + } + + public static String getResourceURL(String resource) { + return "http://" + Support_Configuration.TestResources + resource; + } + + /** + * Util method to load resource files + * + * @param name - name of resource file + * @return - resource input stream + */ + public static InputStream getResourceStream(String name) { + + InputStream is = ClassLoader.getSystemClassLoader() + .getResourceAsStream(name); + + if (is == null) { + throw new RuntimeException("Failed to load resource: " + name); + } + + return is; + } +} Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/resource/Support_Resources.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java Thu Sep 14 19:15:10 2006 @@ -1,354 +1,354 @@ -/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package tests.util; - -import java.util.Stack; - -/** - * A stack to store the parameters of a call, as well as the call stack. - * - */ -public class CallVerificationStack extends Stack { - - /* - * -------------------------------------------------------------------- - * Class variables - * -------------------------------------------------------------------- - */ - - private static final long serialVersionUID = 1L; - - // the singleton - private static CallVerificationStack _instance = new CallVerificationStack(); - - /* - * -------------------------------------------------------------------- - * Instance variables - * -------------------------------------------------------------------- - */ - - // the call stack, store StackTraceElement - private Stack callStack = new Stack(); - - /* - * ------------------------------------------------------------------- - * Constructors - * ------------------------------------------------------------------- - */ - - /** - * Can't be instantiated. - */ - private CallVerificationStack() { - // empty - } - - /* - * ------------------------------------------------------------------- - * Methods - * ------------------------------------------------------------------- - */ - - /** - * Gets the singleton instance. - * - * @return the singleton instance - */ - public static CallVerificationStack getInstance() { - return _instance; - } - - /** - * Pushes the call stack. - */ - private void pushCallStack() { - StackTraceElement[] eles = (new Throwable()).getStackTrace(); - int i; - for (i = 1; i < eles.length; i++) { - if (!eles[i].getClassName().equals(this.getClass().getName())) { - break; - } - } - this.callStack.push(eles[i]); - } - - /** - * Gets the "current" calling class name. - * - * @return the "current" calling class name - */ - public String getCurrentSourceClass() { - return ((StackTraceElement) this.callStack.peek()).getClassName(); - } - - /** - * Gets the "current" calling method name. - * - * @return the "current" calling method name - */ - public String getCurrentSourceMethod() { - return ((StackTraceElement) this.callStack.peek()).getMethodName(); - } - - /** - * Clear the parameter stack and the call stack. - * - */ - public void clear() { - this.callStack.clear(); - super.clear(); - } - - /** - * Pushes an object onto the top of this stack. - * - * @param o - * the object to push - */ - public Object push(Object o) { - pushCallStack(); - return super.push(o); - } - - /** - * Pushes a boolean onto the top of this stack. - * - * @param val - * the value to push - */ - public void push(boolean val) { - this.push(new BaseTypeWrapper(val)); - } - - /** - * Pushes a char onto the top of this stack. - * - * @param val - * the value to push - */ - public void push(char val) { - this.push(new BaseTypeWrapper(val)); - } - - /** - * Pushes a double onto the top of this stack. - * - * @param val - * the value to push - */ - public void push(double val) { - this.push(new BaseTypeWrapper(val)); - } - - /** - * Pushes a float onto the top of this stack. - * - * @param val - * the value to push - */ - public void push(float val) { - this.push(new BaseTypeWrapper(val)); - } - - /** - * Pushes an int onto the top of this stack. - * - * @param val - * the value to push - */ - public void push(int val) { - this.push(new BaseTypeWrapper(val)); - } - - /** - * Pushes a long onto the top of this stack. - * - * @param val - * the value to push - */ - public void push(long val) { - this.push(new BaseTypeWrapper(val)); - } - - /** - * Pushes a short onto the top of this stack. - * - * @param val - * the value to push - */ - public void push(short val) { - this.push(new BaseTypeWrapper(val)); - } - - /** - * Pop an object. - * - * @return the object - */ - public Object pop() { - this.callStack.pop(); - return super.pop(); - } - - /** - * Pop a boolean. - * - * @return the value - */ - public boolean popBoolean() { - BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); - Boolean value = (Boolean) wrapper.getValue(); - return value.booleanValue(); - } - - /** - * Pop a char. - * - * @return the value - */ - public char popChar() { - BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); - Character value = (Character) wrapper.getValue(); - return value.charValue(); - } - - /** - * Pop a double. - * - * @return the value - */ - public double popDouble() { - BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); - Double value = (Double) wrapper.getValue(); - return value.doubleValue(); - } - - /** - * Pop a float. - * - * @return the value - */ - public float popFloat() { - BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); - Float value = (Float) wrapper.getValue(); - return value.floatValue(); - } - - /** - * Pop a int. - * - * @return the value - */ - public int popInt() { - BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); - Integer value = (Integer) wrapper.getValue(); - return value.intValue(); - } - - /** - * Pop a long. - * - * @return the value - */ - public long popLong() { - BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); - Long value = (Long) wrapper.getValue(); - return value.longValue(); - } - - /** - * Pop a short. - * - * @return the value - */ - public short popShort() { - BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); - Short value = (Short) wrapper.getValue(); - return value.shortValue(); - } - - /* - * Wrapper of base types. - */ - class BaseTypeWrapper { - - // the internal value - private Object value; - - /* - * Constructs a wrapper object for the base type boolean . - */ - public BaseTypeWrapper(boolean val) { - this.value = new Boolean(val); - } - - /* - * Constructs a wrapper object for the base type c . - */ - public BaseTypeWrapper(byte val) { - this.value = new Byte(val); - } - - /* - * Constructs a wrapper object for the base type char . - */ - public BaseTypeWrapper(char val) { - this.value = new Character(val); - } - - /* - * Constructs a wrapper object for the base type double . - */ - public BaseTypeWrapper(double val) { - this.value = new Double(val); - } - - /* - * Constructs a wrapper object for the base type float . - */ - public BaseTypeWrapper(float val) { - this.value = new Float(val); - } - - /* - * Constructs a wrapper object for the base type int . - */ - public BaseTypeWrapper(int val) { - this.value = new Integer(val); - } - - /* - * Constructs a wrapper object for the base type long . - */ - public BaseTypeWrapper(long val) { - this.value = new Long(val); - } - - /* - * Constructs a wrapper object for the base type short . - */ - public BaseTypeWrapper(short val) { - this.value = new Short(val); - } - - /* - * Gets the internal value. - */ - public Object getValue() { - return this.value; - } - } -} +/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.util; + +import java.util.Stack; + +/** + * A stack to store the parameters of a call, as well as the call stack. + * + */ +public class CallVerificationStack extends Stack { + + /* + * -------------------------------------------------------------------- + * Class variables + * -------------------------------------------------------------------- + */ + + private static final long serialVersionUID = 1L; + + // the singleton + private static CallVerificationStack _instance = new CallVerificationStack(); + + /* + * -------------------------------------------------------------------- + * Instance variables + * -------------------------------------------------------------------- + */ + + // the call stack, store StackTraceElement + private Stack callStack = new Stack(); + + /* + * ------------------------------------------------------------------- + * Constructors + * ------------------------------------------------------------------- + */ + + /** + * Can't be instantiated. + */ + private CallVerificationStack() { + // empty + } + + /* + * ------------------------------------------------------------------- + * Methods + * ------------------------------------------------------------------- + */ + + /** + * Gets the singleton instance. + * + * @return the singleton instance + */ + public static CallVerificationStack getInstance() { + return _instance; + } + + /** + * Pushes the call stack. + */ + private void pushCallStack() { + StackTraceElement[] eles = (new Throwable()).getStackTrace(); + int i; + for (i = 1; i < eles.length; i++) { + if (!eles[i].getClassName().equals(this.getClass().getName())) { + break; + } + } + this.callStack.push(eles[i]); + } + + /** + * Gets the "current" calling class name. + * + * @return the "current" calling class name + */ + public String getCurrentSourceClass() { + return ((StackTraceElement) this.callStack.peek()).getClassName(); + } + + /** + * Gets the "current" calling method name. + * + * @return the "current" calling method name + */ + public String getCurrentSourceMethod() { + return ((StackTraceElement) this.callStack.peek()).getMethodName(); + } + + /** + * Clear the parameter stack and the call stack. + * + */ + public void clear() { + this.callStack.clear(); + super.clear(); + } + + /** + * Pushes an object onto the top of this stack. + * + * @param o + * the object to push + */ + public Object push(Object o) { + pushCallStack(); + return super.push(o); + } + + /** + * Pushes a boolean onto the top of this stack. + * + * @param val + * the value to push + */ + public void push(boolean val) { + this.push(new BaseTypeWrapper(val)); + } + + /** + * Pushes a char onto the top of this stack. + * + * @param val + * the value to push + */ + public void push(char val) { + this.push(new BaseTypeWrapper(val)); + } + + /** + * Pushes a double onto the top of this stack. + * + * @param val + * the value to push + */ + public void push(double val) { + this.push(new BaseTypeWrapper(val)); + } + + /** + * Pushes a float onto the top of this stack. + * + * @param val + * the value to push + */ + public void push(float val) { + this.push(new BaseTypeWrapper(val)); + } + + /** + * Pushes an int onto the top of this stack. + * + * @param val + * the value to push + */ + public void push(int val) { + this.push(new BaseTypeWrapper(val)); + } + + /** + * Pushes a long onto the top of this stack. + * + * @param val + * the value to push + */ + public void push(long val) { + this.push(new BaseTypeWrapper(val)); + } + + /** + * Pushes a short onto the top of this stack. + * + * @param val + * the value to push + */ + public void push(short val) { + this.push(new BaseTypeWrapper(val)); + } + + /** + * Pop an object. + * + * @return the object + */ + public Object pop() { + this.callStack.pop(); + return super.pop(); + } + + /** + * Pop a boolean. + * + * @return the value + */ + public boolean popBoolean() { + BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); + Boolean value = (Boolean) wrapper.getValue(); + return value.booleanValue(); + } + + /** + * Pop a char. + * + * @return the value + */ + public char popChar() { + BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); + Character value = (Character) wrapper.getValue(); + return value.charValue(); + } + + /** + * Pop a double. + * + * @return the value + */ + public double popDouble() { + BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); + Double value = (Double) wrapper.getValue(); + return value.doubleValue(); + } + + /** + * Pop a float. + * + * @return the value + */ + public float popFloat() { + BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); + Float value = (Float) wrapper.getValue(); + return value.floatValue(); + } + + /** + * Pop a int. + * + * @return the value + */ + public int popInt() { + BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); + Integer value = (Integer) wrapper.getValue(); + return value.intValue(); + } + + /** + * Pop a long. + * + * @return the value + */ + public long popLong() { + BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); + Long value = (Long) wrapper.getValue(); + return value.longValue(); + } + + /** + * Pop a short. + * + * @return the value + */ + public short popShort() { + BaseTypeWrapper wrapper = (BaseTypeWrapper) this.pop(); + Short value = (Short) wrapper.getValue(); + return value.shortValue(); + } + + /* + * Wrapper of base types. + */ + class BaseTypeWrapper { + + // the internal value + private Object value; + + /* + * Constructs a wrapper object for the base type boolean . + */ + public BaseTypeWrapper(boolean val) { + this.value = new Boolean(val); + } + + /* + * Constructs a wrapper object for the base type c . + */ + public BaseTypeWrapper(byte val) { + this.value = new Byte(val); + } + + /* + * Constructs a wrapper object for the base type char . + */ + public BaseTypeWrapper(char val) { + this.value = new Character(val); + } + + /* + * Constructs a wrapper object for the base type double . + */ + public BaseTypeWrapper(double val) { + this.value = new Double(val); + } + + /* + * Constructs a wrapper object for the base type float . + */ + public BaseTypeWrapper(float val) { + this.value = new Float(val); + } + + /* + * Constructs a wrapper object for the base type int . + */ + public BaseTypeWrapper(int val) { + this.value = new Integer(val); + } + + /* + * Constructs a wrapper object for the base type long . + */ + public BaseTypeWrapper(long val) { + this.value = new Long(val); + } + + /* + * Constructs a wrapper object for the base type short . + */ + public BaseTypeWrapper(short val) { + this.value = new Short(val); + } + + /* + * Gets the internal value. + */ + public Object getValue() { + return this.value; + } + } +} Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/CallVerificationStack.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java Thu Sep 14 19:15:10 2006 @@ -1,244 +1,244 @@ -/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package tests.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.net.URL; - -/** - * This class simplifies the serialization test. - * - */ -public class SerializationTester { - - /* - * -------------------------------------------------------------------- - * Class variables - * -------------------------------------------------------------------- - */ - - // the last deserialized object - private static Object lastOutput = null; - - /* - * ------------------------------------------------------------------- - * Constructors - * ------------------------------------------------------------------- - */ - - private SerializationTester() { - - } - - /* - * ------------------------------------------------------------------- - * Methods - * ------------------------------------------------------------------- - */ - - /** - * Serialize an object and then deserialize it. - * - * @param inputObject - * the input object - * @return the deserialized object - */ - public static Object getDeserilizedObject(Object inputObject) - throws IOException, ClassNotFoundException { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(bos); - oos.writeObject(inputObject); - oos.close(); - - ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); - ObjectInputStream ois = new ObjectInputStream(bis); - Object outputObject = (Object) ois.readObject(); - lastOutput = outputObject; - ois.close(); - return outputObject; - } - - /** - * Tests the serialization and deserialization of const objects. - * - * @param inputObject - * A const object - * @return true if the deserialized object is the same as the input object, - * otherwise false - * @throws Exception - * If any occurs. - */ - public static boolean assertSame(Object inputObject) throws Exception { - return inputObject == getDeserilizedObject(inputObject); - } - - /** - * Tests the serialization and deserialization of instance objects. - * - * @param inputObject - * An object - * @return true if the deserialized object is equal to the input object, - * otherwise false - * @throws Exception - * If any occurs. - */ - public static boolean assertEquals(Object inputObject) throws Exception { - return inputObject.equals(getDeserilizedObject(inputObject)); - } - - /** - * Tests the serialization compatibility with reference const objects. - * - * @param obj - * the object to be checked - * @param fileName - * the serialization output file generated by reference - * @return true if compatible, otherwise false - * @throws Exception - * If any occurs. - */ - public static boolean assertCompabilitySame(Object obj, String fileName) - throws Exception { - return obj == readObject(obj, fileName); - } - - /** - * Tests the serialization compatibility with reference for instance - * objects. - * - * @param obj - * the object to be checked - * @param fileName - * the serialization output file generated by reference - * @return true if compatible, otherwise false - * @throws Exception - * If any occurs. - */ - public static boolean assertCompabilityEquals(Object obj, String fileName) - throws Exception { - return obj.equals(readObject(obj, fileName)); - } - - /** - * Deserialize an object from a file. - * - * @param obj - * the object to be serialized if no serialization file is found - * @param fileName - * the serialization file - * @return the deserialized object - * @throws Exception - * If any occurs. - */ - public static Object readObject(Object obj, String fileName) - throws Exception { - InputStream input = null; - ObjectInputStream oinput = null; - URL url = SerializationTester.class.getClassLoader().getResource( - fileName); - if (null == url) { - // serialization file does not exist, create one in the current dir - writeObject(obj, new File(fileName).getName()); - throw new Error( - "Serialization file does not exist, created in the current dir."); - } - input = url.openStream(); - try { - oinput = new ObjectInputStream(input); - Object newObj = oinput.readObject(); - return newObj; - } finally { - try { - if (null != oinput) { - oinput.close(); - } - } catch (Exception e) { - // ignore - } - try { - if (null != input) { - input.close(); - } - } catch (Exception e) { - // ignore - } - } - } - - /* - * Creates a serialization output. - * - * @param obj the object to be serialized @param fileName the output file - * @throws Exception If any occurs. - */ - public static void writeObject(Object obj, String fileName) - throws Exception { - // String path = SerializationTester.class.getResource(".").getPath(); - // if (path.endsWith(".")) { - // path = path.substring(0, path.length() - 1); - // } - // if (!path.endsWith("/")) { - // path += "/"; - // } - // path += fileName; - // System.out.println(path); - OutputStream output = null; - ObjectOutputStream ooutput = null; - try { - output = new FileOutputStream(fileName); - ooutput = new ObjectOutputStream(output); - ooutput.writeObject(obj); - } finally { - try { - if (null != ooutput) { - ooutput.close(); - } - } catch (Exception e) { - // ignore - } - try { - if (null != output) { - output.close(); - } - } catch (Exception e) { - // ignore - } - } - } - - /** - * Gets the last deserialized object. - * - * @return the last deserialized object - */ - public static Object getLastOutput() { - return lastOutput; - } - - /* - * For test purpose. - */ - public static void main(String[] args) { - } -} +/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.net.URL; + +/** + * This class simplifies the serialization test. + * + */ +public class SerializationTester { + + /* + * -------------------------------------------------------------------- + * Class variables + * -------------------------------------------------------------------- + */ + + // the last deserialized object + private static Object lastOutput = null; + + /* + * ------------------------------------------------------------------- + * Constructors + * ------------------------------------------------------------------- + */ + + private SerializationTester() { + + } + + /* + * ------------------------------------------------------------------- + * Methods + * ------------------------------------------------------------------- + */ + + /** + * Serialize an object and then deserialize it. + * + * @param inputObject + * the input object + * @return the deserialized object + */ + public static Object getDeserilizedObject(Object inputObject) + throws IOException, ClassNotFoundException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(inputObject); + oos.close(); + + ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + ObjectInputStream ois = new ObjectInputStream(bis); + Object outputObject = (Object) ois.readObject(); + lastOutput = outputObject; + ois.close(); + return outputObject; + } + + /** + * Tests the serialization and deserialization of const objects. + * + * @param inputObject + * A const object + * @return true if the deserialized object is the same as the input object, + * otherwise false + * @throws Exception + * If any occurs. + */ + public static boolean assertSame(Object inputObject) throws Exception { + return inputObject == getDeserilizedObject(inputObject); + } + + /** + * Tests the serialization and deserialization of instance objects. + * + * @param inputObject + * An object + * @return true if the deserialized object is equal to the input object, + * otherwise false + * @throws Exception + * If any occurs. + */ + public static boolean assertEquals(Object inputObject) throws Exception { + return inputObject.equals(getDeserilizedObject(inputObject)); + } + + /** + * Tests the serialization compatibility with reference const objects. + * + * @param obj + * the object to be checked + * @param fileName + * the serialization output file generated by reference + * @return true if compatible, otherwise false + * @throws Exception + * If any occurs. + */ + public static boolean assertCompabilitySame(Object obj, String fileName) + throws Exception { + return obj == readObject(obj, fileName); + } + + /** + * Tests the serialization compatibility with reference for instance + * objects. + * + * @param obj + * the object to be checked + * @param fileName + * the serialization output file generated by reference + * @return true if compatible, otherwise false + * @throws Exception + * If any occurs. + */ + public static boolean assertCompabilityEquals(Object obj, String fileName) + throws Exception { + return obj.equals(readObject(obj, fileName)); + } + + /** + * Deserialize an object from a file. + * + * @param obj + * the object to be serialized if no serialization file is found + * @param fileName + * the serialization file + * @return the deserialized object + * @throws Exception + * If any occurs. + */ + public static Object readObject(Object obj, String fileName) + throws Exception { + InputStream input = null; + ObjectInputStream oinput = null; + URL url = SerializationTester.class.getClassLoader().getResource( + fileName); + if (null == url) { + // serialization file does not exist, create one in the current dir + writeObject(obj, new File(fileName).getName()); + throw new Error( + "Serialization file does not exist, created in the current dir."); + } + input = url.openStream(); + try { + oinput = new ObjectInputStream(input); + Object newObj = oinput.readObject(); + return newObj; + } finally { + try { + if (null != oinput) { + oinput.close(); + } + } catch (Exception e) { + // ignore + } + try { + if (null != input) { + input.close(); + } + } catch (Exception e) { + // ignore + } + } + } + + /* + * Creates a serialization output. + * + * @param obj the object to be serialized @param fileName the output file + * @throws Exception If any occurs. + */ + public static void writeObject(Object obj, String fileName) + throws Exception { + // String path = SerializationTester.class.getResource(".").getPath(); + // if (path.endsWith(".")) { + // path = path.substring(0, path.length() - 1); + // } + // if (!path.endsWith("/")) { + // path += "/"; + // } + // path += fileName; + // System.out.println(path); + OutputStream output = null; + ObjectOutputStream ooutput = null; + try { + output = new FileOutputStream(fileName); + ooutput = new ObjectOutputStream(output); + ooutput.writeObject(obj); + } finally { + try { + if (null != ooutput) { + ooutput.close(); + } + } catch (Exception e) { + // ignore + } + try { + if (null != output) { + output.close(); + } + } catch (Exception e) { + // ignore + } + } + } + + /** + * Gets the last deserialized object. + * + * @return the last deserialized object + */ + public static Object getLastOutput() { + return lastOutput; + } + + /* + * For test purpose. + */ + public static void main(String[] args) { + } +} Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SerializationTester.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java?view=diff&rev=446462&r1=446461&r2=446462 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java (original) +++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java Thu Sep 14 19:15:10 2006 @@ -1,320 +1,320 @@ -/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package tests.util; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.TransformerException; - -import junit.extensions.TestDecorator; -import junit.extensions.TestSetup; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestResult; -import junit.framework.TestSuite; - -import org.apache.xpath.XPathAPI; -import org.apache.xpath.objects.XObject; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Decorator for JUnit test suites that we want to run with certain test cases - * excluded. The exclusions are captured in a separate XML file. - */ -public class SomeTests extends TestSetup { - - private static final String EXCLUDES_SCHEMA_URI_PROP = "excludes.schema.uri"; - - private static final String EXCLUDES_FILE_URI_PROP = "excludes.file.uri"; - - private static final String JAXP_SCHEMA_SOURCE_ATTR_NAME = "http://java.sun.com/xml/jaxp/properties/schemaSource"; - - private static final String JAXP_SCHEMA_LANGUAGE_ATTR_VAL = "http://www.w3.org/2001/XMLSchema"; - - private static final String JAXP_SCHEMA_LANGUAGE_ATTR_NAME = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; - - private static final String DOCUMENT_BUILDER_FACTORY_VAL = "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"; - - private static final String DOCUMENT_BUILDER_FACTORY_PROP = "javax.xml.parsers.DocumentBuilderFactory"; - - private Node excludesDoc; - - private List runCases = new ArrayList(); - - private String excludesListURI; - - private String excludesSchemaURI; - - int originalTestCaseCount; - - private boolean docIsValid = false; - - /** - * @param test - * @param excludesListURI - * @param excludesSchemaURI - */ - public SomeTests(Test test) { - super(test); - initExcludes(); - - // Drill down into each test case contained in the supplied Test - // and, for each one *not* excluded, add the corresponding TestCase - // to an ordered collection. The number of TestCase objects in the - // collection is the number of test cases that will be run. - seekTests(this.getTest()); - } - - /* - * (non-Javadoc) - * - * @see junit.extensions.TestDecorator#basicRun(junit.framework.TestResult) - */ - public void basicRun(TestResult result) { - // The 'basic run' of this decorator is to enumerate through all - // of the tests not excluded and run them... - Iterator allIncluded = runCases.iterator(); - while (allIncluded.hasNext()) { - TestCase test = (TestCase) allIncluded.next(); - test.run(result); - }// end while - } - - /* - * (non-Javadoc) - * - * @see junit.extensions.TestSetup#setUp() - */ - protected void setUp() throws Exception { - if (docIsValid) { - System.out.println("\nExcludes list document " + excludesListURI - + " is valid"); - } - System.out.println("\nRunning " + this.countTestCases() - + " out of a total of " + this.originalTestCaseCount - + " possible test cases\n"); - } - - protected void tearDown() throws Exception { - System.out.println("\nRan " + this.countTestCases() - + " out of a total of " + this.originalTestCaseCount - + " possible test cases\n"); - - if (excludesDoc != null) { - System.out.println("THE FOLLOWING EXCLUSIONS WERE ENFORCED:"); - NodeList allTypes = XPathAPI.selectNodeList(excludesDoc, - "/descendant::hy:type"); - for (int i = 0; i < allTypes.getLength(); i++) { - Node typeNode = allTypes.item(i); - String typeName = typeNode.getAttributes().getNamedItem("id") - .getNodeValue(); - NodeList allExcludesForType = XPathAPI.selectNodeList(typeNode, - "descendant::hy:exclude"); - for (int j = 0; j < allExcludesForType.getLength(); j++) { - Node excludeNode = allExcludesForType.item(j); - String excName = excludeNode.getAttributes().getNamedItem( - "id").getNodeValue(); - if (excName.equalsIgnoreCase("all")) { - excName = "!!!!!!!!!!ALL TESTS!!!!!!!!!!"; - } - System.out.print(typeName + "::" + excName); - Node reasonNode = XPathAPI.selectSingleNode(excludeNode, - "descendant::hy:reason"); - if (reasonNode != null) { - XObject reason = XPathAPI.eval(reasonNode, "string()"); - System.out.print(" (" + reason.str() + ")"); - } - System.out.print("\n"); - }// end for all excludes - }// end for all types - System.out.println("\n"); - } - super.tearDown(); - } - - /* - * (non-Javadoc) - * - * @see junit.framework.Test#countTestCases() - */ - public int countTestCases() { - return runCases.size(); - } - - private void seekTests(TestSuite suite) { - Enumeration allTests = suite.tests(); - while (allTests.hasMoreElements()) { - Test test = (Test) allTests.nextElement(); - seekTests(test); - }// end while - } - - private void seekTests(Test test) { - if (test instanceof TestSuite) { - seekTests((TestSuite) test); - } else if (test instanceof TestCase) { - seekTests((TestCase) test); - } else if (test instanceof TestDecorator) { - seekTests(((TestDecorator) test).getTest()); - } - } - - private void seekTests(TestCase testCase) { - // Check the testcase against the excludes structure - if (!isTestCaseExcluded(testCase)) { - // Add this testcase to the collection of tests to be run. - runCases.add(testCase); - } - } - - private boolean isTestCaseExcluded(TestCase testCase) { - this.originalTestCaseCount++; - boolean result = false; - String tcType = testCase.getClass().getName(); - String tcName = testCase.getName(); - - if (excludesDoc != null) { - try { - // Find *the first* element for the type. If there are - // more than one "type" elements for a given type then the - // first one found is what counts. - NodeList typeNodes = XPathAPI.selectNodeList(excludesDoc, - "/descendant::hy:type[@id=\"" + tcType + "\"]"); - if (typeNodes.getLength() > 0) { - Node typeNode = typeNodes.item(0); - // Look for a blanket exclusion of this test case type - NodeList excludes = XPathAPI.selectNodeList(typeNode, - "descendant::hy:exclude[@id=\"all\"]"); - if (excludes.getLength() != 0) { - result = true; - } else { - // Look for explicit exclusion - excludes = XPathAPI.selectNodeList(typeNode, - "descendant::hy:exclude[@id=\"" + tcName - + "\"]"); - if (excludes.getLength() != 0) { - result = true; - } - }// end else - }// end if named type located - } catch (TransformerException e) { - // Carry on. - result = false; - } - } - return result; - } - - /** - */ - private boolean initExcludes() { - boolean result = true; - - // Look for location of excludes list and (optionally) a schema - // location override. - readProperties(); - if (excludesListURI == null) { - System.out.println("No excludes list specified."); - result = false; - } - - if (result) { - try { - System.setProperty(DOCUMENT_BUILDER_FACTORY_PROP, - DOCUMENT_BUILDER_FACTORY_VAL); - DocumentBuilderFactory factory = DocumentBuilderFactory - .newInstance(); - factory.setNamespaceAware(true); - factory.setValidating(true); - factory.setAttribute(JAXP_SCHEMA_LANGUAGE_ATTR_NAME, - JAXP_SCHEMA_LANGUAGE_ATTR_VAL); - if (excludesSchemaURI != null) { - factory.setAttribute(JAXP_SCHEMA_SOURCE_ATTR_NAME, - excludesSchemaURI); - } - - DocumentBuilder builder = factory.newDocumentBuilder(); - DocValidator handler = new DocValidator(); - builder.setErrorHandler(handler); - excludesDoc = builder.parse(excludesListURI); - if (handler.inError == true) { - this.docIsValid = false; - System.out.println("Excludes list document " - + excludesListURI + " is invalid :" - + handler.inError + " " - + handler.spException.getMessage()); - excludesDoc = null; - result = false; - } else { - this.docIsValid = true; - } - } catch (FileNotFoundException e) { - System.out.println("File not found : " + e.getMessage()); - result = false; - } catch (ParserConfigurationException e) { - System.out.println("Serious error with XML parser : " - + e.getMessage()); - result = false; - } catch (SAXException e) { - System.out.println("Serious error occurred parsing document : " - + e.getMessage()); - result = false; - } catch (IOException e) { - System.out.println("IO error occurred : " + e.getMessage()); - result = false; - } - } - return result; - } - - /** - * - */ - private void readProperties() { - excludesListURI = System.getProperty(EXCLUDES_FILE_URI_PROP); - excludesSchemaURI = System.getProperty(EXCLUDES_SCHEMA_URI_PROP); - } - - /** - */ - class DocValidator extends DefaultHandler { - private boolean inError = false; - - private SAXParseException spException = null; - - public void error(SAXParseException exception) throws SAXException { - inError = true; - spException = exception; - } - - public void fatalError(SAXParseException exception) throws SAXException { - inError = true; - spException = exception; - } - } -} +/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tests.util; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerException; + +import junit.extensions.TestDecorator; +import junit.extensions.TestSetup; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestResult; +import junit.framework.TestSuite; + +import org.apache.xpath.XPathAPI; +import org.apache.xpath.objects.XObject; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * Decorator for JUnit test suites that we want to run with certain test cases + * excluded. The exclusions are captured in a separate XML file. + */ +public class SomeTests extends TestSetup { + + private static final String EXCLUDES_SCHEMA_URI_PROP = "excludes.schema.uri"; + + private static final String EXCLUDES_FILE_URI_PROP = "excludes.file.uri"; + + private static final String JAXP_SCHEMA_SOURCE_ATTR_NAME = "http://java.sun.com/xml/jaxp/properties/schemaSource"; + + private static final String JAXP_SCHEMA_LANGUAGE_ATTR_VAL = "http://www.w3.org/2001/XMLSchema"; + + private static final String JAXP_SCHEMA_LANGUAGE_ATTR_NAME = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; + + private static final String DOCUMENT_BUILDER_FACTORY_VAL = "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"; + + private static final String DOCUMENT_BUILDER_FACTORY_PROP = "javax.xml.parsers.DocumentBuilderFactory"; + + private Node excludesDoc; + + private List runCases = new ArrayList(); + + private String excludesListURI; + + private String excludesSchemaURI; + + int originalTestCaseCount; + + private boolean docIsValid = false; + + /** + * @param test + * @param excludesListURI + * @param excludesSchemaURI + */ + public SomeTests(Test test) { + super(test); + initExcludes(); + + // Drill down into each test case contained in the supplied Test + // and, for each one *not* excluded, add the corresponding TestCase + // to an ordered collection. The number of TestCase objects in the + // collection is the number of test cases that will be run. + seekTests(this.getTest()); + } + + /* + * (non-Javadoc) + * + * @see junit.extensions.TestDecorator#basicRun(junit.framework.TestResult) + */ + public void basicRun(TestResult result) { + // The 'basic run' of this decorator is to enumerate through all + // of the tests not excluded and run them... + Iterator allIncluded = runCases.iterator(); + while (allIncluded.hasNext()) { + TestCase test = (TestCase) allIncluded.next(); + test.run(result); + }// end while + } + + /* + * (non-Javadoc) + * + * @see junit.extensions.TestSetup#setUp() + */ + protected void setUp() throws Exception { + if (docIsValid) { + System.out.println("\nExcludes list document " + excludesListURI + + " is valid"); + } + System.out.println("\nRunning " + this.countTestCases() + + " out of a total of " + this.originalTestCaseCount + + " possible test cases\n"); + } + + protected void tearDown() throws Exception { + System.out.println("\nRan " + this.countTestCases() + + " out of a total of " + this.originalTestCaseCount + + " possible test cases\n"); + + if (excludesDoc != null) { + System.out.println("THE FOLLOWING EXCLUSIONS WERE ENFORCED:"); + NodeList allTypes = XPathAPI.selectNodeList(excludesDoc, + "/descendant::hy:type"); + for (int i = 0; i < allTypes.getLength(); i++) { + Node typeNode = allTypes.item(i); + String typeName = typeNode.getAttributes().getNamedItem("id") + .getNodeValue(); + NodeList allExcludesForType = XPathAPI.selectNodeList(typeNode, + "descendant::hy:exclude"); + for (int j = 0; j < allExcludesForType.getLength(); j++) { + Node excludeNode = allExcludesForType.item(j); + String excName = excludeNode.getAttributes().getNamedItem( + "id").getNodeValue(); + if (excName.equalsIgnoreCase("all")) { + excName = "!!!!!!!!!!ALL TESTS!!!!!!!!!!"; + } + System.out.print(typeName + "::" + excName); + Node reasonNode = XPathAPI.selectSingleNode(excludeNode, + "descendant::hy:reason"); + if (reasonNode != null) { + XObject reason = XPathAPI.eval(reasonNode, "string()"); + System.out.print(" (" + reason.str() + ")"); + } + System.out.print("\n"); + }// end for all excludes + }// end for all types + System.out.println("\n"); + } + super.tearDown(); + } + + /* + * (non-Javadoc) + * + * @see junit.framework.Test#countTestCases() + */ + public int countTestCases() { + return runCases.size(); + } + + private void seekTests(TestSuite suite) { + Enumeration allTests = suite.tests(); + while (allTests.hasMoreElements()) { + Test test = (Test) allTests.nextElement(); + seekTests(test); + }// end while + } + + private void seekTests(Test test) { + if (test instanceof TestSuite) { + seekTests((TestSuite) test); + } else if (test instanceof TestCase) { + seekTests((TestCase) test); + } else if (test instanceof TestDecorator) { + seekTests(((TestDecorator) test).getTest()); + } + } + + private void seekTests(TestCase testCase) { + // Check the testcase against the excludes structure + if (!isTestCaseExcluded(testCase)) { + // Add this testcase to the collection of tests to be run. + runCases.add(testCase); + } + } + + private boolean isTestCaseExcluded(TestCase testCase) { + this.originalTestCaseCount++; + boolean result = false; + String tcType = testCase.getClass().getName(); + String tcName = testCase.getName(); + + if (excludesDoc != null) { + try { + // Find *the first* element for the type. If there are + // more than one "type" elements for a given type then the + // first one found is what counts. + NodeList typeNodes = XPathAPI.selectNodeList(excludesDoc, + "/descendant::hy:type[@id=\"" + tcType + "\"]"); + if (typeNodes.getLength() > 0) { + Node typeNode = typeNodes.item(0); + // Look for a blanket exclusion of this test case type + NodeList excludes = XPathAPI.selectNodeList(typeNode, + "descendant::hy:exclude[@id=\"all\"]"); + if (excludes.getLength() != 0) { + result = true; + } else { + // Look for explicit exclusion + excludes = XPathAPI.selectNodeList(typeNode, + "descendant::hy:exclude[@id=\"" + tcName + + "\"]"); + if (excludes.getLength() != 0) { + result = true; + } + }// end else + }// end if named type located + } catch (TransformerException e) { + // Carry on. + result = false; + } + } + return result; + } + + /** + */ + private boolean initExcludes() { + boolean result = true; + + // Look for location of excludes list and (optionally) a schema + // location override. + readProperties(); + if (excludesListURI == null) { + System.out.println("No excludes list specified."); + result = false; + } + + if (result) { + try { + System.setProperty(DOCUMENT_BUILDER_FACTORY_PROP, + DOCUMENT_BUILDER_FACTORY_VAL); + DocumentBuilderFactory factory = DocumentBuilderFactory + .newInstance(); + factory.setNamespaceAware(true); + factory.setValidating(true); + factory.setAttribute(JAXP_SCHEMA_LANGUAGE_ATTR_NAME, + JAXP_SCHEMA_LANGUAGE_ATTR_VAL); + if (excludesSchemaURI != null) { + factory.setAttribute(JAXP_SCHEMA_SOURCE_ATTR_NAME, + excludesSchemaURI); + } + + DocumentBuilder builder = factory.newDocumentBuilder(); + DocValidator handler = new DocValidator(); + builder.setErrorHandler(handler); + excludesDoc = builder.parse(excludesListURI); + if (handler.inError == true) { + this.docIsValid = false; + System.out.println("Excludes list document " + + excludesListURI + " is invalid :" + + handler.inError + " " + + handler.spException.getMessage()); + excludesDoc = null; + result = false; + } else { + this.docIsValid = true; + } + } catch (FileNotFoundException e) { + System.out.println("File not found : " + e.getMessage()); + result = false; + } catch (ParserConfigurationException e) { + System.out.println("Serious error with XML parser : " + + e.getMessage()); + result = false; + } catch (SAXException e) { + System.out.println("Serious error occurred parsing document : " + + e.getMessage()); + result = false; + } catch (IOException e) { + System.out.println("IO error occurred : " + e.getMessage()); + result = false; + } + } + return result; + } + + /** + * + */ + private void readProperties() { + excludesListURI = System.getProperty(EXCLUDES_FILE_URI_PROP); + excludesSchemaURI = System.getProperty(EXCLUDES_SCHEMA_URI_PROP); + } + + /** + */ + class DocValidator extends DefaultHandler { + private boolean inError = false; + + private SAXParseException spException = null; + + public void error(SAXParseException exception) throws SAXException { + inError = true; + spException = exception; + } + + public void fatalError(SAXParseException exception) throws SAXException { + inError = true; + spException = exception; + } + } +} Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/util/SomeTests.java ------------------------------------------------------------------------------ svn:eol-style = native