From 8989c09566bb791afb620adcedeaf180a5c6fabb Mon Sep 17 00:00:00 2001 From: Dustin Johnson Date: Wed, 17 Apr 2013 11:50:41 -0500 Subject: [PATCH] Issue #1914 Add plugin based registry notification Change-Id: Ie450b60683e4c317ac19628cb923310b828747a7 Former-commit-id: c75a5f6664b3c6d79773f4eda52ce03dfb5ba877 --- .../res/spring/ebxml-edex-impl.xml | 7 +- .../res/spring/ebxml-registry-dao.xml | 1 + .../ebxml/dao/AuditableEventTypeDao.java | 33 ++++- ...RegistrySubscriptionManagerInvocation.java | 70 +++++++++ .../IRegistrySubscriptionManager.java | 46 ++++++ .../ebxml/dao/AbstractRegistryTest.java | 139 ++++++++++++++++++ .../LifecycleManagerSubmitObjectsTest.java | 110 ++------------ .../resources/ebxml/unit-test-ebxml-beans.xml | 3 + .../TestJaxbableClassesLocator.java | 5 +- ...ctlyInvokeRegistrySubscriptionManager.java | 67 +++++++++ 10 files changed, 378 insertions(+), 103 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/EsbRouteRegistrySubscriptionManagerInvocation.java create mode 100644 edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/IRegistrySubscriptionManager.java create mode 100644 tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/AbstractRegistryTest.java create mode 100644 tests/unit/com/raytheon/uf/edex/registry/ebxml/dao/DirectlyInvokeRegistrySubscriptionManager.java diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-edex-impl.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-edex-impl.xml index 44aae86f3a..6b14576b22 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-edex-impl.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-edex-impl.xml @@ -4,12 +4,15 @@ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> - + - + + + diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml index 6f4cab8b85..e8d1ddf656 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/res/spring/ebxml-registry-dao.xml @@ -42,6 +42,7 @@ + diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/AuditableEventTypeDao.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/AuditableEventTypeDao.java index cf3eaf2801..eea2104bd3 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/AuditableEventTypeDao.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/AuditableEventTypeDao.java @@ -40,8 +40,8 @@ import com.raytheon.uf.common.registry.constants.ActionTypes; import com.raytheon.uf.common.registry.constants.RegistryObjectTypes; import com.raytheon.uf.common.registry.constants.StatusTypes; import com.raytheon.uf.common.registry.ebxml.RegistryUtil; -import com.raytheon.uf.edex.core.EDEXUtil; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; +import com.raytheon.uf.edex.registry.ebxml.services.IRegistrySubscriptionManager; import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; /** @@ -55,6 +55,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * ------------ ---------- ----------- -------------------------- * 3/18/2013 1802 bphillip Initial creation * 4/9/2013 1802 bphillip Removed exception catching + * Apr 17, 2013 1914 djohnson Use strategy for subscription processing. * * * @@ -82,12 +83,22 @@ public class AuditableEventTypeDao extends /** Order by clause */ private static final String ORDER_CLAUSE = " order by event.timestamp asc"; + private IRegistrySubscriptionManager subscriptionManager; + + /** + * Constructor. + * + * @param subscriptionProcessor + */ + public AuditableEventTypeDao() { + } + + @Override public void create(AuditableEventType event) { template.save(event); // Notify the subscription monitor that a new event has occurred try { - EDEXUtil.getMessageProducer().sendAsyncUri( - "vm:processSubscriptions", null); + subscriptionManager.processSubscriptions(); } catch (Throwable t) { statusHandler .error("Unexpected error ecountered while processing subscriptions!", @@ -292,4 +303,20 @@ public class AuditableEventTypeDao extends return AuditableEventType.class; } + /** + * @return the subscription manager + */ + public IRegistrySubscriptionManager getSubscriptionManager() { + return subscriptionManager; + } + + /** + * @param subscriptionManager + * the subscriptionManager to set + */ + public void setSubscriptionManager( + IRegistrySubscriptionManager subscriptionManager) { + this.subscriptionManager = subscriptionManager; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/EsbRouteRegistrySubscriptionManagerInvocation.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/EsbRouteRegistrySubscriptionManagerInvocation.java new file mode 100644 index 0000000000..0ff5abf4c5 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/EsbRouteRegistrySubscriptionManagerInvocation.java @@ -0,0 +1,70 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.edex.registry.ebxml.dao; + +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.edex.core.EDEXUtil; +import com.raytheon.uf.edex.core.EdexException; +import com.raytheon.uf.edex.registry.ebxml.services.IRegistrySubscriptionManager; + +/** + * Sends a request to the esb route to request that registry subscriptions are + * processed. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 16, 2013 1914       djohnson     Extracted from AuditableEventTypeDao.
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ +public class EsbRouteRegistrySubscriptionManagerInvocation implements + IRegistrySubscriptionManager { + + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(EsbRouteRegistrySubscriptionManagerInvocation.class); + + private static final String ESB_ROUTE = "vm:processSubscriptions"; + + /** + * {@inheritDoc} + */ + @Override + public void processSubscriptions() { + try { + EDEXUtil.getMessageProducer().sendAsyncUri( + ESB_ROUTE, null); + } catch (EdexException e) { + statusHandler + .handle(Priority.PROBLEM, + "Unable to post message to esb route to process registry subscriptions!", + e); + } + } + +} diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/IRegistrySubscriptionManager.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/IRegistrySubscriptionManager.java new file mode 100644 index 0000000000..245d05ec68 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/services/IRegistrySubscriptionManager.java @@ -0,0 +1,46 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.edex.registry.ebxml.services; + +/** + * Extracted from RegistrySubscriptionManager. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 17, 2013 1914       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ + +public interface IRegistrySubscriptionManager { + + /** + * Process the subscriptions currently in the registry + */ + void processSubscriptions(); + +} \ No newline at end of file diff --git a/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/AbstractRegistryTest.java b/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/AbstractRegistryTest.java new file mode 100644 index 0000000000..005b5dd9f5 --- /dev/null +++ b/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/AbstractRegistryTest.java @@ -0,0 +1,139 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.edex.registry.ebxml.dao; + +import java.math.BigInteger; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager; +import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager; +import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode; +import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest; +import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest; +import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType; +import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; +import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType; +import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; +import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType; +import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType; + +import org.junit.Before; +import org.springframework.beans.factory.annotation.Autowired; + +import com.google.common.collect.Lists; +import com.raytheon.uf.edex.core.EDEXUtil; +import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; +import com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl.RETURN_TYPE; +import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; + +/** + * Test {@link LifecycleManager} submit objects functionality. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 15, 2013 1914       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ +public class AbstractRegistryTest { + + protected static final String MY_REGISTRY_OBJECT_ID = "myRegistryObjectId"; + + protected static final String REGISTRY_OBJECT_TYPE = "myRegistryObjectType"; + + @Autowired + protected LifecycleManager lifecycleManager; + + protected QueryManager queryManager; + + @Before + public void setUp() { + this.queryManager = EDEXUtil.getESBComponent(QueryManager.class, + "queryServiceImpl"); + } + + /** + * Create the submit objects request. + * + * @param registryObjectId + * the registry object id + * @param mode + * @return + */ + protected SubmitObjectsRequest createSubmitObjectsRequest( + String registryObjectId, String registryObjectType, Mode mode) { + final RegistryObjectType registryObject = new RegistryObjectType(); + registryObject.setId(MY_REGISTRY_OBJECT_ID); + registryObject.setLid(registryObject.getId()); + registryObject.setObjectType(registryObjectType); + + List registryObjects = Lists.newArrayList(); + registryObjects.add(registryObject); + + RegistryObjectListType registryObjectList = new RegistryObjectListType(); + registryObjectList.setRegistryObject(registryObjects); + SubmitObjectsRequest submitObjectsRequest = new SubmitObjectsRequest(); + submitObjectsRequest.setCheckReferences(false); + submitObjectsRequest.setComment("This is a comment."); + submitObjectsRequest.setId("someId"); + submitObjectsRequest.setMode(mode); + submitObjectsRequest.setRegistryObjectList(registryObjectList); + + return submitObjectsRequest; + } + + protected QueryRequest createQueryForRegistryObjectByLid( + String registryObjectId) { + final ResponseOptionType responseOption = EbxmlObjectUtil.queryObjectFactory + .createResponseOptionType(); + responseOption.setReturnType(RETURN_TYPE.RegistryObject.toString()); + responseOption.setReturnComposedObjects(false); + + final QueryType queryType = new QueryType(); + queryType + .setQueryDefinition("urn:oasis:names:tc:ebxml-regrep:query:GetObjectsByLid"); + Set slots = new HashSet(); + final SlotType slot = new SlotType(); + slot.setName(QueryConstants.LID); + final StringValueType slotValue = new StringValueType(); + slotValue.setStringValue(registryObjectId); + slot.setSlotValue(slotValue); + slots.add(slot); + queryType.setSlot(slots); + + QueryRequest partQueryRequest = new QueryRequest(); + partQueryRequest.setResponseOption(responseOption); + partQueryRequest.setFederated(false); + partQueryRequest.setQuery(queryType); + partQueryRequest.setMatchOlderVersions(true); + partQueryRequest.setMaxResults(new BigInteger("9999")); + return partQueryRequest; + } + +} diff --git a/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/LifecycleManagerSubmitObjectsTest.java b/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/LifecycleManagerSubmitObjectsTest.java index 716d94a295..1e4b5edb55 100644 --- a/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/LifecycleManagerSubmitObjectsTest.java +++ b/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/LifecycleManagerSubmitObjectsTest.java @@ -26,44 +26,28 @@ import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; -import java.math.BigInteger; -import java.util.HashSet; import java.util.List; -import java.util.Set; import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager; import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException; -import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager; import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode; import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest; import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse; -import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.ObjectExistsExceptionType; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType; import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import com.google.common.collect.Lists; import com.raytheon.uf.common.registry.constants.RegistryResponseStatus; -import com.raytheon.uf.edex.core.EDEXUtil; import com.raytheon.uf.edex.database.dao.DatabaseUtil; -import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants; -import com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl.RETURN_TYPE; -import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; /** * Test {@link LifecycleManager} submit objects functionality. @@ -87,22 +71,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; "/spring/ebxml-querytypes.xml", "/spring/ebxml-registry-dao.xml", "/ebxml/unit-test-ebxml-beans.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) -public class LifecycleManagerSubmitObjectsTest { - - private static final String MY_REGISTRY_OBJECT_ID = "myRegistryObjectId"; - - private static final String REGISTRY_OBJECT_TYPE = "myRegistryObjectType"; - - @Autowired - private LifecycleManager lifecycleManager; - - private QueryManager queryManager; - - @Before - public void setUp() { - this.queryManager = EDEXUtil.getESBComponent(QueryManager.class, - "queryServiceImpl"); - } +public class LifecycleManagerSubmitObjectsTest extends AbstractRegistryTest { /** * CreateOnly - If an object does not exist, server MUST create it as a new @@ -116,7 +85,7 @@ public class LifecycleManagerSubmitObjectsTest { throws MsgRegistryException { SubmitObjectsRequest submitObjectsRequest = createSubmitObjectsRequest( - MY_REGISTRY_OBJECT_ID, Mode.CREATE_ONLY); + MY_REGISTRY_OBJECT_ID, REGISTRY_OBJECT_TYPE, Mode.CREATE_ONLY); final RegistryResponseType response = lifecycleManager .submitObjects(submitObjectsRequest); @@ -137,7 +106,7 @@ public class LifecycleManagerSubmitObjectsTest { throws MsgRegistryException { SubmitObjectsRequest submitObjectsRequest = createSubmitObjectsRequest( - MY_REGISTRY_OBJECT_ID, Mode.CREATE_ONLY); + MY_REGISTRY_OBJECT_ID, REGISTRY_OBJECT_TYPE, Mode.CREATE_ONLY); lifecycleManager.submitObjects(submitObjectsRequest); @@ -162,7 +131,8 @@ public class LifecycleManagerSubmitObjectsTest { throws MsgRegistryException { SubmitObjectsRequest submitObjectsRequest = createSubmitObjectsRequest( - MY_REGISTRY_OBJECT_ID, Mode.CREATE_OR_REPLACE); + MY_REGISTRY_OBJECT_ID, REGISTRY_OBJECT_TYPE, + Mode.CREATE_OR_REPLACE); final RegistryResponseType response = lifecycleManager .submitObjects(submitObjectsRequest); @@ -181,7 +151,8 @@ public class LifecycleManagerSubmitObjectsTest { throws MsgRegistryException { SubmitObjectsRequest submitObjectsRequest = createSubmitObjectsRequest( - MY_REGISTRY_OBJECT_ID, Mode.CREATE_OR_REPLACE); + MY_REGISTRY_OBJECT_ID, REGISTRY_OBJECT_TYPE, + Mode.CREATE_OR_REPLACE); lifecycleManager.submitObjects(submitObjectsRequest); @@ -202,7 +173,8 @@ public class LifecycleManagerSubmitObjectsTest { throws MsgRegistryException { SubmitObjectsRequest submitObjectsRequest = createSubmitObjectsRequest( - MY_REGISTRY_OBJECT_ID, Mode.CREATE_OR_REPLACE); + MY_REGISTRY_OBJECT_ID, REGISTRY_OBJECT_TYPE, + Mode.CREATE_OR_REPLACE); lifecycleManager.submitObjects(submitObjectsRequest); lifecycleManager.submitObjects(submitObjectsRequest); @@ -227,7 +199,8 @@ public class LifecycleManagerSubmitObjectsTest { throws MsgRegistryException { SubmitObjectsRequest submitObjectsRequest = createSubmitObjectsRequest( - MY_REGISTRY_OBJECT_ID, Mode.CREATE_OR_VERSION); + MY_REGISTRY_OBJECT_ID, REGISTRY_OBJECT_TYPE, + Mode.CREATE_OR_VERSION); final RegistryResponseType response = lifecycleManager .submitObjects(submitObjectsRequest); @@ -247,7 +220,8 @@ public class LifecycleManagerSubmitObjectsTest { throws MsgRegistryException { SubmitObjectsRequest submitObjectsRequest = createSubmitObjectsRequest( - MY_REGISTRY_OBJECT_ID, Mode.CREATE_OR_VERSION); + MY_REGISTRY_OBJECT_ID, REGISTRY_OBJECT_TYPE, + Mode.CREATE_OR_VERSION); lifecycleManager.submitObjects(submitObjectsRequest); lifecycleManager.submitObjects(submitObjectsRequest); @@ -261,62 +235,4 @@ public class LifecycleManagerSubmitObjectsTest { assertThat(registryObjects, hasSize(2)); } - /** - * Create the submit objects request. - * - * @param registryObjectId - * the registry object id - * @param mode - * @return - */ - private SubmitObjectsRequest createSubmitObjectsRequest( - String registryObjectId, Mode mode) { - final RegistryObjectType registryObject = new RegistryObjectType(); - registryObject.setId(MY_REGISTRY_OBJECT_ID); - registryObject.setLid(registryObject.getId()); - registryObject.setObjectType(REGISTRY_OBJECT_TYPE); - - List registryObjects = Lists.newArrayList(); - registryObjects.add(registryObject); - - RegistryObjectListType registryObjectList = new RegistryObjectListType(); - registryObjectList.setRegistryObject(registryObjects); - SubmitObjectsRequest submitObjectsRequest = new SubmitObjectsRequest(); - submitObjectsRequest.setCheckReferences(false); - submitObjectsRequest.setComment("This is a comment."); - submitObjectsRequest.setId("someId"); - submitObjectsRequest.setMode(mode); - submitObjectsRequest.setRegistryObjectList(registryObjectList); - - return submitObjectsRequest; - } - - private QueryRequest createQueryForRegistryObjectByLid( - String registryObjectId) { - final ResponseOptionType responseOption = EbxmlObjectUtil.queryObjectFactory - .createResponseOptionType(); - responseOption.setReturnType(RETURN_TYPE.RegistryObject.toString()); - responseOption.setReturnComposedObjects(false); - - final QueryType queryType = new QueryType(); - queryType - .setQueryDefinition("urn:oasis:names:tc:ebxml-regrep:query:GetObjectsByLid"); - Set slots = new HashSet(); - final SlotType slot = new SlotType(); - slot.setName(QueryConstants.LID); - final StringValueType slotValue = new StringValueType(); - slotValue.setStringValue(registryObjectId); - slot.setSlotValue(slotValue); - slots.add(slot); - queryType.setSlot(slots); - - QueryRequest partQueryRequest = new QueryRequest(); - partQueryRequest.setResponseOption(responseOption); - partQueryRequest.setFederated(false); - partQueryRequest.setQuery(queryType); - partQueryRequest.setMatchOlderVersions(true); - partQueryRequest.setMaxResults(new BigInteger("9999")); - return partQueryRequest; - } - } diff --git a/tests/resources/ebxml/unit-test-ebxml-beans.xml b/tests/resources/ebxml/unit-test-ebxml-beans.xml index 8048a3d4b9..75da6f9a06 100644 --- a/tests/resources/ebxml/unit-test-ebxml-beans.xml +++ b/tests/resources/ebxml/unit-test-ebxml-beans.xml @@ -6,6 +6,9 @@ + + diff --git a/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java b/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java index 7bce3b69aa..118f5a83b1 100644 --- a/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java +++ b/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java @@ -22,6 +22,8 @@ package com.raytheon.uf.common.serialization; import java.util.Arrays; import java.util.List; +import javax.xml.ws.wsaddressing.W3CEndpointReference; + import org.junit.Ignore; import com.raytheon.uf.common.monitor.xml.FFMPTemplateXML; @@ -37,6 +39,7 @@ import com.raytheon.uf.common.monitor.xml.FFMPTemplateXML; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 06, 2013 1543 djohnson Moved out of SerializationUtilTest. + * Apr 17, 2013 1914 djohnson Add W3CEndpointReference. * * * @@ -91,7 +94,7 @@ public class TestJaxbableClassesLocator implements IJaxbableClassesLocator { com.raytheon.uf.common.datadelivery.retrieval.xml.LevelLookup.class, com.raytheon.uf.common.monitor.xml.FFMPSourceConfigXML.class, com.raytheon.uf.common.monitor.xml.FFMPRunConfigXML.class, - FFMPTemplateXML.class }; + FFMPTemplateXML.class, W3CEndpointReference.class }; JAXB_CLASSES = Arrays.asList(array); } diff --git a/tests/unit/com/raytheon/uf/edex/registry/ebxml/dao/DirectlyInvokeRegistrySubscriptionManager.java b/tests/unit/com/raytheon/uf/edex/registry/ebxml/dao/DirectlyInvokeRegistrySubscriptionManager.java new file mode 100644 index 0000000000..91658509c2 --- /dev/null +++ b/tests/unit/com/raytheon/uf/edex/registry/ebxml/dao/DirectlyInvokeRegistrySubscriptionManager.java @@ -0,0 +1,67 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.edex.registry.ebxml.dao; + +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.edex.core.EDEXUtil; +import com.raytheon.uf.edex.registry.ebxml.services.IRegistrySubscriptionManager; + +/** + * Invokes the registry subscription manager directly. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 16, 2013 1914       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ +public class DirectlyInvokeRegistrySubscriptionManager implements IRegistrySubscriptionManager { + + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(DirectlyInvokeRegistrySubscriptionManager.class); + + public DirectlyInvokeRegistrySubscriptionManager() { + } + + /** + * {@inheritDoc} + */ + @Override + public void processSubscriptions() { + // RegistrySubscriptionManager doesn't exist in this repo, so it must be + // looked up dynamically until 5-Data_Delivery is merged in + try { + EDEXUtil.getESBComponent(IRegistrySubscriptionManager.class, + "RegistrySubscriptionManager").processSubscriptions(); + } catch (Exception e) { + statusHandler + .info("Registry subscription management is not enabled."); + } + } + +}