You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/09/15 19:47:21 UTC
svn commit: r289284 [2/9] - in /beehive/trunk/netui: ./ test/ant/
test/dist-test/ test/dist-test/ant/ test/src/compilerTests/
test/src/compilerTests/org/ test/src/compilerTests/org/apache/
test/src/compilerTests/org/apache/beehive/ test/src/compilerTes...
Added: beehive/trunk/netui/test/src/compilerTests/README.txt
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/README.txt?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/README.txt (added)
+++ beehive/trunk/netui/test/src/compilerTests/README.txt Thu Sep 15 10:43:52 2005
@@ -0,0 +1,40 @@
+The Beehive compiler test framework is a JUnit TestCase which will
+attempt to compile pageflow controller files and any controls files
+in the test directory and then analyze the compiler output results.
+
+Each compilation of a test directory which is laid out as a normal
+Beehive webapp directory structure is considered a junit test.
+
+You may put as many page flow directories as you want in each test
+directory . All the test directories should reside in one testsuite
+directory. The testsuite location should be specified throught an system
+viriable "testsuite.dir".
+
+Each test directory should contain an expectedOutput directory that has
+all the expected compiler outputs. All the expected generated struts config
+files should be recorded there with the extention ".expected" instead of
+".xml". Any compiler warning or error messages are piped into a file named
+warningorerror.actual. The expected warning or error output should also be
+recorded into the expectedOutput directory with the extention of ".expected"
+instead of ".actual".
+
+The test results are based on the line comparison between the actual and expected
+ouputs.
+
+Each of the test will be first copied into a build area which can be specified
+through a system viriable "test.output.dir". You can specify a list of tests you
+want to include or exclude by the test directory name throught the system viriables
+"included.test.list" and "excluded.test.list". This two lists can work together to
+get the list of tests you want to include.
+
+A class path that is required to run the beehive compiler needs to be passed though
+a system varialble "compiler-tests.classpath". The class path should include
+beehive-netui-compiler.jar, beehive-controls.jar, a servletAPI jar file and velocity
+jar files. The beehive-netui-core.jar is also needed when needing to run javac afte
+the apt compiler.
+
+To run the compiler Junit TestCase itselt, you will need the junit.jar,
+commons-logging and log4j in your your classpath.
+
+The compiler test automation in beehive and beehive test distribution is built in
+through netui/test/ant/junitCore.xml and netui/test/ant/compiler-test.properties.
\ No newline at end of file
Propchange: beehive/trunk/netui/test/src/compilerTests/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/build.xml?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/build.xml (added)
+++ beehive/trunk/netui/test/src/compilerTests/build.xml Thu Sep 15 10:43:52 2005
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright 2004-2005 The Apache Software Foundation.
+
+ 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.
+
+ $Header:$
+-->
+<project name="Beehive/NetUI/Test/Compiler" default="build" basedir=".">
+
+ <import file="../../../../beehive-imports.xml"/>
+ <import file="../../../netui-imports.xml"/>
+ <import file="../../ant/netui-test-imports.xml"/>
+
+ <property name="module.name" value="compilerTests"/>
+ <property name="module.dir" location="${test.src.dir}/${module.name}"/>
+ <property name="module.classes.dir" location="${test.classes.dir}/${module.name}"/>
+ <property name="module.jar" location="${test.lib.dir}/beehive-netui-compilerTests.jar"/>
+
+ <path id="module.classpath">
+ <path refid="junit.dependency.path"/>
+ <path refid="compiler-test.dependency.path"/>
+ <path refid="commons-logging.dependency.path"/>
+ </path>
+
+ <target name="build">
+ <echo>compile module: ${module.name}</echo>
+ <echo>debug: ${compile.debug}</echo>
+
+ <mkdir dir="${module.classes.dir}"/>
+
+ <javac srcdir="${module.dir}"
+ destdir="${module.classes.dir}"
+ classpathref="module.classpath"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}"
+ source="1.5">
+ <include name="**/*.java"/>
+ <exclude name="**/*testsuite/**"/>
+ </javac>
+
+ <copy todir="${module.classes.dir}">
+ <fileset dir="${module.dir}">
+ <include name="**/*testsuite/**"/>
+ </fileset>
+ </copy>
+
+ <jar jarfile="${module.jar}" basedir="${module.classes.dir}"/>
+ </target>
+
+ <target name="clean">
+ <delete dir="${module.classes.dir}"/>
+ <delete file="${module.jar}"/>
+ </target>
+
+</project>
+
Propchange: beehive/trunk/netui/test/src/compilerTests/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/OutputHandler.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/OutputHandler.java?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/OutputHandler.java (added)
+++ beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/OutputHandler.java Thu Sep 15 10:43:52 2005
@@ -0,0 +1,299 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.test.compiler;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+final class OutputHandler {
+
+ private static Log LOGGER = LogFactory.getLog(OutputHandler.class);
+
+ /**
+ * Validate the generated jpf-struts config files, if any.
+ *
+ * @param outputDir compiler test output directory
+ * @param expectedDirName the page flow direcotry name under test
+ * @return String - file mismatch messages
+ */
+ protected String handleGeneratedStrutsConfigFileComparisons(File outputDir, String expectedDirName)
+ throws PageFlowCompilerTestException {
+
+ boolean localize = false;
+ boolean trimLines = true;
+ boolean removeXMLComment = true;
+ boolean removeJpfLineNumbers = true;
+ StringBuffer failMsg = new StringBuffer();
+
+ Map actual = getActualGeneratedStrutsConfigFiles(outputDir);
+ Map expected = getExpectedGeneratedStrutsConfigFiles(outputDir, expectedDirName);
+
+ if ((actual == null && expected.size() == 0) || (actual.size() == 0 && expected.size() == 0)) {
+ // no comparision needed
+ return null;
+ }
+
+ if ((actual == null && expected.size() > 0) || (actual.size() == 0 && expected.size() > 0)) {
+ // no comparision needed
+ failMsg.append(" no config files were generated but " + expected.size() + " were expected! \n");
+ return failMsg.toString();
+ }
+
+ if (actual.size() > 0 && expected.size() == 0) {
+ // no comparision needed
+ failMsg.append(" no config files expected " + actual.size() + " were generated! \n");
+ return failMsg.toString();
+ }
+
+ if (actual.size() != expected.size()) {
+ failMsg.append(actual.size() + " files were found but " + expected.size() + " were expected! \n");
+ }
+
+ Iterator it = actual.keySet().iterator();
+ String key = null;
+ while (it.hasNext()) {
+ key = (String) it.next();
+ String[] tokens = key.split(TestPropertyMgr.EXT_XML);
+ String returnMsg;
+
+ if (!expected.containsKey(tokens[0] + TestPropertyMgr.EXT_EXPECTED)) {
+ returnMsg = ((File) actual.get(key)).getName() + " is not expected!";
+
+ } else {
+ returnMsg = TestUtil.fileCompare(((File) expected.get(tokens[0] + TestPropertyMgr.EXT_EXPECTED)),
+ ((File) actual.get(key)), localize, trimLines, removeXMLComment,
+ removeJpfLineNumbers);
+ }
+ if (returnMsg != null) {
+ failMsg.append(returnMsg);
+ }
+
+ }
+
+ if (failMsg.length() == 0)
+ return null;
+ else
+ return failMsg.toString();
+ }
+
+ /**
+ * Validate any warnings or errors generated (or not generated) by the
+ * compiler.
+ *
+ * @param outputDir compiler test output directory
+ * @param expectedDirName the pageflow direcotry name under test
+ */
+ protected String handleWarningsOrErrors(File outputDir, String expectedDirName)
+ throws PageFlowCompilerTestException {
+
+ boolean localize = true;
+ boolean trimLines = true;
+ boolean removeXMLComment = false;
+ boolean removeJpfLineNumbers = false;
+ StringBuffer failMsg = new StringBuffer();
+
+ File actual = getActualOutputFile(outputDir);
+ File expected = getExpectedWarningsOrErrorsFile(outputDir, expectedDirName);
+ try {
+ if (!actual.exists() && expected.exists()) {
+ FileInputStream expectedStream = null;
+ try {
+ expectedStream = new FileInputStream(expected);
+
+ if (expectedStream.available() > 0)
+ failMsg.append(" [warningorerrors.actual] is expected! actual: " + actual.getPath() + " expected: "
+ + expected.getPath() + "\n");
+ }
+ finally {
+ try{if(expectedStream != null)expectedStream.close();}catch(IOException ignore){}
+ }
+ }
+ else if (actual.exists() && !expected.exists()) {
+ FileInputStream actualStream = null;
+ try {
+ actualStream = new FileInputStream(actual);
+
+ if (actualStream.available() > 0)
+ failMsg.append("No [warningorerrors.actual] is expected! actual: " + actual.getPath() + "\n");
+ }
+ finally {
+ try{if(actualStream != null)actualStream.close();}catch(IOException ignore){}
+ }
+ }
+ else if (!actual.exists() && !expected.exists()) { }
+ // Try the new compare logic to accormodate the messages occuring in different order
+ else {
+ Set<String> actualOutput = TestUtil.processWarningOrErrorContent(actual, localize, trimLines,
+ removeXMLComment, removeJpfLineNumbers);
+ Set<String> expectedOutput = TestUtil.processWarningOrErrorContent(expected, localize, trimLines,
+ removeXMLComment,
+ removeJpfLineNumbers);
+ if (!actualOutput.equals(expectedOutput)) {
+ failMsg.append("[warningorerrors] \nACTUAL: ");
+
+ String[] actualInArray = actualOutput.toArray(new String[actualOutput.size()]);
+ String[] expectedInArray = expectedOutput.toArray(new String[expectedOutput.size()]);
+ for (int i = 0; i < actualInArray.length; i++) {
+
+ failMsg.append(actualInArray[i]);
+ }
+
+ failMsg.append("\nEXPECTED: ");
+ for (int i = 0; i < expectedInArray.length; i++) {
+
+ failMsg.append(expectedInArray[i]);
+ }
+ }
+ }
+
+ }
+ catch (IOException ioe) {
+ throw new PageFlowCompilerTestException("Can not read " + expected.getName());
+ }
+
+ if (failMsg.length() == 0) {
+ return null;
+ } else {
+ return (failMsg.toString() + "\n");
+ }
+ }
+
+ /**
+ * Get all generated struts config files from the test output area
+ *
+ * @param outputDir --
+ * File, the test output directory
+ * @return Map <File.getName(),File>
+ */
+ protected Map getActualGeneratedStrutsConfigFiles(File outputDir) {
+ File classesDir = new File(outputDir.getAbsolutePath() + File.separatorChar + TestPropertyMgr.DIRNAME_WEB_INF + File.separatorChar + TestPropertyMgr.JAVAC_OUTPUT_DIR_NAME);
+ File generatedDir = new File(classesDir, TestPropertyMgr.DIRNAME_PAGEFLOW_STRUTS_GENERATED);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("ACTUAL_GENERATDSTRUTSCONFIG_PARENT:" + generatedDir.getPath());
+ }
+
+ if (!generatedDir.exists()) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(generatedDir.getAbsolutePath() + " did not exist.");
+ }
+
+ return null;
+ }
+ return getGeneratedStrutsConfigFiles(generatedDir, TestPropertyMgr.EXT_XML);
+ }
+
+ /**
+ * Find the Files which is the file we expect to be created by the compiler.
+ *
+ * @param outputDir -
+ * File, the test output directory
+ * @param testName -
+ * the page flow directory name under test
+ * @return Map <File.getName(),File>
+ */
+ protected Map getExpectedGeneratedStrutsConfigFiles(File outputDir, String expectedDirName) {
+ File parent = new File(outputDir, expectedDirName);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("EXPECTED_GENERATEDSTRUTSCONFIG_PARENT:" + parent.getPath());
+ }
+
+ return getGeneratedStrutsConfigFiles(parent, TestPropertyMgr.EXT_EXPECTED);
+ }
+
+ /**
+ * Get the actual compiler test errororwarning output file
+ *
+ * @param outputDir The test output directory
+ * @return File
+ */
+ protected File getActualOutputFile(File outputDir) {
+ File file = new File(outputDir, TestPropertyMgr.FILENAME_ACTUAL_OUTPUT);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("ACTUAL_OUTPUT_FILE:" + file.getPath());
+ }
+ return file;
+ }
+
+ /**
+ * Get the expected warnings or errors file.
+ *
+ * @param outputdir
+ * @param testName
+ */
+ protected File getExpectedWarningsOrErrorsFile(File outputDir, String expectedDirName) {
+ String filename = TestPropertyMgr.PREFIX_WARNINGS_OR_ERRORS + TestPropertyMgr.EXT_EXPECTED;
+ File file = new File(outputDir, expectedDirName + File.separatorChar + filename);
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("EXPECTED_OUTPUT_FILE:" + file.getPath());
+ }
+ return file;
+ }
+
+ /**
+ * Get the struts config files in a HashMap. The files must be direct
+ * children of the parent directory
+ *
+ * @param parent the directory where the actual or expected config files reside
+ * @param extension the struts config file extention, .xml for the actual, .expected for the expected
+ * @return Map <File.getName(),File>
+ */
+ protected Map getGeneratedStrutsConfigFiles(File parent, String extension) {
+ Map map = new HashMap();
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("?IS_THIS_A_STRUTS_CONFIG_FILE with prefix and extension:"
+ + TestPropertyMgr.PREFIX_CONFIG_FILE + " and " + extension);
+ }
+
+ if (parent == null) {
+ LOGGER.error(parent.getAbsolutePath() + " was null.");
+ return map;
+ }
+ if (!parent.isDirectory()) {
+ LOGGER.error(parent.getAbsolutePath() + " was not a directory.");
+ return map;
+ }
+ if (!parent.exists()) {
+ LOGGER.error(parent.getAbsolutePath() + " did not exist.");
+ return map;
+ }
+ File[] files = parent.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ /* Is this the file we want to compile? */
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("?IS_THIS_A_STRUTS_CONFIG_FILE:" + files[i].getPath());
+ }
+ if (!files[i].isDirectory() && files[i].getName().endsWith(extension)
+ && files[i].getName().startsWith(TestPropertyMgr.PREFIX_CONFIG_FILE)) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("ADDING_A_STRUTS_CONFIG_FILE:" + files[i].getPath());
+ }
+ map.put(files[i].getName(), files[i]);
+ }
+ }
+ return map;
+ }
+
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/OutputHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTest.java?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTest.java (added)
+++ beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTest.java Thu Sep 15 10:43:52 2005
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.test.compiler;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.Arrays;
+import java.util.Set;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+public class PageFlowCompilerTest
+ extends TestCase {
+
+ /**
+ * Test Log.
+ */
+ private static final Log LOGGER = LogFactory.getLog(PageFlowCompilerTest.class);
+
+ /**
+ * The parent directory of the filesToCompile.
+ */
+ private File _testDir;
+
+ /**
+ * The directory to which the compiler will write the actual file.
+ */
+ private File _outputDir;
+
+ /**
+ * The handler to process the compiler outputs and compare with the expected
+ */
+ private OutputHandler _outputHandler = new OutputHandler();
+
+ protected void setUp()
+ throws Exception {
+ super.setUp();
+ System.out.println("Compiling: " + this.getName());
+ // Set up test resources into the _outputDir
+ TestUtil.createCompilerResources(_testDir, _outputDir);
+ }
+
+ /**
+ * Constructor for PageFlowCompilerTest. A PageFlowCompilerTest is created
+ * by a PageflowCompilerTestSuite.
+ *
+ * @param testName Take the test directory (pageflow) name as the test name
+ * @param outputDir the directory for the compiler output
+ * @param testDir the directory that contains the tests
+ */
+ public PageFlowCompilerTest(String testName, File outputDir, File testDir) {
+ super(testName);
+ _outputDir = outputDir;
+ _testDir = testDir;
+ }
+
+ /**
+ * Run a JUnit TestCase which will attempt to compile pageflow controller
+ * files and any controls files in the test directory and
+ * analyze the compiler output results.
+ * <p/>
+ * This is intended to be called by the runner.
+ *
+ * @throws PageFlowCompilerTestException Each compilation of a page flow is considered a junit test, and each test
+ * uses the same runTest() method.
+ * <p/>
+ * The runTest() method follows the below algorithm:
+ * <p/>
+ * 1. Setup: Copy the page flow and its expected results to a build
+ * directory. 2. Compile: Try to compile the page flow and its controls. Any
+ * warning or error messages are piped to a warningorerrors.actual file. A
+ * jpf-struts-config file MAY have been created. 3. Compare: The compiler
+ * may have produced certain files. These files need to be compared to files
+ * that are KNOWN to be correct. The correctness is determined by the test
+ * author.
+ * <p/>
+ * The supported file comparisons are: A jpf-struts-config-*.xml file and A
+ * warningsorerrors.actual file.
+ * <p/>
+ * If the test has a .expected file, then compiler MUST produce a
+ * duplicate .actual file. If the files differ, the test will fail. If you
+ * have a .expected file, without a corresponding .actual file, the test
+ * will fail. File comparisons, are generally, just
+ * line by line diffs.
+ */
+ protected void runTest()
+ throws Throwable, FileNotFoundException {
+
+ String webappRoot = _outputDir.getAbsolutePath();
+ if (LOGGER.isDebugEnabled())
+ LOGGER.debug("webappRoot = " + webappRoot);
+
+ String outputFailure = "";
+ String strutsOutputFailure = "";
+ assertNotNull("outputDir not exist", _outputDir);
+
+ RunApt runner = new RunApt();
+ runner.runControlsApt(webappRoot, true, TestPropertyMgr.getControlsCompilerSwitch());
+ runner.runPageFlowApt(webappRoot, true, TestPropertyMgr.getJPFCompilerSwitch());
+
+ outputFailure = _outputHandler.handleWarningsOrErrors(_outputDir, TestPropertyMgr.EXPECTED_DIR_NAME);
+ strutsOutputFailure = _outputHandler.handleGeneratedStrutsConfigFileComparisons(_outputDir, TestPropertyMgr.EXPECTED_DIR_NAME);
+
+ assertNull(outputFailure, outputFailure);
+ assertNull(strutsOutputFailure, strutsOutputFailure);
+ }
+
+ /**
+ * The suite method will generate a list of TestCases to run, and run them.
+ * TODO will need to use a test config file to parse for test locations and
+ * what tests to run and what not to run etc.
+ */
+ public static Test suite()
+ throws PageFlowCompilerTestException {
+ File suiteTestDir;
+ File suiteOutputDir;
+
+ TestSuite suite = new TestSuite();
+ suite.setName("PageflowCompilerTestSuite");
+
+ /* Get the test suite location. */
+ String testSuitePath = TestPropertyMgr.getTestSuiteDir();
+
+ /* Verify the existance of the directory. */
+ suiteTestDir = new File(testSuitePath);
+ assertTrue(TestPropertyMgr.PROPERTY_TESTSUITE_TESTS_DIR + " [" + testSuitePath + "]: did not exist.",
+ suiteTestDir.exists());
+ assertTrue(TestPropertyMgr.PROPERTY_TESTSUITE_TESTS_DIR + " [" + testSuitePath + "]: is not a directory.",
+ suiteTestDir.isDirectory());
+
+ /* Get test output location. */
+ String outputPath = TestPropertyMgr.getOutputDir();
+
+ /* Verify and create the output directory for the suite. */
+ suiteOutputDir = new File(outputPath);
+ /* Create the output directory. */
+ if (!suiteOutputDir.exists())
+ suiteOutputDir.mkdirs();
+
+ /* Get included and excluded test lists */
+ Set includedTests = TestPropertyMgr.getPropertySet(TestPropertyMgr.PROPERTY_TESTSUITE_INCLUDE_LIST);
+ Set excludedTests = TestPropertyMgr.getPropertySet(TestPropertyMgr.PROPERTY_TESTSUITE_EXCLUDE_LIST);
+
+ /* Each direct child directory of the suiteTestDir is a test. */
+ File[] directories = suiteTestDir.listFiles();
+ // Sort the directories to keep the test close to consistent on
+ // different platforms
+ Arrays.sort(directories);
+ for (int i = 0; i < directories.length; i++) {
+ File test = directories[i];
+ String name = test.getName().trim();
+ if (test.isDirectory() && !name.startsWith(".")) {
+ /* Determine if it is included or excluded. */
+ File myoutputdir = new File(suiteOutputDir, name);
+ if (includedTests.size() > 0
+ && !includedTests.contains("${" + TestPropertyMgr.PROPERTY_TESTSUITE_INCLUDE_LIST + "}")
+ && !includedTests.contains("ALL")) {
+ if (includedTests.contains(name) && !excludedTests.contains(name)) {
+ /* Add the JUnit TestCase. */
+ suite.addTest(new PageFlowCompilerTest(name, myoutputdir, test));
+ }
+ } else {
+ if (!excludedTests.contains(name)) {
+ /* Add the JUnit TestCase. */
+ suite.addTest(new PageFlowCompilerTest(name, myoutputdir, test));
+ }
+ }
+ } // end IF isDirectory
+ }// end FOR directories
+
+ System.out.println("This PageFlowCompilerTest has " + suite.countTestCases() + " test cases.");
+
+ return suite;
+ }
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTestException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTestException.java?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTestException.java (added)
+++ beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTestException.java Thu Sep 15 10:43:52 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.test.compiler;
+
+public class PageFlowCompilerTestException
+ extends Exception {
+
+ PageFlowCompilerTestException() {
+ super();
+ }
+
+ PageFlowCompilerTestException(String message) {
+ super(message);
+ }
+
+ PageFlowCompilerTestException(Throwable cause) {
+ super(cause);
+ }
+
+ PageFlowCompilerTestException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/PageFlowCompilerTestException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java (added)
+++ beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java Thu Sep 15 10:43:52 2005
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.test.compiler;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+class RunApt {
+ private static Log LOGGER = LogFactory.getLog(RunApt.class);
+ private boolean _doCompile = false;
+
+ /**
+ * Run Page Flow apt on the given file/directory.
+ *
+ * @param webappRootPath the path to the root of the target webapp.
+ * @param doCompile whether or not perform javac compile after apt
+ * @param doPageFlow the switch to turn on/off of the JPF compiler
+ *
+ * @throws FileNotFoundException
+ * @throws IOException
+ */
+ public void runPageFlowApt(String webappRootPath, boolean doCompile, boolean doPageFlow)
+ throws FileNotFoundException, IOException, PageFlowCompilerTestException {
+ if (doPageFlow){
+ _doCompile = doCompile;
+ File srcDir = new File(webappRootPath);
+ File tempDir = new File(srcDir.getAbsolutePath() + File.separatorChar +
+ TestPropertyMgr.DIRNAME_WEB_INF + File.separatorChar +
+ TestPropertyMgr.TMPBEANSRC_DIR_NAME);
+ tempDir.mkdirs();
+ runApt(webappRootPath, tempDir, srcDir);
+ }
+ }
+
+ /**
+ * Run Controls apt on the given file/directory.
+ *
+ * @param webappRootPath the path to the root of the target webapp.
+ * @param doCompile
+ * @param doControls switch to turn on/off the controls compiler
+ *
+ * @throws FileNotFoundException
+ * @throws IOException
+ */
+ public void runControlsApt(String webappRootPath, boolean doCompile, boolean doControls)
+ throws FileNotFoundException, IOException, PageFlowCompilerTestException {
+
+ if(doControls){
+ _doCompile = doCompile;
+ File srcDir = new File(webappRootPath + File.separatorChar + TestPropertyMgr.DIRNAME_WEB_INF
+ + File.separatorChar + TestPropertyMgr.SRC_DIR_NAME);
+ // no files need to be compiled
+ if (!srcDir.exists()) {
+ }
+ else {
+ File tempDir = new File(srcDir.getAbsolutePath() + File.separatorChar +
+ TestPropertyMgr.DIRNAME_WEB_INF + File.separatorChar +
+ TestPropertyMgr.TMPBEANSRC_DIR_NAME);
+ tempDir.mkdirs();
+ runApt(webappRootPath, tempDir, srcDir);
+
+ }
+ }
+ }
+
+ /**
+ * Run apt on the given files/directories.
+ *
+ * @param webappRoot
+ * @param tempDir
+ * @param srcDir the path to the root of the target webapp.
+ */
+ public void runApt(String webappRoot, File tempDir, File srcDir)
+ throws FileNotFoundException, IOException, PageFlowCompilerTestException {
+
+ ArrayList<String> aptArgs = new ArrayList<String>();
+
+ // add apt call
+ aptArgs.add("apt");
+
+ // -nocompile
+ if (!_doCompile)
+ aptArgs.add("-nocompile");
+
+ // target directory for apt-generated files (unused for us)
+ aptArgs.add("-s");
+ aptArgs.add(webappRoot + File.separatorChar + TestPropertyMgr.DIRNAME_WEB_INF + File.separatorChar
+ + TestPropertyMgr.TMPBEANSRC_DIR_NAME);
+
+ // target directory for processor and javac generated class files
+ aptArgs.add("-d");
+ aptArgs.add(webappRoot + File.separatorChar + TestPropertyMgr.DIRNAME_WEB_INF + File.separatorChar
+ + TestPropertyMgr.JAVAC_OUTPUT_DIR_NAME);
+
+ // Build the classpath
+ String classpath = TestPropertyMgr.getClassPath();
+ if (classpath == null){
+ LOGGER.error("No class path defined!", (new Exception("No class path defined!")));
+ }
+
+ aptArgs.add("-classpath");
+
+ if (LOGGER.isDebugEnabled())
+ LOGGER.debug("Classpath: " + classpath.toString());
+
+ aptArgs.add(classpath);
+
+ aptArgs.add("-sourcepath");
+ aptArgs.add(tempDir.getAbsolutePath());
+
+ aptArgs.add("-Aweb.content.root=" + webappRoot);
+ aptArgs.add("-Aweb.output.root=" + webappRoot);
+ aptArgs.add("-Aweb.source.roots=" + webappRoot + File.pathSeparatorChar + webappRoot + File.separatorChar
+ + TestPropertyMgr.DIRNAME_WEB_INF + File.separatorChar + TestPropertyMgr.SRC_DIR_NAME);
+
+ // Find all the source files by the specified extentions
+ Set srcExtentions = TestPropertyMgr.getSrcExts();
+ String[] files = TestUtil.findSrcFiles(srcDir, srcExtentions);
+
+ // Copy all the source file into the test area and rename them into .java
+ TestUtil.processTestSrcFiles(srcDir, tempDir, files);
+ for (int i = 0; i < files.length; i++)
+ aptArgs.add(files[i]);
+
+ String[] aptArgsArray = aptArgs.toArray(new String[aptArgs.size()]);
+
+ // Invoke apt using a new process
+ String ls_str;
+ File SystemErr = new File(webappRoot + File.separatorChar + TestPropertyMgr.PREFIX_WARNINGS_OR_ERRORS
+ + TestPropertyMgr.EXT_ACTUAL);
+ FileWriter errorsFw = new FileWriter(SystemErr, true);
+ BufferedReader aptErrBufferedReader = null;
+
+ try {
+ Process ls_proc = Runtime.getRuntime().exec(aptArgsArray);
+ aptErrBufferedReader = new BufferedReader(new InputStreamReader(ls_proc.getErrorStream()));
+
+ try {
+ while ((ls_str = aptErrBufferedReader.readLine()) != null) {
+ errorsFw.write(ls_str);
+ }
+ }
+ catch (IOException eWhile) {
+ eWhile.printStackTrace();
+ }
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ finally {
+ if (errorsFw != null)
+ errorsFw.close();
+ if (aptErrBufferedReader != null)
+ aptErrBufferedReader.close();
+ }
+ }
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestPropertyMgr.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestPropertyMgr.java?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestPropertyMgr.java (added)
+++ beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestPropertyMgr.java Thu Sep 15 10:43:52 2005
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.test.compiler;
+
+import java.io.File;
+import java.util.Set;
+import java.util.TreeSet;
+
+final class TestPropertyMgr {
+
+ // Defaults
+ public static final String TESTS_DIR_NAME = "testsuite";
+
+ public static final String OUTPUT_DIR_NAME = "compiler";
+
+ public static final String EXPECTED_DIR_NAME = "expectedOutput";
+
+ public static final String TMPBEANSRC_DIR_NAME = ".tmpbeansrc";
+
+ public static final String SRC_DIR_NAME = "src";
+
+ public static final String JAVAC_OUTPUT_DIR_NAME = "classes";
+
+ public static final String LIST_DELIM = ",";
+
+ public static final String DEFAULT_SRC_EXT = "java,jpf,jsfb,jpfs,jcx,jcs,app";
+
+ public static final String UNSET = "UNSET";
+
+ // test properties
+ public static final String PROPERTY_JPF_COMPILER_SWITCH = "jpfCompilerSwitch";
+
+ public static final String PROPERTY_CONTROLS_COMPILER_SWITCH = "controlsCompilerSwitch";
+
+ public static final String PROPERTY_CLASS_PATH = "compiler-tests.classpath";
+
+ public static final String PROPERTY_TESTSUITE_TESTS_DIR = "testsuite.dir";
+
+ public static final String PROPERTY_TESTSUITE_OUTPUT_DIR = "test.output.dir";
+
+ public static final String PROPERTY_TESTSUITE_INCLUDE_LIST = "included.test.list";
+
+ public static final String PROPERTY_TESTSUITE_EXCLUDE_LIST = "excluded.test.list";
+
+ public static final String PROPERTY_TEST_HOME_DIR = "compiler.test.home";
+
+ public static final String PROPERTY_TEST_OUTPUT_DIR = "test.output.dir";
+
+ // extentions
+ public static final String EXT_XML = ".xml";
+
+ public static final String EXT_EXPECTED = ".expected";
+
+ public static final String EXT_ACTUAL = ".actual";
+
+ // directory names
+ public static final String DIRNAME_WEB_INF = "WEB-INF";
+
+ public static final String DIRNAME_PAGEFLOW_STRUTS_GENERATED = "_pageflow";
+
+ // prefixes
+ public static final String PREFIX_CONFIG_FILE = "jpf-struts-config-";
+
+ public static final String PREFIX_WARNINGS_OR_ERRORS = "warningsorerrors";
+
+ // output file name
+ public static final String FILENAME_ACTUAL_OUTPUT = PREFIX_WARNINGS_OR_ERRORS + EXT_ACTUAL;
+
+ // local path representation
+ public static final String LOCAL_PATH_STRING = "[LOCAL_PATH]";
+
+ // exception messages
+ public static final String EXCEPTION_FILE_COMPARISON = "The file comparison encountered an IOException.";
+
+ public static final String EXCEPTION_TEST_HOME_DIR_UNSET = PROPERTY_TEST_HOME_DIR + " " + UNSET;
+
+ public static final String EXCEPTION_TESTSUITE_TESTS_DIR_UNSET = PROPERTY_TESTSUITE_TESTS_DIR + " " + UNSET;
+
+ public static final String EXCEPTION_TEST_OUTPUT_DIR_UNSET =
+ PROPERTY_TEST_OUTPUT_DIR + " OR " + PROPERTY_TEST_HOME_DIR + " " + UNSET;
+
+ /**
+ * Property getters
+ */
+
+ public static String getTestHomeDir() throws PageFlowCompilerTestException {
+ String testHomeDir = (System.getProperty(PROPERTY_TEST_HOME_DIR, UNSET)).trim();
+
+ if (testHomeDir.equals(TestPropertyMgr.UNSET) ||
+ testHomeDir.contains("${" + PROPERTY_TEST_HOME_DIR + "}") ||
+ testHomeDir.length() == 0)
+ throw new PageFlowCompilerTestException(EXCEPTION_TEST_HOME_DIR_UNSET);
+ else return testHomeDir;
+ }
+
+ public static String getTestSuiteDir()
+ throws PageFlowCompilerTestException {
+
+ String suiteDir = (System.getProperty(PROPERTY_TESTSUITE_TESTS_DIR, UNSET)).trim();
+
+ if (suiteDir.contains("${" + PROPERTY_TESTSUITE_TESTS_DIR + "}") ||
+ suiteDir.equals(TestPropertyMgr.UNSET) ||
+ suiteDir.length() == 0) {
+ // default here
+ String testHome;
+ try {
+ testHome = getTestHomeDir();
+ }
+ catch (Exception re) {
+ throw new PageFlowCompilerTestException(EXCEPTION_TEST_OUTPUT_DIR_UNSET);
+ }
+ suiteDir = testHome + File.separatorChar + TESTS_DIR_NAME;
+ }
+
+ return suiteDir;
+ }
+
+ public static String getOutputDir() throws PageFlowCompilerTestException {
+
+ String outputDir = System.getProperty(PROPERTY_TEST_OUTPUT_DIR, UNSET);
+
+ if (UNSET.equals(outputDir) || outputDir.length() == 0)
+ throw new PageFlowCompilerTestException(EXCEPTION_TEST_OUTPUT_DIR_UNSET);
+
+ return outputDir + File.separatorChar + OUTPUT_DIR_NAME;
+ }
+
+ public static Set getPropertySet(String property) {
+ String propertyString = System.getProperty(property, UNSET);
+ Set propertySet = new TreeSet();
+ if (!propertyString.equals(UNSET) || propertyString.length() != 0)
+ propertySet = TestUtil.parseList(propertyString, LIST_DELIM);
+
+ return propertySet;
+ }
+
+ public static Set getSrcExts() {
+ return TestUtil.parseList(DEFAULT_SRC_EXT, LIST_DELIM);
+ }
+
+ public static String getClassPath() {
+ String classPath = System.getProperty(PROPERTY_CLASS_PATH, UNSET);
+ if (classPath.equals(UNSET) || classPath.length() == 0 || classPath.contains("${" + PROPERTY_CLASS_PATH + "}"))
+ return null;
+ else return classPath;
+ }
+
+ public static Boolean getJPFCompilerSwitch() {
+ String flag = System.getProperty(PROPERTY_JPF_COMPILER_SWITCH, UNSET);
+ return !(flag.toUpperCase()).equals("OFF");
+ }
+
+ public static Boolean getControlsCompilerSwitch() {
+ String flag = System.getProperty(PROPERTY_CONTROLS_COMPILER_SWITCH, UNSET);
+ return !(flag.toUpperCase()).equals("OFF");
+ }
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestPropertyMgr.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestUtil.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestUtil.java?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestUtil.java (added)
+++ beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestUtil.java Thu Sep 15 10:43:52 2005
@@ -0,0 +1,422 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.test.compiler;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+
+class TestUtil {
+
+ /* do not construct */
+ private TestUtil() {
+ }
+
+ // read and process the warningorerror file contents into a set of Strings.
+ public static Set<String> processWarningOrErrorContent(File file,
+ boolean localize,
+ boolean trim,
+ boolean removeXMLComment,
+ boolean removeJpfLineNumbers)
+ throws PageFlowCompilerTestException {
+
+ Set stringSet = null;
+ StringBuffer fileInString = new StringBuffer();
+ String outputDir = file.getParent();
+ LineNumberReader lineReader = null;
+ try {
+ lineReader = new LineNumberReader(new FileReader(file));
+ String line = "";
+
+ while (line != null) {
+ line = lineReader.readLine();
+ if (line != null) {
+ line = processLine(line, localize, trim, removeXMLComment, removeJpfLineNumbers, outputDir);
+ fileInString.append(line);
+ }
+ }
+ stringSet = parseList(fileInString.toString(), "^");
+ }
+ catch (IOException ioe) {
+ throw new PageFlowCompilerTestException("Failed to read file: " + file.getName(), ioe);
+ }
+ finally {
+ try{if(lineReader != null) lineReader.close();} catch(IOException ignore) {}
+ }
+
+ return stringSet;
+ }
+
+ /**
+ * Do a line by line comparison of 2 files.
+ *
+ * @param expected
+ * @param actual
+ * @param localize
+ * @param trim
+ * @param removeXMLComment
+ * @throws PageFlowCompilerTestException
+ */
+ public static String fileCompare(File expected,
+ File actual,
+ boolean localize,
+ boolean trim,
+ boolean removeXMLComment,
+ boolean removeJpfLineNumbers)
+ throws PageFlowCompilerTestException {
+
+ StringBuffer failMsg = new StringBuffer();
+
+ if (expected == null)
+ failMsg.append("Expected file must not be null.\n");
+
+ if (actual == null)
+ failMsg.append("Actual file must not be null.\n");
+
+ String outputDir = actual.getParent();
+
+ LineNumberReader expectedReader = null;
+ LineNumberReader actualReader = null;
+ try {
+ expectedReader = new LineNumberReader(new FileReader(expected));
+ actualReader = new LineNumberReader(new FileReader(actual));
+
+ String expectedLine = "";
+ String actualLine = "";
+
+ while (expectedLine != null && actualLine != null) {
+ expectedLine = expectedReader.readLine();
+ actualLine = actualReader.readLine();
+ String expectedNull = "In file [" + actual.getName() + "] line "
+ + Integer.toString(actualReader.getLineNumber()) + ": " + actualLine
+ + ", Expected null.";
+ String actualNull = "In file [" + actual.getName() + "] line "
+ + Integer.toString(actualReader.getLineNumber() + 1) + ": null, \nExpected "
+ + expectedLine;
+
+ if (actualLine == null && expectedLine == null)
+ break;
+ else if (actualLine == null)
+ failMsg.append(actualNull + "\n");
+ else if (expectedLine == null)
+ failMsg.append(expectedNull + "\n");
+
+ if (actualLine != null && expectedLine != null) {
+ expectedLine =
+ processLine(expectedLine, localize, trim, removeXMLComment, removeJpfLineNumbers, outputDir);
+
+ actualLine =
+ processLine(actualLine, localize, trim, removeXMLComment, removeJpfLineNumbers, outputDir);
+
+ if (!expectedLine.equals(actualLine)) {
+ failMsg.append("In file: [" + actual.getName() + "] line "
+ + Integer.toString(actualReader.getLineNumber()) + ": " + actualLine
+ + "\nExpected " + expectedLine + "\n");
+ }
+ }
+
+ }
+ }
+ catch (IOException ioe) {
+ throw new PageFlowCompilerTestException(TestPropertyMgr.EXCEPTION_FILE_COMPARISON, ioe);
+ }
+ finally {
+ try{if(expectedReader != null) expectedReader.close();} catch(IOException ignore) {}
+ try{if(actualReader != null) actualReader.close();} catch(IOException ignore) {}
+ }
+
+ if (failMsg.length() == 0)
+ return null;
+ else return failMsg.toString();
+ }
+
+ /**
+ * Return a Set of Strings, tokenized by the delimiter.
+ *
+ * @param list
+ * @param delim
+ * @return a Set of Strings
+ */
+ protected static Set parseList(String list, String delim) {
+ Set set = new TreeSet();
+ StringTokenizer tokenizer = new StringTokenizer(list, delim);
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ set.add(token.trim());
+ }
+ return set;
+ }
+
+ /**
+ * Copy the test resources (.jpf, etc...) to the output directory for this
+ * test, and create a WEB-INF and WEB-INF/classes directories for the
+ * generated files, and reset jpf, jpfs, jcs, etc to .java file for apt to
+ * process.
+ *
+ * @param testDir
+ * @param outputDir
+ */
+ public static void createCompilerResources(File testDir, File outputDir)
+ throws PageFlowCompilerTestException {
+
+ try {
+ copyDir(testDir, outputDir);
+ }
+ catch (IOException ioe) {
+ throw new PageFlowCompilerTestException("Couldn't copy directory.", ioe);
+ }
+
+ // Create a needed WEB-INF for the compiler.
+ File webinf = new File(outputDir, TestPropertyMgr.DIRNAME_WEB_INF);
+ if (!webinf.exists()) {
+ webinf.mkdirs();
+ }
+
+ // Create the class output dir "WEB-INF/classes" for javac output.
+ File webinfClasses = new File(webinf, "classes");
+ if (!webinfClasses.exists()) {
+ webinfClasses.mkdirs();
+ }
+ }
+
+ /**
+ * A recursive directory copy.
+ *
+ * @param src
+ * @param dst
+ * @throws IOException
+ */
+ public static void copyDir(File src, File dst) throws IOException {
+ if (src.isDirectory() && !dst.exists())
+ dst.mkdirs();
+
+ File[] children = src.listFiles();
+ for (int i = 0; i < children.length; i++) {
+ if (children[i].isDirectory()) {
+ copyDir(children[i], new File(dst, children[i].getName()));
+ }
+ else {
+ fileCopy(children[i], new File(dst, children[i].getName()));
+ }
+ }
+ }
+
+ /**
+ * Convenience method to delete a directory
+ *
+ * @param src directory to be deleted
+ * @throws IOException
+ */
+ public static void deleteDir(File src)
+ throws IOException {
+ if (!src.exists())
+ throw new IOException("src does not exists");
+
+ File[] children = src.listFiles();
+ for (int i = 0; i < children.length; i++) {
+ if (children[i].delete()) {}
+ else {
+ deleteDir(children[i]);
+ if (children[i].delete())
+ ;
+ }
+ }
+ if (src.delete()) {}
+ else throw new IOException("Could not delete: " + src);
+ }
+
+ // Find all src files recursively
+ public static String[] findSrcFiles(File file, Set<String> extentions)
+ throws PageFlowCompilerTestException {
+ ArrayList<String> foundFiles = new ArrayList<String>();
+ scanDir(file, extentions, foundFiles);
+ if (foundFiles.size() == 0)
+ throw new PageFlowCompilerTestException("No File found!");
+ return foundFiles.toArray(new String[foundFiles.size()]);
+ }
+
+ public static void processTestSrcFiles(File srcDir, File tempDir, String[] files)
+ throws IOException {
+
+ String srcDirPath = srcDir.getAbsolutePath();
+ for (int i = 0; i < files.length; i++) {
+ File srcFile = new File(files[i]);
+ String theFile = files[i];
+ if (theFile.startsWith(srcDirPath)) {
+ int trim = srcDirPath.length();
+ theFile = theFile.substring(trim, theFile.length());
+ }
+ int dot = theFile.lastIndexOf('.');
+ theFile = tempDir.getAbsolutePath() + theFile.substring(0, dot) + ".java";
+ files[i] = theFile;
+ File destFile = new File(files[i]);
+ destFile.getParentFile().mkdirs();
+ TestUtil.fileCopy(srcFile, destFile);
+ }
+ }
+
+ /**
+ * Process a line.
+ * <p/>
+ * This method is used to remove 'uncomparable' items from a line: like
+ * hardcoded paths, whitespace at the end of a line, unix/windows paths, and
+ * line numbers in exceptions.
+ *
+ * @param line
+ * @param localize
+ * @param trim
+ * @param removeXMLComment
+ * @param removeJpfLineNumbers
+ * @param outputDir
+ * @return String
+ */
+ private static String processLine(String line,
+ boolean localize,
+ boolean trim,
+ boolean removeXMLComment,
+ boolean removeJpfLineNumbers,
+ String outputDir) {
+ if (trim)
+ line = line.trim();
+ if (localize)
+ line = localizePath(line, outputDir);
+ if (removeXMLComment)
+ line = removeXMLComment(line);
+ if (removeJpfLineNumbers)
+ line = removeJpfLineNumbers(line);
+ return line;
+ }
+
+ /**
+ * Replace any path referring to the .jpf's parent with [LOCAL_PATH], and
+ * call normalizePath().
+ *
+ * @param path
+ * @param outputDir
+ * @return String
+ */
+ private static String localizePath(String path, String outputDir) {
+ String root = normalizePath(outputDir.trim());
+ path = normalizePath(path);
+ return path.replaceAll(root, TestPropertyMgr.LOCAL_PATH_STRING);
+ }
+
+ /**
+ * Replace backslashes with forwardslashes, and remove references to the
+ * current directory ("/.").
+ *
+ * @param path
+ * @return String
+ */
+ private static String normalizePath(String path) {
+ return path.replace('\\', '/').replaceAll("/./", "/");
+ }
+
+ /**
+ * Remove line numbers, which may cause problems for a file comparison.
+ *
+ * @param line
+ * @return String
+ */
+ private static String removeJpfLineNumbers(String line) {
+ /*
+ * @todo: will probably need support for jpfs files. A list of supported
+ * file extensions might be a good way to go.
+ */
+ String regex = "jpfs:[0-9]+:[0-9]+:";
+ String processed = line.replaceAll(regex, "jpfs");
+ regex = "app:[0-9]+:[0-9]+:";
+ processed = processed.replaceAll(regex, "app");
+ regex = "jpf:[0-9]+:[0-9]+:";
+ processed = processed.replaceAll(regex, "jpf");
+ return processed;
+ }
+
+ /**
+ * Remove xml comments, which may cause problems for a file comparison.
+ *
+ * @param line
+ * @return String
+ */
+ private static String removeXMLComment(String line) {
+ String regex = "<!--.*-->";
+ return line.replaceAll(regex, "");
+ }
+
+ /**
+ * Convenience method to copy files from one location to another
+ *
+ * @param file1 source file path
+ * @param file2 destination file path
+ * @throws FileNotFoundException
+ * @throws IOException
+ */
+ private static void fileCopy(File file1, File file2)
+ throws FileNotFoundException, IOException {
+
+ FileReader in = new FileReader(file1);
+ FileWriter out = null;
+
+ try {
+ out = new FileWriter(file2);
+ int c;
+
+ while ((c = in.read()) != -1) {
+ out.write(c);
+ }
+ }
+ finally {
+ in.close();
+ if (out != null)
+ out.close();
+ }
+ }
+
+ /**
+ * Implements a tail recursive file scanner
+ */
+ private static void scanDir(File file, Set<String> extentions, ArrayList<String> foundList)
+ throws PageFlowCompilerTestException {
+
+ if (!file.exists())
+ return;
+
+ if (file.isFile()) {
+ String name = file.getName().trim();
+ int dotIndex = name.lastIndexOf(".");
+ if (extentions.contains(name.substring(dotIndex + 1, name.length()))) {
+ foundList.add(file.getAbsolutePath());
+ }
+ // ignoring file types that are not defined in the extention set
+ }
+
+ if (file.isDirectory() && file.getName().charAt(0) != '.') {
+ File[] files = file.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ scanDir(files[i], extentions, foundList);
+ }
+ }
+ }
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/TestUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page1.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page1.jsp?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page1.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page1.jsp Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page1.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page2.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page2.jsp?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page2.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page2.jsp Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/GA_DeprecationWarning/Page2.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/WEB-INF/src/global/Global.app
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/WEB-INF/src/global/Global.app?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/WEB-INF/src/global/Global.app (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/WEB-INF/src/global/Global.app Thu Sep 15 10:43:52 2005
@@ -0,0 +1,37 @@
+package global;
+
+import org.apache.beehive.netui.pageflow.GlobalApp;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/*******************************************************************************
+ * ******************************************************************************
+ *
+ * @desc: This Global.app file is designed to compile without errors.
+ *
+ * @result: This test must compile without errors.
+ *
+ ******************************************************************************/
+@Jpf.Controller() public class Global extends GlobalApp {
+ /**
+ * @jpf:action
+ * @jpf:forward name="page1" path="/GA_DeprecationWarning/Page1.jsp"
+ */
+ @Jpf.Action(forwards =
+ { @Jpf.Forward(name = "page1",
+ path = "/GA_DeprecationWarning/Page1.jsp") })
+ protected Forward begin() {
+ return new Forward("page1");
+ }
+
+ /**
+ * @jpf:action
+ * @jpf:forward name="page2" path="/GA_DeprecationWarning/Page2.jsp"
+ */
+ @Jpf.Action(forwards =
+ { @Jpf.Forward(name = "page2",
+ path = "/GA_DeprecationWarning/Page2.jsp") })
+ protected Forward page2() {
+ return new Forward("page2");
+ }
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/WEB-INF/src/global/Global.app
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/expectedOutput/struts-config--global.expected
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/expectedOutput/struts-config--global.expected?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/expectedOutput/struts-config--global.expected (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/expectedOutput/struts-config--global.expected Thu Sep 15 10:43:52 2005
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
+<!--Generated from /WEB-INF/.tmpbeansrc/WEB-INF/src/global/Global.java on Tue Aug 09 16:45:33 MDT 2005-->
+<struts-config>
+ <form-beans/>
+ <global-exceptions/>
+ <global-forwards>
+ <forward name="_auto" path=""/>
+ </global-forwards>
+ <action-mappings>
+ <action path="/begin" type="org.apache.beehive.netui.pageflow.internal.FlowControllerAction" parameter="global.Global" scope="request" validate="false">
+ <forward name="page1" path="/GA_DeprecationWarning/Page1.jsp" contextRelative="true"/>
+ </action>
+ <action path="/page2" type="org.apache.beehive.netui.pageflow.internal.FlowControllerAction" parameter="global.Global" scope="request" validate="false">
+ <forward name="page2" path="/GA_DeprecationWarning/Page2.jsp" contextRelative="true"/>
+ </action>
+ </action-mappings>
+ <controller processorClass="org.apache.beehive.netui.pageflow.PageFlowRequestProcessor" inputForward="true" className="org.apache.beehive.netui.pageflow.config.PageFlowControllerConfig">
+ <set-property property="isSharedFlow" value="true"/>
+ <set-property property="isReturnToPageDisabled" value="true"/>
+ <set-property property="isReturnToActionDisabled" value="true"/>
+ <set-property property="sharedFlows" value="__global=global.Global"/>
+ <set-property property="controllerClass" value="global.Global"/>
+ <set-property property="isMissingDefaultMessages" value="true"/>
+ </controller>
+ <message-resources key="_defaultMsgs" parameter="org.apache.beehive.netui.pageflow.validation.defaultMessages" null="true"/>
+</struts-config>
\ No newline at end of file
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/expectedOutput/warningsorerrors.expected
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/expectedOutput/warningsorerrors.expected?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/expectedOutput/warningsorerrors.expected (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_DeprecationWarning/expectedOutput/warningsorerrors.expected Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+Note: [LOCAL_PATH]/WEB-INF\src\WEB-INF\.tmpbeansrc\global\Global.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: [LOCAL_PATH]/WEB-INF\src\WEB-INF\.tmpbeansrc\global\Global.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: [LOCAL_PATH]/WEB-INF\.tmpbeansrc\WEB-INF\src\global\Global.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: [LOCAL_PATH]/WEB-INF/.tmpbeansrc/WEB-INF\src\global\Global.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.
\ No newline at end of file
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Global.app
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Global.app?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Global.app (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Global.app Thu Sep 15 10:43:52 2005
@@ -0,0 +1,53 @@
+package global;
+
+import org.apache.beehive.netui.pageflow.*;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ *******************************************************************************
+ *
+ * Test description
+ * -----------------------------------------------------------------------------
+ * This is a Global PageFlow file and resides in test directory GA_WrongLocation.
+ * According to the spec. a global PageGroup (Global.app) can only reside in
+ * the WEB-INF/src/global directory.
+ *
+ * Expected results
+ * -----------------------------------------------------------------------------
+ * The compiler should catch the fact that the file is in the wrong location and
+ * issue an error.
+ *
+ ******************************************************************************/
+@Jpf.Controller()
+public class Global extends GlobalApp
+ {
+ /**
+ * @jpf:action
+ * @jpf:forward name="page1" path="Page1.jsp"
+ */
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name = "page1",
+ path = "Page1.jsp")
+ })
+ protected Forward page1()
+ {
+ return new Forward("page1");
+ }
+
+ /**
+ * @jpf:action
+ * @jpf:forward name="page2" path="Page2.jsp"
+ */
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name = "page2",
+ path = "Page2.jsp")
+ })
+ protected Forward page2()
+ {
+ return new Forward("page2");
+ }
+ }
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Global.app
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page1.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page1.jsp?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page1.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page1.jsp Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page1.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page2.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page2.jsp?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page2.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page2.jsp Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/GA_WrongLocation/Page2.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/expectedOutput/warningsorerrors.expected
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/expectedOutput/warningsorerrors.expected?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/expectedOutput/warningsorerrors.expected (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongLocation/expectedOutput/warningsorerrors.expected Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+[LOCAL_PATH]/WEB-INF\.tmpbeansrc\GA_WrongLocation\Global.java:34: warning: File "Page1.jsp" could not be found in the web application. protected Forward page1() ^[LOCAL_PATH]/WEB-INF\.tmpbeansrc\GA_WrongLocation\Global.java:49: warning: File "Page2.jsp" could not be found in the web application. protected Forward page2() ^[LOCAL_PATH]/WEB-INF\.tmpbeansrc\GA_WrongLocation\Global.java:22: Global.app must be in the /WEB-INF/src/global directory.public class Global extends GlobalApp ^Note: [LOCAL_PATH]/WEB-INF\.tmpbeansrc\GA_WrongLocation\Global.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.1 error2 warnings
\ No newline at end of file
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Global.app
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Global.app?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Global.app (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Global.app Thu Sep 15 10:43:52 2005
@@ -0,0 +1,49 @@
+package invalid.packagename;
+
+import org.apache.beehive.netui.pageflow.GlobalApp;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+/**
+ *******************************************************************************
+ *
+ * @desc: This global PageFlow file is in an invalid package. The spec. says that the
+ * package name should be in package "global".
+ *
+ * @result: The compiler should catch this error and issue an error message, as well
+ * as issue an error for not being in WEB-INF/src.
+ *
+ ******************************************************************************/
+@Jpf.Controller()
+public class Global extends GlobalApp
+ {
+ /**
+ * @jpf:action
+ * @jpf:forward name="page1" path="Page1.jsp"
+ */
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name = "page1",
+ path = "Page1.jsp")
+ })
+ protected Forward begin()
+ {
+ return new Forward("page1");
+ }
+
+ /**
+ * @jpf:action
+ * @jpf:forward name="page2" path="Page2.jsp"
+ */
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(
+ name = "page2",
+ path = "Page2.jsp")
+ })
+ protected Forward page2()
+ {
+ return new Forward("page2");
+ }
+ }
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Global.app
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page1.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page1.jsp?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page1.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page1.jsp Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page1.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page2.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page2.jsp?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page2.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page2.jsp Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/GA_WrongPkg/Page2.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/expectedOutput/warningsorerrors.expected
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/expectedOutput/warningsorerrors.expected?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/expectedOutput/warningsorerrors.expected (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/GA_WrongPkg/expectedOutput/warningsorerrors.expected Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+[LOCAL_PATH]/WEB-INF\.tmpbeansrc\GA_WrongPkg\Global.java:30: warning: File "Page1.jsp" could not be found in the web application. protected Forward begin() ^[LOCAL_PATH]/WEB-INF\.tmpbeansrc\GA_WrongPkg\Global.java:45: warning: File "Page2.jsp" could not be found in the web application. protected Forward page2() ^[LOCAL_PATH]/WEB-INF\.tmpbeansrc\GA_WrongPkg\Global.java:18: The package must be "global".public class Global extends GlobalApp ^[LOCAL_PATH]/WEB-INF\.tmpbeansrc\GA_WrongPkg\Global.java:18: Global.app must be in the /WEB-INF/src/global directory.public class Global extends GlobalApp ^Note: [LOCAL_PATH]/WEB-INF\.tmpbeansrc\GA_WrongPkg\Global.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.2 errors2 warnings
\ No newline at end of file
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/Controller.jpf
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/Controller.jpf?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/Controller.jpf (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/Controller.jpf Thu Sep 15 10:43:52 2005
@@ -0,0 +1,22 @@
+/*
+ * Test defect: http://issues.apache.org/jira/browse/BEEHIVE-389
+ * NPE when compiling a page flow with @Jpf.MessageBundle that lacks 'bundlePath' attribute
+ * Expected: There should be a compiler error message
+ */
+package Jira389;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+@Jpf.Controller(
+ messageBundles={
+ @Jpf.MessageBundle()
+ },
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ }
+ )
+public class Controller extends PageFlowController
+{
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/Controller.jpf
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/index.jsp?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/index.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/index.jsp Thu Sep 15 10:43:52 2005
@@ -0,0 +1,16 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+<netui:html>
+ <head>
+ <title>
+ LongLived Page Flows
+ </title>
+ </head>
+ <body>
+ <h3>LongLived Page Flows</h3>
+ <netui:anchor action="goNoFrames">without frames</netui:anchor><br>
+ <netui:anchor action="goFrames">with frames</netui:anchor>
+ </body>
+</netui:html>
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/Jira389/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/expectedOutput/warningsorerrors.expected
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/expectedOutput/warningsorerrors.expected?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/expectedOutput/warningsorerrors.expected (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira389/expectedOutput/warningsorerrors.expected Thu Sep 15 10:43:52 2005
@@ -0,0 +1 @@
+[LOCAL_PATH]/WEB-INF\.tmpbeansrc\Jira389\Controller.java:20: Attribute "bundlePath" must be present.public class Controller extends PageFlowController ^1 error
\ No newline at end of file
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/Controller.jpf
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/Controller.jpf?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/Controller.jpf (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/Controller.jpf Thu Sep 15 10:43:52 2005
@@ -0,0 +1,15 @@
+package Jira390;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+@Jpf.Controller(
+ strutsMerge="myMerge.xml",
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ }
+)
+public class Controller extends PageFlowController
+{
+}
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/Controller.jpf
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/index.jsp?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/index.jsp (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/index.jsp Thu Sep 15 10:43:52 2005
@@ -0,0 +1,16 @@
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%>
+<netui:html>
+ <head>
+ <title>
+ LongLived Page Flows
+ </title>
+ </head>
+ <body>
+ <h3>LongLived Page Flows</h3>
+ <netui:anchor action="goNoFrames">without frames</netui:anchor><br>
+ <netui:anchor action="goFrames">with frames</netui:anchor>
+ </body>
+</netui:html>
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/myMerge.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/myMerge.xml?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/myMerge.xml (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/myMerge.xml Thu Sep 15 10:43:52 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
+<struts-config>
+ <form-beans/>
+ <global-exceptions/>
+ <action-mappings>
+ </action-mappings>
+ <controller processorClass="foo"/>
+</struts-config>
\ No newline at end of file
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/Jira390/myMerge.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/expectedOutput/struts-config-Jira390.expected
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/expectedOutput/struts-config-Jira390.expected?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/expectedOutput/struts-config-Jira390.expected (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira390/expectedOutput/struts-config-Jira390.expected Thu Sep 15 10:43:52 2005
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
+<!--Generated from /WEB-INF/.tmpbeansrc/Jira390/Controller.java and /Jira390/myMerge.xml on Tue Aug 09 22:05:35 MDT 2005-->
+<struts-config>
+ <form-beans/>
+ <global-exceptions/>
+ <global-forwards>
+ <forward name="_auto" path=""/>
+ </global-forwards>
+ <action-mappings>
+ <action path="/begin" type="org.apache.beehive.netui.pageflow.internal.FlowControllerAction" parameter="Jira390.Controller" scope="request" validate="false" className="org.apache.beehive.netui.pageflow.config.PageFlowActionMapping">
+ <set-property property="readonly" value="true"/>
+ <set-property property="simpleAction" value="true"/>
+ <set-property property="defaultForward" value="_defaultForward"/>
+ <forward name="_defaultForward" path="/index.jsp"/>
+ </action>
+ </action-mappings>
+ <controller processorClass="foo" inputForward="true" className="org.apache.beehive.netui.pageflow.config.PageFlowControllerConfig">
+ <set-property property="isReturnToPageDisabled" value="true"/>
+ <set-property property="isReturnToActionDisabled" value="true"/>
+ <set-property property="sharedFlows" value=""/>
+ <set-property property="controllerClass" value="Jira390.Controller"/>
+ <set-property property="isMissingDefaultMessages" value="true"/>
+ </controller>
+ <message-resources key="_defaultMsgs" parameter="org.apache.beehive.netui.pageflow.validation.defaultMessages" null="true"/>
+</struts-config>
\ No newline at end of file
Added: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira611/Jira611/child/Controller.jpf
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/test/src/compilerTests/testsuite/Jira611/Jira611/child/Controller.jpf?rev=289284&view=auto
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/testsuite/Jira611/Jira611/child/Controller.jpf (added)
+++ beehive/trunk/netui/test/src/compilerTests/testsuite/Jira611/Jira611/child/Controller.jpf Thu Sep 15 10:43:52 2005
@@ -0,0 +1,25 @@
+package Jira611.child;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+@Jpf.Controller(
+ simpleActions={
+ @Jpf.SimpleAction(name="begin", path="index.jsp")
+ }
+)
+public class Controller extends Jira611.parent.Controller
+{
+ @Jpf.Action(
+ forwards = {
+ @Jpf.Forward(name="test", path="index.jsp")
+ })
+ public Forward abstractAction(){
+ return new Forward("test");
+ }
+
+}
+
Propchange: beehive/trunk/netui/test/src/compilerTests/testsuite/Jira611/Jira611/child/Controller.jpf
------------------------------------------------------------------------------
svn:eol-style = native