Issue #2142 clean up dependencies and dead code

Change-Id: I30f94c9afb01cdd1b7bef98c6ba40f79c3acea59

Former-commit-id: 8838a7ee75 [formerly c4bc1ef034] [formerly a636846295] [formerly 8838a7ee75 [formerly c4bc1ef034] [formerly a636846295] [formerly f28420dac4 [formerly a636846295 [formerly 593073cade120a95899f4f4d2c5a652c6ac3389a]]]]
Former-commit-id: f28420dac4
Former-commit-id: d39a175583 [formerly 8b070975aa] [formerly 222e227b908ca94947a44a0518892d94ce66b436 [formerly 65dbc62b59]]
Former-commit-id: 858ba69761701e13b33acad8a218e96e2b1ad8e4 [formerly 428d0c73dc]
Former-commit-id: 5a0dd6f037
This commit is contained in:
Nate Jensen 2013-07-17 16:30:08 -05:00
parent bc564392d1
commit c6b9b2dd7f
16 changed files with 8 additions and 858 deletions

View file

@ -8,15 +8,7 @@ Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime, org.eclipse.core.runtime,
com.raytheon.uf.viz.core,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.time;bundle-version="1.11.1",
com.raytheon.edex.common;bundle-version="1.11.1",
org.geotools;bundle-version="2.5.2",
javax.measure,
com.raytheon.viz.grid,
com.raytheon.viz.core, com.raytheon.viz.core,
com.raytheon.viz.pointdata;bundle-version="1.11.1",
com.raytheon.uf.common.dataplugin.cwat;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.cwat;bundle-version="1.0.0",
com.raytheon.uf.common.colormap;bundle-version="1.11.17", com.raytheon.uf.common.colormap;bundle-version="1.11.17",
com.raytheon.uf.common.monitor;bundle-version="1.11.17" com.raytheon.uf.common.monitor;bundle-version="1.11.17"

View file

@ -6,7 +6,7 @@ Bundle-Version: 1.12.1174.qualifier
Bundle-Activator: com.raytheon.viz.awipstools.Activator Bundle-Activator: com.raytheon.viz.awipstools.Activator
Bundle-Vendor: Raytheon Bundle-Vendor: Raytheon
Eclipse-BuddyPolicy: registered, ext, global Eclipse-BuddyPolicy: registered, ext, global
Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.viz.core, com.raytheon.edex, com.raytheon.edex.common, com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.viz.core, com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui, org.eclipse.ui,
com.raytheon.viz.core, com.raytheon.viz.core,
@ -17,6 +17,7 @@ Require-Bundle: org.eclipse.core.runtime,
javax.measure, javax.measure,
com.raytheon.uf.common.pointdata, com.raytheon.uf.common.pointdata,
javax.vecmath;bundle-version="1.3.1", javax.vecmath;bundle-version="1.3.1",
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.awipstools;bundle-version="1.12.1112", com.raytheon.uf.common.awipstools;bundle-version="1.12.1112",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1112", com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1112",
com.raytheon.uf.viz.d2d.core, com.raytheon.uf.viz.d2d.core,

View file

@ -12,8 +12,7 @@ Require-Bundle: com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1
com.raytheon.viz.core, com.raytheon.viz.core,
org.geotools, org.geotools,
com.raytheon.viz.ui, com.raytheon.viz.ui,
org.apache.commons.lang, org.apache.commons.lang
com.raytheon.edex.common
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.lightning Export-Package: com.raytheon.viz.lightning
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -12,7 +12,6 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.ui, com.raytheon.viz.ui,
org.geotools, org.geotools,
org.apache.commons.lang, org.apache.commons.lang,
com.raytheon.edex.common,
com.raytheon.uf.viz.core.maps;bundle-version="1.0.0" com.raytheon.uf.viz.core.maps;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.lpi Export-Package: com.raytheon.viz.lpi

View file

