Issue #2038 Fix ability to get shared subscriptions by id
Change-Id: Iff7d9ab52e8152e7f950a536e49d92acad45dd19 Former-commit-id:f6c89fa3d9
[formerlyb4bc2ca947
] [formerlyfc807288a7
] [formerly05bd3e113d
[formerlyfc807288a7
[formerly e308ea7b1bc786832d4414369f86cc2d02f71ae2]]] Former-commit-id:05bd3e113d
Former-commit-id: e9924f52a848d24038a0a3fb3705c0ff67f9a02e [formerly42d1d74b04
] Former-commit-id:3f4b010b84
This commit is contained in:
parent
dcee8de5bf
commit
8df55423f5
4 changed files with 45 additions and 20 deletions
|
@ -33,7 +33,8 @@ export BROKER_ADDR=localhost
|
||||||
export PYPIES_SERVER=http://localhost:9582
|
export PYPIES_SERVER=http://localhost:9582
|
||||||
|
|
||||||
# data delivery specific variables, used below in the localization section
|
# 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_HOST=localhost
|
||||||
export DATADELIVERY_PORT=9588
|
export DATADELIVERY_PORT=9588
|
||||||
# Currently the registry is hosted on datadelivery, but this could be changed in the future
|
# 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_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_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 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
|
# set the AWIPS II shared directory
|
||||||
export SHARE_DIR=/awips2/edex/data/share
|
export SHARE_DIR=/awips2/edex/data/share
|
||||||
|
|
|
@ -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.datadelivery.registry.Subscription;
|
||||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
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;
|
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 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
|
||||||
* May 28, 2013 1650 djohnson Add getByNames.
|
* May 28, 2013 1650 djohnson Add getByNames.
|
||||||
* May 29, 2013 1650 djohnson Fix ability to delete multiple types of subscriptions at once.
|
* 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.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -61,6 +65,9 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
||||||
*/
|
*/
|
||||||
public class SubscriptionHandler implements ISubscriptionHandler {
|
public class SubscriptionHandler implements ISubscriptionHandler {
|
||||||
|
|
||||||
|
private static final IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(SubscriptionHandler.class);
|
||||||
|
|
||||||
private final ISiteSubscriptionHandler siteSubscriptionHandler;
|
private final ISiteSubscriptionHandler siteSubscriptionHandler;
|
||||||
|
|
||||||
private final ISharedSubscriptionHandler sharedSubscriptionHandler;
|
private final ISharedSubscriptionHandler sharedSubscriptionHandler;
|
||||||
|
@ -249,7 +256,19 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Subscription getById(String id) throws RegistryHandlerException {
|
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) {
|
if (value == null) {
|
||||||
value = sharedSubscriptionHandler.getById(id);
|
value = sharedSubscriptionHandler.getById(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.common.datadelivery.registry.handlers;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.empty;
|
import static org.hamcrest.Matchers.empty;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -46,6 +47,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.AbstractRegistryTest;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* May 29, 2013 1650 djohnson Initial creation
|
* May 29, 2013 1650 djohnson Initial creation
|
||||||
|
* May 31, 2013 1650 djohnson Fix ability to get shared subscriptions by id.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -95,4 +97,17 @@ public class SubscriptionHandlerTest extends AbstractRegistryTest {
|
||||||
|
|
||||||
assertThat(subscriptionHandler.getAll(), is(empty()));
|
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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ import com.raytheon.uf.common.util.FileUtil;
|
||||||
* Jul 18, 2012 740 djohnson Initial creation
|
* Jul 18, 2012 740 djohnson Initial creation
|
||||||
* Oct 23, 2012 1286 djohnson Change to find more localization files.
|
* 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.
|
* 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.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -225,20 +226,9 @@ public class TestPathManager extends PathManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buildEdexDir == null) {
|
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(
|
throw new RuntimeException(
|
||||||
"Unable to find the build.edex directory!");
|
"Unable to find the build.edex directory!");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Plugin utility directories
|
// Plugin utility directories
|
||||||
for (File pluginDir : pluginDirectories) {
|
for (File pluginDir : pluginDirectories) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue