Issue #2344 Fixed HibernateBandwidthInitializerTest.
Amend: Removed officeID change to BaseSubscriptionFixture. Change-Id: Ib3065684aa88cdcde000239d9202d5d43259f43e Former-commit-id:d0ccc11f58
[formerly 69b7fc7281a4cc266b7e6ca6f0adff00b3658957] Former-commit-id:695aa9e609
This commit is contained in:
parent
7e64263f54
commit
a206fb5b21
4 changed files with 68 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -33,6 +33,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
|
|||
* Apr 30, 2013 1960 djohnson just call init rather than drop/create tables explicitly.
|
||||
* Jun 25, 2013 2106 djohnson init() now takes a {@link RetrievalManager} as well.
|
||||
* Sep 05, 2013 2330 bgonzale On WFO registry init, only subscribe to local site subscriptions.
|
||||
* Sep 06, 2013 2344 bgonzale Removed attempt to add to immutable empty set.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -83,7 +84,7 @@ public class HibernateBandwidthInitializer implements BandwidthInitializer {
|
|||
*/
|
||||
@Override
|
||||
public void executeAfterRegistryInit() {
|
||||
Set<Subscription> activeSubscriptions = Collections.emptySet();
|
||||
Set<Subscription> activeSubscriptions = new HashSet<Subscription>();
|
||||
try {
|
||||
final String localOffice = SiteUtil.getSite();
|
||||
|
||||
|
|
|
@ -155,5 +155,6 @@
|
|||
<classpathentry kind="lib" path="lib/swt_gtk_linux_x86.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/com.raytheon.uf.common.wxmath"/>
|
||||
<classpathentry kind="lib" path="lib/org.eclipse.jface_3.8.0.v20120912-135020.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/org.apache.commons.configuration"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* 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.core.props;
|
||||
|
||||
import org.apache.commons.configuration.Configuration;
|
||||
|
||||
/**
|
||||
* Inject attribute names, attribute values, and property values into the
|
||||
* PropertiesFactory environment configuration.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 06, 2013 2344 bgonzale Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bgonzale
|
||||
* @version 1.0
|
||||
*/
|
||||
public class EnvAttributePropertyInjector {
|
||||
|
||||
public static void injectAttributeProperty(String attributeName,
|
||||
String attributeValue, String propertyValue) {
|
||||
Configuration attrNamesConfig = PropertiesFactory.getInstance()
|
||||
.getEnvProperties().theAttrNamesConfiguration;
|
||||
Configuration envConfig = PropertiesFactory.getInstance()
|
||||
.getEnvProperties().theEnvConfiguration;
|
||||
|
||||
attrNamesConfig.setProperty(attributeName, attributeValue);
|
||||
envConfig.setProperty(attributeValue, propertyValue);
|
||||
}
|
||||
}
|
|
@ -23,11 +23,13 @@ import static org.mockito.Mockito.mock;
|
|||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.edex.core.props.EnvAttributePropertyInjector;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.IBandwidthManager;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
|
||||
|
@ -44,6 +46,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
|
|||
* Feb 18, 2013 1543 djohnson Initial creation
|
||||
* Apr 18, 2013 1914 djohnson Fix broken test.
|
||||
* Jun 25, 2013 2106 djohnson init() now takes a {@link RetrievalManager}.
|
||||
* Sep 06, 2013 2344 bgonzale Added property injection of valid test value.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,11 +55,19 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
|
|||
*/
|
||||
public class HibernateBandwidthInitializerTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
System.setProperty("edex.home", "../edexOsgi/build.edex/esb/");
|
||||
EnvAttributePropertyInjector.injectAttributeProperty("SITENAME",
|
||||
"sitename", "OAX");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSchedulesAllSubscriptionReturnedFromIFindSubscriptions()
|
||||
throws Exception {
|
||||
final Subscription subscription = SiteSubscriptionFixture.INSTANCE.get();
|
||||
|
||||
subscription.addOfficeID("OAX");
|
||||
IFindSubscriptionsForScheduling strategy = mock(IFindSubscriptionsForScheduling.class);
|
||||
when(strategy.findSubscriptionsToSchedule()).thenReturn(
|
||||
Sets.newHashSet(subscription));
|
||||
|
|
Loading…
Add table
Reference in a new issue