@ -5,7 +5,7 @@ Bundle-SymbolicName: com.raytheon.viz.redbook;singleton:=true
Bundle-Version: 1.12.1174.qualifier Bundle-Version: 1.12.1174.qualifier
Bundle-Activator: com.raytheon.viz.redbook.Activator Bundle-Activator: com.raytheon.viz.redbook.Activator
Bundle-Vendor: Raytheon Bundle-Vendor: Raytheon
Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.edex.common, com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.common.serialization
Require-Bundle: org.apache.batik, Require-Bundle: org.apache.batik,
org.eclipse.ui, org.eclipse.ui,
org.eclipse.core.runtime, org.eclipse.core.runtime,
@ -13,7 +13,7 @@ Require-Bundle: org.apache.batik,
org.geotools, org.geotools,
com.raytheon.viz.ui, com.raytheon.viz.ui,
org.apache.commons.lang, org.apache.commons.lang,
com.raytheon.edex.common, com.raytheon.uf.common.serialization,
com.raytheon.edex.plugin.redbook, com.raytheon.edex.plugin.redbook,
com.raytheon.uf.common.pointdata;bundle-version="1.11.26", com.raytheon.uf.common.pointdata;bundle-version="1.11.26",
com.raytheon.viz.pointdata;bundle-version="1.11.26", com.raytheon.viz.pointdata;bundle-version="1.11.26",
@ -24,3 +24,4 @@ Export-Package: com.raytheon.viz.redbook,
com.raytheon.viz.redbook.rsc, com.raytheon.viz.redbook.rsc,
com.raytheon.viz.redbookua.rsc com.raytheon.viz.redbookua.rsc
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.colormap.prefs

View file

@ -5,7 +5,7 @@ Bundle-SymbolicName: com.raytheon.viz.volumebrowser;singleton:=true
Bundle-Version: 1.12.1174.qualifier Bundle-Version: 1.12.1174.qualifier
Bundle-Activator: com.raytheon.viz.volumebrowser.Activator Bundle-Activator: com.raytheon.viz.volumebrowser.Activator
Bundle-Vendor: Raytheon Bundle-Vendor: Raytheon
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.viz.ui.menus Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.viz.ui.menus
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime, org.eclipse.core.runtime,
com.raytheon.viz.core, com.raytheon.viz.core,
@ -24,6 +24,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.xy, com.raytheon.uf.viz.xy,
com.raytheon.uf.viz.objectiveanalysis, com.raytheon.uf.viz.objectiveanalysis,
com.raytheon.uf.common.pointdata, com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.serialization,
net.sf.swtaddons;bundle-version="1.0.0", net.sf.swtaddons;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
com.raytheon.uf.viz.points;bundle-version="1.0.0", com.raytheon.uf.viz.points;bundle-version="1.0.0",

View file

@ -11,7 +11,6 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.core, com.raytheon.viz.core,
com.raytheon.viz.ui, com.raytheon.viz.ui,
org.geotools, org.geotools,
com.raytheon.edex.common,
com.raytheon.viz.texteditor;bundle-version="1.11.5", com.raytheon.viz.texteditor;bundle-version="1.11.5",
com.raytheon.uf.common.serialization.comm;bundle-version="1.11.22" com.raytheon.uf.common.serialization.comm;bundle-version="1.11.22"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy

View file

@ -4,7 +4,6 @@ Bundle-Name: Jep Plug-in
Bundle-SymbolicName: org.jep Bundle-SymbolicName: org.jep
Bundle-Version: 1.0.0.qualifier Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Raytheon-bundled OSS Bundle-Vendor: Raytheon-bundled OSS
Require-Bundle: org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-ClassPath: jep.jar Bundle-ClassPath: jep.jar
Export-Package: jep Export-Package: jep

View file

@ -14,7 +14,6 @@ Export-Package: com.raytheon.edex.colormap,
com.raytheon.edex.db.purge, com.raytheon.edex.db.purge,
com.raytheon.edex.esb, com.raytheon.edex.esb,
com.raytheon.edex.exception, com.raytheon.edex.exception,
com.raytheon.edex.jmx,
com.raytheon.edex.msg, com.raytheon.edex.msg,
com.raytheon.edex.plugin, com.raytheon.edex.plugin,
com.raytheon.edex.plugin.factory, com.raytheon.edex.plugin.factory,
@ -58,6 +57,4 @@ Require-Bundle: net.sf.ehcache,
org.slf4j;bundle-version="1.7.5" org.slf4j;bundle-version="1.7.5"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: junit.framework, Import-Package: junit.framework,
org.hamcrest,
org.jmock.api,
org.junit org.junit

View file

@ -1,40 +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.edex.common;
/**
* Activator for the EDEX common component
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 8, 2008 njensen Initial creation
* </pre>
*
* @author njensen
* @version 1.0
*/
public class Activator {
public static final String PLUGIN_ID = "com.raytheon.edex.common";
}

View file

