diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java index c0f882bba6..52019bc00c 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SharedSubscription.java @@ -37,6 +37,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; * ------------ ---------- ----------- -------------------------- * Mar 27, 2013 1841 djohnson Initial creation * May 15, 2013 1040 mpduff Added addOfficeId. + * May 29, 2013 1650 djohnson Add setOwner() so reflection works. * * * @@ -84,6 +85,18 @@ public class SharedSubscription extends RecurringSubscription { return SHARED_SUBSCRIPTION_OWNER; } + /** + * This method does nothing. It is only required due to reflective + * associations when creating associations between + * {@link SharedSubscription} and {@link PendingSharedSubscription} + * instances. + * + * @param owner + * owner + */ + public void setOwner(String owner) { + } + /** * {@inheritDoc} */ diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandler.java index c86d5a48c2..287a555c80 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandler.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandler.java @@ -22,6 +22,7 @@ package com.raytheon.uf.common.datadelivery.registry.handlers; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.Set; @@ -51,6 +52,7 @@ import com.raytheon.uf.common.util.CollectionUtil; * Sep 24, 2012 1157 mpduff Changed to use InitialPendingSubscription. * 4/9/2013 1802 bphillip Using constant values from constants package instead of RegistryUtil * May 28, 2013 1650 djohnson Add getByNames. + * May 29, 2013 1650 djohnson Fix ability to delete multiple types of subscriptions at once. * * * @@ -296,16 +298,37 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler { /** * {@inheritDoc} */ - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void delete(Collection objects) throws RegistryHandlerException { if (!CollectionUtil.isNullOrEmpty(objects)) { - final Collection asSubtype = objects; - if (objects.iterator().next() instanceof InitialPendingSiteSubscription) { - siteSubscriptionHandler.delete(asSubtype); - } else { - sharedSubscriptionHandler.delete(asSubtype); + final Collection siteSubscriptions = Lists + .newArrayList(); + final Collection sharedSubscriptions = Lists + .newArrayList(); + for (Iterator iter = objects.iterator(); iter + .hasNext();) { + final Subscription sub = iter.next(); + if (sub instanceof InitialPendingSiteSubscription) { + siteSubscriptions.add((InitialPendingSiteSubscription) sub); + } else if (sub instanceof InitialPendingSharedSubscription) { + sharedSubscriptions + .add((InitialPendingSharedSubscription) sub); + } else { + throw new RegistryHandlerException( + new IllegalArgumentException( + "Unable to delete pending subscription of type [" + + sub.getClass().getName() + + "]. Did you add a new subscription type?")); + } + } + + if (!siteSubscriptions.isEmpty()) { + siteSubscriptionHandler.delete(siteSubscriptions); + } + + if (!sharedSubscriptions.isEmpty()) { + sharedSubscriptionHandler.delete(sharedSubscriptions); } } } @@ -313,17 +336,38 @@ public class PendingSubscriptionHandler implements IPendingSubscriptionHandler { /** * {@inheritDoc} */ - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void delete(String username, Collection objects) throws RegistryHandlerException { if (!CollectionUtil.isNullOrEmpty(objects)) { - final Collection asSubtype = objects; - if (objects.iterator().next() instanceof SiteSubscription) { - siteSubscriptionHandler.delete(username, asSubtype); - } else { - sharedSubscriptionHandler.delete(username, asSubtype); + final Collection siteSubscriptions = Lists + .newArrayList(); + final Collection sharedSubscriptions = Lists + .newArrayList(); + for (Iterator iter = objects.iterator(); iter + .hasNext();) { + final Subscription sub = iter.next(); + if (sub instanceof InitialPendingSiteSubscription) { + siteSubscriptions.add((InitialPendingSiteSubscription) sub); + } else if (sub instanceof InitialPendingSharedSubscription) { + sharedSubscriptions + .add((InitialPendingSharedSubscription) sub); + } else { + throw new RegistryHandlerException( + new IllegalArgumentException( + "Unable to delete pending subscription of type [" + + sub.getClass().getName() + + "]. Did you add a new subscription type?")); + } + } + + if (!siteSubscriptions.isEmpty()) { + siteSubscriptionHandler.delete(siteSubscriptions); + } + + if (!sharedSubscriptions.isEmpty()) { + sharedSubscriptionHandler.delete(sharedSubscriptions); } } } diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandler.java b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandler.java index 82255129b8..5334f15b7a 100644 --- a/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandler.java +++ b/edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandler.java @@ -20,6 +20,7 @@ package com.raytheon.uf.common.datadelivery.registry.handlers; import java.util.Collection; +import java.util.Iterator; import java.util.List; import java.util.Set; @@ -51,6 +52,7 @@ import com.raytheon.uf.common.util.CollectionUtil; * 4/9/2013 1802 bphillip Using constant values from constants package instead of RegistryUtil * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * May 28, 2013 1650 djohnson Add getByNames. + * May 29, 2013 1650 djohnson Fix ability to delete multiple types of subscriptions at once. * * * @@ -328,16 +330,36 @@ public class SubscriptionHandler implements ISubscriptionHandler { /** * {@inheritDoc} */ - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void delete(Collection objects) throws RegistryHandlerException { if (!CollectionUtil.isNullOrEmpty(objects)) { - final Collection asSubtype = objects; - if (objects.iterator().next() instanceof SiteSubscription) { - siteSubscriptionHandler.delete(asSubtype); - } else { - sharedSubscriptionHandler.delete(asSubtype); + final Collection siteSubscriptions = Lists + .newArrayList(); + final Collection sharedSubscriptions = Lists + .newArrayList(); + for (Iterator iter = objects.iterator(); iter + .hasNext();) { + final Subscription sub = iter.next(); + if (sub instanceof SiteSubscription) { + siteSubscriptions.add((SiteSubscription) sub); + } else if (sub instanceof SharedSubscription) { + sharedSubscriptions.add((SharedSubscription) sub); + } else { + throw new RegistryHandlerException( + new IllegalArgumentException( + "Unable to delete subscription of type [" + + sub.getClass().getName() + + "]. Did you add a new subscription type?")); + } + } + + if (!siteSubscriptions.isEmpty()) { + siteSubscriptionHandler.delete(siteSubscriptions); + } + + if (!sharedSubscriptions.isEmpty()) { + sharedSubscriptionHandler.delete(sharedSubscriptions); } } } @@ -345,18 +367,37 @@ public class SubscriptionHandler implements ISubscriptionHandler { /** * {@inheritDoc} */ - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void delete(String username, Collection objects) throws RegistryHandlerException { if (!CollectionUtil.isNullOrEmpty(objects)) { - final Collection asSubtype = objects; - if (objects.iterator().next() instanceof SiteSubscription) { - siteSubscriptionHandler.delete(username, asSubtype); - } else { - sharedSubscriptionHandler.delete(username, asSubtype); + final Collection siteSubscriptions = Lists + .newArrayList(); + final Collection sharedSubscriptions = Lists + .newArrayList(); + for (Iterator iter = objects.iterator(); iter + .hasNext();) { + final Subscription sub = iter.next(); + if (sub instanceof SiteSubscription) { + siteSubscriptions.add((SiteSubscription) sub); + } else if (sub instanceof SharedSubscription) { + sharedSubscriptions.add((SharedSubscription) sub); + } else { + throw new RegistryHandlerException( + new IllegalArgumentException( + "Unable to delete subscription of type [" + + sub.getClass().getName() + + "]. Did you add a new subscription type?")); + } + } + + if (!siteSubscriptions.isEmpty()) { + siteSubscriptionHandler.delete(username, siteSubscriptions); + } + + if (!sharedSubscriptions.isEmpty()) { + sharedSubscriptionHandler.delete(username, sharedSubscriptions); } } } - } diff --git a/edexOsgi/com.raytheon.uf.edex.archive/res/spring/archivepurger-spring.xml b/edexOsgi/com.raytheon.uf.edex.archive/res/spring/archivepurger-spring.xml index eac0144061..66ad0a143a 100644 --- a/edexOsgi/com.raytheon.uf.edex.archive/res/spring/archivepurger-spring.xml +++ b/edexOsgi/com.raytheon.uf.edex.archive/res/spring/archivepurger-spring.xml @@ -1,16 +1,15 @@ - + + xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler"> - + @@ -24,7 +23,8 @@ java.lang.Throwable - + diff --git a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/init/DbInit.java b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/init/DbInit.java index 308d665dfa..cd2468edc9 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/init/DbInit.java +++ b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/init/DbInit.java @@ -48,6 +48,7 @@ import com.raytheon.uf.edex.database.dao.SessionManagedDao; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 30, 2013 1960 djohnson Extracted and generalized from the registry DbInit. + * May 29, 2013 1650 djohnson Allow initDb() to be overridden, though should rarely be done. * * * @author djohnson @@ -115,7 +116,7 @@ public abstract class DbInit { * @throws Exception * on error initializing the database */ - public final void initDb() throws Exception { + public void initDb() throws Exception { /* * Create a new configuration object which holds all the classes that * this Hibernate SessionFactory is aware of diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/DbInit.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/DbInit.java index 640a273d8e..c276abe089 100644 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/DbInit.java +++ b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/dao/DbInit.java @@ -36,6 +36,7 @@ import java.util.Map; import java.util.jar.JarEntry; import java.util.jar.JarFile; +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.xsd.lcm.v4.SubmitObjectsRequest; import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType; @@ -63,7 +64,6 @@ import com.raytheon.uf.edex.core.EDEXUtil; import com.raytheon.uf.edex.core.props.PropertiesFactory; import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; import com.raytheon.uf.edex.registry.ebxml.init.RegistryInitializedListener; -import com.raytheon.uf.edex.registry.ebxml.services.lifecycle.LifecycleManagerImpl; /** * The DbInit class is responsible for ensuring that the appropriate tables are @@ -81,6 +81,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.lifecycle.LifecycleManagerIm * Apr 15, 2013 1693 djohnson Use a strategy to verify the database is up to date. * Apr 30, 2013 1960 djohnson Extend the generalized DbInit. * 5/21/2013 2022 bphillip Using TransactionTemplate for database initialization + * May 29, 2013 1650 djohnson Reference LifecycleManager as interface type. * * * @author bphillip @@ -100,7 +101,7 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements private static final String TABLE_CHECK_QUERY = "SELECT tablename FROM pg_tables where schemaname = 'ebxml';"; /** The lifecycle manager instance */ - private LifecycleManagerImpl lcm; + private LifecycleManager lcm; /** Hibernate session factory */ private SessionFactory sessionFactory; @@ -142,7 +143,7 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements * If errors occur during the object submission process * @throws EbxmlRegistryException */ - private void populateDB() throws SerializationException, + protected void populateDB() throws SerializationException, MsgRegistryException, EbxmlRegistryException { LocalizationFile[] files = PathManagerFactory.getPathManager() .listStaticFiles("ebxml/minDB", new String[] { ".xml" }, true, @@ -369,7 +370,7 @@ public class DbInit extends com.raytheon.uf.edex.database.init.DbInit implements * @param lcm * the lcm to set */ - public void setLcm(LifecycleManagerImpl lcm) { + public void setLcm(LifecycleManager lcm) { this.lcm = lcm; } diff --git a/tests/deploy/com/raytheon/uf/edex/datadelivery/service/services/SubscriptionDeleteHandlerDeployTest.java b/tests/deploy/com/raytheon/uf/edex/datadelivery/service/services/SubscriptionDeleteHandlerDeployTest.java index 926c80be92..78f8c7ae77 100644 --- a/tests/deploy/com/raytheon/uf/edex/datadelivery/service/services/SubscriptionDeleteHandlerDeployTest.java +++ b/tests/deploy/com/raytheon/uf/edex/datadelivery/service/services/SubscriptionDeleteHandlerDeployTest.java @@ -30,7 +30,7 @@ import org.junit.Test; import com.raytheon.uf.common.datadelivery.registry.PendingSubscription; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.SubscriptionDeleteRequest; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.IPendingSubscriptionHandler; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; @@ -71,7 +71,7 @@ public class SubscriptionDeleteHandlerDeployTest { @Test public void testDeletingSubscriptionDeletesPendingAlso() throws Exception { - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); PendingSubscription pending = subscription.pending(subscription .getOwner()); diff --git a/tests/integration/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandlerTest.java b/tests/integration/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandlerTest.java new file mode 100644 index 0000000000..45b3119856 --- /dev/null +++ b/tests/integration/com/raytheon/uf/common/datadelivery/registry/handlers/PendingSubscriptionHandlerTest.java @@ -0,0 +1,120 @@ +/** + * 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.common.datadelivery.registry.handlers; + +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +import java.util.List; + +import org.junit.Test; + +import com.google.common.collect.Lists; +import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription; +import com.raytheon.uf.common.datadelivery.registry.PendingSharedSubscription; +import com.raytheon.uf.common.datadelivery.registry.PendingSharedSubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.PendingSiteSubscription; +import com.raytheon.uf.common.datadelivery.registry.PendingSiteSubscriptionFixture; +import com.raytheon.uf.common.registry.handler.RegistryHandlerException; +import com.raytheon.uf.edex.registry.ebxml.dao.AbstractRegistryTest; + +/** + * Test {@link PendingSubscriptionHandler}. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ +public class PendingSubscriptionHandlerTest extends AbstractRegistryTest { + + @Test + public void canDeleteMixedSiteAndPendingSharedSubscriptions() + throws RegistryHandlerException { + + final PendingSiteSubscription siteSubscription = PendingSiteSubscriptionFixture.INSTANCE + .get(); + final PendingSharedSubscription sharedSubscription = PendingSharedSubscriptionFixture.INSTANCE + .get(); + + storeSubscriptionsForPendingAssociations(siteSubscription, + sharedSubscription); + + final IPendingSubscriptionHandler pendingSubHandler = DataDeliveryHandlers + .getPendingSubscriptionHandler(); + pendingSubHandler.store(siteSubscription); + pendingSubHandler.store(sharedSubscription); + + List subscriptions = Lists + . newArrayList(siteSubscription, + sharedSubscription); + + pendingSubHandler.delete(subscriptions); + + assertThat(pendingSubHandler.getAll(), is(empty())); + } + + @Test + public void canDeleteMixedSiteAndPendingSharedSubscriptionsWithUsername() + throws RegistryHandlerException { + + final PendingSiteSubscription siteSubscription = PendingSiteSubscriptionFixture.INSTANCE + .get(); + final PendingSharedSubscription sharedSubscription = PendingSharedSubscriptionFixture.INSTANCE + .get(); + + storeSubscriptionsForPendingAssociations(siteSubscription, + sharedSubscription); + + final IPendingSubscriptionHandler pendingSubHandler = DataDeliveryHandlers + .getPendingSubscriptionHandler(); + pendingSubHandler.store(siteSubscription); + pendingSubHandler.store(sharedSubscription); + + List subscriptions = Lists + . newArrayList(siteSubscription, + sharedSubscription); + + pendingSubHandler.delete("joeSchmo", subscriptions); + + assertThat(pendingSubHandler.getAll(), is(empty())); + } + + private void storeSubscriptionsForPendingAssociations( + final PendingSiteSubscription siteSubscription, + final PendingSharedSubscription sharedSubscription) + throws RegistryHandlerException { + + final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers + .getSubscriptionHandler(); + subscriptionHandler.store(siteSubscription.subscription()); + subscriptionHandler.store(sharedSubscription.subscription()); + } + +} diff --git a/tests/integration/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandlerTest.java b/tests/integration/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandlerTest.java new file mode 100644 index 0000000000..701042e946 --- /dev/null +++ b/tests/integration/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandlerTest.java @@ -0,0 +1,98 @@ +/** + * 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.common.datadelivery.registry.handlers; + +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +import java.util.List; + +import org.junit.Test; + +import com.google.common.collect.Lists; +import com.raytheon.uf.common.datadelivery.registry.SharedSubscription; +import com.raytheon.uf.common.datadelivery.registry.SharedSubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.Subscription; +import com.raytheon.uf.common.registry.handler.RegistryHandlerException; +import com.raytheon.uf.edex.registry.ebxml.dao.AbstractRegistryTest; + +/** + * Test {@link SubscriptionHandler}. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ +public class SubscriptionHandlerTest extends AbstractRegistryTest { + + @Test + public void canDeleteMixedSiteAndSharedSubscriptions() + throws RegistryHandlerException { + final SiteSubscription siteSubscription = SiteSubscriptionFixture.INSTANCE + .get(); + final SharedSubscription sharedSubscription = SharedSubscriptionFixture.INSTANCE + .get(); + + final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers + .getSubscriptionHandler(); + subscriptionHandler.store(siteSubscription); + subscriptionHandler.store(sharedSubscription); + + List subscriptions = Lists. newArrayList( + siteSubscription, sharedSubscription); + + subscriptionHandler.delete(subscriptions); + + assertThat(subscriptionHandler.getAll(), is(empty())); + } + + @Test + public void canDeleteMixedSiteAndSharedSubscriptionsWithUsername() + throws RegistryHandlerException { + final SiteSubscription siteSubscription = SiteSubscriptionFixture.INSTANCE + .get(); + final SharedSubscription sharedSubscription = SharedSubscriptionFixture.INSTANCE + .get(); + + final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers + .getSubscriptionHandler(); + subscriptionHandler.store(siteSubscription); + subscriptionHandler.store(sharedSubscription); + + List subscriptions = Lists. newArrayList( + siteSubscription, sharedSubscription); + + subscriptionHandler.delete("joeSchmo", subscriptions); + + assertThat(subscriptionHandler.getAll(), is(empty())); + } +} diff --git a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthManagerIntTest.java b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthManagerIntTest.java index dc32faba7b..d33b526ad0 100644 --- a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthManagerIntTest.java +++ b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthManagerIntTest.java @@ -32,16 +32,23 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; +import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; +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.raytheon.uf.common.datadelivery.registry.Network; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.localization.PathManagerFactoryTest; import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtilTest; import com.raytheon.uf.common.util.PropertiesUtil; +import com.raytheon.uf.common.util.SpringFiles; +import com.raytheon.uf.edex.database.dao.DatabaseUtil; import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao; import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager; import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan; @@ -70,6 +77,14 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil; * @author djohnson * @version 1.0 */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = { DatabaseUtil.UNIT_TEST_DB_BEANS_XML, + SpringFiles.EVENTBUS_COMMON_XML, + SpringFiles.RETRIEVAL_DATADELIVERY_DAOS_XML, + SpringFiles.BANDWIDTH_DATADELIVERY_DAOS_XML, + SpringFiles.BANDWIDTH_DATADELIVERY_XML, + SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_XML }) +@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) @Ignore public abstract class AbstractBandwidthManagerIntTest { @@ -205,7 +220,7 @@ public abstract class AbstractBandwidthManagerIntTest { protected SiteSubscription createSubscriptionWithDataSetSizeInBytes( long bytes) { - SiteSubscription subscription = SubscriptionFixture.INSTANCE + SiteSubscription subscription = SiteSubscriptionFixture.INSTANCE .get(subscriptionSeed++); subscription.setDataSetSize(BandwidthUtil .convertBytesToKilobytes(bytes)); diff --git a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractWfoBandwidthManagerIntTest.java b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractWfoBandwidthManagerIntTest.java new file mode 100644 index 0000000000..7643e477af --- /dev/null +++ b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractWfoBandwidthManagerIntTest.java @@ -0,0 +1,49 @@ +/** + * 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.datadelivery.bandwidth; + +import org.junit.Ignore; +import org.springframework.test.context.ContextConfiguration; + +import com.raytheon.uf.common.util.SpringFiles; + +/** + * Class that any WFO bandwidth manager tests should extend. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ +@ContextConfiguration(inheritLocations = true, locations = { + SpringFiles.BANDWIDTH_DATADELIVERY_WFO_XML, + SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_WFO_XML }) +@Ignore +public abstract class AbstractWfoBandwidthManagerIntTest extends + AbstractBandwidthManagerIntTest { +} diff --git a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java index 39c817b317..ac0834bf92 100644 --- a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java +++ b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthManagerIntTest.java @@ -46,11 +46,6 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.CountDownLatch; import org.junit.Test; -import org.junit.runner.RunWith; -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.raytheon.uf.common.datadelivery.registry.DataDeliveryRegistryObjectTypes; import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData; @@ -58,11 +53,11 @@ import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaData; import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture; import com.raytheon.uf.common.datadelivery.registry.ParameterFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.Time; -import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.registry.event.RemoveRegistryEvent; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; @@ -71,9 +66,7 @@ import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.time.util.ImmutableDate; import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtilTest; -import com.raytheon.uf.common.util.SpringFiles; import com.raytheon.uf.common.util.TestUtil; -import com.raytheon.uf.edex.database.dao.DatabaseUtil; import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation; import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription; import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval; @@ -111,18 +104,7 @@ import com.raytheon.uf.edex.datadelivery.retrieval.RetrievalManagerNotifyEvent; * @author djohnson * @version 1.0 */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { DatabaseUtil.UNIT_TEST_DB_BEANS_XML, - SpringFiles.EVENTBUS_COMMON_XML, - SpringFiles.RETRIEVAL_DATADELIVERY_DAOS_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_DAOS_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_EVENTBUS_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_WFO_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_WFO_XML }) -@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) -public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { +public class BandwidthManagerIntTest extends AbstractWfoBandwidthManagerIntTest { @Test public void testAddingSubscriptionAllocatesOncePerPlanDayForOneCycle() @@ -141,7 +123,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { @Test public void testDataSetMetaDataUpdateSetsSubscriptionRetrievalsToReady() throws SerializationException, ParseException { - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); bandwidthManager.subscriptionUpdated(subscription); OpenDapGriddedDataSetMetaData metadata = OpenDapGriddedDataSetMetaDataFixture.INSTANCE @@ -163,7 +145,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { @Test public void testDataSetMetaDataUpdateSetsCorrectTimeOnSubscription() throws SerializationException, ParseException { - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); bandwidthManager.subscriptionUpdated(subscription); OpenDapGriddedDataSetMetaData metadata = OpenDapGriddedDataSetMetaDataFixture.INSTANCE @@ -199,7 +181,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { RegistryObjectHandlersUtil.initMemory(); // Store the original subscription - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); DataDeliveryHandlers.getSubscriptionHandler().store(subscription); // The dataset metadata update @@ -235,7 +217,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { RegistryObjectHandlersUtil.initMemory(); // Store the original subscription - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); subscription.getTime().setCycleTimes(Collections. emptyList()); DataDeliveryHandlers.getSubscriptionHandler().store(subscription); @@ -269,7 +251,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { RegistryObjectHandlersUtil.initMemory(); // Store the original subscription - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); subscription.setLatencyInMinutes(5); DataDeliveryHandlers.getSubscriptionHandler().store(subscription); @@ -703,7 +685,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { @Override public void run() { try { - final Subscription subscription2 = SubscriptionFixture.INSTANCE + final Subscription subscription2 = SiteSubscriptionFixture.INSTANCE .get(current); subscription2 .addParameter(ParameterFixture.INSTANCE @@ -999,7 +981,7 @@ public class BandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { private void testSubscriptionCyclesAreAllocatedOncePerCyclePerPlanDay( List cycles) throws SerializationException { - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); subscription.getTime().setCycleTimes(cycles); try { bandwidthManager.subscriptionUpdated(subscription); diff --git a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthServiceIntTest.java b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthServiceIntTest.java index 1c450aaf40..df7cebc40b 100644 --- a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthServiceIntTest.java +++ b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/BandwidthServiceIntTest.java @@ -37,11 +37,6 @@ import java.util.Set; import java.util.SortedSet; import org.junit.Test; -import org.junit.runner.RunWith; -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.raytheon.uf.common.datadelivery.bandwidth.BandwidthService; import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest; @@ -56,8 +51,6 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority; import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.time.util.TimeUtil; -import com.raytheon.uf.common.util.SpringFiles; -import com.raytheon.uf.edex.database.dao.DatabaseUtil; import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthAllocation; import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval; import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.BandwidthMap; @@ -86,17 +79,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil; * @author djohnson * @version 1.0 */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { DatabaseUtil.UNIT_TEST_DB_BEANS_XML, - SpringFiles.EVENTBUS_COMMON_XML, - SpringFiles.RETRIEVAL_DATADELIVERY_DAOS_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_DAOS_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_WFO_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_WFO_XML }) -@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) -public class BandwidthServiceIntTest extends AbstractBandwidthManagerIntTest { +public class BandwidthServiceIntTest extends AbstractWfoBandwidthManagerIntTest { private static final int ONE_HUNDRED = 100; diff --git a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/WfoBandwidthManagerIntTest.java b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/WfoBandwidthManagerIntTest.java index 55935f7cc8..4cd462b13a 100644 --- a/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/WfoBandwidthManagerIntTest.java +++ b/tests/integration/com/raytheon/uf/edex/datadelivery/bandwidth/WfoBandwidthManagerIntTest.java @@ -27,18 +27,11 @@ import static org.junit.Assert.assertThat; import java.util.List; import org.junit.Test; -import org.junit.runner.RunWith; -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.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest; import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest.RequestType; import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.Subscription; -import com.raytheon.uf.common.util.SpringFiles; -import com.raytheon.uf.edex.database.dao.DatabaseUtil; import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval; import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus; @@ -58,17 +51,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus; * @author djohnson * @version 1.0 */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { DatabaseUtil.UNIT_TEST_DB_BEANS_XML, - SpringFiles.EVENTBUS_COMMON_XML, - SpringFiles.RETRIEVAL_DATADELIVERY_DAOS_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_DAOS_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_WFO_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_XML, - SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_WFO_XML }) -@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) -public class WfoBandwidthManagerIntTest extends AbstractBandwidthManagerIntTest { +public class WfoBandwidthManagerIntTest extends + AbstractWfoBandwidthManagerIntTest { @Test public void testSchedulesSbnSubscriptionForRetrieval() { 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 index 6949f8c128..35d60c8575 100644 --- a/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/AbstractRegistryTest.java +++ b/tests/integration/com/raytheon/uf/edex/registry/ebxml/dao/AbstractRegistryTest.java @@ -49,11 +49,18 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType; import org.junit.Before; import org.junit.Ignore; +import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.transaction.TransactionConfiguration; +import org.springframework.transaction.annotation.Transactional; import com.google.common.collect.Lists; import com.raytheon.uf.common.registry.ebxml.RegistryUtil; +import com.raytheon.uf.common.util.SpringFiles; 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; @@ -76,6 +83,20 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * @author djohnson * @version 1.0 */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = { SpringFiles.DATADELIVERY_HANDLERS_XML, + SpringFiles.DATADELIVERY_HANDLERS_IMPL_XML, SpringFiles.EBXML_XML, + SpringFiles.EBXML_IMPL_XML, SpringFiles.EBXML_QUERYTYPES_XML, + SpringFiles.EBXML_REGISTRY_DAO_XML, + SpringFiles.EBXML_REGISTRY_ENCODER_XML, + SpringFiles.EBXML_WEBSERVICES_XML, SpringFiles.EBXML_XACML_XML, + SpringFiles.EBXML_VALIDATOR_PLUGINS_XML, + SpringFiles.EBXML_SUBSCRIPTION_XML, SpringFiles.EVENTBUS_COMMON_XML, + DatabaseUtil.UNIT_TEST_DB_BEANS_XML, + SpringFiles.UNIT_TEST_EBXML_BEANS_XML, + SpringFiles.UNIT_TEST_LOCALIZATION_BEANS_XML }) +@TransactionConfiguration(transactionManager = "metadataTxManager", defaultRollback = true) +@Transactional @Ignore public class AbstractRegistryTest { diff --git a/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/validator/ValidatorImplTest.java b/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/validator/ValidatorImplTest.java index 87dd8c2763..39cf3842db 100644 --- a/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/validator/ValidatorImplTest.java +++ b/tests/integration/com/raytheon/uf/edex/registry/ebxml/services/validator/ValidatorImplTest.java @@ -42,15 +42,8 @@ import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsRequest; import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsResponse; import org.junit.Test; -import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.transaction.TransactionConfiguration; -import org.springframework.transaction.annotation.Transactional; -import com.raytheon.uf.common.util.SpringFiles; -import com.raytheon.uf.edex.database.dao.DatabaseUtil; import com.raytheon.uf.edex.registry.ebxml.dao.AbstractRegistryTest; import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; @@ -72,18 +65,6 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil; * @author djohnson * @version 1.0 */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { DatabaseUtil.UNIT_TEST_DB_BEANS_XML, - SpringFiles.EVENTBUS_COMMON_XML, - SpringFiles.EBXML_XML, SpringFiles.EBXML_XACML_XML, - SpringFiles.EBXML_SUBSCRIPTION_XML, - SpringFiles.EBXML_WEBSERVICES_XML, - SpringFiles.EBXML_VALIDATOR_PLUGINS_XML, - SpringFiles.EBXML_QUERYTYPES_XML, SpringFiles.EBXML_REGISTRY_DAO_XML, - SpringFiles.UNIT_TEST_EBXML_BEANS_XML, - SpringFiles.UNIT_TEST_LOCALIZATION_BEANS_XML }) -@TransactionConfiguration(transactionManager = "metadataTxManager", defaultRollback = true) -@Transactional public class ValidatorImplTest extends AbstractRegistryTest { private static final String LOCAL_STATIC_REFERENCE = "urn:acme:person:Danyal"; diff --git a/tests/resources/bandwidth/bandwidth-datadelivery-integrationtest-impl.xml b/tests/resources/bandwidth/bandwidth-datadelivery-integrationtest-impl.xml index 944600af9e..5a5068866c 100644 --- a/tests/resources/bandwidth/bandwidth-datadelivery-integrationtest-impl.xml +++ b/tests/resources/bandwidth/bandwidth-datadelivery-integrationtest-impl.xml @@ -1,7 +1,7 @@ - + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> + diff --git a/tests/resources/bandwidth/bandwidth-datadelivery-integrationtest-wfo-impl.xml b/tests/resources/bandwidth/bandwidth-datadelivery-integrationtest-wfo-impl.xml index 8426002260..b06bca90a0 100644 --- a/tests/resources/bandwidth/bandwidth-datadelivery-integrationtest-wfo-impl.xml +++ b/tests/resources/bandwidth/bandwidth-datadelivery-integrationtest-wfo-impl.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> diff --git a/tests/resources/datadelivery/memory-datadelivery-handlers.xml b/tests/resources/datadelivery/memory-datadelivery-handlers.xml index 3c95c27a58..f56da60696 100644 --- a/tests/resources/datadelivery/memory-datadelivery-handlers.xml +++ b/tests/resources/datadelivery/memory-datadelivery-handlers.xml @@ -1,20 +1,37 @@ - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> + + - + class="com.raytheon.uf.common.datadelivery.registry.handlers.SubscriptionHandler"> + + + + + + + + + class="com.raytheon.uf.common.datadelivery.registry.handlers.PendingSubscriptionHandler"> + + + + + + + - + @@ -22,7 +39,7 @@ class="com.raytheon.uf.common.datadelivery.registry.handlers.MemoryDataSetNameHandler" /> + class="com.raytheon.uf.common.datadelivery.registry.handlers.MemoryParameterHandler" /> diff --git a/tests/resources/datadelivery/mock-datadelivery-handlers.xml b/tests/resources/datadelivery/mock-datadelivery-handlers.xml index 9f8b56f09c..8787dfa979 100644 --- a/tests/resources/datadelivery/mock-datadelivery-handlers.xml +++ b/tests/resources/datadelivery/mock-datadelivery-handlers.xml @@ -1,66 +1,65 @@ - - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> + + - + - + - + - + - + - + - + - + - + + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> + + + + classpath:com.raytheon.uf.common.registry.ebxml.properties + + + + + + + + + + diff --git a/tests/resources/unit-test-db-beans.xml b/tests/resources/unit-test-db-beans.xml index 6597684aee..83ff494d92 100644 --- a/tests/resources/unit-test-db-beans.xml +++ b/tests/resources/unit-test-db-beans.xml @@ -12,6 +12,7 @@ classpath:/unit-test-db-beans.properties + diff --git a/tests/resources/unit-test-db-beans2.xml b/tests/resources/unit-test-db-beans2.xml index a1ecfa31df..1ad00562e5 100644 --- a/tests/resources/unit-test-db-beans2.xml +++ b/tests/resources/unit-test-db-beans2.xml @@ -15,6 +15,7 @@ classpath:/unit-test-db-beans2.properties + diff --git a/tests/resources/unit-test-db-session.xml b/tests/resources/unit-test-db-session.xml index 1430fe711c..bb5e6579ed 100644 --- a/tests/resources/unit-test-db-session.xml +++ b/tests/resources/unit-test-db-session.xml @@ -28,6 +28,10 @@ class="org.springframework.orm.hibernate3.HibernateTransactionManager"> + + + + diff --git a/tests/resources/unit-test-localization-beans.xml b/tests/resources/unit-test-localization-beans.xml index 2e22c3b515..c40a8bb21a 100644 --- a/tests/resources/unit-test-localization-beans.xml +++ b/tests/resources/unit-test-localization-beans.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSharedSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSharedSubscriptionFixture.java new file mode 100644 index 0000000000..ec0ba0853e --- /dev/null +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSharedSubscriptionFixture.java @@ -0,0 +1,65 @@ +/** + * 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.common.datadelivery.registry; + +import java.util.Random; + +import com.raytheon.uf.common.registry.ebxml.RegistryUtil; + +/** + * Base fixture for {@link SharedSubscription} objects. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ + +public abstract class BaseSharedSubscriptionFixture + extends BaseSubscriptionFixture { + + /** + * Constructor. + */ + protected BaseSharedSubscriptionFixture() { + + } + + /** + * {@inheritDoc} + */ + @Override + public T getInstance(long seedValue, Random random) { + T subscription = super.getInstance(seedValue, random); + + subscription.setId(RegistryUtil.getRegistryObjectKey(subscription)); + + return subscription; + } + +} diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSubscriptionFixture.java index 493274a4c5..a869191b26 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSubscriptionFixture.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/BaseSubscriptionFixture.java @@ -28,7 +28,7 @@ import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.util.AbstractFixture; /** - * Move in reusable code from {@link SubscriptionFixture}. + * Move in reusable code from {@link SiteSubscriptionFixture}. * *
  * 
diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscriptionFixture.java
new file mode 100644
index 0000000000..ce75cc8f16
--- /dev/null
+++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSharedSubscriptionFixture.java
@@ -0,0 +1,72 @@
+/**
+ * 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.common.datadelivery.registry;
+
+import java.util.Random;
+
+
+/**
+ * Fixture for {@link PendingSharedSubscription} objects.
+ * 
+ * 
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ + +public class PendingSharedSubscriptionFixture extends + BaseSharedSubscriptionFixture { + + public static final PendingSharedSubscriptionFixture INSTANCE = new PendingSharedSubscriptionFixture(); + + /** + * Constructor. + */ + private PendingSharedSubscriptionFixture() { + } + + /** + * {@inheritDoc} + */ + @Override + public PendingSharedSubscription getInstance(long seedValue, Random random) { + PendingSharedSubscription sub = super.getInstance(seedValue, random); + sub.setChangeReqId("change" + seedValue); + + return sub; + } + + /** + * {@inheritDoc} + */ + @Override + protected PendingSharedSubscription getSubscription() { + return new PendingSharedSubscription(); + } + +} diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscriptionFixture.java similarity index 90% rename from tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionFixture.java rename to tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscriptionFixture.java index 5cc18fcabb..c5e58f4b70 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionFixture.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSiteSubscriptionFixture.java @@ -41,15 +41,15 @@ import com.raytheon.uf.common.util.AbstractFixture; * @version 1.0 */ -public class PendingSubscriptionFixture extends +public class PendingSiteSubscriptionFixture extends BaseSiteSubscriptionFixture { - public static final PendingSubscriptionFixture INSTANCE = new PendingSubscriptionFixture(); + public static final PendingSiteSubscriptionFixture INSTANCE = new PendingSiteSubscriptionFixture(); /** * Disabled constructor. */ - private PendingSubscriptionFixture() { + private PendingSiteSubscriptionFixture() { } /** diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java index 25873bc410..5c0ec9bd41 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/PendingSubscriptionTest.java @@ -46,7 +46,7 @@ public class PendingSubscriptionTest { @Test public void testCopyConstructorSetsOriginalSubNameAsName() { - SiteSubscription subscription = SubscriptionFixture.INSTANCE.get(); + SiteSubscription subscription = SiteSubscriptionFixture.INSTANCE.get(); PendingSiteSubscription pendingSubscription = new PendingSiteSubscription( subscription, "djohnson"); @@ -57,7 +57,7 @@ public class PendingSubscriptionTest { @Test public void testCopyConstructorSetsSubscriptionValuesOnPendingSubscription() { - SiteSubscription subscription = SubscriptionFixture.INSTANCE.get(); + SiteSubscription subscription = SiteSubscriptionFixture.INSTANCE.get(); PendingSiteSubscription copied = new PendingSiteSubscription( subscription, "djohnson"); diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SharedSubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SharedSubscriptionFixture.java new file mode 100644 index 0000000000..6403cbddb6 --- /dev/null +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SharedSubscriptionFixture.java @@ -0,0 +1,60 @@ +/** + * 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.common.datadelivery.registry; + + +/** + * Fixture for {@link SharedSubscription} objects. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ + +public class SharedSubscriptionFixture extends + BaseSharedSubscriptionFixture { + + public static final SharedSubscriptionFixture INSTANCE = new SharedSubscriptionFixture(); + + /** + * Constructor. + */ + private SharedSubscriptionFixture() { + + } + + /** + * {@inheritDoc} + */ + @Override + protected SharedSubscription getSubscription() { + return new SharedSubscription(); + } + +} diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionFixture.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionFixture.java similarity index 90% rename from tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionFixture.java rename to tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionFixture.java index 4bcd611f2c..b90dc84d2b 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionFixture.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionFixture.java @@ -40,15 +40,15 @@ import com.raytheon.uf.common.util.AbstractFixture; * @version 1.0 */ -public class SubscriptionFixture extends +public class SiteSubscriptionFixture extends BaseSiteSubscriptionFixture { - public static final SubscriptionFixture INSTANCE = new SubscriptionFixture(); + public static final SiteSubscriptionFixture INSTANCE = new SiteSubscriptionFixture(); /** * Disabled constructor. */ - private SubscriptionFixture() { + private SiteSubscriptionFixture() { } /** diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java index 3ec3d8522a..2df0d8352b 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SiteSubscriptionTest.java @@ -78,7 +78,7 @@ public class SiteSubscriptionTest { @Test public void testCopyConstructorSetsSpecifiedName() throws Exception { - SiteSubscription subscription = SubscriptionFixture.INSTANCE.get(); + SiteSubscription subscription = SiteSubscriptionFixture.INSTANCE.get(); Subscription copied = new SiteSubscription(subscription, "newName"); @@ -89,7 +89,7 @@ public class SiteSubscriptionTest { @Test public void testCopyConstructorSetsValuesFromSourceSubscription() throws Exception { - SiteSubscription subscription = SubscriptionFixture.INSTANCE.get(); + SiteSubscription subscription = SiteSubscriptionFixture.INSTANCE.get(); Subscription copied = new SiteSubscription(subscription, "newName"); diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionBuilder.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionBuilder.java index 9ed135df7e..c9d151c955 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionBuilder.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/SubscriptionBuilder.java @@ -98,7 +98,7 @@ public class SubscriptionBuilder { * {@inheritDoc} */ public SiteSubscription build() { - SiteSubscription subscription = SubscriptionFixture.INSTANCE.get(); + SiteSubscription subscription = SiteSubscriptionFixture.INSTANCE.get(); subscription.setActive(active); subscription.setActivePeriodStart(activePeriodStart); subscription.setActivePeriodEnd(activePeriodEnd); diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSharedSubscriptionHandler.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSharedSubscriptionHandler.java new file mode 100644 index 0000000000..0fac5cd0a1 --- /dev/null +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSharedSubscriptionHandler.java @@ -0,0 +1,44 @@ +/** + * 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.common.datadelivery.registry.handlers; + +import com.raytheon.uf.common.datadelivery.registry.InitialPendingSharedSubscription; + +/** + * {@link IPendingSharedSubscriptionHandler} in-memory implementation. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ + +public class MemoryPendingSharedSubscriptionHandler extends + MemoryPendingSubscriptionTypeHandler + implements IPendingSharedSubscriptionHandler { +} diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSiteSubscriptionHandler.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSiteSubscriptionHandler.java new file mode 100644 index 0000000000..5adea57ac3 --- /dev/null +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSiteSubscriptionHandler.java @@ -0,0 +1,44 @@ +/** + * 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.common.datadelivery.registry.handlers; + +import com.raytheon.uf.common.datadelivery.registry.InitialPendingSiteSubscription; + +/** + * {@link IPendingSiteSubscriptionHandler} in-memory implementation. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ + +public class MemoryPendingSiteSubscriptionHandler extends + MemoryPendingSubscriptionTypeHandler + implements IPendingSiteSubscriptionHandler { +} diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSubscriptionHandler.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSubscriptionTypeHandler.java similarity index 78% rename from tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSubscriptionHandler.java rename to tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSubscriptionTypeHandler.java index 4c0e5a1e1b..cdd64ba6ac 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSubscriptionHandler.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemoryPendingSubscriptionTypeHandler.java @@ -30,8 +30,6 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.registry.ebxml.RegistryUtil; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; - - /** * {@link IPendingSubscriptionHandler} in-memory implementation. * @@ -49,16 +47,15 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException; * @version 1.0 */ -public class MemoryPendingSubscriptionHandler extends - BaseMemorySubscriptionHandler implements - IPendingSubscriptionHandler { +public class MemoryPendingSubscriptionTypeHandler + extends BaseMemorySubscriptionHandler implements + IBasePendingSubscriptionHandler { /** * {@inheritDoc} */ @Override - public void store(InitialPendingSubscription obj) - throws RegistryHandlerException { + public void store(T obj) throws RegistryHandlerException { // TODO: Store an in-memory association to the subscription super.store(obj); } @@ -77,8 +74,8 @@ public class MemoryPendingSubscriptionHandler extends * {@inheritDoc} */ @Override - public InitialPendingSubscription getBySubscription( - Subscription subscription) throws RegistryHandlerException { + public T getBySubscription(Subscription subscription) + throws RegistryHandlerException { return getBySubscriptionId(RegistryUtil .getRegistryObjectKey(subscription)); } @@ -87,10 +84,8 @@ public class MemoryPendingSubscriptionHandler extends * {@inheritDoc} */ @Override - public InitialPendingSubscription getBySubscriptionId(String id) - throws RegistryHandlerException { - List results = getBySubscriptionIds(Arrays - .asList(id)); + public T getBySubscriptionId(String id) throws RegistryHandlerException { + List results = getBySubscriptionIds(Arrays.asList(id)); return (!results.isEmpty()) ? results.iterator().next() : null; } @@ -98,8 +93,7 @@ public class MemoryPendingSubscriptionHandler extends * {@inheritDoc} */ @Override - public List getBySubscriptions( - Collection subscriptions) + public List getBySubscriptions(Collection subscriptions) throws RegistryHandlerException { List ids = new ArrayList(subscriptions.size()); for (Subscription subscription : subscriptions) { @@ -112,8 +106,8 @@ public class MemoryPendingSubscriptionHandler extends * {@inheritDoc} */ @Override - public List getBySubscriptionIds( - List ids) throws RegistryHandlerException { + public List getBySubscriptionIds(List ids) + throws RegistryHandlerException { // TODO: Lookup via an in-memory association return Collections.emptyList(); } diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySharedSubscriptionHandler.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySharedSubscriptionHandler.java new file mode 100644 index 0000000000..ff70176a2a --- /dev/null +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySharedSubscriptionHandler.java @@ -0,0 +1,44 @@ +/** + * 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.common.datadelivery.registry.handlers; + +import com.raytheon.uf.common.datadelivery.registry.SharedSubscription; + +/** + * {@link ISharedSubscriptionHandler} in-memory implementation. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ + +public class MemorySharedSubscriptionHandler extends + MemorySubscriptionTypeHandler implements + ISharedSubscriptionHandler { +} diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySiteSubscriptionHandler.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySiteSubscriptionHandler.java new file mode 100644 index 0000000000..9b9202a949 --- /dev/null +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySiteSubscriptionHandler.java @@ -0,0 +1,44 @@ +/** + * 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.common.datadelivery.registry.handlers; + +import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; + +/** + * {@link ISubscriptionHandler} in-memory implementation. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 17, 2012 0726       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ + +public class MemorySiteSubscriptionHandler extends + MemorySubscriptionTypeHandler implements + ISiteSubscriptionHandler { +} diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySubscriptionHandler.java b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySubscriptionTypeHandler.java similarity index 83% rename from tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySubscriptionHandler.java rename to tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySubscriptionTypeHandler.java index bc0bf9c37a..07c87b45a0 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySubscriptionHandler.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/registry/handlers/MemorySubscriptionTypeHandler.java @@ -31,7 +31,7 @@ import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers; import com.raytheon.uf.common.util.CollectionUtil; /** - * {@link ISubscriptionHandler} in-memory implementation. + * Base {@link ISubscriptionTypeHandler} in-memory implementation. * *
  * 
@@ -39,7 +39,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
  * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Oct 17, 2012 0726       djohnson     Initial creation
+ * May 29, 2013 1650       djohnson     Initial creation
  * 
  * 
* @@ -47,15 +47,15 @@ import com.raytheon.uf.common.util.CollectionUtil; * @version 1.0 */ -public class MemorySubscriptionHandler extends - BaseMemorySubscriptionHandler implements - ISubscriptionHandler { +public abstract class MemorySubscriptionTypeHandler + extends BaseMemorySubscriptionHandler implements + IBaseSubscriptionHandler, ISubscriptionTypeHandler { /** * {@inheritDoc} */ @Override - public Subscription getByPendingSubscription(PendingSubscription pending) + public T getByPendingSubscription(PendingSubscription pending) throws RegistryHandlerException { return getByPendingSubscriptionId(RegistryUtil .getRegistryObjectKey(pending)); @@ -65,7 +65,7 @@ public class MemorySubscriptionHandler extends * {@inheritDoc} */ @Override - public Subscription getByPendingSubscriptionId(final String id) + public T getByPendingSubscriptionId(final String id) throws RegistryHandlerException { // TODO: lookup via in-memory association return null; @@ -99,11 +99,11 @@ public class MemorySubscriptionHandler extends * {@inheritDoc} */ @Override - public List getActiveByDataSetAndProvider(String dataSetName, + public List getActiveByDataSetAndProvider(String dataSetName, String providerName) throws RegistryHandlerException { - List retVal = new ArrayList(); + List retVal = new ArrayList(); - for (Subscription obj : getActive()) { + for (T obj : getActive()) { if (matches(dataSetName, obj.getDataSetName()) && matches(providerName, obj.getProvider())) { retVal.add(obj); diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionDuplicateCheckerTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionDuplicateCheckerTest.java index a73186d1a9..4b48ef1e6a 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionDuplicateCheckerTest.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionDuplicateCheckerTest.java @@ -33,7 +33,7 @@ import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.datadelivery.registry.GriddedCoverage; import com.raytheon.uf.common.datadelivery.registry.Parameter; import com.raytheon.uf.common.datadelivery.registry.ParameterFixture; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; import com.raytheon.uf.common.geospatial.MapUtil; import com.vividsolutions.jts.geom.Coordinate; @@ -61,8 +61,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsPercentOfParametersThatAreTheSame() { - final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); sub1.getParameter().clear(); sub1.addParameter(ParameterFixture.INSTANCE.get(1)); @@ -79,8 +79,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfParametersForNullsOrEmpties() { - final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); sub1.setParameter(null); @@ -101,8 +101,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsPercentOfForecastHoursThatAreTheSame() { - final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); final List sub1SelectedTimes = Arrays.asList(0, 1); sub1.getTime().setSelectedTimeIndices(sub1SelectedTimes); @@ -117,8 +117,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfForecastHoursForNullsOrEmpties() { - final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); sub1.getTime().setSelectedTimeIndices(null); final List sub2SelectedTimes = Arrays.asList(0, 3, 4); @@ -139,8 +139,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsPercentOfCyclesThatAreTheSame() { - final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); final List sub1CycleTimes = Arrays.asList(0, 6); sub1.getTime().setCycleTimes(sub1CycleTimes); @@ -155,8 +155,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfCyclesForNullsOrEmpties() { - final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); sub1.getTime().setCycleTimes(null); final List cycleTimes = Arrays.asList(0, 3, 4); @@ -173,8 +173,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsPercentOfSpatialThatIsTheSame() throws TransformException { - final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); ReferencedEnvelope envelope1 = new ReferencedEnvelope(new Envelope( new Coordinate(-5, 0), new Coordinate(0, 5)), @@ -198,8 +198,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfSpatialWhenNoOverlap() throws TransformException { - final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); ReferencedEnvelope envelope1 = new ReferencedEnvelope(new Envelope( new Coordinate(-5, 0), new Coordinate(0, 5)), @@ -217,8 +217,8 @@ public class SubscriptionDuplicateCheckerTest { @Test public void returnsZeroPercentOfSpatialForNulls() throws TransformException { - final SiteSubscription sub1 = SubscriptionFixture.INSTANCE.get(1); - final SiteSubscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final SiteSubscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); + final SiteSubscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); sub1.setCoverage(null); diff --git a/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionOverlapServiceTest.java b/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionOverlapServiceTest.java index 88bb124652..abc5767e28 100644 --- a/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionOverlapServiceTest.java +++ b/tests/unit/com/raytheon/uf/common/datadelivery/service/subscription/SubscriptionOverlapServiceTest.java @@ -31,7 +31,7 @@ import org.junit.Test; import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.datadelivery.registry.Subscription; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.localization.PathManagerFactoryTest; import com.raytheon.uf.common.localization.exception.LocalizationException; @@ -65,9 +65,9 @@ public class SubscriptionOverlapServiceTest { private final SubscriptionOverlapService service = new SubscriptionOverlapService( duplicateChecker); - private final Subscription sub1 = SubscriptionFixture.INSTANCE.get(1); + private final Subscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); - private final Subscription sub2 = SubscriptionFixture.INSTANCE.get(2); + private final Subscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); @Before public void setUp() { diff --git a/tests/unit/com/raytheon/uf/common/registry/handler/RegistryObjectHandlersUtil.java b/tests/unit/com/raytheon/uf/common/registry/handler/RegistryObjectHandlersUtil.java index af213ed236..9196e55473 100644 --- a/tests/unit/com/raytheon/uf/common/registry/handler/RegistryObjectHandlersUtil.java +++ b/tests/unit/com/raytheon/uf/common/registry/handler/RegistryObjectHandlersUtil.java @@ -22,6 +22,7 @@ package com.raytheon.uf.common.registry.handler; import org.mockito.Mockito; import org.springframework.context.support.ClassPathXmlApplicationContext; +import com.raytheon.uf.common.util.SpringFiles; import com.raytheon.uf.common.util.TestUtil; /** @@ -47,8 +48,6 @@ public class RegistryObjectHandlersUtil { private static final String MOCK_DATADELIVERY_HANDLERS_XML = "/datadelivery/mock-datadelivery-handlers.xml"; - private static final String SPRING_DATADELIVERY_HANDLERS_IMPL_XML = "/spring/datadelivery-handlers-impl.xml"; - private static final String MEMORY_DATADELIVERY_HANDLERS_XML = "/datadelivery/memory-datadelivery-handlers.xml"; /** @@ -56,7 +55,7 @@ public class RegistryObjectHandlersUtil { * which interact with the registry proper. */ public static void init() { - initHandlersFromSpringFile(SPRING_DATADELIVERY_HANDLERS_IMPL_XML); + initHandlersFromSpringFile(SpringFiles.DATADELIVERY_HANDLERS_IMPL_XML); } /** @@ -80,7 +79,7 @@ public class RegistryObjectHandlersUtil { RegistryObjectHandlers.clear(); new ClassPathXmlApplicationContext( new String[] { - TestUtil.getResResourcePath("/spring/datadelivery-handlers.xml"), + TestUtil.getResResourcePath(SpringFiles.DATADELIVERY_HANDLERS_XML), TestUtil.getResResourcePath(resResource) }, RegistryObjectHandlersUtil.class); } diff --git a/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java b/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java index 268a491eb6..1877e98f28 100644 --- a/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java +++ b/tests/unit/com/raytheon/uf/common/serialization/TestJaxbableClassesLocator.java @@ -24,9 +24,12 @@ import java.util.List; import javax.xml.ws.wsaddressing.W3CEndpointReference; +import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExtensibleObjectType; + import org.junit.Ignore; import com.raytheon.uf.common.monitor.xml.FFMPTemplateXML; +import com.raytheon.uf.edex.registry.ebxml.services.query.adhoc.AdhocQueryExpression; /** * Implementation of {@link IJaxbableClassesLocator} that returns a static list @@ -95,7 +98,8 @@ 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, W3CEndpointReference.class }; + FFMPTemplateXML.class, W3CEndpointReference.class, + AdhocQueryExpression.class, ExtensibleObjectType.class }; JAXB_CLASSES = Arrays.asList(array); } diff --git a/tests/unit/com/raytheon/uf/common/util/SpringFiles.java b/tests/unit/com/raytheon/uf/common/util/SpringFiles.java index f4e99f29bc..b4200983fa 100644 --- a/tests/unit/com/raytheon/uf/common/util/SpringFiles.java +++ b/tests/unit/com/raytheon/uf/common/util/SpringFiles.java @@ -67,6 +67,10 @@ public class SpringFiles { public static final String BANDWIDTH_DATADELIVERY_WFO_XML = "/spring/bandwidth-datadelivery-wfo.xml"; + public static final String DATADELIVERY_HANDLERS_XML = "/spring/datadelivery-handlers.xml"; + + public static final String DATADELIVERY_HANDLERS_IMPL_XML = "/spring/datadelivery-handlers-impl.xml"; + public static final String EBXML_XML = "/spring/ebxml.xml"; public static final String EBXML_IMPL_XML = "/spring/ebxml-impl.xml"; @@ -75,6 +79,8 @@ public class SpringFiles { public static final String EBXML_REGISTRY_DAO_XML = "/spring/ebxml-registry-dao.xml"; + public static final String EBXML_REGISTRY_ENCODER_XML = "/spring/ebxml-registry-encoder.xml"; + public static final String EBXML_REPLICATION_DATADELIVERY_WFO_XML = "/spring/registry-replication-datadelivery-wfo.xml"; public static final String EBXML_SUBSCRIPTION_XML = "/spring/ebxml-subscription.xml"; @@ -94,4 +100,5 @@ public class SpringFiles { public static final String UNIT_TEST_EBXML_REPLICATION_BEANS_XML = "/ebxml/unit-test-ebxml-replication-beans.xml"; public static final String UNIT_TEST_EBXML_PLUGIN_NOTIFICATION_LISTENER_XML = "/ebxml/ebxml-plugin-notification-listener.xml"; + } \ No newline at end of file diff --git a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthDaoTest.java b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthDaoTest.java index 4c5320e06c..9e543b75d3 100644 --- a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthDaoTest.java +++ b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/AbstractBandwidthDaoTest.java @@ -36,7 +36,7 @@ import com.raytheon.uf.common.datadelivery.registry.Network; import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaData; import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetMetaDataFixture; import com.raytheon.uf.common.datadelivery.registry.Subscription; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.time.util.ImmutableDate; import com.raytheon.uf.common.time.util.TimeUtil; @@ -305,9 +305,9 @@ public abstract class AbstractBandwidthDaoTest { final Calendar now = BandwidthUtil.now(); // Identical except for their identifier fields BandwidthSubscription entity1 = dao.newBandwidthSubscription( - SubscriptionFixture.INSTANCE.get(), now); + SiteSubscriptionFixture.INSTANCE.get(), now); BandwidthSubscription entity2 = dao.newBandwidthSubscription( - SubscriptionFixture.INSTANCE.get(), now); + SiteSubscriptionFixture.INSTANCE.get(), now); assertFalse("The two objects should not have the same id!", entity1.getId() == entity2.getId()); @@ -323,12 +323,12 @@ public abstract class AbstractBandwidthDaoTest { throws SerializationException { final Calendar now = BandwidthUtil.now(); // Identical except for their base reference times and ids - dao.newBandwidthSubscription(SubscriptionFixture.INSTANCE.get(), now); + dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(), now); final Calendar later = BandwidthUtil.now(); later.add(Calendar.HOUR, 1); BandwidthSubscription entity2 = dao.newBandwidthSubscription( - SubscriptionFixture.INSTANCE.get(), later); + SiteSubscriptionFixture.INSTANCE.get(), later); final BandwidthSubscription result = dao.getBandwidthSubscription( entity2.getRegistryId(), later); @@ -457,7 +457,7 @@ public abstract class AbstractBandwidthDaoTest { public void testGetSubscriptionsReturnsClones() throws SerializationException { BandwidthSubscription entity = dao.newBandwidthSubscription( - SubscriptionFixture.INSTANCE.get(), BandwidthUtil.now()); + SiteSubscriptionFixture.INSTANCE.get(), BandwidthUtil.now()); List results = dao.getBandwidthSubscriptions(); assertEquals(1, results.size()); @@ -475,12 +475,12 @@ public abstract class AbstractBandwidthDaoTest { three.add(Calendar.HOUR, 1); // Three entities all the same except for base reference time - dao.newBandwidthSubscription(SubscriptionFixture.INSTANCE.get(), one); - dao.newBandwidthSubscription(SubscriptionFixture.INSTANCE.get(), two); + dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(), one); + dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(), two); BandwidthSubscription entity3 = dao.newBandwidthSubscription( - SubscriptionFixture.INSTANCE.get(), three); + SiteSubscriptionFixture.INSTANCE.get(), three); // One with same base reference time but different provider/dataset - dao.newBandwidthSubscription(SubscriptionFixture.INSTANCE.get(2), three); + dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(2), three); List results = dao.getBandwidthSubscriptions( entity3.getProvider(), entity3.getDataSetName(), three); @@ -575,10 +575,10 @@ public abstract class AbstractBandwidthDaoTest { @Test public void testRemoveSubscriptionDao() throws SerializationException { final Calendar now = BandwidthUtil.now(); - dao.newBandwidthSubscription(SubscriptionFixture.INSTANCE.get(1), now); + dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(1), now); final BandwidthSubscription entity2 = dao.newBandwidthSubscription( - SubscriptionFixture.INSTANCE.get(2), now); - dao.newBandwidthSubscription(SubscriptionFixture.INSTANCE.get(3), now); + SiteSubscriptionFixture.INSTANCE.get(2), now); + dao.newBandwidthSubscription(SiteSubscriptionFixture.INSTANCE.get(3), now); assertEquals("Incorrect number of entities found!", 3, dao .getBandwidthSubscriptions().size()); @@ -641,7 +641,7 @@ public abstract class AbstractBandwidthDaoTest { final long estimatedSize = 25L; BandwidthSubscription entity = dao.newBandwidthSubscription( - SubscriptionFixture.INSTANCE.get(), BandwidthUtil.now()); + SiteSubscriptionFixture.INSTANCE.get(), BandwidthUtil.now()); entity.setEstimatedSize(estimatedSize); dao.update(entity); diff --git a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/dao/SubscriptionDaoFixture.java b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/dao/SubscriptionDaoFixture.java index b6df0a611f..b480493fd9 100644 --- a/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/dao/SubscriptionDaoFixture.java +++ b/tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/dao/SubscriptionDaoFixture.java @@ -22,7 +22,7 @@ package com.raytheon.uf.edex.datadelivery.bandwidth.dao; import java.util.Random; import com.raytheon.uf.common.datadelivery.registry.Subscription; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.util.AbstractFixture; import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil; @@ -60,7 +60,7 @@ public class SubscriptionDaoFixture extends AbstractFixture subscriptions = Arrays.asList(sub1, sub2); diff --git a/tests/unit/com/raytheon/uf/edex/registry/ebxml/dao/HsqlEbxmlDbInit.java b/tests/unit/com/raytheon/uf/edex/registry/ebxml/dao/HsqlEbxmlDbInit.java new file mode 100644 index 0000000000..948cdf6ba6 --- /dev/null +++ b/tests/unit/com/raytheon/uf/edex/registry/ebxml/dao/HsqlEbxmlDbInit.java @@ -0,0 +1,49 @@ +/** + * 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; + + +/** + * Extends {@link DbInit} to load the database for HSQL. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 1650       djohnson     Initial creation
+ * 
+ * 
+ * + * @author djohnson + * @version 1.0 + */ +public class HsqlEbxmlDbInit extends DbInit { + + /** + * {@inheritDoc} + */ + @Override + public void initDb() throws Exception { + populateDB(); + } + +} diff --git a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/AbstractSubscriptionServiceTest.java b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/AbstractSubscriptionServiceTest.java index 467fc4d737..555aa5308d 100644 --- a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/AbstractSubscriptionServiceTest.java +++ b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/AbstractSubscriptionServiceTest.java @@ -48,7 +48,7 @@ import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse; import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription; import com.raytheon.uf.common.datadelivery.registry.AdhocSubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.Subscription; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers; import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler; import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService; @@ -91,9 +91,9 @@ public abstract class AbstractSubscriptionServiceTest { protected static final long REQUIRED_DATASET_SIZE = 1024l; - final Subscription sub1 = SubscriptionFixture.INSTANCE.get(1); + final Subscription sub1 = SiteSubscriptionFixture.INSTANCE.get(1); - final Subscription sub2 = SubscriptionFixture.INSTANCE.get(2); + final Subscription sub2 = SiteSubscriptionFixture.INSTANCE.get(2); final List subs = Arrays.asList(sub1, sub2); diff --git a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionPresenterTest.java b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionPresenterTest.java index 0cd2cd2e8b..69d5a52f20 100644 --- a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionPresenterTest.java +++ b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionPresenterTest.java @@ -44,7 +44,7 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet; import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; import com.raytheon.uf.common.time.CalendarBuilder; @@ -160,7 +160,7 @@ public class CreateSubscriptionPresenterTest { @Test public void verifySubscriptionIsSubmittedToSubscriptionService() throws RegistryHandlerException { - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); final ISubscriptionServiceResult result = mock(ISubscriptionServiceResult.class); when( @@ -176,7 +176,7 @@ public class CreateSubscriptionPresenterTest { @Test public void verifyIfMessageIsNotReturnedFromSubscriptionServiceThenItIsNotDisplayed() throws RegistryHandlerException { - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); final ISubscriptionServiceResult result = mock(ISubscriptionServiceResult.class); when(result.hasMessageToDisplay()).thenReturn(false); diff --git a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/LatencyRuleXMLTest.java b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/LatencyRuleXMLTest.java index 2ac91180a3..7d6238dda4 100644 --- a/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/LatencyRuleXMLTest.java +++ b/tests/unit/com/raytheon/uf/viz/datadelivery/subscription/xml/LatencyRuleXMLTest.java @@ -23,7 +23,7 @@ import javax.xml.bind.JAXBException; import org.junit.Test; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.units.DataSizeUnit; import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.viz.datadelivery.system.CreateEditRuleDlg.FreqUnitOptions; @@ -66,7 +66,7 @@ public class LatencyRuleXMLTest { ruleXml.setRuleUnit(DataSizeUnit.BYTE.getUnit()); ruleXml.setRuleValue("10"); - ruleXml.matches(SubscriptionFixture.INSTANCE.get(), + ruleXml.matches(SiteSubscriptionFixture.INSTANCE.get(), CollectionUtil.asSet(1, 2)); } @@ -80,7 +80,7 @@ public class LatencyRuleXMLTest { ruleXml.setRuleUnit(FreqUnitOptions.MIN.getOperation()); ruleXml.setRuleValue("10"); - ruleXml.matches(SubscriptionFixture.INSTANCE.get(), + ruleXml.matches(SiteSubscriptionFixture.INSTANCE.get(), CollectionUtil.asSet(1, 2)); } } diff --git a/tests/unit/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtilsTest.java b/tests/unit/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtilsTest.java index afb47cae91..555186acef 100644 --- a/tests/unit/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtilsTest.java +++ b/tests/unit/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtilsTest.java @@ -32,7 +32,7 @@ import org.junit.Test; import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet; import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSetFixture; import com.raytheon.uf.common.datadelivery.registry.Subscription; -import com.raytheon.uf.common.datadelivery.registry.SubscriptionFixture; +import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture; import com.raytheon.uf.common.datadelivery.registry.Time; /** @@ -68,7 +68,7 @@ public class DataDeliveryUtilsTest { cycleTimes.add(1); cycleTimes.add(4); - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); Time subTime = subscription.getTime(); subTime.setCycleTimes(cycleTimes); @@ -81,7 +81,7 @@ public class DataDeliveryUtilsTest { List cycleTimes = newArrayList(); cycleTimes.add(0); - Subscription subscription = SubscriptionFixture.INSTANCE.get(); + Subscription subscription = SiteSubscriptionFixture.INSTANCE.get(); Time subTime = subscription.getTime(); subTime.setCycleTimes(cycleTimes);