Issue #1784 Move NCF bandwidth manager code to data delivery repo

Amend:
  Publish JUnit test reports as XML, in support of Jenkins.
  Fix build/merge of 13.3.1 code so it compiles.

Change-Id: Ida653ee4ea8cd9d37f0b7d51f2d00db8fda38ca4

Former-commit-id: 60efd125706d618ae06eb84f959302213da2f7f1
This commit is contained in:
Dustin Johnson 2013-03-12 11:14:18 -05:00
parent 676b3c9d11
commit 1930183036
19 changed files with 88 additions and 747 deletions

View file

@ -77,7 +77,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
*/
public class FFMPDataGenerator {
private FfmpTableConfig tableConfig;
private final FfmpTableConfig tableConfig;
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPDataGenerator.class);
@ -86,23 +86,23 @@ public class FFMPDataGenerator {
private final String NA = "NA";
private String siteKey;
private final String siteKey;
private String dataKey;
private final String dataKey;
private ProductXML product;
private final ProductXML product;
private Date paintRefTime;
private final Date paintRefTime;
private Date tableTime;
private final Date tableTime;
private Object centeredAggregationKey;
private final Object centeredAggregationKey;
private String huc;
private final String huc;
private ArrayList<DomainXML> domains;
private final ArrayList<DomainXML> domains;
private double sliderTime;
private final double sliderTime;
private boolean isWorstCase = false;
@ -220,7 +220,11 @@ public class FFMPDataGenerator {
if (virtualBasin != null) {
for (Long id : ft
.getVirtualGageBasinLookupIds(
siteKey, key)) {
siteKey,
key,
huc,
resource.basinTableDlg
.getRowName())) {
setFFMPRow(
virtualBasin
.get(id),
@ -287,7 +291,11 @@ public class FFMPDataGenerator {
if (virtualBasin != null) {
for (Long id : ft
.getVirtualGageBasinLookupIds(
siteKey, key)) {
siteKey,
key,
huc,
resource.basinTableDlg
.getRowName())) {
setFFMPRow(
virtualBasin
.get(id),

View file

@ -30,15 +30,15 @@ import javax.measure.unit.SI;
import org.opengis.referencing.operation.MathTransform;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.dataplugin.radar.RadarDataKey;
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.level3.generic.AreaComponent;
import com.raytheon.uf.common.dataplugin.radar.level3.generic.GenericDataComponent;
import com.raytheon.uf.common.dataplugin.radar.level3.GFMPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.GFMPacket.GFMAttributeIDs;
import com.raytheon.uf.common.dataplugin.radar.level3.generic.AreaComponent;
import com.raytheon.uf.common.dataplugin.radar.level3.generic.GenericDataComponent;
import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
@ -249,7 +249,7 @@ public class RadarGFMInterrogator extends RadarGraphicInterrogator implements
if (spd < R_EQ_ZERO) {
dir = 0.0;
} else {
dir = (double)(Math.toDegrees(Math.atan2(u, v)) + DEG_HALF_PI + 1.0E-3);
dir = (Math.toDegrees(Math.atan2(u, v)) + DEG_HALF_PI + 1.0E-3);
}
return dir;

View file

@ -26,7 +26,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin.gfe;bundle-version="1.12.1174"
ucar.nc2;bundle-version="1.0.0",
com.raytheon.uf.common.parameter;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0",
com.raytheon.uf.common.util;bundle-version="1.12.1174"
com.raytheon.uf.common.util;bundle-version="1.12.1174",
com.google.guava;bundle-version="1.0.0"
Export-Package: com.raytheon.edex.plugin.gfe,
com.raytheon.edex.plugin.gfe.config,

View file

@ -111,7 +111,7 @@ public class FFMPTemplates {
private HashMap<String, HashMap<String, LinkedHashMap<String, FFMPVirtualGageBasinMetaData>>> virtualDomainMap = null;
private Map<String, SoftReference<Map<Long, Geometry>>> cwaRawGeometries = new ConcurrentHashMap<String, SoftReference<Map<Long, Geometry>>>();
private final Map<String, SoftReference<Map<Long, Geometry>>> cwaRawGeometries = new ConcurrentHashMap<String, SoftReference<Map<Long, Geometry>>>();
/** Singleton instance of this class */
private static FFMPTemplates template = null;
@ -148,12 +148,12 @@ public class FFMPTemplates {
public boolean done = false;
private Map<Long, FFMPCounty> countyMap = new HashMap<Long, FFMPCounty>();
private final Map<Long, FFMPCounty> countyMap = new HashMap<Long, FFMPCounty>();
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(FFMPTemplates.class);
private IPathManager pathManager;
private final IPathManager pathManager;
/**
* Single constructor
@ -1613,9 +1613,11 @@ public class FFMPTemplates {
* @param pfaf
* @return
*/
public synchronized /*ArrayList<FFMPVirtualGageBasinMetaData>*/ArrayList<Long> getVirtualGageBasinLookupIds(
public synchronized ArrayList<Long> getVirtualGageBasinLookupIds(
String dataKey, Long pfaf, String huc, String rowName) {
if(isCountyRow(huc, rowName)) return getVgbLookupIdsByCounty(dataKey, pfaf, huc, rowName);
if (isCountyRow(huc, rowName)) {
return getVgbLookupIdsByCounty(dataKey, pfaf, huc, rowName);
}
HashMap<String, HashMap<Long, ArrayList<FFMPVirtualGageBasinMetaData>>> virtualMap = virtualGageBasinsInParentPfaf
.get(dataKey);
@ -1626,15 +1628,15 @@ if(isCountyRow(huc, rowName)) return getVgbLookupIdsByCounty(dataKey, pfaf, huc,
if (map != null) {
ArrayList<FFMPVirtualGageBasinMetaData> list = map.get(pfaf);
if (list != null && !list.isEmpty()) {
ArrayList<Long> result = new ArrayList<Long>();//ArrayList<FFMPVirtualGageBasinMetaData> vgblist = new ArrayList<FFMPVirtualGageBasinMetaData>();
ArrayList<Long> result = new ArrayList<Long>();
for (FFMPVirtualGageBasinMetaData md : list)
/*vgblist.add(md);*/result.add(md.getLookupId());
return /*vgblist;*/result;
result.add(md.getLookupId());
return result;
}
}
}
return /*new ArrayList<FFMPVirtualGageBasinMetaData>();*/new ArrayList<Long>();
return new ArrayList<Long>();
}
@ -2367,7 +2369,7 @@ if(isCountyRow(huc, rowName)) return getVgbLookupIdsByCounty(dataKey, pfaf, huc,
public synchronized ArrayList<Long> getVgbLookupIdsByCounty(
String dataKey, Long pfaf, String huc, String rowName) {
String stateCommaCnty = rowName;//.split(",")[1];
String stateCommaCnty = rowName;
HashMap<String, HashMap<String, ArrayList<FFMPVirtualGageBasinMetaData>>> virtualMap = vgbsInCounty.get(dataKey);

View file

@ -30,7 +30,11 @@ Require-Bundle: com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.common.plugin.nwsauth;bundle-version="1.12.1174",
com.raytheon.uf.common.util,
com.raytheon.uf.common.datadelivery.request;bundle-version="1.0.0"
Export-Package: com.raytheon.uf.edex.datadelivery.bandwidth.interfaces,
com.raytheon.uf.edex.datadelivery.bandwidth.processing
Export-Package: com.raytheon.uf.edex.datadelivery.bandwidth,
com.raytheon.uf.edex.datadelivery.bandwidth.dao,
com.raytheon.uf.edex.datadelivery.bandwidth.interfaces,
com.raytheon.uf.edex.datadelivery.bandwidth.processing,
com.raytheon.uf.edex.datadelivery.bandwidth.retrieval,
com.raytheon.uf.edex.datadelivery.bandwidth.util
Import-Package: com.raytheon.uf.common.datadelivery.event.retrieval,
com.raytheon.uf.common.datadelivery.registry

View file

@ -1,29 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="bandwidthManagerCreator"
class="com.raytheon.uf.edex.datadelivery.bandwidth.NcfBandwidthManagerCreator" />
<bean id="sbnSubscriptionRetrievalAgentPrototype"
class="com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.SubscriptionRetrievalAgent"
scope="prototype">
<constructor-arg value="SBN" />
<constructor-arg value="notifyRetrieval" />
<constructor-arg ref="retrievalAgentNotifier" />
<constructor-arg value="${bandwidth.default.retrieval.priority}" />
<constructor-arg ref="retrievalManager" />
<constructor-arg ref="bandwidthDao" />
<constructor-arg ref="retrievalDao" />
</bean>
<util:map id="retrievalAgents">
<entry key="Retrievals-1" value-ref="sbnSubscriptionRetrievalAgentPrototype" />
<entry key="Retrievals-2" value-ref="sbnSubscriptionRetrievalAgentPrototype" />
<entry key="Retrievals-3" value-ref="sbnSubscriptionRetrievalAgentPrototype" />
<entry key="Retrievals-4" value-ref="sbnSubscriptionRetrievalAgentPrototype" />
<entry key="Retrievals-5" value-ref="sbnSubscriptionRetrievalAgentPrototype" />
</util:map>
</beans>

View file

@ -1,14 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="ncfBandwidthManagerServiceRouter" class="com.raytheon.uf.edex.auth.ServerRequestRouter" />
<bean id="registerNcfBandwidthManagerServiceRouter"
factory-bean="requestRouterRegistry" factory-method="register">
<constructor-arg ref="ncfBandwidthManagerServiceKey" />
<constructor-arg ref="ncfBandwidthManagerServiceRouter" />
</bean>
</beans>

View file

@ -1,27 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<util:list id="subscriptionRoutesToSchedule">
<value>SBN</value>
</util:list>
<bean id="SBNRetrievalPlan"
class="com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalPlan">
<constructor-arg value="SBN" />
<constructor-arg ref="BandwidthMap" />
<constructor-arg ref="bandwidthDao" />
<property name="scheduler">
<bean
class="com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.PriorityRetrievalScheduler" />
</property>
</bean>
<util:map id="retrievalPlans">
<entry key="SBN">
<ref local="SBNRetrievalPlan" />
</entry>
</util:map>
</beans>

View file

@ -111,7 +111,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
* @author dhladky
* @version 1.0
*/
abstract class BandwidthManager extends
public abstract class BandwidthManager extends
AbstractPrivilegedRequestHandler<IBandwidthRequest> implements
IBandwidthManager {

View file

@ -54,13 +54,13 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthDaoUtil;
* @author djohnson
* @version 1.0
*/
class EdexBandwidthContextFactory implements BandwidthContextFactory {
public class EdexBandwidthContextFactory implements BandwidthContextFactory {
/**
* Pluggable strategy for how to create the {@link BandwidthManager}.
* Intentionally package-private.
*/
static interface IEdexBandwidthManagerCreator {
public static interface IEdexBandwidthManagerCreator {
/**
* Get the bandwidth manaager.

View file

@ -1,116 +0,0 @@
/**
* 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 java.util.List;
import java.util.Set;
import com.raytheon.uf.common.datadelivery.bandwidth.ProposeScheduleResponse;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.util.JarUtil;
import com.raytheon.uf.edex.datadelivery.bandwidth.EdexBandwidthContextFactory.IEdexBandwidthManagerCreator;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthDaoUtil;
/**
* {@link IEdexBandwidthManagerCreator} for an NCF bandwidth manager.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 20, 2013 1543 djohnson Initial creation
* Feb 27, 2013 1644 djohnson Schedule SBN subscriptions.
* Mar 11, 2013 1645 djohnson Add missing Spring file.
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class NcfBandwidthManagerCreator implements IEdexBandwidthManagerCreator {
/**
* NCF {@link BandwidthManager} implementation.
*/
static class NcfBandwidthManager extends BandwidthManager {
private static final String[] NCF_BANDWIDTH_MANAGER_FILES = new String[] {
JarUtil.getResResourcePath("/spring/bandwidth-datadelivery-ncf-edex-impl.xml"),
JarUtil.getResResourcePath("/spring/bandwidth-datadelivery-edex-impl.xml"),
JarUtil.getResResourcePath("/spring/bandwidth-datadelivery.xml"),
JarUtil.getResResourcePath("/spring/thrift-bandwidth.xml"),
JarUtil.getResResourcePath("/spring/bandwidth-datadelivery-ncf.xml") };
/**
* Constructor.
*
* @param dbInit
* @param bandwidthDao
* @param retrievalManager
* @param bandwidthDaoUtil
*/
public NcfBandwidthManager(IBandwidthDbInit dbInit,
IBandwidthDao bandwidthDao, RetrievalManager retrievalManager,
BandwidthDaoUtil bandwidthDaoUtil) {
super(dbInit, bandwidthDao, retrievalManager, bandwidthDaoUtil);
}
@Override
protected String[] getSpringFilesForNewInstance() {
return NCF_BANDWIDTH_MANAGER_FILES;
}
/**
* {@inheritDoc}
*/
@Override
protected ProposeScheduleResponse proposeScheduleSbnSubscription(
List<Subscription> subscriptions) throws Exception {
return proposeScheduleSubscriptions(subscriptions);
}
/**
* {@inheritDoc}
*/
@Override
protected Set<String> scheduleSbnSubscriptions(
List<Subscription> subscriptions) throws SerializationException {
return scheduleSubscriptions(subscriptions);
}
}
/**
* {@inheritDoc}
*/
@Override
public IBandwidthManager getBandwidthManager(IBandwidthDbInit dbInit,
IBandwidthDao bandwidthDao, RetrievalManager retrievalManager,
BandwidthDaoUtil bandwidthDaoUtil) {
return new NcfBandwidthManager(dbInit, bandwidthDao, retrievalManager,
bandwidthDaoUtil);
}
}

View file

@ -13,7 +13,7 @@
</target>
<target name="env-setup" description="Sets up the environment" depends="env-check, env-developer, env-jenkins">
<property file="${build.properties.file}" />
<property file="${build.properties.file}" />
<property file="build.properties" />
<property file="${BUILD.EDEX.PROPERTIES}" />
@ -27,14 +27,15 @@
</target>
<target name="classpath-setup-developer" depends="env-setup" unless="jenkins.build">
<path id="test.compile.classpath">
<dirset dir="${AWIPS2_BASELINE}" includes="**/bin" />
<fileset dir="${AWIPS2_BASELINE}/cots" includes="**/*.jar" excludes="**/ant-*.jar" />
<fileset dir="${AWIPS2_BASELINE}/cots/org.junit" includes="**/*.jar" />
<fileset dir="${PROJECTS.DIR}/cots" includes="**/*.jar" />
<dirset dir="${PROJECTS.DIR}" includes="**/bin" />
<fileset dir="${basedir}/lib" includes="**/*.jar" />
</path>
<path id="test.compile.classpath">
<dirset dir="${AWIPS2_BASELINE}" includes="**/bin" />
<fileset dir="${AWIPS2_BASELINE}/cots" includes="**/*.jar" excludes="**/ant-*.jar" />
<fileset dir="${AWIPS2_BASELINE}/cots/org.junit" includes="**/*.jar" />
<fileset dir="${AWIPS2_BASELINE}/cots/org.springframework" includes="**/*.jar" />
<fileset dir="${PROJECTS.DIR}/cots" includes="**/*.jar" />
<dirset dir="${PROJECTS.DIR}" includes="**/bin" />
<fileset dir="${basedir}/lib" includes="**/*.jar" />
</path>
<path id="test.run.classpath">
<!-- Currently nothing else required here -->
@ -56,20 +57,22 @@
<path id="test.compile.classpath">
<fileset dir="${UNZIP.DIR}" includes="**/*.jar" excludes="**/ant-*.jar" />
<fileset dir="${PROJECTS.DIR}/org.junit" includes="**/*.jar" />
<fileset dir="${PROJECTS.DIR}/org.springframework" includes="**/*.jar" />
<fileset dir="${basedir}/lib" includes="**/*.jar" />
</path>
<!-- Include resource files provided by projects -->
<path id="test.run.classpath">
<dirset dir="${PROJECTS.DIR}" includes="*/resources"/>
<dirset dir="${PROJECTS.DIR}" includes="*/resources" />
<dirset dir="${PROJECTS.DIR}" includes="*/res" />
</path>
</target>
<target name="classpath-setup" depends="classpath-setup-developer, classpath-setup-jenkins" />
<target name="compile-tests" depends="classpath-setup" description="Compiles all tests">
<delete dir="${TEST.COMPILE.DIR}" />
<mkdir dir="${TEST.COMPILE.DIR}" />
<delete dir="${TEST.COMPILE.DIR}" />
<mkdir dir="${TEST.COMPILE.DIR}" />
<forEachTestType>
<javac srcdir="${basedir}/@{testType}" excludes="${TEST.EXCLUSION.PATTERN}" destdir="${TEST.COMPILE.DIR}" classpathref="test.compile.classpath" debug="on" source="${javacSource}" target="${javacTarget}" />
@ -83,10 +86,10 @@
<forEachTestType>
<var name="testTypeSourceDir" value="${basedir}/@{testType}" />
<junit printsummary="yes" haltonfailure="yes">
<junit printsummary="yes" haltonfailure="no" failureproperty="tests.failed">
<jvmarg value="-Duser.dir=${testTypeSourceDir}" />
<classpath>
<!-- Any resources for tests -->
<!-- Any resources for tests -->
<pathelement location="${testTypeSourceDir}" />
<pathelement location="${basedir}/resources" />
<!-- Referenced jar files -->
@ -96,16 +99,18 @@
<pathelement location="${TEST.COMPILE.DIR}" />
</classpath>
<formatter type="plain" />
<formatter type="xml" />
<batchtest fork="no" todir="${TEST.REPORTS.DIR}">
<fileset dir="${basedir}/@{testType}">
<include name="${TEST.INCLUSION.PATTERN}" />
<exclude name="${TEST.EXCLUSION.PATTERN}"/>
<exclude name="${TEST.EXCLUSION.PATTERN}" />
</fileset>
</batchtest>
</junit>
</forEachTestType>
<fail if="tests.failed" message="Received a FAILED status for one or more test results!" />
</target>
<macrodef name="forEachTestType" description="Loops over all requested test types, and performs the passed in action">

View file

@ -1,77 +0,0 @@
/**
* 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 com.raytheon.uf.common.util.SpringFiles;
import com.raytheon.uf.common.util.TestUtil;
import com.raytheon.uf.edex.datadelivery.bandwidth.NcfBandwidthManagerCreator.NcfBandwidthManager;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthDaoUtil;
/**
* An NCF {@link IBandwidthManager} that runs as an integration test, outside of
* the EDEX container.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 18, 2013 1543 djohnson Initial creation
* Feb 27, 2013 1644 djohnson Extend NCF bandwidth manager.
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class IntegrationTestNcfBandwidthManager extends NcfBandwidthManager {
static final String[] INTEGRATION_TEST_SPRING_FILES = new String[] {
"/bandwidth/bandwidth-datadelivery-integrationtest-impl.xml",
TestUtil.getResResourcePath(SpringFiles.BANDWIDTH_DATADELIVERY_XML),
TestUtil.getResResourcePath(SpringFiles.BANDWIDTH_DATADELIVERY_NCF_XML) };
/**
* Constructor.
*
* @param dbInit
* @param bandwidthDao
* @param retrievalManager
* @param bandwidthDaoUtil
*/
public IntegrationTestNcfBandwidthManager(IBandwidthDbInit dbInit,
IBandwidthDao bandwidthDao, RetrievalManager retrievalManager,
BandwidthDaoUtil bandwidthDaoUtil) {
super(dbInit, bandwidthDao, retrievalManager, bandwidthDaoUtil);
}
/**
* {@inheritDoc}
*/
@Override
protected String[] getSpringFilesForNewInstance() {
return INTEGRATION_TEST_SPRING_FILES;
}
}

View file

@ -1,57 +0,0 @@
/**
* 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 com.raytheon.uf.edex.datadelivery.bandwidth.EdexBandwidthContextFactory.IEdexBandwidthManagerCreator;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDao;
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.IBandwidthDbInit;
import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalManager;
import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthDaoUtil;
/**
* Creates {@link IntegrationTestNcfBandwidthManager} instances.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 20, 2013 1543 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
public class IntegrationTestNcfBandwidthManagerCreator implements
IEdexBandwidthManagerCreator {
/**
* {@inheritDoc}
*/
@Override
public IBandwidthManager getBandwidthManager(IBandwidthDbInit dbInit,
IBandwidthDao bandwidthDao, RetrievalManager retrievalManager,
BandwidthDaoUtil bandwidthDaoUtil) {
return new IntegrationTestNcfBandwidthManager(dbInit, bandwidthDao,
retrievalManager, bandwidthDaoUtil);
}
}

View file

@ -1,118 +0,0 @@
/**
* 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 static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
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;
/**
* Test an NCF {@link BandwidthManager}.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 19, 2013 1543 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { DatabaseUtil.UNIT_TEST_DB_BEANS_XML,
SpringFiles.RETRIEVAL_DATADELIVERY_DAOS_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_DAOS_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_NCF_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_NCF_XML })
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
public class NcfBandwidthManagerIntTest extends AbstractBandwidthManagerIntTest {
@Test
public void testSchedulesSbnSubscriptionForRetrieval() {
Subscription subscription = createSubscriptionThatFillsAThirdOfABucket();
bandwidthManager.schedule(subscription);
final List<SubscriptionRetrieval> subRetrievals = bandwidthDao
.getSubscriptionRetrievals(subscription.getProvider(),
subscription.getDataSetName());
assertThat(subRetrievals, is(not(empty())));
for (SubscriptionRetrieval subRetrieval : subRetrievals) {
assertThat(subRetrieval.getStatus(), is(RetrievalStatus.SCHEDULED));
}
}
@Test
public void testDoesNotScheduleOpsnetSubscriptionForRetrieval() {
Subscription subscription = createSubscriptionThatFillsAThirdOfABucket();
subscription.setRoute(Network.OPSNET);
bandwidthManager.schedule(subscription);
final List<SubscriptionRetrieval> subRetrievals = bandwidthDao
.getSubscriptionRetrievals(subscription.getProvider(),
subscription.getDataSetName());
assertThat(subRetrievals, is(empty()));
}
@Test
public void testReinitializeUsesCorrectSpringFiles() throws Exception {
final IBandwidthRequest request = new IBandwidthRequest();
request.setRequestType(RequestType.REINITIALIZE);
bandwidthManager.handleRequest(request);
verifyRetrievalPlanDoesNotExistForRoute(Network.OPSNET);
}
/**
* {@inheritDoc}
*/
@Override
protected Network getRouteToUseForSubscription() {
return Network.SBN;
}
}

View file

@ -1,250 +0,0 @@
/**
* 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 static org.hamcrest.Matchers.emptyCollectionOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
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.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.serialization.comm.IRequestRouter;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.serialization.comm.RequestRouterTest;
import com.raytheon.uf.common.util.SpringFiles;
import com.raytheon.uf.common.util.registry.RegistryException;
import com.raytheon.uf.edex.database.dao.DatabaseUtil;
import com.raytheon.uf.edex.datadelivery.bandwidth.NcfBandwidthManagerCreator.NcfBandwidthManager;
import com.raytheon.uf.edex.datadelivery.bandwidth.WfoBandwidthManagerCreator.WfoBandwidthManager;
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.IBandwidthDao;
/**
* Test interactions between a {@link WfoBandwidthManager} and a
* {@link NcfBandwidthManager}.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 27, 2013 1644 djohnson Initial creation
*
* </pre>
*
* @author djohnson
* @version 1.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { DatabaseUtil.UNIT_TEST_DB_BEANS_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 WfoNcfBandwidthManagerIntTest extends
AbstractBandwidthManagerIntTest {
private BandwidthManager ncfBandwidthManager;
private IBandwidthDao ncfBandwidthDao;
@Override
public void setUp() {
super.setUp();
// Set up the NCF bandwidth manager
ApplicationContext ncfBandwidthManagerCtx = new ClassPathXmlApplicationContext(
new String[] {
DatabaseUtil.UNIT_TEST_DB_BEANS2_XML,
SpringFiles.RETRIEVAL_DATADELIVERY_DAOS_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_DAOS_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_NCF_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_XML,
SpringFiles.BANDWIDTH_DATADELIVERY_INTEGRATION_TEST_NCF_XML });
ncfBandwidthManager = (BandwidthManager) ncfBandwidthManagerCtx
.getBean("bandwidthManager");
ncfBandwidthDao = (IBandwidthDao) ncfBandwidthManagerCtx
.getBean("bandwidthDao");
// Add the router to the NCF bandwidth manager
RequestRouterTest.clearRegistry();
try {
RequestRouterTest.register(
DataDeliveryConstants.NCF_BANDWIDTH_MANAGER_SERVICE,
new IRequestRouter() {
@Override
public Object route(IServerRequest request)
throws Exception {
return ncfBandwidthManager
.handleRequest((IBandwidthRequest) request);
}
});
} catch (RegistryException e) {
throw new RuntimeException(e);
}
}
@Test
public void proposeScheduleSbnSubscriptionIsScheduledForNcf()
throws Exception {
proposeScheduleSbnSubscriptionThatFits();
final List<BandwidthAllocation> ncfSbnBandwidthAllocations = ncfBandwidthDao
.getBandwidthAllocations(Network.SBN);
assertThat(ncfSbnBandwidthAllocations,
is(not(emptyCollectionOf(BandwidthAllocation.class))));
}
@Test
public void proposeScheduleSbnSubscriptionIsScheduledForWfo()
throws Exception {
proposeScheduleSbnSubscriptionThatFits();
final List<BandwidthAllocation> wfoSbnBandwidthAllocations = bandwidthDao
.getBandwidthAllocations(Network.SBN);
assertThat(wfoSbnBandwidthAllocations,
is(not(emptyCollectionOf(BandwidthAllocation.class))));
}
@Test
public void tooLargeSbnSubscriptionIsNotScheduledForNcf() throws Exception {
proposeScheduleSbnSubscriptionThatDoesNotFit();
final List<BandwidthAllocation> ncfSbnBandwidthAllocations = ncfBandwidthDao
.getBandwidthAllocations(Network.SBN);
assertThat(ncfSbnBandwidthAllocations,
is(emptyCollectionOf(BandwidthAllocation.class)));
}
@Test
public void tooLargeSbnSubscriptionIsNotScheduledForWfo() throws Exception {
proposeScheduleSbnSubscriptionThatDoesNotFit();
final List<BandwidthAllocation> wfoSbnBandwidthAllocations = bandwidthDao
.getBandwidthAllocations(Network.SBN);
assertThat(wfoSbnBandwidthAllocations,
is(emptyCollectionOf(BandwidthAllocation.class)));
}
@Test
public void smallEnoughSbnSubscriptionCanBeScheduledForNcf()
throws Exception {
scheduleSbnSubscriptionThatFits();
final List<BandwidthSubscription> subscriptions = ncfBandwidthDao
.getBandwidthSubscriptions();
assertThat(subscriptions,
is(not(emptyCollectionOf(BandwidthSubscription.class))));
}
@Test
public void smallEnoughSbnSubscriptionCanBeScheduledForWfo()
throws Exception {
scheduleSbnSubscriptionThatFits();
final List<BandwidthSubscription> subscriptions = bandwidthDao
.getBandwidthSubscriptions();
assertThat(subscriptions,
is(not(emptyCollectionOf(BandwidthSubscription.class))));
}
/**
* Propose schedules an SBN routed subscription that will fit within the
* bandwidth requirements.
*
* @throws Exception
*/
private void proposeScheduleSbnSubscriptionThatFits() throws Exception {
scheduleSbnSubscription(createSubscriptionThatFillsAThirdOfABucket(),
RequestType.PROPOSE_SCHEDULE_SUBSCRIPTION);
}
/**
* Propose schedules an SBN routed subscription that will NOT fit within the
* bandwidth requirements.
*
* @throws Exception
*/
private void proposeScheduleSbnSubscriptionThatDoesNotFit()
throws Exception {
scheduleSbnSubscription(createSubscriptionThatFillsUpTwoBuckets(),
RequestType.PROPOSE_SCHEDULE_SUBSCRIPTION);
}
/**
* Schedules an SBN routed subscription that will fit within the bandwidth
* requirements.
*
* @throws Exception
*/
private void scheduleSbnSubscriptionThatFits() throws Exception {
scheduleSbnSubscription(createSubscriptionThatFillsAThirdOfABucket(),
RequestType.SCHEDULE_SUBSCRIPTION);
}
/**
* Schedules an SBN routed subscription that will NOT fit within the
* bandwidth requirements.
*
* @param requestType
*
* @throws Exception
*/
private void scheduleSbnSubscription(Subscription subscription,
RequestType requestType) throws Exception {
IBandwidthRequest request = new IBandwidthRequest();
request.setRequestType(requestType);
request.setNetwork(subscription.getRoute());
request.setSubscriptions(Arrays.asList(subscription));
bandwidthManager.handleRequest(request);
}
/**
* {@inheritDoc}
*/
@Override
protected Network getRouteToUseForSubscription() {
return Network.SBN;
}
}

View file

@ -1,8 +0,0 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="bandwidthManagerCreator"
class="com.raytheon.uf.edex.datadelivery.bandwidth.IntegrationTestNcfBandwidthManagerCreator" />
</beans>

7
tests/runTests.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
INITIAL_PERMGEN_SIZE="64m"
MAX_PERMGEN_SIZE="128m"
export ANT_OPTS="-XX:PermSize=${INITIAL_PERMGEN_SIZE} -XX:MaxPermSize=${MAX_PERMGEN_SIZE}"
ant

View file

@ -41,10 +41,15 @@ import org.junit.Test;
import com.raytheon.uf.common.datadelivery.registry.Network;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
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.edex.datadelivery.bandwidth.IntegrationTestBandwidthContextFactory;
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.IBandwidthDao;
@ -96,8 +101,14 @@ public class BandwidthDaoUtilTest {
dataSetAvailabilityCalculator);
PathManagerFactoryTest.initLocalization();
map = BandwidthMap.load(IntegrationTestBandwidthContextFactory
.getIntegrationTestBandwidthMapConfigFile());
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.BASE);
LocalizationFile lf = pm.getLocalizationFile(lc,
"datadelivery/bandwidthmap.xml");
map = BandwidthMap.load(lf.getFile());
plan = new RetrievalPlan(Network.OPSNET, map, mockDao);
}