diff --git a/edexOsgi/build.edex/esb/bin/setup.env b/edexOsgi/build.edex/esb/bin/setup.env index 1295a26f5c..8f13ba33eb 100644 --- a/edexOsgi/build.edex/esb/bin/setup.env +++ b/edexOsgi/build.edex/esb/bin/setup.env @@ -33,7 +33,8 @@ export BROKER_ADDR=localhost export PYPIES_SERVER=http://localhost:9582 # data delivery specific variables, used below in the localization section -export NCF_ADDRESS=http://165.92.30.69:8084 +export NCF_HOST=165.92.30.69 +export NCF_ADDRESS=http://${NCF_HOST}:8084 export DATADELIVERY_HOST=localhost export DATADELIVERY_PORT=9588 # Currently the registry is hosted on datadelivery, but this could be changed in the future @@ -52,7 +53,7 @@ export DATADELIVERY_SERVER=http://${DATADELIVERY_HOST}:${DATADELIVERY_PORT}/serv export EBXML_REGISTRY_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_PORT}/services export EBXML_REGISTRY_LCM_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_PORT}/lifecycleManager?WSDL export EBXML_REGISTRY_QUERY_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_PORT}/queryManager?WSDL -export NCF_BANDWIDTH_MANAGER_SERVICE=http://${DATADELIVERY_HOST}:9590/services +export NCF_BANDWIDTH_MANAGER_SERVICE=http://${NCF_HOST}:9590/services # set the AWIPS II shared directory export SHARE_DIR=/awips2/edex/data/share 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 5334f15b7a..55d4af6f80 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 @@ -34,6 +34,9 @@ import com.raytheon.uf.common.datadelivery.registry.SiteSubscription; import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler; import com.raytheon.uf.common.registry.handler.RegistryHandlerException; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.util.CollectionUtil; /** @@ -53,6 +56,7 @@ import com.raytheon.uf.common.util.CollectionUtil; * 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. + * May 31, 2013 1650 djohnson Fix ability to get shared subscriptions by id. * * * @@ -61,6 +65,9 @@ import com.raytheon.uf.common.util.CollectionUtil; */ public class SubscriptionHandler implements ISubscriptionHandler { + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(SubscriptionHandler.class); + private final ISiteSubscriptionHandler siteSubscriptionHandler; private final ISharedSubscriptionHandler sharedSubscriptionHandler; @@ -249,7 +256,19 @@ public class SubscriptionHandler implements ISubscriptionHandler { */ @Override public Subscription getById(String id) throws RegistryHandlerException { - Subscription value = siteSubscriptionHandler.getById(id); + Subscription value = null; + try { + value = siteSubscriptionHandler.getById(id); + } catch (RegistryHandlerException e) { + if (e.getCause() instanceof ClassCastException) { + // This will happen for shared subscriptions + if (statusHandler.isPriorityEnabled(Priority.DEBUG)) { + statusHandler.handle(Priority.DEBUG, + "Registry object with id [" + id + + "] is not a site subscription.", e); + } + } + } if (value == null) { value = sharedSubscriptionHandler.getById(id); } @@ -353,11 +372,11 @@ public class SubscriptionHandler implements ISubscriptionHandler { + "]. Did you add a new subscription type?")); } } - + if (!siteSubscriptions.isEmpty()) { siteSubscriptionHandler.delete(siteSubscriptions); } - + if (!sharedSubscriptions.isEmpty()) { sharedSubscriptionHandler.delete(sharedSubscriptions); } @@ -390,11 +409,11 @@ public class SubscriptionHandler implements ISubscriptionHandler { + "]. Did you add a new subscription type?")); } } - + if (!siteSubscriptions.isEmpty()) { siteSubscriptionHandler.delete(username, siteSubscriptions); } - + if (!sharedSubscriptions.isEmpty()) { sharedSubscriptionHandler.delete(username, sharedSubscriptions); } 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 index 701042e946..d4cfba21f3 100644 --- a/tests/integration/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandlerTest.java +++ b/tests/integration/com/raytheon/uf/common/datadelivery/registry/handlers/SubscriptionHandlerTest.java @@ -21,6 +21,7 @@ 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.assertNotNull; import static org.junit.Assert.assertThat; import java.util.List; @@ -46,6 +47,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.AbstractRegistryTest; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * May 29, 2013 1650 djohnson Initial creation + * May 31, 2013 1650 djohnson Fix ability to get shared subscriptions by id. * * * @@ -95,4 +97,17 @@ public class SubscriptionHandlerTest extends AbstractRegistryTest { assertThat(subscriptionHandler.getAll(), is(empty())); } + + @Test + public void getByIdReturnsSharedSubscription() + throws RegistryHandlerException { + final SharedSubscription sharedSubscription = SharedSubscriptionFixture.INSTANCE + .get(); + + final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers + .getSubscriptionHandler(); + subscriptionHandler.store(sharedSubscription); + + assertNotNull(subscriptionHandler.getById(sharedSubscription.getId())); + } } diff --git a/tests/unit/com/raytheon/uf/common/localization/TestPathManager.java b/tests/unit/com/raytheon/uf/common/localization/TestPathManager.java index b1e18b955a..9a02b66b89 100644 --- a/tests/unit/com/raytheon/uf/common/localization/TestPathManager.java +++ b/tests/unit/com/raytheon/uf/common/localization/TestPathManager.java @@ -41,6 +41,7 @@ import com.raytheon.uf.common.util.FileUtil; * Jul 18, 2012 740 djohnson Initial creation * Oct 23, 2012 1286 djohnson Change to find more localization files. * Jan 16, 2013 1487 djohnson Avoid adding new localization files to baseline utility directories. + * May 31, 2013 1650 djohnson Fix incorrect merge from vlab branch. * * * @@ -225,19 +226,8 @@ public class TestPathManager extends PathManager { } if (buildEdexDir == null) { - // work assignment workaround to for tests since we don't - // know where the baseline repo is and we can't necessarily - // find files if we don't know the baseline repo's location - // THIS MEANS THAT FOR WORK ASSIGNMENTS WE MUST HAVE - // BASELINE_DIR SET - buildEdexDir = new File(System.getenv("baseline_dir") - .replace("\n", ""), "edexOsgi" + File.separator - + "build.edex"); - if (buildEdexDir.exists() == false - || buildEdexDir.isDirectory() == false) { - throw new RuntimeException( - "Unable to find the build.edex directory!"); - } + throw new RuntimeException( + "Unable to find the build.edex directory!"); } // Plugin utility directories