@ -1,268 +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.edex.jmx;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.Set;
import javax.management.MBeanInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* A client wrapper to access JMX.
*
* <pre>
* SOFTWARE HISTORY
* Date PR# Engineer Description
* ------------ ------ ---------------- -------------------------------------------------
* Apr 26, 2007 #261 garmendariz Initial creation
* </pre>
*
* @author garmendariz
*/
public class Client {
/** The logger */
private final static transient Log logger = LogFactory.getLog(Client.class);
public static final String MULE = "server";
public static final String ACTIVEMQ = "jmxrmi";
public static void main(String[] args) throws Exception {
MBeanServerConnection connection = null;
System.out.println("Server is: "
+ (Client.checkServer(Client.MULE, "localhost") == true ? "Up"
: "Down"));
connection = Client.createConnection(Client.MULE, "localhost");
String domainNames[] = Client.queryDomainNames(connection);
// ObjectName obj = null;
Set<ObjectName> sets = null;
for (int i = 0; i < domainNames.length; i++) {
System.out.println("\n****DOMAIN: " + domainNames[i]);
sets = Client.queryObjectNames(connection, domainNames[i]);
for (Iterator<ObjectName> iter = sets.iterator(); iter.hasNext();) {
ObjectName element = (ObjectName) iter.next();
// System.out.println(element.getDomain());
System.out.println("MBean: " + element.getCanonicalName());
// ObjectInstance instance =
// connection.getObjectInstance(element);
processBeanInfo(connection.getMBeanInfo(element));
}
}
// make a test call
System.out.println("---------------Making test call--------------");
sets = connection
.queryNames(
new ObjectName(
"Mule*:name=Awips.Mule.Service.IngestSrv-ASCII,type=org.mule.Component"),
null);
for (Iterator<ObjectName> iter = sets.iterator(); iter.hasNext();) {
ObjectName element = (ObjectName) iter.next();
System.out.println("MBean: " + element.getCanonicalName());
MBeanInfo info = connection.getMBeanInfo(element);
MBeanOperationInfo[] oper = info.getOperations();
for (int i = 0; i < oper.length; i++) {
if (oper[i].getName().contains("start")) {
// MBeanParameterInfo[] mbeanParm = oper[i].getSignature();
connection.invoke(element, oper[i].getName(),
new String[] {}, new String[] {});
}
}
}
}
private static void processBeanInfo(MBeanInfo info) {
System.out.println("\tMBean Class Name: " + info.getClassName());
System.out.println("\t\tMBean Description: " + info.getDescription());
MBeanOperationInfo[] ops = info.getOperations();
for (int i = 0; i < ops.length; i++) {
System.out.println("\t\t\t\tOperation #" + i);
System.out.println("\t\t\t\tOperation name: " + ops[i].getName());
System.out.println("\t\t\t\tOperation Impact: "
+ ops[i].getImpact());
System.out.println("\t\t\t\tOperation ret type: "
+ ops[i].getReturnType());
MBeanParameterInfo[] ard = ops[i].getSignature();
for (int j = 0; j < ard.length; j++) {
System.out.println("\t\t\t\t\tOperation params");
System.out
.println("\t\t\t\t\tparam name = " + ard[j].getName());
System.out
.println("\t\t\t\t\tparam type = " + ard[j].getType());
System.out.println("\t\t\t\t\tparam desc = "
+ ard[j].getDescription());
}
}
}
/**
* Check for the availability of the MBean server for an application at the
* given host.
*
* @param application
* The application to query (Mule, ActiveMQ, etc.)
* @param host
* The hostname of the box
* @return True if the server is available
* @throws Exception
*/
public static boolean checkServer(String application, String host)
throws Exception {
JMXServiceURL url = null;
JMXConnector connector = null;
boolean retVal = false;
try {
// get url to connect to
url = new JMXServiceURL("service:jmx:rmi://" + host
+ "/jndi/rmi://" + host + ":1099/" + application);
} catch (MalformedURLException e) {
System.out.println("service:jmx:rmi://" + host + "/jndi/rmi://"
+ host + ":1099/" + application + " is invalid");
}
try {
// verify server status
connector = JMXConnectorFactory.connect(url);
} catch (IOException e) {
// don't report we can't connect, return value is doing this
} finally {
if (connector != null) {
connector.close();
retVal = true;
}
}
return retVal;
}
/**
* Creates an RMI connection to the MBean server for the application on the
* given host.
*
* @param application
* The application to query (Mule, ActiveMQ, etc.)
* @param host
* The hostname of the box
* @return A connection to this MBean servers
* @throws Exception
*/
public static MBeanServerConnection createConnection(String application,
String host) throws Exception {
JMXServiceURL url = null;
JMXConnector connector = null;
MBeanServerConnection connection = null;
String urlString = "service:jmx:rmi://" + host + "/jndi/rmi://" + host
+ ":1099/" + application;
try {
// get url to connect to
url = new JMXServiceURL(urlString);
connector = JMXConnectorFactory.connect(url);
} catch (MalformedURLException e) {
throw new Exception(urlString + " is invalid");
} catch (IOException e) {
throw new Exception("Unable to connect to: " + urlString);
}
if (connector != null) {
connection = connector.getMBeanServerConnection();
} else {
throw new Exception("Unable to create connection to: " + urlString);
}
return connection;
}
/**
* Retrieves the list of domain names available for this connection
*
* @param connection
* A connection to a MBean server
* @return A string array of domain names
*/
public static String[] queryDomainNames(MBeanServerConnection connection) {
String[] domainNames = null;
try {
domainNames = connection.getDomains();
} catch (IOException e) {
logger.error("Unable to retrieve domain names", e);
}
return domainNames;
}
/**
* Retrieve all object names for a domain name. The query is based on the
* following string: domainName:* , where all properties are selected
*
* @param connection
* The connection to the MBean server
* @param domainName
* The domain to query
* @return A list of objects available for that domain
*/
public static Set<ObjectName> queryObjectNames(
MBeanServerConnection connection, String domainName) {
Set<ObjectName> returnSet = null;
try {
returnSet = connection.queryNames(null, new ObjectName(domainName
+ ":*"));
} catch (Exception e) {
logger.error("Unable to retrieve object names for domain");
}
return returnSet;
}
}

