Author: tfischer
Date: Mon Oct 31 02:10:16 2011
New Revision: 1195311
URL: http://svn.apache.org/viewvc?rev=1195311&view=rev
Log:
added a source transformer which can load all source files for the current
output into one model
Added:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformerTest.java
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected1.xml
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected2.xml
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/package.html
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/conf/
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/outlets/
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/outlets/outlets.xml
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source1.xml
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source2.xml
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/file.vm
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/filename.vm
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/license.vm
Modified:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java
Modified:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java?rev=1195311&r1=1195310&r2=1195311&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
(original)
+++
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
Mon Oct 31 02:10:16 2011
@@ -60,9 +60,10 @@ public class Controller
/**
* All known ExistingTargetStrategies.
- * TODO move to a better place.
+ * TODO: move to a better place.
*/
- private static List<ExistingTargetStrategy> EXISTING_TARGET_STRATEGIES;
+ private static final List<ExistingTargetStrategy>
+ EXISTING_TARGET_STRATEGIES;
static
{
@@ -209,6 +210,7 @@ public class Controller
}
sourceProvider = overrideSourceProvider;
}
+ controllerState.setSourceProvider(sourceProvider);
sourceProvider.init(
unitConfiguration.getConfigurationHandlers(),
controllerState);
@@ -226,6 +228,7 @@ public class Controller
controllerState,
unitConfiguration);
}
+ controllerState.setSourceProvider(null);
}
/**
@@ -316,8 +319,7 @@ public class Controller
}
controllerState.setOutputFile(null);
- Outlet filenameOutlet
- = output.getFilenameOutlet();
+ Outlet filenameOutlet = output.getFilenameOutlet();
OutletReference contentOutletReference
= new OutletReference(
filenameOutlet.getName());
@@ -503,7 +505,7 @@ public class Controller
*
* @return the transformed root element, not null.
*/
- protected SourceElement transformSource(
+ public SourceElement transformSource(
final SourceElement rootElement,
final List<SourceTransformerDefinition>
transformerDefinitions,
final ControllerState controllerState)
Modified:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java?rev=1195311&r1=1195310&r2=1195311&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java
(original)
+++
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java
Mon Oct 31 02:10:16 2011
@@ -33,6 +33,7 @@ import org.apache.torque.generator.outle
import org.apache.torque.generator.qname.Namespace;
import org.apache.torque.generator.qname.QualifiedName;
import org.apache.torque.generator.source.SourceElement;
+import org.apache.torque.generator.source.SourceProvider;
import org.apache.torque.generator.variable.VariableStore;
/**
@@ -42,6 +43,11 @@ import org.apache.torque.generator.varia
public class ControllerState
{
/**
+ * The Source provider which is currently used.
+ */
+ private SourceProvider sourceProvider;
+
+ /**
* The output which currently processed .
*/
private Output output;
@@ -97,6 +103,26 @@ public class ControllerState
private Namespace outletNamespace;
/**
+ * Returns the source provider which is currently in use.
+ *
+ * @return the current source provider.
+ */
+ public SourceProvider getSourceProvider()
+ {
+ return sourceProvider;
+ }
+
+ /**
+ * Sets the source provider which is currently in use.
+ *
+ * @param sourceProvider the current source provider.
+ */
+ public void setSourceProvider(SourceProvider sourceProvider)
+ {
+ this.sourceProvider = sourceProvider;
+ }
+
+ /**
* Returns the output declaration which is currently processed.
*
* @return the output declaration which is currently processed, may be null
@@ -480,7 +506,8 @@ public class ControllerState
public String toString()
{
StringBuffer result = new StringBuffer();
- result.append("output=").append(output)
+ result.append("sourceProvider=").append(sourceProvider)
+ .append("output=").append(output)
.append("outputFilePath=").append(outputFile)
.append("\noutletNamespace=").append(outletNamespace)
.append("\noutlets=").append(outlets)
Added:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java
(added)
+++
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,278 @@
+package org.apache.torque.generator.source.transform;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.torque.generator.configuration.ConfigurationException;
+import org.apache.torque.generator.configuration.ConfigurationHandlers;
+import org.apache.torque.generator.configuration.UnitConfiguration;
+import org.apache.torque.generator.configuration.controller.Output;
+import org.apache.torque.generator.control.Controller;
+import org.apache.torque.generator.control.ControllerState;
+import org.apache.torque.generator.source.Source;
+import org.apache.torque.generator.source.SourceElement;
+import org.apache.torque.generator.source.SourceException;
+import org.apache.torque.generator.source.SourcePath;
+import org.apache.torque.generator.source.SourceProcessConfiguration;
+import org.apache.torque.generator.source.SourceProvider;
+import org.apache.torque.generator.source.SourceTransformerDefinition;
+
+/**
+ * A SourceTransformer which loads all sources which are defined in the current
+ * output into the source graph.
+ * The sources are added into new created element. If such elements
+ * already exists in the defined, generation is skipped
+ * (preventing an infinite loop).
+ *
+ * @version $Id: $
+ */
+public class LoadAllSourceFilesTransformer implements SourceTransformer
+{
+ /** The class log. */
+ private static Log log
+ = LogFactory.getLog(LoadAllSourceFilesTransformer.class);
+
+ /**
+ * The element to where the new elements are added.
+ * This element must already exist.
+ */
+ private String addTo;
+
+ /**
+ * The name of the new element(s) into which a loaded source is added /
+ * the loaded sources are added.
+ */
+ private String newElement;
+
+ /**
+ * Whether all sources are loaded into one new Element.
+ * If false, a new element is created for every source.
+ */
+ private boolean combineSources;
+
+ /**
+ * Loads the additional source into the current source graph.
+ *
+ * @param root the root of the source graph, not null.
+ * @param controllerState the controller state, not null.
+ *
+ * @throws SourceTransformerException if the additional source
+ * cannot be loaded or the element to add to does not exist.
+ */
+ public SourceElement transform(
+ SourceElement root,
+ ControllerState controllerState)
+ throws SourceTransformerException
+ {
+ Output output = controllerState.getOutput();
+ log.debug("adding all sources of output " + output.getName()
+ + " to current source tree at element " + addTo);
+ // the element where the additional source should be anchored.
+ SourceElement addToSourceElement;
+ List<SourceElement> sourceElementList
+ = SourcePath.getElementsFromRoot(root, addTo);
+ if (sourceElementList.isEmpty())
+ {
+ throw new SourceTransformerException(
+ "Source element " + addTo + " does not exist");
+ }
+ addToSourceElement = sourceElementList.get(0);
+
+
+ UnitConfiguration unitConfiguration
+ = controllerState.getUnitConfiguration();
+ ConfigurationHandlers configurationHandlers
+ = unitConfiguration.getConfigurationHandlers();
+ Controller helperController = new Controller();
+
+ SourceElement newSourceElement = new SourceElement(newElement);
+ boolean newSourceElementAdded = false;
+ try
+ {
+ // do not change state of original source provider,
+ // instead make a copy.
+ SourceProvider sourceProvider
+ = controllerState.getSourceProvider().copy();
+ sourceProvider.init(configurationHandlers, controllerState);
+
+ while (sourceProvider.hasNext())
+ {
+ Source source = sourceProvider.next();
+ SourceElement rootElement = source.getRootElement();
+ SourceProcessConfiguration sourceProcessConfiguration
+ = output.getSourceProcessConfiguration();
+ List<SourceTransformerDefinition> transformerDefinitions
+ = sourceProcessConfiguration.getTransformerDefinitions();
+ transformerDefinitions
+ = new ArrayList<SourceTransformerDefinition>
+ (transformerDefinitions);
+ Iterator<SourceTransformerDefinition> transformerDefinitionIt
+ = transformerDefinitions.iterator();
+ while (transformerDefinitionIt.hasNext())
+ {
+ SourceTransformerDefinition transformerDefinition
+ = transformerDefinitionIt.next();
+ if (this.equals(
+ transformerDefinition.getSourceTransformer()))
+ {
+ transformerDefinitionIt.remove();
+ }
+ }
+
+ rootElement = helperController.transformSource(
+ rootElement,
+ transformerDefinitions,
+ controllerState);
+
+ newSourceElement.getChildren().add(rootElement);
+ if (!newSourceElementAdded)
+ {
+ addToSourceElement.getChildren().add(newSourceElement);
+ newSourceElementAdded = true;
+ }
+
+ if (!combineSources)
+ {
+ newSourceElement = new SourceElement(newElement);
+ newSourceElementAdded = false;
+ }
+ }
+ }
+ catch (ConfigurationException e)
+ {
+ throw new SourceTransformerException(e);
+ }
+ catch (SourceException e)
+ {
+ throw new SourceTransformerException(e);
+ }
+
+ log.debug("additional sources loaded.");
+ return root;
+ }
+
+ /**
+ * Returns the path to the source element to where the new elements
+ * are added. This element must already exist.
+ *
+ * @return the path to the anchor element.
+ */
+ public String getAddTo()
+ {
+ return addTo;
+ }
+
+ /**
+ * Sets the path to the source element to where the new elements
+ * are added. This element must already exist.
+ *
+ * @param addTo the path to the anchor element.
+ */
+ public void setAddTo(String addTo)
+ {
+ this.addTo = addTo;
+ }
+
+ /**
+ * Returns the name of the new element(s) into which a loaded source
+ * is added / the loaded sources are added.
+ *
+ * @return the name of the new element.
+ */
+ public String getNewElement()
+ {
+ return newElement;
+ }
+
+ /**
+ * Sets the name of the new element(s) into which a loaded source
+ * is added / the loaded sources are added.
+ *
+ * @param newElement the name of the new element.
+ */
+ public void setNewElement(String newElement)
+ {
+ this.newElement = newElement;
+ }
+
+ /**
+ * Returns whether all sources are be loaded into one new Element.
+ * If false, a new element is created for every source.
+ *
+ * @return whether all sources are be loaded into one new Element.
+ */
+ public boolean isCombineSources()
+ {
+ return combineSources;
+ }
+
+ /**
+ * Sets whether all sources are be loaded into one new Element.
+ * If false, a new element is created for every source.
+ *
+ * @param combineSources whether all sources are be loaded
+ * into one new Element.
+ */
+ public void setCombineSources(boolean combineSources)
+ {
+ this.combineSources = combineSources;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return new HashCodeBuilder()
+ .append(addTo)
+ .append(combineSources)
+ .append(newElement)
+ .toHashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj.getClass() != getClass())
+ {
+ return false;
+ }
+ LoadAllSourceFilesTransformer other
+ = (LoadAllSourceFilesTransformer) obj;
+ return new EqualsBuilder()
+ .append(other.addTo, this.addTo)
+ .append(other.combineSources, this.combineSources)
+ .append(other.newElement, this.newElement)
+ .isEquals();
+ }
+}
Added:
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformerTest.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformerTest.java?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformerTest.java
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformerTest.java
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,73 @@
+package org.apache.torque.generator.source.transform;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static junitx.framework.FileAssert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.torque.generator.BaseTest;
+import org.apache.torque.generator.configuration.UnitDescriptor;
+import org.apache.torque.generator.configuration.paths.CustomProjectPaths;
+import
org.apache.torque.generator.configuration.paths.DefaultTorqueGeneratorPaths;
+import
org.apache.torque.generator.configuration.paths.Maven2DirectoryProjectPaths;
+import org.apache.torque.generator.control.Controller;
+import org.junit.Test;
+
+/**
+ * Tests whether the loadAllSourceTransformer works correctly.
+ */
+public class LoadAllSourceFilesTransformerTest extends BaseTest
+{
+ private static final String TEST_RESOURCES_ROOT
+ = "src/test/loadAllSourceFilesTransformer";
+
+ @Test
+ public void testLoadAllSourceFilesTransformerGeneration() throws Exception
+ {
+ File targetDir = new File("target/test/loadAllSourceFilesTransformer");
+ FileUtils.deleteDirectory(targetDir);
+ Controller controller = new Controller();
+ List<UnitDescriptor> unitDescriptors = new ArrayList<UnitDescriptor>();
+ CustomProjectPaths projectPaths = new CustomProjectPaths(
+ new Maven2DirectoryProjectPaths(
+ new File(TEST_RESOURCES_ROOT)));
+ projectPaths.setOutputDirectory(null, targetDir);
+ unitDescriptors.add(new UnitDescriptor(
+ UnitDescriptor.Packaging.DIRECTORY,
+ projectPaths,
+ new DefaultTorqueGeneratorPaths()));
+ controller.run(unitDescriptors);
+
+ assertTrue(targetDir.exists());
+ File targetFile = new File(targetDir, "output_for_source1.xml");
+ assertTrue(targetFile.exists());
+ File expectedFile = new File(TEST_RESOURCES_ROOT, "expected1.xml");
+ assertEquals(expectedFile, targetFile);
+ targetFile = new File(targetDir, "output_for_source2.xml");
+ assertTrue(targetFile.exists());
+ expectedFile = new File(TEST_RESOURCES_ROOT, "expected2.xml");
+ assertEquals(expectedFile, targetFile);
+ }
+}
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected1.xml
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected1.xml?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected1.xml
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected1.xml
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,44 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<rootOfSource1>
+ <element1OfSource1>
+ <child1OfSource1/>
+ </element1OfSource1>
+ <allSources>
+ <newElement>
+ <rootOfSource1>
+ <element1OfSource1>
+ <child1OfSource1/>
+ </element1OfSource1>
+ <allSources/>
+ <element2OfSource1/>
+ </rootOfSource1>
+ </newElement>
+ <newElement>
+ <rootOfSource2>
+ <allSources/>
+ <element1OfSource2>
+ <child1OfSource2/>
+ </element1OfSource2>
+ <element2OfSource2/>
+ </rootOfSource2>
+ </newElement>
+ </allSources>
+ <element2OfSource1/>
+</rootOfSource1>
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected2.xml
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected2.xml?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected2.xml
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/expected2.xml
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,44 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<rootOfSource2>
+ <allSources>
+ <newElement>
+ <rootOfSource1>
+ <element1OfSource1>
+ <child1OfSource1/>
+ </element1OfSource1>
+ <allSources/>
+ <element2OfSource1/>
+ </rootOfSource1>
+ </newElement>
+ <newElement>
+ <rootOfSource2>
+ <allSources/>
+ <element1OfSource2>
+ <child1OfSource2/>
+ </element1OfSource2>
+ <element2OfSource2/>
+ </rootOfSource2>
+ </newElement>
+ </allSources>
+ <element1OfSource2>
+ <child1OfSource2/>
+ </element1OfSource2>
+ <element2OfSource2/>
+</rootOfSource2>
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/package.html
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/package.html?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/package.html
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/package.html
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,24 @@
+<!--
+ Copyright 2001-2010 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.
+-->
+
+<h2>Test configuration for the LoadAllSourceFilesTransformer</h2>
+
+<p>
+ This directory and its subdirectories contain a test configuration
+ which is used by the LoadAllSourceFilesTransformerTest to check whether
+ the LoadAllSourceFilesTransformer works correctly.
+</p>
+
\ No newline at end of file
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/conf/control.xml
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/conf/control.xml?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/conf/control.xml
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/conf/control.xml
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<control loglevel="debug"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration
http://db.apache.org/torque/4.0/generator/configuration.xsd"
+ xmlns="http://db.apache.org/torque/4.0/generator/configuration">
+ <output name="output" file="output.txt">
+ <filenameOutlet
+ xsi:type="velocityOutlet"
+ path="filename.vm">
+ </filenameOutlet>
+ <source xsi:type="fileSource" format="xml">
+ <transformer
class="org.apache.torque.generator.source.transform.LoadAllSourceFilesTransformer">
+ <addTo>/*/allSources</addTo>
+ <newElement>newElement</newElement>
+ <combineSources>false</combineSources>
+ </transformer>
+ <include>source1.xml</include>
+ <include>source2.xml</include>
+ </source>
+ <outlet name="fileOutlet"/>
+ </output>
+</control>
+
\ No newline at end of file
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/outlets/outlets.xml
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/outlets/outlets.xml?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/outlets/outlets.xml
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/outlets/outlets.xml
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<outlets xmlns="http://db.apache.org/torque/4.0/generator/configuration"
+
xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration
http://db.apache.org/torque/4.0/generator/configuration.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <outlet name="fileOutlet"
+ xsi:type="velocityOutlet"
+ path="file.vm">
+ <mergepoint name="license">
+ <action xsi:type="applyAction" outlet="licenseOutlet" />
+ </mergepoint>
+ <mergepoint name="content">
+ <action xsi:type="applyAction" outlet="debugSourceOutlet" />
+ </mergepoint>
+ </outlet>
+ <outlet name="debugSourceOutlet"
+ xsi:type="javaOutlet"
+ class="org.apache.torque.generator.outlet.java.XmlOutlet">
+ </outlet>
+ <outlet name="licenseOutlet"
+ xsi:type="velocityOutlet"
+ path="license.vm">
+ </outlet>
+</outlets>
\ No newline at end of file
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source1.xml
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source1.xml?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source1.xml
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source1.xml
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<rootOfSource1>
+ <element1OfSource1>
+ <child1OfSource1/>
+ </element1OfSource1>
+ <allSources/>
+ <element2OfSource1/>
+</rootOfSource1>
\ No newline at end of file
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source2.xml
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source2.xml?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source2.xml
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/src/source2.xml
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<rootOfSource2>
+ <allSources/>
+ <element1OfSource2>
+ <child1OfSource2/>
+ </element1OfSource2>
+ <element2OfSource2/>
+</rootOfSource2>
\ No newline at end of file
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/file.vm
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/file.vm?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/file.vm
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/file.vm
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,19 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+$torqueGen.mergepoint("license")
+$torqueGen.mergepoint("content")
\ No newline at end of file
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/filename.vm
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/filename.vm?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/filename.vm
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/filename.vm
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,18 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+output_for_${torqueGen.getSourceFile().getName()}
\ No newline at end of file
Added:
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/license.vm
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/license.vm?rev=1195311&view=auto
==============================================================================
---
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/license.vm
(added)
+++
db/torque/torque4/trunk/torque-generator/src/test/loadAllSourceFilesTransformer/src/main/torque-gen/templates/license.vm
Mon Oct 31 02:10:16 2011
@@ -0,0 +1,18 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]