[java-metadata-aggregator] 01/02: MDA-281 - Remove ComponentInfo system
Ian Young
ian at iay.org.uk
Wed Mar 29 15:21:49 UTC 2023
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch main
in repository java-metadata-aggregator.
View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=9de4db2caa6804f3252d80ec0dc1e440576c11ad
commit 9de4db2caa6804f3252d80ec0dc1e440576c11ad
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Wed Mar 29 14:13:28 2023 +0100
MDA-281 - Remove ComponentInfo system
https://shibboleth.atlassian.net/browse/MDA-281
---
.../metadata/pipeline/AbstractStage.java | 8 --
.../metadata/pipeline/ComponentInfo.java | 98 ------------------
.../metadata/pipeline/SimplePipeline.java | 8 --
.../net/shibboleth/metadata/AssertSupport.java | 64 ------------
.../dom/MultiOutputXSLTransformationStageTest.java | 7 --
.../metadata/dom/XMLSignatureSigningStageTest.java | 5 -
.../dom/XMLSignatureValidationStageTest.java | 4 -
.../metadata/dom/XSLTtransformationStageTest.java | 8 --
.../metadata/dom/XSLValidationStageTest.java | 4 -
.../metadata/pipeline/ComponentInfoTest.java | 115 ---------------------
.../pipeline/ItemIdTransformStageTest.java | 9 +-
.../metadata/pipeline/PipelineMergeStageTest.java | 4 +-
.../metadata/pipeline/SimplePipelineTest.java | 3 -
13 files changed, 4 insertions(+), 333 deletions(-)
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/AbstractStage.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/AbstractStage.java
index 8ebebdc..c18fb04 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/AbstractStage.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/AbstractStage.java
@@ -17,7 +17,6 @@
package net.shibboleth.metadata.pipeline;
-import java.time.Instant;
import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;
@@ -75,16 +74,9 @@ public abstract class AbstractStage<T> extends AbstractIdentifiableInitializable
throws StageProcessingException {
checkComponentActive();
- final var start = Instant.now();
-
if (getCollectionPredicate().test(items)) {
doExecute(items);
}
-
- final var componentInfo = new ComponentInfo(getId(), getClass(), start, Instant.now());
- for (final var item : items) {
- item.getItemMetadata().put(componentInfo);
- }
}
/**
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ComponentInfo.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ComponentInfo.java
deleted file mode 100644
index 4e13257..0000000
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/ComponentInfo.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID 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.
- */
-
-package net.shibboleth.metadata.pipeline;
-
-import java.time.Instant;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import net.shibboleth.metadata.ItemMetadata;
-
-/** Some basic information related to a component's processing of an {@link net.shibboleth.metadata.Item}. */
- at Immutable
-public class ComponentInfo implements ItemMetadata {
-
- /** ID of the component that operated on the element. */
- private final String componentId;
-
- /** Gets the type of the component that operated on the element. */
- private final Class<?> componentType;
-
- /** Instant when the component operation started. */
- private final Instant startInstant;
-
- /** Instant when the component operation completed. */
- private final Instant completeInstant;
-
- /**
- * Constructor.
- *
- * @param cId ID of the component performing the processing
- * @param cType type of the component performing the processing
- * @param start time at which the component started processing
- * @param complete time at which the component completed processing
- *
- * @since 0.10.0
- */
- public ComponentInfo(@Nonnull final String cId, @Nonnull final Class<?> cType,
- @Nonnull final Instant start, @Nonnull final Instant complete) {
- componentId = cId;
- componentType = cType;
- startInstant = start;
- completeInstant = complete;
- }
-
- /**
- * Gets the ID of the component that operated on the element.
- *
- * @return ID of the component that operated on the element
- */
- @Nullable public String getComponentId() {
- return componentId;
- }
-
- /**
- * Gets the type of the component that operated on the element.
- *
- * @return type of the component that operated on the element
- */
- @Nullable public Class<?> getComponentType() {
- return componentType;
- }
-
- /**
- * Gets the instant when the component operation started.
- *
- * @return instant when the component operation started
- */
- @Nullable public Instant getStartInstant() {
- return startInstant;
- }
-
- /**
- * Gets the instant when the component operation completed.
- *
- * @return instant when the component operation completed
- */
- @Nullable public Instant getCompleteInstant() {
- return completeInstant;
- }
-
-}
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SimplePipeline.java b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SimplePipeline.java
index 4531d6a..7dee36e 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SimplePipeline.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/pipeline/SimplePipeline.java
@@ -17,7 +17,6 @@
package net.shibboleth.metadata.pipeline;
-import java.time.Instant;
import java.util.Collections;
import java.util.List;
@@ -65,16 +64,9 @@ public class SimplePipeline<T> extends AbstractIdentifiableInitializableComponen
public void execute(@Nonnull @NonnullElements final List<Item<T>> items)
throws PipelineProcessingException {
- final var start = Instant.now();
-
for (final Stage<T> stage : getStages()) {
stage.execute(items);
}
-
- final var componentInfo = new ComponentInfo(getId(), getClass(), start, Instant.now());
- for (final var item : items) {
- item.getItemMetadata().put(componentInfo);
- }
}
@Override
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/AssertSupport.java b/mda-framework/src/test/java/net/shibboleth/metadata/AssertSupport.java
deleted file mode 100644
index b3414ec..0000000
--- a/mda-framework/src/test/java/net/shibboleth/metadata/AssertSupport.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID 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.
- */
-
-package net.shibboleth.metadata;
-
-import java.util.List;
-
-import net.shibboleth.metadata.pipeline.ComponentInfo;
-import net.shibboleth.shared.component.Component;
-import net.shibboleth.shared.logic.Constraint;
-
-import org.testng.Assert;
-
-/** Helper class that offers additional assertion checks. */
-public final class AssertSupport {
-
- /** Constructor. */
- private AssertSupport() {
- }
-
- /**
- * Checks that the given metadata element contains {@link ComponentInfo} information.
- *
- * @param metadataElement element to check, never null
- * @param expectedComponentInfos number of {@link ComponentInfo}s expected on the element, must be greater than 0
- * @param expectedComponentType type of {@link Component} that created that {@link ComponentInfo}, never null
- * @param expectedComponentId ID of the {@link Component} that created that {@link ComponentInfo}, never null
- */
- public static void assertValidComponentInfo(Item<?> metadataElement, int expectedComponentInfos,
- Class<? extends Component> expectedComponentType, String expectedComponentId) {
- Constraint.isNotNull(metadataElement, "Metadata element must not be null");
- Constraint.isGreaterThan(0, expectedComponentInfos, "Expected ComponentInfos must be greater than 0");
- Constraint.isNotNull(expectedComponentType, "Expected Component type must not be null");
- Constraint.isNotNull(expectedComponentId, "Expected Component ID must not be null");
-
- final List<ComponentInfo> compInfos = metadataElement.getItemMetadata().get(ComponentInfo.class);
- Assert.assertEquals(compInfos.size(), expectedComponentInfos);
-
- for (final ComponentInfo compInfo : compInfos) {
- if (expectedComponentType.equals(compInfo.getComponentType())
- && expectedComponentId.equals(compInfo.getComponentId())) {
- Assert.assertNotNull(compInfo.getCompleteInstant());
- return;
- }
- }
-
- Assert.fail("Metadata element does not contain a ComponentInfo from a component of type "
- + expectedComponentType.getCanonicalName() + " with an ID of " + expectedComponentId);
- }
-}
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/MultiOutputXSLTransformationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/MultiOutputXSLTransformationStageTest.java
index 8204581..b92c355 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/MultiOutputXSLTransformationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/MultiOutputXSLTransformationStageTest.java
@@ -26,7 +26,6 @@ import java.util.Set;
import javax.annotation.concurrent.Immutable;
-import net.shibboleth.metadata.AssertSupport;
import net.shibboleth.metadata.ErrorStatus;
import net.shibboleth.metadata.InfoStatus;
import net.shibboleth.metadata.Item;
@@ -86,7 +85,6 @@ public class MultiOutputXSLTransformationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, MultiOutputXSLTransformationStage.class, "test");
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
final Element expected = readXMLData("output.xml");
@@ -139,7 +137,6 @@ public class MultiOutputXSLTransformationStageTest extends BaseDOMTest {
final Set<String> names = new HashSet<>();
for (Item<Element> result : mdCol) {
- AssertSupport.assertValidComponentInfo(result, 1, MultiOutputXSLTransformationStage.class, "test");
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
names.add(result.unwrap().getNodeName());
}
@@ -174,7 +171,6 @@ public class MultiOutputXSLTransformationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, MultiOutputXSLTransformationStage.class, "test");
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
final Element expected = readXMLData("paramOutput.xml");
@@ -204,8 +200,6 @@ public class MultiOutputXSLTransformationStageTest extends BaseDOMTest {
final Set<String> names = new HashSet<>();
for (Item<Element> result : mdCol) {
- AssertSupport.assertValidComponentInfo(result, 1, MultiOutputXSLTransformationStage.class, "test");
-
// each output item should have preserved the TestInfo that was on the input
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
@@ -255,7 +249,6 @@ public class MultiOutputXSLTransformationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, MultiOutputXSLTransformationStage.class, "test");
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
Element expected = readXMLData("output.xml");
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/XMLSignatureSigningStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/XMLSignatureSigningStageTest.java
index 42f3ba2..d337d34 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/XMLSignatureSigningStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/XMLSignatureSigningStageTest.java
@@ -37,7 +37,6 @@ import org.xmlunit.builder.Input;
import org.xmlunit.diff.Diff;
import org.xmlunit.input.NormalizedSource;
-import net.shibboleth.metadata.AssertSupport;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.dom.ds.XMLDSIGSupport;
import net.shibboleth.shared.logic.ConstraintViolationException;
@@ -113,7 +112,6 @@ public class XMLSignatureSigningStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XMLSignatureSigningStage.class, "test");
Element expected = readXMLData("output.xml");
assertXMLIdentical(expected, result.unwrap());
@@ -152,7 +150,6 @@ public class XMLSignatureSigningStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XMLSignatureSigningStage.class, "test");
final Element expected = readXMLData("mda196.xml");
assertXMLIdentical(expected, result.unwrap());
@@ -212,7 +209,6 @@ public class XMLSignatureSigningStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol1.size(), 1);
final Item<Element> result1 = mdCol1.iterator().next();
- AssertSupport.assertValidComponentInfo(result1, 1, XMLSignatureSigningStage.class, "test");
Assert.assertFalse(containsCRs(result1.unwrap()));
/*
@@ -234,7 +230,6 @@ public class XMLSignatureSigningStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol2.size(), 1);
final Item<Element> result2 = mdCol2.iterator().next();
- AssertSupport.assertValidComponentInfo(result2, 1, XMLSignatureSigningStage.class, "test");
/*
* Compare the two results.
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/XMLSignatureValidationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/XMLSignatureValidationStageTest.java
index 85cd1ca..353a516 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/XMLSignatureValidationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/XMLSignatureValidationStageTest.java
@@ -24,7 +24,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import net.shibboleth.metadata.AssertSupport;
import net.shibboleth.metadata.ErrorStatus;
import net.shibboleth.metadata.Item;
import net.shibboleth.metadata.WarningStatus;
@@ -73,7 +72,6 @@ public class XMLSignatureValidationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XMLSignatureValidationStage.class, "test");
// There should not have been any errors.
final List<ErrorStatus> errors = result.getItemMetadata().get(ErrorStatus.class);
@@ -129,7 +127,6 @@ public class XMLSignatureValidationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XMLSignatureValidationStage.class, "test");
final DOMElementItem item2 = makeItem("entities2.xml");
@@ -237,7 +234,6 @@ public class XMLSignatureValidationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XMLSignatureValidationStage.class, "test");
// There should not have been any errors.
final List<ErrorStatus> errors = result.getItemMetadata().get(ErrorStatus.class);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/XSLTtransformationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/XSLTtransformationStageTest.java
index 5bd9323..ff05dd7 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/XSLTtransformationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/XSLTtransformationStageTest.java
@@ -31,7 +31,6 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamSource;
-import net.shibboleth.metadata.AssertSupport;
import net.shibboleth.metadata.ErrorStatus;
import net.shibboleth.metadata.InfoStatus;
import net.shibboleth.metadata.Item;
@@ -93,7 +92,6 @@ public class XSLTtransformationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XSLTransformationStage.class, "test");
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
final Element expected = readXMLData("output.xml");
@@ -126,7 +124,6 @@ public class XSLTtransformationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XSLTransformationStage.class, "test");
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
final Element expected = readXMLData("paramOutput.xml");
@@ -156,8 +153,6 @@ public class XSLTtransformationStageTest extends BaseDOMTest {
final Set<String> names = new HashSet<>();
for (Item<Element> result : mdCol) {
- AssertSupport.assertValidComponentInfo(result, 1, XSLTransformationStage.class, "test");
-
// each output item should have preserved the TestInfo that was on the input
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
@@ -207,7 +202,6 @@ public class XSLTtransformationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XSLTransformationStage.class, "test");
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
final Element expected = readXMLData("output.xml");
@@ -236,7 +230,6 @@ public class XSLTtransformationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XSLTransformationStage.class, "test");
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
final Element expected = readXMLData("transform1.xml");
@@ -298,7 +291,6 @@ public class XSLTtransformationStageTest extends BaseDOMTest {
Assert.assertEquals(mdCol.size(), 1);
final Item<Element> result = mdCol.iterator().next();
- AssertSupport.assertValidComponentInfo(result, 1, XSLTransformationStage.class, "test");
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
final Element expected = readXMLData("output2.xml");
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java
index f8ad7f0..da5c83d 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java
@@ -22,7 +22,6 @@ import java.util.List;
import javax.annotation.concurrent.Immutable;
-import net.shibboleth.metadata.AssertSupport;
import net.shibboleth.metadata.ErrorStatus;
import net.shibboleth.metadata.InfoStatus;
import net.shibboleth.metadata.Item;
@@ -87,9 +86,6 @@ public class XSLValidationStageTest extends BaseDOMTest {
final Element expected = readXMLData("input.xml");
assertXMLIdentical(expected, result.unwrap());
- // It should have been processed by the appropriate stage
- AssertSupport.assertValidComponentInfo(result, 1, XSLValidationStage.class, "test");
-
// result item should have preserved the TestInfo that was on the input
Assert.assertEquals(result.getItemMetadata().get(TestInfo.class).size(), 1);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ComponentInfoTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ComponentInfoTest.java
deleted file mode 100644
index e2cc9dd..0000000
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ComponentInfoTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-
-package net.shibboleth.metadata.pipeline;
-
-import java.time.Duration;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.function.Predicate;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import net.shibboleth.metadata.Item;
-import net.shibboleth.metadata.MockItem;
-
-public class ComponentInfoTest {
-
- @Test
- public void testBasicOperation() throws Exception {
-
- // A predicate which just delays for 11ms and then returns true.
- final var delayingCollectionPredicate = new Predicate<Collection<Item<String>>>() {
- public boolean test(Collection<Item<String>> t) {
- try {
- Thread.sleep(11);
- } catch (InterruptedException e) {
- }
- return true;
- }
- };
-
- final Item<String> item = new MockItem("test");
- final List<Item<String>> items = new ArrayList<>();
- items.add(item);
-
- // comp1 is a CompositeStage which does nothing other than delay for 10ms
- final CompositeStage<String> comp1 = new CompositeStage<>();
- comp1.setId("comp1");
- comp1.setCollectionPredicate(delayingCollectionPredicate);
- comp1.initialize();
-
- // comp2 is a CompositeStage which does nothing other than delay for 10ms
- final CompositeStage<String> comp2 = new CompositeStage<>();
- comp2.setId("comp2");
- comp2.setCollectionPredicate(delayingCollectionPredicate);
- comp2.initialize();
-
- final List<Stage<String>> stages = new ArrayList<>();
- stages.add(comp1);
- stages.add(comp2);
-
- final SimplePipeline<String> pipe = new SimplePipeline<>();
- pipe.setId("pipe");
- pipe.setStages(stages);
- pipe.initialize();
-
- pipe.execute(items);
-
- final List<ComponentInfo> infos = item.getItemMetadata().get(ComponentInfo.class);
-
- // expect one for each CompositeStage and one for the SimplePipeline
- Assert.assertEquals(infos.size(), 3);
- final var info0 = infos.get(0);
- final var info1 = infos.get(1);
- final var info2 = infos.get(2);
-
- Assert.assertSame(infos.get(0).getComponentType(), CompositeStage.class, "0");
- Assert.assertEquals(infos.get(0).getComponentId(), "comp1", "0");
-
- Assert.assertSame(infos.get(1).getComponentType(), CompositeStage.class, "1");
- Assert.assertEquals(infos.get(1).getComponentId(), "comp2", "1");
-
- Assert.assertSame(infos.get(2).getComponentType(), SimplePipeline.class, "2");
- Assert.assertEquals(infos.get(2).getComponentId(), "pipe", "2");
-
- // Timing for first stage: takes at least 10ms.
- final var time0 = Duration.between(info0.getStartInstant(), info0.getCompleteInstant());
- final var nano0 = time0.toNanos();
- Assert.assertTrue(nano0 >= 10_000_000);
-
- // Timing for second stage: takes at least 10ms.
- final var time1 = Duration.between(info1.getStartInstant(), info1.getCompleteInstant());
- final var nano1 = time1.toNanos();
- Assert.assertTrue(nano1 >= 10_000_000);
-
- // Second stage does not start before first stage ends
- Assert.assertFalse(info1.getStartInstant().isBefore(info0.getCompleteInstant()));
-
- // Timing for pipeline: takes at least 20ms
- final var time2 = Duration.between(info2.getStartInstant(), info2.getCompleteInstant());
- final var nano2 = time2.toNanos();
- Assert.assertTrue(nano2 >= 20_000_000);
-
- // Stage 1 does not start earlier than pipeline
- Assert.assertFalse(info0.getStartInstant().isBefore(info2.getStartInstant()));
-
- // Pipeline does not end earlier than stage 2
- Assert.assertFalse(info2.getCompleteInstant().isBefore(info1.getCompleteInstant()));
-
- // Check that we're getting ISO 8601 Z time out from toString
- // Java 8 gives a result with three sub-second digits (millisecond precision)
- // Java 9 gives six digits (microsecond precision)
- // Accept anything with at least three, which is what we used to get from
- // Joda-Time DateTime values.
- final String zuluPattern =
- "\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d\\d\\d\\d*Z";
- for (final ComponentInfo c : infos) {
- final String startString = c.getStartInstant().toString();
- Assert.assertTrue(startString.matches(zuluPattern), "start: " + startString);
- final String completeString = c.getCompleteInstant().toString();
- Assert.assertTrue(completeString.matches(zuluPattern), "complete: " + completeString);
- }
- }
-
-}
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ItemIdTransformStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ItemIdTransformStageTest.java
index ee47b0f..99efec6 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ItemIdTransformStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/ItemIdTransformStageTest.java
@@ -52,13 +52,8 @@ public class ItemIdTransformStageTest {
stage.execute(mdColl);
Assert.assertEquals(mdColl.size(), 1);
- Assert.assertEquals(item.getItemMetadata().values().size(), 4);
-
- final ComponentInfo compInfo = item.getItemMetadata().get(ComponentInfo.class).get(0);
- Assert.assertNotNull(compInfo.getCompleteInstant());
- Assert.assertEquals(compInfo.getComponentId(), "test");
- Assert.assertEquals(compInfo.getComponentType(), ItemIdTransformStage.class);
- Assert.assertNotNull(compInfo.getStartInstant());
+ // Three item metadata values: the original ItemId plus two transformed versions
+ Assert.assertEquals(item.getItemMetadata().values().size(), 3);
final List<ItemId> idInfos = item.getItemMetadata().get(ItemId.class);
Assert.assertEquals(idInfos.size(), 3);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/PipelineMergeStageTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/PipelineMergeStageTest.java
index 150336c..8b82a80 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/PipelineMergeStageTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/PipelineMergeStageTest.java
@@ -112,8 +112,8 @@ public class PipelineMergeStageTest {
md2CloneMatch = true;
Assert.assertFalse(metadata == md2);
}
- // two ComponentInfo: one from the pipeline, one from the static inject stage, one from the join stage
- Assert.assertEquals(metadata.getItemMetadata().values().size(), 3);
+ // no item metadata, as we don't have ComponentInfo any more
+ Assert.assertEquals(metadata.getItemMetadata().values().size(), 0);
}
Assert.assertTrue(md1CloneMatch);
diff --git a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SimplePipelineTest.java b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SimplePipelineTest.java
index 793eb58..3d4c8eb 100644
--- a/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SimplePipelineTest.java
+++ b/mda-framework/src/test/java/net/shibboleth/metadata/pipeline/SimplePipelineTest.java
@@ -89,9 +89,6 @@ public class SimplePipelineTest {
Assert.assertEquals(((CountingStage<String>) stages.get(2)).getInvocationCount(), 1);
Item<String> md = metadata.iterator().next();
- Assert.assertTrue(md.getItemMetadata().containsKey(ComponentInfo.class));
- // components in processing chain: source, count1, count2, pipeline itself
- Assert.assertEquals(md.getItemMetadata().get(ComponentInfo.class).size(), 4);
try {
List<Stage<String>> pipelineStages = pipeline.getStages();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list