View file

@ -1,99 +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.edex.util;
/**
* JMX MBean interface for AbstractMessageSrv. This interface specifies the
* common methods for JMX instrumenting classes that derive from AbstractMessageSrv.
* <P>
* To enable JMX instrumentation, any class that extends {@code AbstractMessageSrv}
* must inplement an interface that extends this interface. In addition, the class
* and interface must be defined as follows:
* <PRE>
* {@code public interface MyClassMBean}
* {@code extends AbstractSrvMBean} {
* }
*
* {@code public class MyClass }
* {@code extends AbstractMessageSrv}
* {@code implements AbstractSrvMBean} {
* }
* </PRE>
* The naming convention shown here must be followed. If no methods beyond those
* provided by this interface are required, the derived interface may be empty.
* <P>
* This interface provides the basic instrumentation as follows:
* <DL>
* <DT>{@link #getExecCount()}
* <DD>gets the current number of times the implementing class'
* {@link com.raytheon.edex.util.AbstractMessageSrv#process() process()} method
* has been been called.
* <DT>{@link #clearExecCount()}
* <DT>clears the execution counter.
* <DT>{@link #getExecTime()}
* <DD>gets the total time the implementing class'
* {@link com.raytheon.edex.util.AbstractMessageSrv#process() process()} method
* has spent processing messages.
* <DT>{@link #clearExecTime()}
* <DD>clears the execution time accumulator.
* </DL>
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 14Jun2006 GArmendariz Initial check in.
* 15Aug2006 #18 MW Fegan Added methods for execution
* time accumulator. Added
* documentation.
*
* </pre>
*
* @author mfegan
* @version 1
*/
public interface AbstractSrvMBean {
/**
* Gets the number of times {@code process()} has executed.
*
* @return number of executions
*/
public int getExecCount();
/**
* Clears the execution counter.
*/
public void clearExecCount();
/**
* Gets the total execution time.
*
* @return the total execution time.
*/
public long getExecTime();
/**
* Clears the total execution time.
*
*/
public void clearExecTime();
}

View file

@ -1,63 +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.edex.subscription;
import org.hamcrest.Description;
import org.jmock.api.Action;
import org.jmock.api.Invocation;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
*
*
* </pre>
*
* @author mfegan
* @version 1
*/
public class AddScriptAction implements Action {
// private Subscription object;
public static Action addScript(Subscription sub, Object... elements) {
return new AddScriptAction(sub);
}
public AddScriptAction(Subscription object) {
// this.object = object;
}
public void describeTo(Description description) {
description.appendText("adds a Script to a Subscription");
}
public Object invoke(Invocation invocation) throws Throwable {
String id = (String) invocation.getParameter(1);
Object script = (Object) invocation.getParameter(2);
((Subscription) invocation.getParameter(0)).addScript(id, script);
return null;
}
}

