jadex.base.test.impl.ComponentTestBase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-platform-bridge Show documentation
Show all versions of jadex-platform-bridge Show documentation
Jadex bridge is a base package for kernels and platforms, i.e., it is used by both and provides commonly used interfaces and classes for active components and their management.
package jadex.base.test.impl;
import java.util.Iterator;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import jadex.base.IPlatformConfiguration;
import jadex.base.test.IAbortableTestSuite;
import jadex.base.test.TestReport;
import jadex.base.test.Testcase;
import jadex.bridge.IComponentIdentifier;
import jadex.bridge.IExternalAccess;
import jadex.bridge.IResourceIdentifier;
import jadex.bridge.ServiceCall;
import jadex.bridge.service.annotation.Timeout;
import jadex.bridge.service.types.cms.CreationInfo;
import jadex.commons.SUtil;
import jadex.commons.TimeoutException;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;
import jadex.commons.future.IResultListener;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
/**
* Test a component.
*/
public class ComponentTestBase extends TestCase
{
//-------- attributes --------
/** The component management system. */
protected IExternalAccess platform;
/** The platform configuration */
protected IPlatformConfiguration conf;
/** The component model. */
protected String filename;
/** The component resource identifier. */
protected IResourceIdentifier rid;
/** The timeout. */
protected long timeout;
/** The test suite. */
protected IAbortableTestSuite suite;
//-------- constructors --------
/**
* Create a new ComponentTest.
*/
public ComponentTestBase()
{
//Logger.getLogger("ComponentTest").log(Level.SEVERE, "Empty ComponentTest Constructor called");
}
/**
* Create a component test.
* Run on existing test suite platform.
* @param cms The CMS of the test suite platform.
*/
public ComponentTestBase(String comp, IAbortableTestSuite suite)
{
super(comp);
this.suite = suite;
}
//-------- methods --------
/**
* The number of test cases.
*/
public int countTestCases()
{
return 1;
}
/**
* Test the component.
*/
public void runBare()
{
Timer t = null;
try
{
if(suite!=null && suite.isAborted())
return;
// Start the component.
final IComponentIdentifier[] cid = new IComponentIdentifier[1];
final Future