JBoss Portal SVN: r8757 - in modules/test/trunk/tooling: src and 9 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-23 12:16:42 -0400 (Tue, 23 Oct 2007)
New Revision: 8757
Added:
modules/test/trunk/tooling/src/main/java/
modules/test/trunk/tooling/src/main/java/org/
modules/test/trunk/tooling/src/main/java/org/jboss/
modules/test/trunk/tooling/src/main/java/unit/
modules/test/trunk/tooling/src/main/resources/
modules/test/trunk/tooling/src/test/
modules/test/trunk/tooling/src/test/java/
modules/test/trunk/tooling/src/test/java/org/
modules/test/trunk/tooling/src/test/java/org/jboss/
modules/test/trunk/tooling/src/test/java/org/jboss/test/
modules/test/trunk/tooling/src/test/resources/
modules/test/trunk/tooling/src/test/resources/assertkeyword-unit.xml
modules/test/trunk/tooling/src/test/resources/simple-tests.xml
Removed:
modules/test/trunk/tooling/src/main/org/jboss/test/
modules/test/trunk/tooling/src/main/org/jboss/unit/
modules/test/trunk/tooling/src/resources/
Modified:
modules/test/trunk/tooling/build.xml
Log:
tooling reorganization to maven structure
Modified: modules/test/trunk/tooling/build.xml
===================================================================
--- modules/test/trunk/tooling/build.xml 2007-10-23 15:47:48 UTC (rev 8756)
+++ modules/test/trunk/tooling/build.xml 2007-10-23 16:16:42 UTC (rev 8757)
@@ -127,6 +127,30 @@
_default:compile-etc,
_default:compile-resources">
<!-- Add module specific elements here. -->
+
+
+ <!-- Workaround to include test classes from maven convention -->
+
+ <javac destdir="${build.classes}"
+ optimize="${javac.optimize}"
+ target="${javac.target}"
+ debug="${javac.debug}"
+ source="${javac.source}"
+ depend="${javac.depend}"
+ verbose="${javac.verbose}"
+ deprecation="${javac.deprecation}"
+ includeAntRuntime="${javac.include.ant.runtime}"
+ includeJavaRuntime="${javac.include.java.runtime}"
+ failonerror="${javac.fail.onerror}">
+ <src path="${maven.module.test.sources}"/>
+ <classpath>
+ <path refid="javac.classpath"/>
+ <pathelement location="${build.classes}"/>
+ </classpath>
+
+ <include name="${javac.includes}"/>
+ </javac>
+
</target>
<!--+====================================================================+-->
@@ -147,13 +171,13 @@
<fileset dir="${build.classes}">
<exclude name="org/jboss/test/**"/>
</fileset>
- <!--<fileset dir="${build.resources}/jboss-unit-jar"/>-->
</jar>
<jar jarfile="${build.lib}/jboss-unit-tooling-test.jar">
<fileset dir="${build.classes}">
<exclude name="org/jboss/unit/**"/>
</fileset>
+ <fileset dir="${maven.module.test.resources}"/>
</jar>
</target>
@@ -217,7 +241,7 @@
<jboss-unit>
- <tests config="./output/resources/test/simple-tests.xml" suiteName="one">
+ <tests config="./src/test/resources/simple-tests.xml" suiteName="one">
<!-- no include tag means invoke all -->
<!-- but you can still exclude some tests -->
<property name="propName" value="propValue"/>
@@ -237,7 +261,7 @@
<exclude id="otherTestTwo"/>
</tests>
- <tests config="./output/resources/test/assertkeyword-unit.xml">
+ <tests config="./src/test/resources/assertkeyword-unit.xml">
</tests>
<!--<tests config="./output/resources/test/simple-tests.xml">
Copied: modules/test/trunk/tooling/src/main/java/unit (from rev 8756, modules/test/trunk/tooling/src/main/org/jboss/unit)
Copied: modules/test/trunk/tooling/src/test/java/org/jboss/test (from rev 8756, modules/test/trunk/tooling/src/main/org/jboss/test)
Copied: modules/test/trunk/tooling/src/test/resources/assertkeyword-unit.xml (from rev 8756, modules/test/trunk/tooling/src/resources/test/assertkeyword-unit.xml)
===================================================================
--- modules/test/trunk/tooling/src/test/resources/assertkeyword-unit.xml (rev 0)
+++ modules/test/trunk/tooling/src/test/resources/assertkeyword-unit.xml 2007-10-23 16:16:42 UTC (rev 8757)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-unit
+ xmlns="urn:jboss:jboss-unit:1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
+ <pojo>
+ <test>
+ <class name="org.jboss.test.unit.tooling.AssertKeywordTest"/>
+ </test>
+ </pojo>
+</jboss-unit>
\ No newline at end of file
Copied: modules/test/trunk/tooling/src/test/resources/simple-tests.xml (from rev 8756, modules/test/trunk/tooling/src/resources/test/simple-tests.xml)
===================================================================
--- modules/test/trunk/tooling/src/test/resources/simple-tests.xml (rev 0)
+++ modules/test/trunk/tooling/src/test/resources/simple-tests.xml 2007-10-23 16:16:42 UTC (rev 8757)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-unit
+ xmlns="urn:jboss:jboss-unit:1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
+ <pojo>
+ <test>
+ <class name="org.jboss.test.unit.tooling.simple.SimpleTest1"/>
+ </test>
+ </pojo>
+</jboss-unit>
\ No newline at end of file
16 years, 7 months
JBoss Portal SVN: r8756 - in modules/test/trunk: build and 8 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-23 11:47:48 -0400 (Tue, 23 Oct 2007)
New Revision: 8756
Added:
modules/test/trunk/pom.xml
Modified:
modules/test/trunk/build/build-thirdparty.xml
modules/test/trunk/build/ide/intellij/idea60/modules/mc/mc.iml
modules/test/trunk/build/ide/intellij/idea60/modules/remote/remote.iml
modules/test/trunk/build/ide/intellij/idea60/modules/test/test.iml
modules/test/trunk/build/ide/intellij/idea60/modules/testsuite/testsuite.iml
modules/test/trunk/build/ide/intellij/idea60/modules/thirdparty/thirdparty.iml
modules/test/trunk/build/ide/intellij/idea60/modules/tooling/tooling.iml
modules/test/trunk/build/ide/intellij/idea60/modules/tools/tools.iml
modules/test/trunk/build/ide/intellij/idea60/modules/unit/unit.iml
Log:
root pom for test module
Modified: modules/test/trunk/build/build-thirdparty.xml
===================================================================
--- modules/test/trunk/build/build-thirdparty.xml 2007-10-23 15:46:18 UTC (rev 8755)
+++ modules/test/trunk/build/build-thirdparty.xml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -49,12 +49,12 @@
<componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
- <componentref name="apache-ant" version="1.6.5"/>
+ <componentref name="apache-ant" version="1.6.5-junit"/>
<componentref name="codehaus/cargo" version="0.9-portal"/>
<componentref name="hibernate" version="3.2.0.CR2"/>
- <componentref name="apache-log4j" version="1.2.8"/>
+ <componentref name="apache-log4j" version="1.2.14"/>
<componentref name="junit" version="3.8.1"/>
<componentref name="sun-servlet" version="2.4"/>
<componentref name="apache-httpclient" version="3.0.1"/>
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/mc/mc.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/mc/mc.iml 2007-10-23 15:46:18 UTC (rev 8755)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/mc/mc.iml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../../../../../../mc">
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/remote/remote.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/remote/remote.iml 2007-10-23 15:46:18 UTC (rev 8755)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/remote/remote.iml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../../../../../../remote">
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/test/test.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/test/test.iml 2007-10-23 15:46:18 UTC (rev 8755)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/test/test.iml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../../../../../test/classes" />
<exclude-output />
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/testsuite/testsuite.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/testsuite/testsuite.iml 2007-10-23 15:46:18 UTC (rev 8755)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/testsuite/testsuite.iml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../../../../../testsuite/classes" />
<exclude-output />
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/thirdparty/thirdparty.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/thirdparty/thirdparty.iml 2007-10-23 15:46:18 UTC (rev 8755)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/thirdparty/thirdparty.iml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../../../../../thirdparty/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../../../../../thirdparty">
<excludeFolder url="file://$MODULE_DIR$/../../../../../../thirdparty/antlr" />
- <excludeFolder url="file://$MODULE_DIR$/../../../../../../thirdparty/apache-ant" />
<excludeFolder url="file://$MODULE_DIR$/../../../../../../thirdparty/apache-codec" />
<excludeFolder url="file://$MODULE_DIR$/../../../../../../thirdparty/apache-collections" />
<excludeFolder url="file://$MODULE_DIR$/../../../../../../thirdparty/apache-fileupload" />
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/tooling/tooling.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/tooling/tooling.iml 2007-10-23 15:46:18 UTC (rev 8755)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/tooling/tooling.iml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../../../../../../tooling">
@@ -8,7 +7,6 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="unit" />
<orderEntry type="module-library">
<library>
<CLASSES>
@@ -27,6 +25,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="unit" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/tools/tools.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/tools/tools.iml 2007-10-23 15:46:18 UTC (rev 8755)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/tools/tools.iml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../../../../../tools/classes" />
<exclude-output />
Modified: modules/test/trunk/build/ide/intellij/idea60/modules/unit/unit.iml
===================================================================
--- modules/test/trunk/build/ide/intellij/idea60/modules/unit/unit.iml 2007-10-23 15:46:18 UTC (rev 8755)
+++ modules/test/trunk/build/ide/intellij/idea60/modules/unit/unit.iml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../../../../../../unit">
- <sourceFolder url="file://$MODULE_DIR$/../../../../../../unit/src/main" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../../../../unit/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/../../../../../../unit/src/test/java" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Added: modules/test/trunk/pom.xml
===================================================================
--- modules/test/trunk/pom.xml (rev 0)
+++ modules/test/trunk/pom.xml 2007-10-23 15:47:48 UTC (rev 8756)
@@ -0,0 +1,188 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal.test</groupId>
+ <artifactId>jboss-portal-modules-test-root</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Portal Modules Test</name>
+ <version>1.1.0-SNAPSHOT</version>
+ <url>http://labs.jboss.com/jbossportal</url>
+
+ <dependencies/>
+
+ <repositories>
+ <repository>
+ <id>repository.maven.org</id>
+ <name>Maven Repository</name>
+ <layout>default</layout>
+ <url>http://repo1.maven.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav</artifactId>
+ <version>1.0-beta-2</version>
+ </extension>
+ </extensions>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>true</optimize>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <extensions>true</extensions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jboss-deploy-plugin</artifactId>
+ <version>1.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jboss-deploy</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <jbossDeployRoot>${jboss.repository.root}</jbossDeployRoot>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <distributionManagement>
+ <!--<repository>-->
+ <!--Copy the distribution jar file to a local checkout of the maven repository
+ - This variable can be set in $MAVEN_HOME/conf/settings.xml-->
+ <!--<id>repository.jboss.org</id>-->
+ <!--<url>file://${jboss.repository.root}</url>-->
+ <!--</repository>-->
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ <uniqueVersion>true</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <modules>
+ <module>unit</module>
+ </modules>
+
+
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://jira.jboss.com/jira/browse/JBPORTAL</url>
+ </issueManagement>
+ <ciManagement>
+ <system>cruisecontrol</system>
+ </ciManagement>
+
+ <licenses>
+ <license>
+ <name>LGPL 2.1</name>
+ <url>http://www.gnu.org/licenses/lgpl.html</url>
+ <distribution>repo</distribution>
+ <comments>
+ GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
+ </comments>
+ </license>
+ </licenses>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/portal/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/portal/trunk</developerConnection>
+ <url>https://svn.jboss.org/repos/portal/trunk</url>
+ </scm>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-changes-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.0</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jxr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <linkXref>true</linkXref>
+ <targetJdk>1.5</targetJdk>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <properties/>
+
+</project>
\ No newline at end of file
16 years, 7 months
JBoss Portal SVN: r8755 - in modules/test/trunk/unit: src and 10 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-23 11:46:18 -0400 (Tue, 23 Oct 2007)
New Revision: 8755
Added:
modules/test/trunk/unit/pom.xml
modules/test/trunk/unit/src/main/java/
modules/test/trunk/unit/src/main/java/org/
modules/test/trunk/unit/src/main/java/org/jboss/
modules/test/trunk/unit/src/main/java/org/jboss/unit/
modules/test/trunk/unit/src/main/resources/
modules/test/trunk/unit/src/main/resources/org/
modules/test/trunk/unit/src/test/
modules/test/trunk/unit/src/test/java/
modules/test/trunk/unit/src/test/java/org/
modules/test/trunk/unit/src/test/java/org/jboss/
modules/test/trunk/unit/src/test/java/org/jboss/test/
modules/test/trunk/unit/src/test/resources/
modules/test/trunk/unit/src/test/resources/org/
Removed:
modules/test/trunk/unit/src/main/org/
modules/test/trunk/unit/src/resources/
Modified:
modules/test/trunk/unit/build.xml
Log:
- unit submodule reorganization for maven structure
Modified: modules/test/trunk/unit/build.xml
===================================================================
--- modules/test/trunk/unit/build.xml 2007-10-23 15:44:23 UTC (rev 8754)
+++ modules/test/trunk/unit/build.xml 2007-10-23 15:46:18 UTC (rev 8755)
@@ -124,6 +124,30 @@
_default:compile-etc,
_default:compile-resources">
<!-- Add module specific elements here. -->
+
+
+ <!-- Workaround to include test classes from maven convention -->
+
+ <javac destdir="${build.classes}"
+ optimize="${javac.optimize}"
+ target="${javac.target}"
+ debug="${javac.debug}"
+ source="${javac.source}"
+ depend="${javac.depend}"
+ verbose="${javac.verbose}"
+ deprecation="${javac.deprecation}"
+ includeAntRuntime="${javac.include.ant.runtime}"
+ includeJavaRuntime="${javac.include.java.runtime}"
+ failonerror="${javac.fail.onerror}">
+ <src path="${maven.module.test.sources}"/>
+ <classpath>
+ <path refid="javac.classpath"/>
+ <pathelement location="${build.classes}"/>
+ </classpath>
+
+ <include name="${javac.includes}"/>
+ </javac>
+
</target>
<!--+====================================================================+-->
@@ -144,13 +168,14 @@
<fileset dir="${build.classes}">
<exclude name="org/jboss/test/**"/>
</fileset>
- <fileset dir="${build.resources}/jboss-unit-jar"/>
+ <fileset dir="${maven.module.resources}"/>
</jar>
<jar jarfile="${build.lib}/jboss-unit-test.jar">
<fileset dir="${build.classes}">
<exclude name="org/jboss/unit/**"/>
</fileset>
+ <fileset dir="${maven.module.test.resources}"/>
</jar>
</target>
Added: modules/test/trunk/unit/pom.xml
===================================================================
--- modules/test/trunk/unit/pom.xml (rev 0)
+++ modules/test/trunk/unit/pom.xml 2007-10-23 15:46:18 UTC (rev 8755)
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.test</groupId>
+ <artifactId>jboss-portal-modules-test-root</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-portal-modules-test-unit</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal Modules Common Portal</name>
+
+ <dependencies/>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <properties>
+
+ </properties>
+</project>
+
Copied: modules/test/trunk/unit/src/main/java/org/jboss/unit (from rev 8752, modules/test/trunk/unit/src/main/org/jboss/unit)
Copied: modules/test/trunk/unit/src/main/resources/org (from rev 8752, modules/test/trunk/unit/src/resources/jboss-unit-jar/org)
Copied: modules/test/trunk/unit/src/test/java/org/jboss/test (from rev 8752, modules/test/trunk/unit/src/main/org/jboss/test)
Copied: modules/test/trunk/unit/src/test/resources/org (from rev 8752, modules/test/trunk/unit/src/resources/test/org)
16 years, 7 months
JBoss Portal SVN: r8754 - modules/test/trunk/tools/etc/buildfragments.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-23 11:44:23 -0400 (Tue, 23 Oct 2007)
New Revision: 8754
Modified:
modules/test/trunk/tools/etc/buildfragments/buildmagic.ent
Log:
- some helper envs to keep maven and ant together temporarily
Modified: modules/test/trunk/tools/etc/buildfragments/buildmagic.ent
===================================================================
--- modules/test/trunk/tools/etc/buildfragments/buildmagic.ent 2007-10-23 15:43:07 UTC (rev 8753)
+++ modules/test/trunk/tools/etc/buildfragments/buildmagic.ent 2007-10-23 15:44:23 UTC (rev 8754)
@@ -52,6 +52,12 @@
<property name="module.tools" value="${module.root}/tools"/>
<property name="module.thirdparty" value="${module.root}/thirdparty"/>
+ <property name="maven.module.source" value="${module.source}/main/java"/>
+ <property name="maven.module.resources" value="${module.source}/main/resources"/>
+ <property name="maven.module.test" value="${module.source}/test"/>
+ <property name="maven.module.test.sources" value="${maven.module.test}/java"/>
+ <property name="maven.module.test.resources" value="${maven.module.test}/resources"/>
+
<!-- Load Buildmagic extention tasks. -->
<property name="buildmagic.local.classpath" value="."/>
<path id="buildmagic.task.classpath">
16 years, 7 months
JBoss Portal SVN: r8753 - in modules/test/trunk/tooling/src: resources/test and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-10-23 11:43:07 -0400 (Tue, 23 Oct 2007)
New Revision: 8753
Removed:
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/
modules/test/trunk/tooling/src/resources/test/bobo-tests.xml
Log:
- cleanup
Deleted: modules/test/trunk/tooling/src/resources/test/bobo-tests.xml
===================================================================
--- modules/test/trunk/tooling/src/resources/test/bobo-tests.xml 2007-10-23 14:45:40 UTC (rev 8752)
+++ modules/test/trunk/tooling/src/resources/test/bobo-tests.xml 2007-10-23 15:43:07 UTC (rev 8753)
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jboss-unit
- xmlns="urn:jboss:jboss-unit:1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
- <pojo>
- <test>
- <class name="org.jboss.test.unit.tooling.bobo.BoboTest1"/>
- </test>
- </pojo>
-</jboss-unit>
\ No newline at end of file
16 years, 7 months
JBoss Portal SVN: r8752 - in modules/portlet/trunk: test and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-23 10:45:40 -0400 (Tue, 23 Oct 2007)
New Revision: 8752
Added:
modules/portlet/trunk/test/src/resources/test/deployment/
Removed:
modules/portlet/trunk/portlet/src/resources/test/deployment/
Modified:
modules/portlet/trunk/test/build.xml
modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/deployment/UnmarshallerTestCase.java
Log:
tweaks to correct failling test cases
Modified: modules/portlet/trunk/test/build.xml
===================================================================
--- modules/portlet/trunk/test/build.xml 2007-10-23 13:57:28 UTC (rev 8751)
+++ modules/portlet/trunk/test/build.xml 2007-10-23 14:45:40 UTC (rev 8752)
@@ -573,6 +573,8 @@
<classpath>
+ <pathelement location="${build.resources}/test"/>
+
<path refid="jboss.portal/modules/test.classpath"/>
<path location="../tools/lib/ant.jar"/>
<path location="../tools/lib/ant-launcher.jar"/>
Modified: modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/deployment/UnmarshallerTestCase.java
===================================================================
--- modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/deployment/UnmarshallerTestCase.java 2007-10-23 13:57:28 UTC (rev 8751)
+++ modules/portlet/trunk/test/src/main/org/jboss/portal/portlet/test/deployment/UnmarshallerTestCase.java 2007-10-23 14:45:40 UTC (rev 8752)
@@ -49,11 +49,10 @@
public class UnmarshallerTestCase
{
- @Test
public void testJBossPortletXML() throws Exception
{
- URL jbossPortletXML = Thread.currentThread().getContextClassLoader().getResource("test/deployment/jboss-portlet.xml");
- assertTrue(URLTools.exists(jbossPortletXML));
+ URL jbossPortletXML = Thread.currentThread().getContextClassLoader().getResource("deployment/jboss-portlet.xml");
+ assertTrue(URLTools.exists(assertNotNull(jbossPortletXML)));
//
JBossApplicationMetaDataFactory factory = new JBossApplicationMetaDataFactory();
@@ -97,8 +96,8 @@
@Test
public void testPortletXML() throws Exception
{
- URL portletXML = Thread.currentThread().getContextClassLoader().getResource("test/deployment/portlet.xml");
- assertTrue(URLTools.exists(portletXML));
+ URL portletXML = Thread.currentThread().getContextClassLoader().getResource("deployment/portlet.xml");
+ assertTrue(URLTools.exists(assertNotNull(portletXML)));
//
// URL portletXSD = Thread.currentThread().getContextClassLoader().getResource("portlet-app_1_0.xsd");
Copied: modules/portlet/trunk/test/src/resources/test/deployment (from rev 8636, modules/portlet/trunk/portlet/src/resources/test/deployment)
16 years, 7 months
JBoss Portal SVN: r8751 - in modules/common/trunk/common: src/main/java/org/jboss/portal/common/net and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-10-23 09:57:28 -0400 (Tue, 23 Oct 2007)
New Revision: 8751
Added:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractServer.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractSynchronizedServer.java
modules/common/trunk/common/src/test/resources/log4j.properties
Removed:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLStreamOpeningThread.java
Modified:
modules/common/trunk/common/pom.xml
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/URLToolsTestCase.java
Log:
- switched URLTools timeout implementations to use Java 5
- removed dependency over HTTP Client
- added timeout and response 200 test cases for URLTools.exist and URLTools.performGET
Modified: modules/common/trunk/common/pom.xml
===================================================================
--- modules/common/trunk/common/pom.xml 2007-10-23 11:14:01 UTC (rev 8750)
+++ modules/common/trunk/common/pom.xml 2007-10-23 13:57:28 UTC (rev 8751)
@@ -145,6 +145,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <!-- To use in conjonctin with
+ export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
+ -->
<!--
<forkMode>never</forkMode>
<argLine>-enableassertions</argLine>
Deleted: modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLStreamOpeningThread.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLStreamOpeningThread.java 2007-10-23 11:14:01 UTC (rev 8750)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLStreamOpeningThread.java 2007-10-23 13:57:28 UTC (rev 8751)
@@ -1,99 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, 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.portal.common.net;
-
-import org.jboss.portal.common.util.ParameterValidation;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-/**
- * A class that opens an InputStream to a URL in a thread so that it doesn't block normal operations and can be timed
- * out if needed.
- *
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 7379 $
- * @since 2.4.2
- */
-public class URLStreamOpeningThread extends Thread
-{
-
- /** . */
- private final URL url;
-
- /** . */
- private volatile InputStream inputStream;
-
- /** Exception in the event a connection error occurs */
- private volatile IOException exception;
-
- public URLStreamOpeningThread(URL url)
- {
- ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
-
- //
- this.url = url;
- this.inputStream = null;
- this.exception = null;
- }
-
- public void run()
- {
- try
- {
- InputStream in = url.openStream();
- if (in == null)
- {
- throw new IllegalArgumentException("Cannot open stream from [" + url + "]");
- }
-
- //
- inputStream = in;
- }
- catch (IOException e)
- {
- exception = e;
- }
- }
-
- public boolean isConnected()
- {
- return inputStream != null;
- }
-
- public boolean isError()
- {
- return exception != null;
- }
-
- public InputStream getInputStream()
- {
- return inputStream;
- }
-
- public IOException getException()
- {
- return exception;
- }
-}
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java 2007-10-23 11:14:01 UTC (rev 8750)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java 2007-10-23 13:57:28 UTC (rev 8751)
@@ -22,17 +22,18 @@
******************************************************************************/
package org.jboss.portal.common.net;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.log4j.Logger;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.util.ParameterValidation;
+import java.io.BufferedInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
import java.net.URL;
+import java.net.URLConnection;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
@@ -56,18 +57,8 @@
public static final String FTP_PREFIX = "ftp://";
public static final String FILE_PREFIX = "/";
- public static final int PROXY_PORT;
- public static final String PROXY_HOST;
-
private static final Logger log = Logger.getLogger(URLTools.class);
- static
- {
- PROXY_HOST = System.getProperty("http.proxyHost");
- PROXY_PORT = Integer.parseInt(System.getProperty("http.proxyPort", "-1"));
- log.debug("Proxy settings: host='" + PROXY_HOST + "', port='" + PROXY_PORT + "'");
- }
-
public static boolean isURLAbsolute(String url)
{
return isNetworkURL(url) || url.startsWith(FILE_PREFIX);
@@ -81,9 +72,10 @@
* @param url the URL the URL of the resource
* @param soTimeoutMillis the socket connection timeout in millis
* @param connTimeoutMillis the connection timeout in millis
- * @return the retrieved byte array
+ * @return the retrieved byte array
+ * @throws IllegalArgumentException if the URL is null or any time out value is negative
*/
- public static byte[] performGET(URL url, int soTimeoutMillis, int connTimeoutMillis) throws IllegalArgumentException, IOException
+ public static byte[] performGET(URL url, int soTimeoutMillis, int connTimeoutMillis) throws IllegalArgumentException
{
if (url == null)
{
@@ -91,55 +83,48 @@
}
if (soTimeoutMillis < 0)
{
- throw new IllegalArgumentException("No negative socket timeout");
+ throw new IllegalArgumentException("No negative socket timeout " + soTimeoutMillis);
}
if (connTimeoutMillis < 0)
{
- throw new IllegalArgumentException("No negative connection timeout");
+ throw new IllegalArgumentException("No negative connection timeout" + connTimeoutMillis);
}
- if ("http".equals(url.getProtocol()) || "https".equals(url.getProtocol()))
+
+ //
+ URLConnection conn;
+ try
{
- HttpClient client = new HttpClient();
+ conn = url.openConnection();
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
- if (PROXY_HOST != null)
- {
- client.getHostConfiguration().setProxy(PROXY_HOST, PROXY_PORT);
- }
+ // Configure
+ conn.setConnectTimeout(soTimeoutMillis);
+ conn.setReadTimeout(connTimeoutMillis);
- // Yes deprecated but advocated way to do will not for with 2.0.2 which is what today JBoss AS ships
- if (connTimeoutMillis > 0)
- {
- client.setConnectionTimeout(connTimeoutMillis);
- }
- if (soTimeoutMillis > 0)
- {
- client.setTimeout(soTimeoutMillis);
- }
-
- //
- HttpMethod method = null;
- try
- {
- method = new GetMethod(url.toString());
- method.setFollowRedirects(true);
- int statusCode = client.executeMethod(method);
- if (statusCode == 200)
- {
- return method.getResponseBody();
- }
- }
- finally
- {
- if (method != null)
- {
- method.releaseConnection();
- }
- }
-
- //
+ //
+ InputStream in = null;
+ try
+ {
+ conn.connect();
+ in = new BufferedInputStream(conn.getInputStream());
+ return IOTools.getBytes(in);
+ }
+ catch (SocketTimeoutException e)
+ {
return null;
}
- throw new IllegalArgumentException("Protocol " + url.getProtocol() + " not accepted for url " + url);
+ catch (IOException e)
+ {
+ return null;
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ }
}
/**
@@ -210,72 +195,89 @@
*/
public static boolean exists(URL url)
{
- ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
-
return exists(url, 1000);
}
/**
- * Determines if the specified URL corresponds to an existing resource by trying to open a stream from it. The
- * connection attempt is made from a different thread on which we wait for the specified amount of time before timing
- * out.
+ * Determines if the specified URL corresponds to an existing resource by trying to open a stream from it.
*
* @param url the URL to be tested
* @param waitForMillis the number of milliseconds to wait before timing out, 0 meaning never timing out.
* @return
+ * @throws IllegalArgumentException if the url is null or the time out negative
* @since 2.4.2
*/
- public static boolean exists(URL url, long waitForMillis)
+ public static boolean exists(URL url, long waitForMillis) throws IllegalArgumentException
{
- URLStreamOpeningThread thread = new URLStreamOpeningThread(url);
- thread.start();
+ if (url == null)
+ {
+ throw new IllegalArgumentException("No null URL accepted");
+ }
+ if (waitForMillis < 0)
+ {
+ throw new IllegalArgumentException("Read time out must be a positive value instead of " + waitForMillis);
+ }
+ //
+ URLConnection conn;
try
{
- // Wait for the thread to finish but don't wait longer than the specified time
- thread.join(waitForMillis);
+ conn = url.openConnection();
+ }
+ catch (IOException e)
+ {
+ log.debug("Could not open connection for " + url, e);
+ return false;
+ }
- if (thread.isAlive())
- {
- // Timeout occurred; thread has not finished
- throw new RuntimeException("Couldn't connect to " + url + " within " + waitForMillis / 1000
- + " seconds. Check your connection parameters or the URL.");
- }
- else
- {
- // Finished
- return thread.isConnected() && !thread.isError();
- }
+ // Configure
+ conn.setConnectTimeout((int)waitForMillis);
+ conn.setReadTimeout((int)waitForMillis);
+
+ //
+ InputStream in = null;
+ try
+ {
+ conn.connect();
+ in = conn.getInputStream();
+ return true;
}
- catch (InterruptedException e)
+ catch (SocketTimeoutException e)
{
- // Thread was interrupted
- throw new RuntimeException("Connection thread to " + url + " was interrupted!", e);
+ return false;
}
+ catch (IOException e)
+ {
+ return false;
+ }
finally
{
- IOTools.safeClose(thread.getInputStream());
+ IOTools.safeClose(in);
}
}
/**
- * @param urlAsString
+ * to remove : an API should not try to accomodate the client for that kind of situation,
+ * why not also something like forbidStringLengthToDivisibleBy3 ?
+
+ * @param stringURL
* @param allowNull <code>true</code> if passing <code>null</code> will be ignored and just return
* <code>false</code>, <code>false</code> to throw an {@link IllegalArgumentException} is the
* given URL is <code>null</code>.
+ *
* @return
* @since 2.4.2
*/
- public static boolean exists(String urlAsString, boolean allowNull)
+ public static boolean exists(String stringURL, boolean allowNull)
{
if (!allowNull)
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(urlAsString, "URL", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(stringURL, "URL", null);
}
try
{
- URL url = new URL(urlAsString);
+ URL url = new URL(stringURL);
return exists(url);
}
catch (MalformedURLException e)
Added: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractServer.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractServer.java (rev 0)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractServer.java 2007-10-23 13:57:28 UTC (rev 8751)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.portal.test.common.net;
+
+import java.net.ServerSocket;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractServer implements Runnable
+{
+
+ /** . */
+ private int port;
+
+ /** . */
+ private ServerSocket server;
+
+ public AbstractServer(int port)
+ {
+ this.port = port;
+ }
+
+ public final void start() throws Exception
+ {
+ server = new ServerSocket(port, 1);
+ new Thread(this).start();
+ }
+
+ public final void run()
+ {
+ try
+ {
+ run(server);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if (!server.isClosed())
+ {
+ try
+ {
+ server.close();
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+ }
+ }
+
+ protected abstract void run(ServerSocket server) throws Exception;
+
+ public final void stop()
+ {
+ if (server != null)
+ {
+ try
+ {
+ server.close();
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+ }
+
+}
Added: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractSynchronizedServer.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractSynchronizedServer.java (rev 0)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractSynchronizedServer.java 2007-10-23 13:57:28 UTC (rev 8751)
@@ -0,0 +1,180 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, 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.portal.test.common.net;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.junit.ExtendedAssert;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.io.BufferedInputStream;
+import java.io.LineNumberReader;
+import java.io.InputStreamReader;
+import java.io.BufferedOutputStream;
+import java.io.OutputStreamWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractSynchronizedServer extends AbstractServer
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(AbstractSynchronizedServer.class);
+
+ /** . */
+ private final Object lock = new Object();
+
+ /** . */
+ private final AtomicInteger b = new AtomicInteger(0);
+
+ /** . */
+ private Throwable failure;
+
+ protected AbstractSynchronizedServer(int port)
+ {
+ super(port);
+ }
+
+ protected void run(ServerSocket server) throws Exception
+ {
+ synchronized (lock)
+ {
+ b.set(1);
+ lock.notifyAll();
+ }
+
+ //
+ log.debug("Ready for accept");
+
+ //
+ try
+ {
+ doServer(server);
+ }
+ catch (Throwable throwable)
+ {
+ failure = throwable;
+ }
+
+ //
+ synchronized (lock)
+ {
+ lock.wait();
+ }
+
+ //
+ log.debug("Shutting down");
+ }
+
+ protected abstract void doServer(ServerSocket server) throws Exception;
+
+ protected abstract void doClient() throws Exception;
+
+ public void performInteraction() throws Exception
+ {
+ try
+ {
+ start();
+
+ // Wait until the we know the server will accept
+ synchronized (lock)
+ {
+ while (b.get() != 1)
+ {
+ lock.wait();
+ }
+ }
+
+ // Perform client action
+ doClient();
+ }
+ finally
+ {
+ synchronized (lock)
+ {
+ lock.notify();
+ }
+ stop();
+ }
+
+ //
+ if (failure != null)
+ {
+ log.error("The server reported a failure", failure);
+
+ ExtendedAssert.fail("The server reported a failure");
+ }
+ }
+
+ public static abstract class AbstractTimeoutServer extends AbstractSynchronizedServer
+ {
+
+ protected AbstractTimeoutServer(int port)
+ {
+ super(port);
+ }
+
+ protected void doServer(ServerSocket server) throws Exception
+ {
+ server.accept();
+ }
+
+ }
+
+ public static abstract class AbstractOKServer extends AbstractSynchronizedServer
+ {
+
+ protected AbstractOKServer(int port)
+ {
+ super(port);
+ }
+
+ protected void doServer(ServerSocket server) throws Exception
+ {
+ //
+ Socket s = server.accept();
+ BufferedInputStream in = new BufferedInputStream(s.getInputStream());
+ LineNumberReader reader = new LineNumberReader(new InputStreamReader(in, "ISO-8859-1"));
+ for (String line = reader.readLine();line.length() > 0;line = reader.readLine())
+ {
+ log.debug("server received = " + line);
+ }
+
+ //
+ log.debug("Finished reading");
+
+ //
+ BufferedOutputStream out = new BufferedOutputStream(s.getOutputStream());
+ OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
+ writer.write("HTTP/1.1 200 OK\r\n");
+ writer.write("\r\n");
+ writer.flush();
+ out.write("CAFEBABE".getBytes("UTF-8"));
+ out.close();
+ }
+ }
+
+}
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/URLToolsTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/URLToolsTestCase.java 2007-10-23 11:14:01 UTC (rev 8750)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/URLToolsTestCase.java 2007-10-23 13:57:28 UTC (rev 8751)
@@ -23,8 +23,17 @@
package org.jboss.portal.test.common.net;
import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.common.net.URLTools;
+import java.io.BufferedInputStream;
+import java.net.MalformedURLException;
+import java.net.ServerSocket;
+import java.net.URL;
+import java.net.URLConnection;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision: 7379 $
@@ -32,6 +41,10 @@
*/
public class URLToolsTestCase extends TestCase
{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(URLToolsTestCase.class);
+
private static final String MARKUP = "Hello, Anonymous!\n" +
"Counter: 0<a href='wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=rO0ABXNyACdvcmc" +
"uamJvc3MucG9ydGFsLnNlcnZlci51dGlsLlBhcmFtZXRlcnOJoAlMQZGhngIAAUwAA21hcHQAD0xqYXZhL3V0aWwvTWFwO3hwc3IAEWphd" +
@@ -163,7 +176,96 @@
public void testExistsURL()
{
- // todo: add more tests
assertFalse(URLTools.exists(null, true));
+
+
}
+
+ public void testURLExistsTimeout() throws Exception
+ {
+ AbstractSynchronizedServer server = new AbstractSynchronizedServer.AbstractTimeoutServer(8080)
+ {
+ protected void doClient()
+ {
+ boolean exist = true;
+ try
+ {
+ URL url = new URL("http://localhost:8080/");
+ exist = URLTools.exists(url, 500);
+ }
+ catch (MalformedURLException e)
+ {
+ log.error("Cannot create URL", e);
+ fail("Cannot create URL " + e.getMessage());
+ }
+
+ //
+ assertFalse("Was not expecting the URL to exist", exist);
+ }
+ };
+
+ //
+ server.performInteraction();
+ }
+
+ public void testURLPerformGETTimeout() throws Exception
+ {
+ AbstractSynchronizedServer server = new AbstractSynchronizedServer.AbstractTimeoutServer(8080)
+ {
+ protected void doClient()
+ {
+ byte[] bytes = null;
+ try
+ {
+ URL url = new URL("http://localhost:8080/");
+ bytes = URLTools.performGET(url, 500, 500);
+ }
+ catch (MalformedURLException e)
+ {
+ log.error("Cannot create URL", e);
+ fail("Cannot create URL " + e.getMessage());
+ }
+
+ //
+ assertNull("Was not expecting the URL GET to return a non null value", bytes);
+ }
+ };
+
+ //
+ server.performInteraction();
+ }
+
+ public void testURLPerformGET() throws Exception
+ {
+ AbstractSynchronizedServer server = new AbstractSynchronizedServer.AbstractOKServer(8080)
+ {
+
+ protected void doClient() throws Exception
+ {
+ URL url = new URL("http://localhost:8080/");
+ byte[] bytes = URLTools.performGET(url, 5000, 5000);
+ ExtendedAssert.assertEquals("CAFEBABE".getBytes("UTF-8"), bytes);
+ }
+ };
+
+ //
+ server.performInteraction();
+ }
+
+ public void testURLExists() throws Exception
+ {
+ AbstractSynchronizedServer server = new AbstractSynchronizedServer.AbstractOKServer(8080)
+ {
+
+ protected void doClient() throws Exception
+ {
+ URL url = new URL("http://localhost:8080/");
+ boolean exists = URLTools.exists(url, 5000);
+ ExtendedAssert.assertTrue("Was expecting the URL to exist", exists);
+ }
+ };
+
+ //
+ server.performInteraction();
+ }
}
Added: modules/common/trunk/common/src/test/resources/log4j.properties
===================================================================
--- modules/common/trunk/common/src/test/resources/log4j.properties (rev 0)
+++ modules/common/trunk/common/src/test/resources/log4j.properties 2007-10-23 13:57:28 UTC (rev 8751)
@@ -0,0 +1,7 @@
+log4j.rootCategory=DEBUG, CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
\ No newline at end of file
16 years, 7 months
JBoss Portal SVN: r8750 - in branches/JBoss_Portal_2_6_2_JBPORTAL-1772: core-samples/src/main/org/jboss/portal/core/samples/basic and 1 other directories.
by portal-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2007-10-23 07:14:01 -0400 (Tue, 23 Oct 2007)
New Revision: 8750
Modified:
branches/JBoss_Portal_2_6_2_JBPORTAL-1772/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java
branches/JBoss_Portal_2_6_2_JBPORTAL-1772/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java
branches/JBoss_Portal_2_6_2_JBPORTAL-1772/wsrp/build.xml
Log:
[JBPORTAL-1772] Security fixes for JBoss Portal 2.6.2 - Added changes for [JBPORTAL-1741] PortalURL security not honored
Modified: branches/JBoss_Portal_2_6_2_JBPORTAL-1772/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java
===================================================================
--- branches/JBoss_Portal_2_6_2_JBPORTAL-1772/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java 2007-10-23 10:31:14 UTC (rev 8749)
+++ branches/JBoss_Portal_2_6_2_JBPORTAL-1772/core/src/main/org/jboss/portal/core/impl/api/node/AbstractPortalNodeURL.java 2007-10-23 11:14:01 UTC (rev 8750)
@@ -53,6 +53,9 @@
/** . */
protected boolean relative;
+ /** . */
+ protected URLContext urlContext;
+
public AbstractPortalNodeURL(PortalObjectId id, ControllerContext controllerContext)
{
this.id = id;
@@ -74,11 +77,17 @@
public void setAuthenticated(Boolean authenticated)
{
this.wantAuthenticated = authenticated;
+
+ //
+ this.urlContext = null;
}
public void setSecure(Boolean secure)
{
this.wantSecure = secure;
+
+ //
+ this.urlContext = null;
}
public void setRelative(boolean relative)
@@ -88,6 +97,41 @@
protected URLContext getURLContext()
{
- return controllerContext.getServerInvocation().getServerContext().getURLContext();
+ if (urlContext == null)
+ {
+ URLContext tmp = controllerContext.getServerInvocation().getServerContext().getURLContext();
+
+ //
+ if (wantSecure != null)
+ {
+ if (wantSecure.booleanValue())
+ {
+ tmp = tmp.asSecured();
+ }
+ else
+ {
+ tmp = tmp.asNonSecured();
+ }
+ }
+
+ //
+ if (wantAuthenticated != null)
+ {
+ if (wantAuthenticated.booleanValue())
+ {
+ tmp = tmp.asAuthenticated();
+ }
+ else
+ {
+ tmp = tmp.asNonAuthenticated();
+ }
+ }
+
+ //
+ urlContext = tmp;
+ }
+
+ //
+ return urlContext;
}
}
Modified: branches/JBoss_Portal_2_6_2_JBPORTAL-1772/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java
===================================================================
--- branches/JBoss_Portal_2_6_2_JBPORTAL-1772/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java 2007-10-23 10:31:14 UTC (rev 8749)
+++ branches/JBoss_Portal_2_6_2_JBPORTAL-1772/core-samples/src/main/org/jboss/portal/core/samples/basic/TestPortlet.java 2007-10-23 11:14:01 UTC (rev 8750)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.samples.basic;
+import org.jboss.portal.api.node.PortalNodeURL;
import org.jboss.portal.common.transaction.TransactionManagerProvider;
import org.jboss.portal.core.CoreConstants;
import org.jboss.portal.identity.User;
@@ -147,7 +148,32 @@
writer.write("</div>");
writer.write("</p>");
+ PortalNodeURL nodeURL = resp.createRenderURL(req.getPortalNode());
+ String nothingURL = nodeURL.toString();
+ nodeURL.setAuthenticated(Boolean.TRUE);
+ nodeURL.setSecure(Boolean.TRUE);
+ String authenticatedSecureURL = nodeURL.toString();
+ nodeURL.setAuthenticated(Boolean.TRUE);
+ nodeURL.setSecure(Boolean.FALSE);
+ String authenticatedNotSecureURL = nodeURL.toString();
+ nodeURL.setAuthenticated(Boolean.FALSE);
+ nodeURL.setSecure(Boolean.FALSE);
+ String notAuthenticatedNotSecureURL = nodeURL.toString();
+ nodeURL.setAuthenticated(Boolean.FALSE);
+ nodeURL.setSecure(Boolean.TRUE);
+ String notAuthenticatedSecureURL = nodeURL.toString();
writer.write("<p>");
+ writer.write("<div class=\"portlet-section-header\">Portal node URLs</div>");
+ writer.write("<div class=\"portlet-section-body\">");
+ writer.write("<div><a href=\"" + nothingURL + "\">Keeping context</a></div>");
+ writer.write("<div><a href=\"" + authenticatedSecureURL + "\">Authenticated and Secured</a></div>");
+ writer.write("<div><a href=\"" + authenticatedNotSecureURL + "\">Authenticated and Not Secured</a></div>");
+ writer.write("<div><a href=\"" + notAuthenticatedNotSecureURL + "\">Not Authenticated and Not Secured</a></div>");
+ writer.write("<div><a href=\"" + notAuthenticatedSecureURL + "\">Not Authenticated and Secured</a></div>");
+ writer.write("</div>");
+ writer.write("</p>");
+
+ writer.write("<p>");
writer.write("<div class=\"portlet-section-header\">Path</div>");
writer.write("<div class=\"portlet-section-body\">");
writer.write("<div>portal path info = " + req.getAttribute("PATH") + "</div>");
Modified: branches/JBoss_Portal_2_6_2_JBPORTAL-1772/wsrp/build.xml
===================================================================
--- branches/JBoss_Portal_2_6_2_JBPORTAL-1772/wsrp/build.xml 2007-10-23 10:31:14 UTC (rev 8749)
+++ branches/JBoss_Portal_2_6_2_JBPORTAL-1772/wsrp/build.xml 2007-10-23 11:14:01 UTC (rev 8750)
@@ -641,8 +641,8 @@
<target name="clean-test">
<!-- remove generated test xml files -->
<delete dir="${reports.dir}"/>
- <delete file="tests.log"/>
- <delete file="output.log"/>
+ <delete file="tests.log" failonerror="false"/>
+ <delete file="output.log" failonerror="false"/>
</target>
<target name="tests-local" depends="clean,output">
16 years, 7 months
JBoss Portal SVN: r8749 - branches/JBoss_Portal_Branch_2_6/build.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-10-23 06:31:14 -0400 (Tue, 23 Oct 2007)
New Revision: 8749
Modified:
branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
Log:
Use common trunk-SNAPSHOT since Julien fixed an issue related to FastURLEncoder
Modified: branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2007-10-23 10:22:43 UTC (rev 8748)
+++ branches/JBoss_Portal_Branch_2_6/build/build-thirdparty.xml 2007-10-23 10:31:14 UTC (rev 8749)
@@ -47,7 +47,7 @@
are pushed to the http://repository.jboss.com site.
-->
- <componentref name="jboss-portal/modules/common" version="1.0.0"/>
+ <componentref name="jboss-portal/modules/common" version="trunk-SNAPSHOT"/>
<componentref name="jboss-portal/modules/web" version="1.0.0"/>
<componentref name="jboss-portal/modules/test" version="1.0.0"/>
<componentref name="jboss-portal/modules/portlet" version="trunk-SNAPSHOT"/>
16 years, 7 months