View file

@ -1,73 +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.edex.subscription;
import org.hamcrest.Description;
import org.jmock.api.Action;
import org.jmock.api.Invocation;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
*
*
* </pre>
*
* @author mfegan
* @version 1
*/
public class DeleteScriptAction implements Action {
// private Subscription object;
public static Action deleteScript(Subscription sub, Object... elements) {
return new DeleteScriptAction(sub);
}
public DeleteScriptAction(Subscription object) {
// this.object = object;
}
/*
* (non-Javadoc)
*
* @see org.hamcrest.SelfDescribing#describeTo(org.hamcrest.Description)
*/
public void describeTo(Description description) {
description.appendText("deletes a Script from a Subscription");
}
/*
* (non-Javadoc)
*
* @see org.jmock.api.Invokable#invoke(org.jmock.api.Invocation)
*/
public Object invoke(Invocation invocation) throws Throwable {
String id = (String) invocation.getParameter(1);
((Subscription) invocation.getParameter(0)).removeScript(id);
return null;
}
}

View file

@ -1,87 +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.edex.subscription;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* JUnit Test case for the {@link com.raytheon.edex.subscription.Script Script}
* class. Includes the following tests:
* <dl>
* <dt><b>{@link #basicScriptTest() basic Script test}:</b>
* <dd>Tests the creation of a Script.
* </dl>
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02May2007 266 MW Fegan Initial creation.
*
* </pre>
*
* @author mfegan
* @version 1
*/
public class TestScript {
String scriptID;
String script;
/**
* Initialized test data set.
*
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
scriptID = "test";
script = "This is a test.";
}
/**
* Performs test cleanup.
*
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
/* intentionally empty */
}
/**
* Test method for {@link com.raytheon.edex.subscription.Script#Script(java.lang.String, java.lang.Object)}.
* Verifies basic creation of a Script.
*/
@Test
public void basicScriptTest() {
System.out.println("Testing basic Script creation.");
Script s = new Script(scriptID,script);
assertNotNull("Checking object creation",s);
assertSame("Checking script ID",scriptID,s.getScriptid());
assertSame("Schecking script",script,s.getScript());
}
}

View file

