[java-metadata-aggregator COMMIT] in /trunk/aggregator-pipeline/src: main/java/net/shibboleth/metadata/dom/ElementFor...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Mar 23 12:39:17 GMT 2012
Author: lajoie
Date: Fri Mar 23 12:39:16 2012
New Revision: 199
URL: http://svn.shibboleth.net/view/java-metadata-aggregator?rev=199&view=rev
Log:
Unit tests for ElementFormattingStage and some small bug fixes
Added:
trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/ElementFormattingStageTest.java (with props)
trunk/aggregator-pipeline/src/test/resources/net/
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/ElementFormattingStage/
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/ElementFormattingStage/prettyPrint.xml (with props)
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/ElementFormattingStage/singleLine.xml (with props)
trunk/aggregator-pipeline/src/test/resources/net/shibboleth/metadata/dom/ElementFormattingStage/unformatted.xml (with props)
Modified:
trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/ElementFormattingStage.java
Modified: trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/ElementFormattingStage.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/ElementFormattingStage.java?rev=199&r1=198&r2=199&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/ElementFormattingStage.java (original)
+++ trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/ElementFormattingStage.java Fri Mar 23 12:39:16 2012
@@ -19,9 +19,11 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
@@ -33,14 +35,21 @@
import net.shibboleth.metadata.pipeline.BaseStage;
import net.shibboleth.metadata.pipeline.StageProcessingException;
import net.shibboleth.metadata.util.ItemMetadataSupport;
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NullableElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+import net.shibboleth.utilities.java.support.collection.CollectionSupport;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Assert;
+import net.shibboleth.utilities.java.support.logic.TrimOrNullStringFunction;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
/**
@@ -67,7 +76,7 @@
* name, if they are not in a namespace, or via the form '{' + namespace URI + '}' + local name if they are in a
* namespace.
*/
- private List<String> cdataSectionElements;
+ private List<String> cdataSectionElements = Collections.emptyList();
/** The factory used to create the {@link Transformer} used to format the elements. */
private TransformerFactory transformerFactory;
@@ -86,10 +95,15 @@
*
* @param seperator line separator character to use
*/
- public synchronized void setLineSeperator(@Nonnull @NotEmpty final String seperator) {
- ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
- ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
- lineSeperator = Assert.isNotNull(StringSupport.trimOrNull(seperator), "Line seperator can not be null");
+ public synchronized void setLineSeperator(@Nullable final String seperator) {
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ if (seperator == null) {
+ lineSeperator = "";
+ } else {
+ lineSeperator = seperator;
+ }
}
/**
@@ -130,6 +144,35 @@
ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
indentSize = (int) Assert.isGreaterThanOrEqual(0, size, "Indentation size must be 0 or greater");
+ }
+
+ /**
+ * Gets the list of elements whose content should be wrapped in CDATA sections.
+ *
+ * <p>
[... 45 lines stripped ...]
More information about the commits
mailing list