@ -1,208 +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.edex.subscription;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* JUnit Test case for the {@link com.raytheon.edex.subscription.Subscription
* Subscription} class. Includes the following tests:
* <dl>
* <dt><b>{@link #basicSubscriptionTest() basic subscription test}:</b>
* <dd>Tests the creation of a Subscription with a single script attached.
* <dt><b>{@link #advancedSubscriptionTest() advanced subscription test}:</b>
* <dd>Tests ability of a single subscription to manage multiple scripts.
* <dt><b>{@link #addScript() test addScript()}:</b>
* <dd>Tests basic functionality of the addScript(String,Object) and
* addScript(Script) methods.
* <dt><b>{@link #getScript() test getScript()}:</b>
* <dd>Tests the basic functionality of the getScript(String) method.
* <dt><b>{@link #removeScript() test removeScript()}:</b>
* <dd>Tests the basic functionality of the removeScript(String) method.
* </dl>
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02May2007 266 MW Fegan Initial creation.
*
* </pre>
*
* @author mfegan
* @version 1
*/
public class TestSubscription {
/* test data values */
private String dataURI;
private String testID1;
private String testID2;
private String testScript1;
private String testScript2;
/* the test fixture */
private Subscription subscription;
/**
* Initialized test data fixture.
*
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
dataURI = "test";
testID1 = "subscription1";
testID2 = "subscription2";
testScript1 = "test script 1";
testScript2 = "test script 2";
subscription = new Subscription();
subscription.setIdentifier(dataURI);
}
/**
* Performs test cleanup.
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
subscription = null;
}
/**
* Basic test method for {@link com.raytheon.edex.subscription.Subscription#Subscription()}.
* Verifies successful creation of a subscription from a data URI, script ID and script.
* Note: does not use the test fixture.
*/
@Test
public void basicSubscriptionTest() {
System.out.println("Testing basic Subscription creation.");
Subscription s = new Subscription(dataURI,testID1,testScript1);
assertSame("Checking subscription URI.",dataURI,(String)s.getIdentifier());
assertTrue("Checking script count.", s.getCount() == 1);
assertNotNull("Checking for non-null script",s.getScript(testID1));
assertSame("Checking script value.",testScript1,s.getScript(testID1).getScript());
}
/**
* Advanced test method for {@link com.raytheon.edex.subscription.Subscription#Subscription()}.
* Verifies that a single subscription can contain multiple scripts, that the scripts can
* be retrieved individually, and that the scripts can be deleted individulally.
*/
@Test
public void advancedSubscriptionTest() {
System.out.println("Testing multiple script Subscription functionality.");
subscription.addScript(testID1, testScript1);
subscription.addScript(testID2, testScript2);
assertSame("Checking subscription URI.",dataURI,(String)subscription.getIdentifier());
assertTrue("Checking script count.", subscription.getCount() == 2);
assertNotNull("Checking for non-null script - script 1.",subscription.getScript(testID1));
assertSame("Checking script value - script 1.",testScript1,subscription.getScript(testID1).getScript());
assertNotNull("Checking for non-null script - script 2.",subscription.getScript(testID2));
assertSame("Checking script value - script 2.",testScript2,subscription.getScript(testID2).getScript());
subscription.removeScript(testID1);
assertTrue("Checking script count.", subscription.getCount() == 1);
assertNull("Checking script value.",subscription.getScript(testID1));
subscription.removeScript(testID2);
assertTrue("Checking script count.", subscription.getCount() == 0);
assertNull("Checking script value.",subscription.getScript(testID2));
}
/**
* Test method for {@link com.raytheon.edex.subscription.Subscription#addScript(Script)} and
* {@link com.raytheon.edex.subscription.Subscription#addScript(String,Object)}.
* Verifies a new script is added to a subscription. Verifies no script is added when the
* script ID is reused.
*/
@Test
public void addScript() {
System.out.println("Testing addScript(String,Object) and addScript(Script)");
boolean r;
r = subscription.addScript(testID1, testScript1);
assertTrue("Checking result of adding script - script 1.",r);
r = subscription.addScript(testID1, testScript1);
assertFalse("Checking result of re-adding script - script 1.",r);
assertTrue("Checking scriptcount.",subscription.getCount() == 1);
Script t = new Script(testID2, testScript2);
r = subscription.addScript(t);
assertTrue("Checking result of adding script - script 2.",r);
r = subscription.addScript(t);
assertFalse("Checking result of re-adding script - script 2.",r);
assertTrue("Checking scriptcount.",subscription.getCount() == 2);
}
/**
* Test method for {@link com.raytheon.edex.subscription.Subscription#getScript(String)}.
* Verifies that the requested Script is returned. Verifies that {@code} is returned
* when the requested Script does not exist.
*
*/
@Test
public void getScript() {
System.out.println("Testing getScript(String)");
Script t;
t = subscription.getScript(testID1);
assertNull("Checking Script retrieval - empty Subscription",t);
subscription.addScript(testID1, testScript1);
t = subscription.getScript(testID1);
assertNotNull("Checking Script retrieval - script 1",t);
assertSame("Checking script ID - script 1",testID1,t.getScriptid());
assertSame("Checking script contents - script 1",testScript1,t.getScript());
t = subscription.getScript(testID2);
assertNull("Checking Script retrieval - invalid script ID",t);
}
/**
* Test method for {@link com.raytheon.edex.subscription.Subscription#removeScript(String)}.
*
*/
@Test
public void removeScript() {
System.out.println("Testing removeScript(String)");
boolean r;
r = subscription.removeScript(testID1);
assertFalse("Checking Script removal - empty Subscription",r);
subscription.addScript(testID1, testScript1);
assertTrue("Checking script count - prior to remove.", subscription.getCount() == 1);
r = subscription.removeScript(testID2);
assertTrue("Checking script count - after remove.", subscription.getCount() == 1);
assertFalse("Checking Script removal - no such script",r);
subscription.addScript(testID2, testScript2);
assertTrue("Checking script count - prior to remove.", subscription.getCount() == 2);
r = subscription.removeScript(testID1);
assertTrue("Checking script count - after remove.", subscription.getCount() == 1);
assertTrue("Checking Script removal - script exists",r);
Script t = subscription.getScript(testID1);
assertNull("Checking that Script has been removed",t);
}
}