diff options
Diffstat (limited to 'plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee')
610 files changed, 0 insertions, 46521 deletions
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/Configuration.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/Configuration.java deleted file mode 100644 index e92606ed5dc..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/Configuration.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.eclipse.osee.ote; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * This defines the bundles to be loaded into the OTE Server. - * - * @author Andrew M. Finkbeiner - * - */ -public class Configuration implements Serializable { - - private static final long serialVersionUID = -3395485777990884086L; - - private ArrayList<ConfigurationItem> items; - - public Configuration() { - items = new ArrayList<>(); - } - - public List<ConfigurationItem> getItems() { - return items; - } - - public void addItem(ConfigurationItem config) { - items.add(config); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationItem.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationItem.java deleted file mode 100644 index 0eb7fa72dcb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationItem.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.eclipse.osee.ote; - -import java.io.Serializable; - -/** - * This defines the bundle to be loaded by the OTE Server. - * - * @author Andrew M. Finkbeiner - * - */ -public class ConfigurationItem implements Serializable { - - private static final long serialVersionUID = -2805353994429454202L; - private String url; - private String version; - private String symbolicName; - private String md5; - private boolean isOsgiBundle; - - public ConfigurationItem(String url, String version, String symbolicName, String md5, boolean isOsgiBundle) { - this.url = url; - this.version = version; - this.symbolicName = symbolicName; - this.md5 = md5; - } - - public boolean isOsgiBundle() { - return isOsgiBundle; - } - - public String getSymbolicName() { - return symbolicName; - } - - public String getMd5Digest() { - return md5; - } - - public String getVersion() { - return version; - } - - public String getLocationUrl() { - return url; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationStatus.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationStatus.java deleted file mode 100644 index 8a537147d00..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationStatus.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.eclipse.osee.ote; - -public class ConfigurationStatus { - - private Configuration configuration; - private boolean success; - private String message; - - public ConfigurationStatus(Configuration configuration, boolean success, String message) { - this.configuration = configuration; - this.success = success; - this.message = message; - } - - public void setFail(String message) { - success = false; - this.message = message; - } - - public boolean isSuccess(){ - return success; - } - - public String getMessage(){ - return message; - } - - public Configuration getConfiguration(){ - return configuration; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationStatusCallback.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationStatusCallback.java deleted file mode 100644 index 9458c9a8096..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/ConfigurationStatusCallback.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.eclipse.osee.ote; - -public interface ConfigurationStatusCallback { - - public void success(); - - public void failure(String errorLog); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/HostServerProperties.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/HostServerProperties.java deleted file mode 100644 index 5de4765f9b5..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/HostServerProperties.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.osee.ote; - - -public enum HostServerProperties { - name, - station, - version, - type, - maxUsers, - comment, - date, - group, - owner, - id, - activeMq, - appServerURI, - oteUdpEndpoint, - serverLaunchWorkingDir -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/NonRemoteUserSession.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/NonRemoteUserSession.java deleted file mode 100644 index 0c5090bcd1f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/NonRemoteUserSession.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.eclipse.osee.ote; - -import java.io.Serializable; -import java.util.UUID; - -import org.eclipse.osee.ote.core.IRemoteUserSession; -import org.eclipse.osee.ote.core.OSEEPerson1_4; -import org.eclipse.osee.ote.core.framework.prompt.IPassFailPromptResponse; -import org.eclipse.osee.ote.core.framework.prompt.IResumeResponse; -import org.eclipse.osee.ote.core.framework.prompt.IUserInputPromptResponse; -import org.eclipse.osee.ote.core.framework.prompt.IYesNoPromptResponse; - -public class NonRemoteUserSession implements IRemoteUserSession, Serializable { - - /** - * - */ - private static final long serialVersionUID = -4094993884862781475L; - - private OSEEPerson1_4 user; - private String address; - - public NonRemoteUserSession(OSEEPerson1_4 user, String address){ - this.user = user; - this.address = address; - } - - @Override - public OSEEPerson1_4 getUser() { - return user; - } - - @Override - public String getAddress() { - return address; - } - - @Override - public byte[] getFile(String workspacePath) { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getFileDate(String workspacePath) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void initiateInformationalPrompt(String message) { - // TODO Auto-generated method stub - - } - - @Override - public void initiatePassFailPrompt(IPassFailPromptResponse prompt) { - // TODO Auto-generated method stub - - } - - @Override - public void initiateYesNoPrompt(IYesNoPromptResponse prompt) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void initiateUserInputPrompt(IUserInputPromptResponse prompt) { - // TODO Auto-generated method stub - - } - - @Override - public void initiateResumePrompt(IResumeResponse prompt) { - // TODO Auto-generated method stub - - } - - @Override - public void cancelPrompts() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public boolean isAlive() { - // TODO Auto-generated method stub - return false; - } - - @Override - public UUID getUserId() throws Exception { - // TODO Auto-generated method stub - return null; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEApi.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEApi.java deleted file mode 100644 index b21c52e7251..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEApi.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.eclipse.osee.ote; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface; -import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment; -import org.eclipse.osee.ote.core.model.IModelManager; -import org.eclipse.osee.ote.io.OTEServerFolder; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; - -/** - * This is an API that exposes some of the key test environment interfaces and operations. It is expected - * that clients of OTE will operate either directly through this API or indirectly using a remote REST or - * Event API that makes use of this API. - * - * @author Andrew M. Finkbeiner - * - */ -public interface OTEApi { - - /** - * Returns the OTEServerFolder service that enables management of the ote server folder area on - * the machine local to the server. - * - * @return the OTEServerFolder service - */ - OTEServerFolder getServerFolder(); - - /** - * Returns the OTEServerJarCache that can be used for saving and getting files from the local - * ote server data store. - * - * @return the OTEServerJarCache service - */ - OTEServerRuntimeCache getRuntimeCache(); - - /** - * Returns the IModelManager service that will give access to generic model controls. It depends on the TestEnvironmentInterface exisiting or it - * will be a null value. - * - * @return null or a valid IModelManager service - */ - IModelManager getModelManager(); - - /** - * Returns the TestEnvironmentInterface service that is a top level object for interacting with the - * environment. It depends on a valid TestEnvironmentInterface getting registered. If we do not - * have a valid test environment it will return null. Generally a valid test environment will exist - * as long as a configuration has been loaded, this can happen if a user connects to a shell server - * or if we have an RCP that contains all the required startup information and bundles. - * - * @return null or a valid TestEnvironmentInterface service - */ - TestEnvironmentInterface getTestEnvironment(); - - /** - * Returns a reference to the Environment implementation of the Remote message service, which allows clients - * to view environment message data. - * - * @return null or a valid IRemoteMessageService - */ - IRemoteMessageService getRemoteMessageService(); - - /** - * This method will make sure that the requested configuration is available to the server and then install them. - * Only jars that are proper OSGI bundles will be loaded. This also means that if configuration items are - * not currently available to the server it will acquire them from the client using the URL in the configuration item. - * - * @param configuration - * @param callable - * @return - * @throws InterruptedException - * @throws ExecutionException - */ - Future<ConfigurationStatus> loadConfiguration(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException; - - /** - * This method will uninstall the previous bundle configuration. - * - * @param callable - * @return - * @throws InterruptedException - * @throws ExecutionException - */ - Future<ConfigurationStatus> resetConfiguration(OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException; - - /** - * Gets the current test environment configuration. - * - * @return - */ - Future<ConfigurationStatus> getConfiguration(); - - /** - * This method will make all bundles defined in the configuration available to the server. This means the server will attempt to use the URL in the configuration item - * to download any bundles not currently in its cache. - * - * @param configuration - * @param callable - * @return - * @throws InterruptedException - * @throws ExecutionException - */ - Future<ConfigurationStatus> downloadConfigurationJars(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException; - - /** - * Attempt to load a class from currently installed bundles and then from the script classpath. - * - * @param clazz - * @return the requested Class - * @throws ClassNotFoundException - */ - Class<?> loadFromScriptClassLoader(String clazz) throws ClassNotFoundException; - - /** - * Attempt to load a class from any currently installed bundled. - * - * @param clazz - * @return the requested Class - * @throws ClassNotFoundException - */ - Class<?> loadFromRuntimeLibraryLoader(String clazz) throws ClassNotFoundException; - - /** - * Get the host test environment. This method will return null if one has not yet been registered, - * so users need to check for null. - * - * @return the host environment or null if one is not created - */ - IHostTestEnvironment getIHostTestEnvironment(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEException.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEException.java deleted file mode 100644 index db0e103cddd..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEException.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.eclipse.osee.ote; - - -public class OTEException extends RuntimeException { - - private static final long serialVersionUID = 8430838531056913404L; - - public OTEException(String format, Throwable t) { - super(format, t); - } - - public OTEException(String string) { - super(string); - } - - public OTEException(Throwable e) { - super(e); - } - - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerRuntimeCache.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerRuntimeCache.java deleted file mode 100644 index 1dcb52272ff..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEServerRuntimeCache.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.osee.ote; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - -/** - * Store, find and remove jars that are used when running an OTE test server. - * - * The format is <pre> - * rootFolder/symbolicName/md5.jar - the jar - * rootFolder/symbolicName/md5.jar.date - the last time it was accessed - * </pre> - * @author Andrew M. Finkbeiner - * - */ -public interface OTEServerRuntimeCache { - - void clearJarCache(); - - File save(String symbolicName, String md5Digest, InputStream servedBundleIn) throws IOException; - - File get(String symbolicName, String md5Digest) throws FileNotFoundException; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEStatusCallback.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEStatusCallback.java deleted file mode 100644 index 28a15115b66..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTEStatusCallback.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.eclipse.osee.ote; - - -public interface OTEStatusCallback<V> { - - void complete(V done); - - void setTotalUnitsOfWork(int totalUnitsOfWork); - - void incrememtUnitsWorked(int count); - - void log(String message); - - void error(String message, Throwable th); - - void error(String message); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTETestEnvironmentClient.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTETestEnvironmentClient.java deleted file mode 100644 index ee733628152..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OTETestEnvironmentClient.java +++ /dev/null @@ -1,385 +0,0 @@ -package org.eclipse.osee.ote; - -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.URISyntaxException; -import java.rmi.RemoteException; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.logging.Level; - -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.framework.jdk.core.type.PropertyStore; -import org.eclipse.osee.framework.jdk.core.util.EnhancedProperties; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.jdk.core.util.network.PortUtil; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader; -import org.eclipse.osee.ote.classserver.HeadlessClassServer; -import org.eclipse.osee.ote.core.BundleInfo; -import org.eclipse.osee.ote.core.ConnectionRequestResult; -import org.eclipse.osee.ote.core.IRemoteUserSession; -import org.eclipse.osee.ote.core.ServiceUtility; -import org.eclipse.osee.ote.core.environment.TestEnvironmentConfig; -import org.eclipse.osee.ote.core.framework.command.ICommandHandle; -import org.eclipse.osee.ote.core.framework.command.ITestCommandResult; -import org.eclipse.osee.ote.core.framework.command.RunTests; -import org.eclipse.osee.ote.endpoint.OteEndpointUtil; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.filetransfer.TcpFileTransfer; -import org.eclipse.osee.ote.filetransfer.TcpFileTransferHandle; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.event.send.OteEndpointSendEventMessage; -import org.eclipse.osee.ote.message.event.send.OteEventMessageFuture; -import org.eclipse.osee.ote.message.event.send.OteSendEventMessage; -import org.eclipse.osee.ote.properties.OtePropertiesCore; -import org.eclipse.osee.ote.remote.messages.BooleanResponse; -import org.eclipse.osee.ote.remote.messages.ConfigurationAndResponse; -import org.eclipse.osee.ote.remote.messages.DisconnectRemoteTestEnvironment; -import org.eclipse.osee.ote.remote.messages.RequestHostEnvironmentProperties; -import org.eclipse.osee.ote.remote.messages.RequestRemoteTestEnvironment; -import org.eclipse.osee.ote.remote.messages.RunTestsCancel; -import org.eclipse.osee.ote.remote.messages.RunTestsGetCommandResultReq; -import org.eclipse.osee.ote.remote.messages.RunTestsGetCommandResultResp; -import org.eclipse.osee.ote.remote.messages.RunTestsIsCancelled; -import org.eclipse.osee.ote.remote.messages.RunTestsIsDone; -import org.eclipse.osee.ote.remote.messages.RunTestsSerialized; -import org.eclipse.osee.ote.remote.messages.SerializedConfigurationAndResponse; -import org.eclipse.osee.ote.remote.messages.SerializedConnectionRequestResult; -import org.eclipse.osee.ote.remote.messages.SerializedDisconnectRemoteTestEnvironment; -import org.eclipse.osee.ote.remote.messages.SerializedEnhancedProperties; -import org.eclipse.osee.ote.remote.messages.SerializedOTEJobStatus; -import org.eclipse.osee.ote.remote.messages.SerializedRequestRemoteTestEnvironment; -import org.eclipse.osee.ote.remote.messages.TestEnvironmentServerShutdown; -import org.eclipse.osee.ote.remote.messages.TestEnvironmentSetBatchMode; -import org.eclipse.osee.ote.remote.messages.TestEnvironmentTransferFile; -import org.osgi.service.event.EventAdmin; - -public class OTETestEnvironmentClient { - - private OteUdpEndpoint service; - private InetSocketAddress destinationAddress; - private ExecutorService pool; - - public static OTETestEnvironmentClient getInstance(String endpoint){ - return new OTETestEnvironmentClient(ServiceUtility.getService(OteUdpEndpoint.class), OteEndpointUtil.getAddress(endpoint)); - } - - public OTETestEnvironmentClient(OteUdpEndpoint service, InetSocketAddress destinationAddress) { - this.service = service; - this.destinationAddress = destinationAddress; - this.pool = Executors.newCachedThreadPool(new ThreadFactory() { - - @Override - public Thread newThread(Runnable arg0) { - Thread th = new Thread(arg0); - th.setName("OTETestEnvironmentClient Thread"); - return th; - } - }); - } - - public void shutdownServer(String serverId){ - TestEnvironmentServerShutdown shutdown = new TestEnvironmentServerShutdown(); - shutdown.SERVER_ID.setValue(serverId); - OteEndpointSendEventMessage sendit = new OteEndpointSendEventMessage(service, destinationAddress); - sendit.asynchSend(shutdown); - } - - public boolean getServerFile(File localFile, File serverFile) throws IOException, ExecutionException, InterruptedException{ - TcpFileTransferHandle receiveFile = TcpFileTransfer.receiveFile(pool, localFile, 0); - TestEnvironmentTransferFile transferFile = new TestEnvironmentTransferFile(); - transferFile.ADDRESS.setAddress(receiveFile.getLocalAddress().getAddress()); - transferFile.ADDRESS.setPort(receiveFile.getLocalAddress().getPort()); - transferFile.FILE_PATH.setValue(serverFile.getAbsolutePath()); - OteEventMessageUtil.sendEvent(transferFile); - return receiveFile.awaitCompletion(); - } - - public void setBatchMode(boolean batchMode) throws URISyntaxException, InterruptedException, ExecutionException, IOException { - TestEnvironmentSetBatchMode setBatchMode = new TestEnvironmentSetBatchMode(); - setBatchMode.SET_BATCH_MODE.setValue(batchMode); - OteEventMessageUtil.postEvent(setBatchMode); - } - - public ICommandHandle runScripts(UUID sessionId, PropertyStore globalProperties, List<IPropertyStore> scriptProperties, boolean useOTEBuilderJars, File rootFolderForOTEBuilderJars, SubProgressMonitor monitor, String serverId, ConfigurationStatusCallback configurationStatusCallback) throws URISyntaxException, InterruptedException, ExecutionException, IOException { - Configuration configuration = null; - if(useOTEBuilderJars){ - configuration = configureEnvironment(serverId, rootFolderForOTEBuilderJars, monitor, configurationStatusCallback); - } - RunTests runTests = new RunTests(UUID.randomUUID().toString(), sessionId, configuration, globalProperties, scriptProperties); - - OteEventMessageUtil.postEvent(new RunTestsSerialized(runTests)); - return new EventRunTestsHandle(runTests.getGUID(), new OteSendEventMessage(ServiceUtility.getService(EventAdmin.class))); - } - - public Configuration configureEnvironment(String serverId, final List<File> bundlesToSend, final boolean installBundles, final SubProgressMonitor monitor, final ConfigurationStatusCallback configurationStatusCallback) { - HeadlessClassServer classServer = null; - Configuration localConfiguration = new Configuration(); - try{ - - classServer = new HeadlessClassServer(PortUtil.getInstance().getValidPort(), InetAddress.getLocalHost(), bundlesToSend); - for (BundleInfo bundleInfo : classServer.getBundles()) { - ConfigurationItem item = new ConfigurationItem(bundleInfo.getServerBundleLocation().toString(),bundleInfo.getVersion(),bundleInfo.getSymbolicName(), bundleInfo.getMd5Digest(), installBundles); - localConfiguration.addItem(item); - } - - if(service != null){ - InetSocketAddress address = service.getLocalEndpoint(); - ConfigurationAndResponse configAndResponse = new ConfigurationAndResponse(address.getAddress().getHostAddress(), address.getPort(), localConfiguration, installBundles, serverId); - SerializedConfigurationAndResponse ser = new SerializedConfigurationAndResponse(); - ser.setObject(configAndResponse); - ser.getHeader().RESPONSE_TOPIC.setValue(SerializedOTEJobStatus.EVENT); - - OteEndpointSendEventMessage sendit = new OteEndpointSendEventMessage(service, destinationAddress); - service.addBroadcast(service.getOteEndpointSender(destinationAddress));//so we can communicate via console before connect - WaitForCompletion completion = new WaitForCompletion(monitor); - final OteEventMessageFuture<SerializedConfigurationAndResponse, SerializedOTEJobStatus> asynchSendAndResponse = sendit.asynchSendAndMultipleResponse(SerializedOTEJobStatus.class, ser, completion, 1000 * 60 * 10); - Thread th = new Thread(new Runnable(){ - @Override - public void run() { - while(true){ - if(monitor != null && monitor.isCanceled()){ - asynchSendAndResponse.complete(); - return; - } else if (asynchSendAndResponse.isDone()){ - return; - } else { - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } - } - } - } - }); - th.setDaemon(true); - th.start(); - asynchSendAndResponse.waitForCompletion(); - if(!asynchSendAndResponse.isTimedOut() && completion.getStatus() != null){ - if(completion.getStatus().isSuccess()){ - configurationStatusCallback.success(); - } else { - String errorLog = completion.getStatus().getErrorLog(); - if(errorLog.length() > 0){ - configurationStatusCallback.failure(errorLog); - } else {//no diff report, must be the same version - configurationStatusCallback.success(); - } - } - } - } - } catch (Throwable th){ - th.printStackTrace(); - } finally { - if(classServer != null){ - classServer.stop(); - } - } - return localConfiguration; - } - - private Configuration configureEnvironment(String serverId, final File oteBuilderRootFolder, final SubProgressMonitor monitor, final ConfigurationStatusCallback configurationStatusCallback) { - HeadlessClassServer classServer = null; - Configuration localConfiguration = new Configuration(); - try{ - List<File> bundlesToSend = new ArrayList<>(); - bundlesToSend.add(oteBuilderRootFolder); - classServer = new HeadlessClassServer(PortUtil.getInstance().getValidPort(), InetAddress.getLocalHost(), bundlesToSend); - File[] jars = oteBuilderRootFolder.listFiles(new FilenameFilter(){ - @Override - public boolean accept(File arg0, String arg1) { - return arg1.endsWith(".jar"); - } - }); - for (File jar : jars) { - try{ - ConfigurationItem item = new ConfigurationItem(classServer.getHostName() + jar.getName(), "1.0", jar.getName(), Lib.fileToString(new File(jar.getAbsolutePath() + ".md5")), false); - localConfiguration.addItem(item); - } catch (IOException ex) { - OseeLog.log(OTETestEnvironmentClient.class, Level.SEVERE, ex); - } - } - - if(service != null){ - InetSocketAddress address = service.getLocalEndpoint(); - ConfigurationAndResponse configAndResponse = new ConfigurationAndResponse(address.getAddress().getHostAddress(), address.getPort(), localConfiguration, false, serverId); - SerializedConfigurationAndResponse ser = new SerializedConfigurationAndResponse(); - ser.setObject(configAndResponse); - ser.getHeader().RESPONSE_TOPIC.setValue(SerializedOTEJobStatus.EVENT); - - OteEndpointSendEventMessage sendit = new OteEndpointSendEventMessage(service, destinationAddress); - WaitForCompletion completion = new WaitForCompletion(monitor); - final OteEventMessageFuture<SerializedConfigurationAndResponse, SerializedOTEJobStatus> asynchSendAndResponse = sendit.asynchSendAndMultipleResponse(SerializedOTEJobStatus.class, ser, completion, 1000 * 60 * 10); - Thread th = new Thread(new Runnable(){ - @Override - public void run() { - while(true){ - if(monitor.isCanceled()){ - asynchSendAndResponse.complete(); - return; - } else if (asynchSendAndResponse.isDone()){ - return; - } else { - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } - } - } - } - }); - th.setDaemon(true); - th.start(); - asynchSendAndResponse.waitForCompletion(); - if(!asynchSendAndResponse.isTimedOut() && completion.getStatus() != null){ - if(completion.getStatus().isSuccess()){ - configurationStatusCallback.success(); - } else { - String errorLog = completion.getStatus().getErrorLog(); - if(errorLog.length() > 0){ - configurationStatusCallback.failure(errorLog); - } else {//no diff report, must be the same version - configurationStatusCallback.success(); - } - } - } - } - } catch (Throwable th){ - th.printStackTrace(); - } finally { - if(classServer != null){ - classServer.stop(); - } - } - return localConfiguration; - } - - private static class EventRunTestsHandle implements ICommandHandle { - - private String guid; - private OteSendEventMessage sendit; - - public EventRunTestsHandle(String guid, OteSendEventMessage sendit){ - this.guid = guid; - this.sendit = sendit; - } - - @Override - public boolean cancelAll(boolean mayInterruptIfRunning) { - RunTestsCancel cancel = new RunTestsCancel(); - cancel.CANCEL_ALL.setValue(true); - cancel.GUID.setValue(guid); - sendit.asynchSend(cancel); - return true; - } - - @Override - public boolean cancelSingle(boolean mayInterruptIfRunning) { - RunTestsCancel cancel = new RunTestsCancel(); - cancel.CANCEL_ALL.setValue(false); - cancel.GUID.setValue(guid); - sendit.asynchSend(cancel); - return true; - } - - @Override - public ITestCommandResult get() { - RunTestsGetCommandResultReq req = new RunTestsGetCommandResultReq(); - RunTestsGetCommandResultResp resp = new RunTestsGetCommandResultResp(); - req.GUID.setValue(guid); - resp = sendit.synchSendAndResponse(resp, req, 30000); - ITestCommandResult result = null; - try { - result = resp.getObject(); - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return result; - } - - @Override - public boolean isCancelled() { - BooleanResponse booleanResponse = new BooleanResponse(); - RunTestsIsCancelled req = new RunTestsIsCancelled(); - req.GUID.setValue(guid); - booleanResponse = sendit.synchSendAndResponse(booleanResponse, req, 20000); - return booleanResponse.VALUE.getValue(); - } - - @Override - public boolean isDone() { - BooleanResponse booleanResponse = new BooleanResponse(); - RunTestsIsDone req = new RunTestsIsDone(); - req.GUID.setValue(guid); - booleanResponse = sendit.synchSendAndResponse(booleanResponse, req, 20000); - return booleanResponse.VALUE.getValue(); - } - - @Override - public String getCommandKey() { - return guid; - } - - } - - public EnhancedProperties getProperties(long timeout) { - SerializedEnhancedProperties props = new SerializedEnhancedProperties(); - RequestHostEnvironmentProperties req = new RequestHostEnvironmentProperties(); - OteEndpointSendEventMessage sendit = new OteEndpointSendEventMessage(service, destinationAddress); - props = sendit.synchSendAndResponse(props, req, timeout); - EnhancedProperties returnVal = null; - try { - if(props != null){ - returnVal = props.getObject(); - } - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return returnVal; - } - - public ConnectionRequestResult requestEnvironment(IRemoteUserSession session, UUID id, TestEnvironmentConfig config) throws RemoteException { - Thread.currentThread().setContextClassLoader(new ExportClassLoader()); - try { - SerializedRequestRemoteTestEnvironment req = new SerializedRequestRemoteTestEnvironment(new RequestRemoteTestEnvironment(session, id, config)); - SerializedConnectionRequestResult result = new SerializedConnectionRequestResult(); - OteEndpointSendEventMessage sendit = new OteEndpointSendEventMessage(service, destinationAddress); - result = sendit.synchSendAndResponse(result, req, OtePropertiesCore.serverConnectionTimeout.getLongValue(1000 * 10)); - if(result != null){ - return result.getObject(); - } - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return null; - } - - public void disconnect(UUID sessionId) throws RemoteException { - try { - SerializedDisconnectRemoteTestEnvironment req = new SerializedDisconnectRemoteTestEnvironment(new DisconnectRemoteTestEnvironment(sessionId)); - OteEndpointSendEventMessage sendit = new OteEndpointSendEventMessage(service, destinationAddress); - sendit.asynchSend(req); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OseeLogStatusCallback.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OseeLogStatusCallback.java deleted file mode 100644 index d33f6413b94..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/OseeLogStatusCallback.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.osee.ote; - -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; - -public class OseeLogStatusCallback implements OTEStatusCallback<ConfigurationStatus> { - - @Override - public void complete(ConfigurationStatus done) { - OseeLog.log(getClass(), Level.INFO, done.getMessage()); - } - - @Override - public void setTotalUnitsOfWork(int totalUnitsOfWork) { - - } - - @Override - public void incrememtUnitsWorked(int count) { - - } - - @Override - public void log(String message) { - OseeLog.log(getClass(), Level.INFO, message); - } - - @Override - public void error(String message, Throwable th) { - OseeLog.log(getClass(), Level.SEVERE, message, th); - } - - @Override - public void error(String message) { - OseeLog.log(getClass(), Level.SEVERE, message); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/WaitForCompletion.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/WaitForCompletion.java deleted file mode 100644 index 883d1208fe5..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/WaitForCompletion.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.eclipse.osee.ote; - -import java.io.IOException; - -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.osee.ote.message.event.send.OteEventMessageCallable; -import org.eclipse.osee.ote.message.event.send.OteEventMessageFuture; -import org.eclipse.osee.ote.remote.messages.JobStatus; -import org.eclipse.osee.ote.remote.messages.SerializedConfigurationAndResponse; -import org.eclipse.osee.ote.remote.messages.SerializedOTEJobStatus; - -class WaitForCompletion implements OteEventMessageCallable<SerializedConfigurationAndResponse, SerializedOTEJobStatus> { - - private SubProgressMonitor monitor; - private int lastUnitsWorked = 0; - private boolean firstTime = true; - private JobStatus status; - - WaitForCompletion(SubProgressMonitor monitor) { - this.monitor = monitor; - } - - @Override - public void call(SerializedConfigurationAndResponse transmitted, SerializedOTEJobStatus recieved, OteEventMessageFuture<?, ?> future) { - - try { - this.status = recieved.getObject(); - reportStatus(status, future); - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - - private synchronized void reportStatus(JobStatus status, OteEventMessageFuture<?, ?> future) { - if(monitor != null){ - if(monitor.isCanceled() || status.isJobComplete()){ - monitor.done(); - future.complete(); - return; - } - if(firstTime){ - monitor.beginTask("Configure Test Server", status.getTotalUnitsOfWork()); - firstTime = false; - } else { - monitor.worked(status.getUnitsWorked() - lastUnitsWorked); - lastUnitsWorked = status.getUnitsWorked(); - } - } else { - if(status.isJobComplete()){ - future.complete(); - return; - } - } - } - - @Override - public void timeout(SerializedConfigurationAndResponse transmitted) { - System.out.println("timed out"); - } - - public JobStatus getStatus(){ - return this.status; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/BundleResourceFinder.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/BundleResourceFinder.java deleted file mode 100644 index 0d01b461b48..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/BundleResourceFinder.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.eclipse.osee.ote.classserver; - -import java.io.FileInputStream; -import java.io.IOException; -import java.util.List; - -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.ote.classserver.ResourceFinder; -import org.eclipse.osee.ote.core.BundleInfo; - -public class BundleResourceFinder extends ResourceFinder { - - private final List<BundleInfo> bundleInfo; - - public BundleResourceFinder(List<BundleInfo> bundleInfo) { - super(); - this.bundleInfo = bundleInfo; - } - - @Override - public byte[] find(String path) throws IOException { - for (BundleInfo info : bundleInfo) { - if (info.getSymbolicName().equals(path) || info.getFile().getName().equals(path)) { - return Lib.inputStreamToBytes(new FileInputStream(info.getFile())); - } - } - return null; - } - - @Override - public void dispose() { - // - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ClassFinder.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ClassFinder.java deleted file mode 100644 index 24914a5497c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ClassFinder.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.classserver; - -import java.io.IOException; -import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader; -import org.osgi.framework.Bundle; - -public class ClassFinder extends ResourceFinder { - - private final ExportClassLoader loader = new ExportClassLoader(); - - @Override - public void dispose() { - } - - @Override - public byte[] find(String path) throws IOException { - Bundle bundle = loader.getExportingBundle(path); - if (bundle != null) { - return getBytes(bundle.getResource(path).openStream()); - } - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ClassServer.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ClassServer.java deleted file mode 100644 index f0c074fc617..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ClassServer.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.classserver; - -import java.io.BufferedInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; - -public class ClassServer extends Thread { - private ServerSocket server; - private URL hostName; - private List<ResourceFinder> resourceFinders; - - private ExecutorService socketThreads; - - /** - * Construct a server - * - * @param port the port to use - * @throws IOException if the server socket cannot be created - */ - public ClassServer(int port, InetAddress address) throws IOException { - server = new ServerSocket(port, 50, address); - socketThreads = Executors.newCachedThreadPool(new ThreadFactory() { - - @Override - public Thread newThread(Runnable arg0) { - Thread th = new Thread(arg0, "ClassServer Task"); - th.setDaemon(true); - return th; - } - }); - if (address instanceof Inet6Address) { - hostName = new URL("http://[" + address.getHostAddress() + "]:" + server.getLocalPort() + "/"); - } else { - hostName = new URL("http://" + address.getHostAddress() + ":" + server.getLocalPort() + "/"); - } - this.setName("OSEE ClassServer"); - this.resourceFinders = new ArrayList<>(); - } - - public void addResourceFinder(ResourceFinder finder) { - this.resourceFinders.add(finder); - } - - /** - * Spawn a thread for each connection requesting service - */ - @Override - public void run() { - - String msg = "ClassServer started ["; - - msg += "port "; - msg += Integer.toString(getPort()); - msg += "]"; - - OseeLog.log(ClassServer.class, Level.INFO, msg); - try { - while (true) { - Socket socket = server.accept(); - socketThreads.submit(new Task(socket)); - } - } catch (IOException e) { - synchronized (this) { - if (!server.isClosed()) { - OseeLog.log(ClassServer.class, Level.SEVERE, "accepting connection", e); - terminate(); - OseeLog.log(ClassServer.class, Level.WARNING, "ClassServer Terminated"); - } - } - } - } - - /** - * Terminate Server - perform cleanup - */ - public synchronized void terminate() { - try { - server.close(); - } catch (IOException e) { - // do nothing - } - final Iterator<ResourceFinder> iter = resourceFinders.iterator(); - while (iter.hasNext()) { - final ResourceFinder resFinder = iter.next(); - resFinder.dispose(); - } - - } - - /** Returns the port on which this server is listening. */ - public int getPort() { - return server.getLocalPort(); - } - - /** Read up to CRLF, return false if EOF */ - private static boolean readLine(InputStream in, StringBuffer buf) throws IOException { - while (true) { - int c = in.read(); - if (c < 0) { - return buf.length() > 0; - } - if (c == '\r') { - in.mark(1); - c = in.read(); - if (c != '\n') { - in.reset(); - } - return true; - } - if (c == '\n') { - return true; - } - buf.append((char) c); - } - } - - /** Read the request/response and return the initial line. */ - private static String getInput(Socket sock, boolean isRequest) throws IOException { - BufferedInputStream in = new BufferedInputStream(sock.getInputStream(), 256); - StringBuffer buf = new StringBuffer(80); - do { - if (!readLine(in, buf)) { - return null; - } - } while (isRequest && buf.length() == 0); - String initial = buf.toString(); - do { - buf.setLength(0); - } while (readLine(in, buf) && buf.length() > 0); - return initial; - } - - /** - * This method provides a way for subclasses to be notified when a file has been completely downloaded. - * - * @param fp The path to the file that was downloaded. - */ - protected void fileDownloaded(String fp, InetAddress addr) { - } - - public URL getHostName() { - return hostName; - } - - private class Task implements Runnable {// Thread { - - private final Socket sock; - - public Task(Socket sock) { - this.sock = sock; - // setDaemon(true); - } - - /** - * Get bytes from path Returns the bytes of the requested file, or null if not found. - */ - private byte[] getBytes(String path) throws IOException { - byte[] bytes = null; - for (int i = 0; i < resourceFinders.size(); i++) { - ResourceFinder finder = resourceFinders.get(i); - bytes = finder.find(path); - if (bytes != null) { - return bytes; - } - } - OseeLog.log(ClassServer.class, Level.INFO, "requested file: '" + path + "' was not found."); - return null; - } - - /** Parse % HEX HEX from s starting at i */ - private char decode(String s, int i) { - return (char) Integer.parseInt(s.substring(i + 1, i + 3), 16); - } - - private String getCanonicalizedPath(String path) { - try { - if (path.regionMatches(true, 0, "http://", 0, 7)) { - int i = path.indexOf('/', 7); - if (i < 0) { - path = "/"; - } else { - path = path.substring(i); - } - } - for (int i = path.indexOf('%'); i >= 0; i = path.indexOf('%', i + 1)) { - char c = decode(path, i); - int n = 3; - if ((c & 0x80) != 0) { - switch (c >> 4) { - case 0xC: - case 0xD: - n = 6; - c = (char) ((c & 0x1F) << 6 | decode(path, i + 3) & 0x3F); - break; - case 0xE: - n = 9; - c = (char) ((c & 0x0f) << 12 | (decode(path, i + 3) & 0x3F) << 6 | decode(path, i + 6) & 0x3F); - break; - default: - return null; - } - } - path = path.substring(0, i) + c + path.substring(i + n); - } - } catch (Exception e) { - return null; - } - if (path.length() == 0 || path.charAt(0) != '/') { - return null; - } - return path.substring(1); - } - - @Override - public void run() { - try { - DataOutputStream out = new DataOutputStream(sock.getOutputStream()); - String req; - try { - req = getInput(sock, true); - } catch (Exception e) { - OseeLog.log(ClassServer.class, Level.INFO, "reading request", e); - return; - } - if (req == null) { - return; - } - if (req.startsWith("SHUTDOWN *")) { - out.writeBytes("HTTP/1.0 403 Forbidden\r\n\r\n"); - out.flush(); - return; - } - - boolean get = req.startsWith("GET "); - if (!get && !req.startsWith("HEAD ")) { - OseeLog.log(ClassServer.class, Level.FINE, "bad request \"{0}\" from {1}:{2}"); - out.writeBytes("HTTP/1.0 400 Bad Request\r\n\r\n"); - out.flush(); - return; - } - String path = req.substring(get ? 4 : 5); - int i = path.indexOf(' '); - if (i > 0) { - path = path.substring(0, i); - } - path = getCanonicalizedPath(path); - if (path == null) { - OseeLog.log(ClassServer.class, Level.FINE, "bad request \"{0}\" from {1}:{2}"); - out.writeBytes("HTTP/1.0 400 Bad Request\r\n\r\n"); - out.flush(); - return; - } - - OseeLog.log(ClassServer.class, Level.FINER, get ? "{0} requested from {1}:{2}" : "{0} probed from {1}:{2}"); - byte[] bytes; - try { - bytes = getBytes(path); - } catch (Exception e) { - OseeLog.log(ClassServer.class, Level.WARNING, "getting bytes", e); - out.writeBytes("HTTP/1.0 500 Internal Error\r\n\r\n"); - out.flush(); - return; - } - if (bytes == null) { - OseeLog.logf(ClassServer.class, Level.FINE, "%s not found", path); - out.writeBytes("HTTP/1.0 404 Not Found\r\n\r\n"); - out.flush(); - return; - } - out.writeBytes("HTTP/1.0 200 OK\r\n"); - out.writeBytes("Content-Length: " + bytes.length + "\r\n"); - out.writeBytes("Content-Type: application/java\r\n\r\n"); - if (get) { - out.write(bytes); - } - out.flush(); - if (get) { - fileDownloaded(path, sock.getInetAddress()); - } - } catch (Exception e) { - OseeLog.log(ClassServer.class, Level.INFO, "writing response", e); - } finally { - try { - sock.close(); - } catch (IOException e) { - } - } - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ClassServerPermissions.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ClassServerPermissions.java deleted file mode 100644 index 3047dc666db..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ClassServerPermissions.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.classserver; - -import java.security.Permission; -import java.security.PermissionCollection; -import java.util.ArrayList; -import java.util.Enumeration; - -/** - * @author Andrew M. Finkbeiner - */ -public class ClassServerPermissions extends PermissionCollection { - - private static final long serialVersionUID = 7752469678730039503L; - private final ArrayList<Permission> list; - - public ClassServerPermissions() { - list = new ArrayList<>(); - } - - @Override - public void add(Permission permission) { - list.add(permission); - } - - @Override - public boolean implies(Permission permission) { - for (int i = 0; i < list.size(); i++) { - if (list.get(i).implies(permission)) { - return true; - } - } - return false; - } - - @Override - public Enumeration<Permission> elements() { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/FrameworkResourceFinder.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/FrameworkResourceFinder.java deleted file mode 100644 index c5260fd863a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/FrameworkResourceFinder.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.classserver; - -import java.io.IOException; -import java.net.URL; - -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; - -public class FrameworkResourceFinder extends ResourceFinder{ - - @Override - public byte[] find(String path) throws IOException { - for(Bundle bundle:FrameworkUtil.getBundle(getClass()).getBundleContext().getBundles()){ - URL url = bundle.getResource(path); - if (url != null) { - return getBytes(url.openStream()); - } - } - return null; - } - - @Override - public void dispose() { - - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/HeadlessClassServer.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/HeadlessClassServer.java deleted file mode 100644 index 2988e3f8227..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/HeadlessClassServer.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.eclipse.osee.ote.classserver; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.net.InetAddress; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.osee.ote.core.BundleInfo; - - - -public class HeadlessClassServer { - - private ClassServer classServer; - private List<BundleInfo> jars; - - public HeadlessClassServer(int port, InetAddress address, List<File> bundleFolders) throws IOException{ -// Thread.currentThread().setName("BundleClassServer"); - classServer = new ClassServer(port, address); - jars = new ArrayList<>(); - for(File dir:bundleFolders){ - if(dir.exists() && dir.isDirectory()){ - findJarFiles(dir, jars); - } else if(dir.exists()){//it may be a jar - BundleInfo info = getBundleInfo(dir); - if(info != null){ - jars.add(info); - } - } - } - BundleResourceFinder bundleResourceFinder = new BundleResourceFinder(jars); - classServer.addResourceFinder(bundleResourceFinder); - classServer.start(); - - } - - public void stop(){ - classServer.terminate(); - } - - public List<BundleInfo> getBundles(){ - return jars; - } - - private void findJarFiles(File dir, final List<BundleInfo> jars) { - dir.listFiles(new FileFilter(){ - @Override - public boolean accept(File pathname) { - if(pathname.isDirectory()){ - findJarFiles(pathname, jars); - } else { - BundleInfo info = getBundleInfo(pathname); - if(info != null){ - jars.add(info); - } - } - return false; - } - }); - } - - private BundleInfo getBundleInfo(File file){ - BundleInfo bundleInfo = null; - try { - if(file.getAbsolutePath().endsWith(".jar")){ - bundleInfo = new BundleInfo(file.toURI().toURL(), getHostName().toExternalForm(), true); - if(bundleInfo.getSymbolicName() != null && !bundleInfo.getSymbolicName().equalsIgnoreCase("unknown") && bundleInfo.getVersion() != null){ - if(bundleInfo.getManifest() == null){ - bundleInfo = null; - } - } - } - } catch (MalformedURLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return bundleInfo; - } - - public URL getHostName(){ - return classServer.getHostName(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/PathResourceFinder.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/PathResourceFinder.java deleted file mode 100644 index 0b2b1dbfe25..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/PathResourceFinder.java +++ /dev/null @@ -1,257 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.classserver; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FilePermission; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.StringTokenizer; -import java.util.jar.Attributes; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.jar.Manifest; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; - -public class PathResourceFinder extends ResourceFinder { - - private final HashSet<JarFile> jars = new HashSet<>(128); - private final HashSet<String> dirs = new HashSet<>(128); - private final HashMap<String, JarFile[]> map = new HashMap<>(128); - private final boolean trees; - private final ClassServerPermissions perm; - private static final int NUMBER_OF_FILE_READ_ATTEMPTS = 20; - - public PathResourceFinder(String[] dirsToAdd, boolean trees) { - this.trees = trees; - perm = new ClassServerPermissions(); - if (dirsToAdd != null) { - addPaths(dirsToAdd); - } - } - - @Override - public byte[] find(String path) throws IOException { - - int i = path.indexOf('/'); - if (i > 0) { - JarFile[] jfs = map.get(path.substring(0, i)); - if (jfs != null) { - String jpath = path.substring(i + 1); - for (i = 0; i < jfs.length; i++) { - JarEntry je = jfs[i].getJarEntry(jpath); - if (je != null) { - return getBytes(jfs[i].getInputStream(je), je.getSize()); - } - } - } - } - synchronized (jars) { - Iterator<JarFile> it = jars.iterator(); - while (it.hasNext()) { - JarFile jar = it.next(); - JarEntry je = jar.getJarEntry(path); - if (je != null) { - return getBytes(jar.getInputStream(je), je.getSize()); - } - } - } - boolean exists = false; - File f = null; - synchronized (dirs) { - for (int j = 0; j < NUMBER_OF_FILE_READ_ATTEMPTS; j++) { // we'll retry in case there is a - // compile going on - Iterator<String> it = dirs.iterator(); - while (it.hasNext()) { - String dirString = it.next(); - f = new File(dirString + File.separatorChar + path.replace('/', File.separatorChar)); - if (f.exists()) { - exists = true; - break; - } - } - if (!exists) { - try { - synchronized (this) { - this.wait(1000); - } - System.err.println(String.format("trying to find :%s %d", path, j)); - } catch (InterruptedException ex) { - // do nothing - } - } else { - break; - } - } - } - - if (exists && f != null) { - if (perm.implies(new FilePermission(f.getPath(), "read"))) { - try { - return getBytes(new FileInputStream(f), f.length()); - } catch (FileNotFoundException e) { - // do nothing - } - } - } - return null; - } - - public void addPaths(String[] paths) { - - for (int i = 0; i < paths.length; i++) { - String path = paths[i]; - - if (path.startsWith("file:\\")) { - path = path.substring(6); - } - - if (path.endsWith(".jar")) { - try { - synchronized (jars) { - jars.add(new JarFile(new File(path))); - } - } catch (Exception ex) { - ex.printStackTrace(); - continue; - } - } else { - if (dirs.add(path)) { - perm.add(new FilePermission(path + File.separator + '-', "read")); - } - } - - if (trees) { - File fdir = new File(path); - String[] files = fdir.list(); - if (files != null) { - try { - URL base = fdir.toURI().toURL(); - for (int j = 0; j < files.length; j++) { - String jar = files[j]; - if (jar.endsWith(".jar") || jar.endsWith(".zip")) { - ArrayList<JarFile> jfs = new ArrayList<>(10); - try { - addJar(jar, jfs, base); - map.put(jar.substring(0, jar.length() - 4), jfs.toArray(new JarFile[jfs.size()])); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - } - } catch (MalformedURLException ex) { - ex.printStackTrace(); - } - } - } - } - } - - /** Add transitive Class-Path JARs to jfs. */ - private void addJar(String jar, ArrayList<JarFile> jfs, URL base) throws IOException { - base = new URL(base, jar); - jar = base.getFile().replace('/', File.separatorChar); - for (int i = jfs.size(); --i >= 0;) { - if (jar.equals(jfs.get(i).getName())) { - return; - } - } - - JarFile jf = new JarFile(jar); - jfs.add(jf); - try { - Manifest man = jf.getManifest(); - if (man == null) { - return; - } - Attributes attrs = man.getMainAttributes(); - if (attrs == null) { - return; - } - String val = attrs.getValue(Attributes.Name.CLASS_PATH); - if (val == null) { - return; - } - for (StringTokenizer st = new StringTokenizer(val); st.hasMoreTokens();) { - addJar(st.nextToken(), jfs, base); - } - } catch (IOException ex) { - jfs.remove(jf); - jf.close(); - throw ex; - } - } - - /** - * Finds the jarFile if it is being served. - * - * @param name The name of the jar file - * @return The jar represented as a File, or null if the jar was not found. - */ - public File getJarFile(String name) { - File jarFileReturn = null; - synchronized (jars) { - Iterator<JarFile> it = jars.iterator(); - while (it.hasNext()) { - JarFile jarFile = it.next(); - if (jarFile.getName().endsWith(File.separator + name)) { - jarFileReturn = new File(jarFile.getName()); - break; - } - } - } - return jarFileReturn; - } - - public void removeJarFile(String name) { - synchronized (jars) { - Iterator<JarFile> it = jars.iterator(); - while (it.hasNext()) { - JarFile jarFile = it.next(); - if (jarFile.getName().endsWith(File.separator + name)) { - try { - OseeLog.log(ClassServer.class, Level.INFO, "removing JAR file " + name); - jarFile.close(); - } catch (IOException ex) { - // do nothing - } - it.remove(); - return; - } - } - } - } - - @Override - public void dispose() { - synchronized (jars) { - OseeLog.log(ClassServer.class, Level.INFO, "disposing path resource finder's cached JAR files"); - Iterator<JarFile> it = jars.iterator(); - while (it.hasNext()) { - JarFile jarFile = it.next(); - try { - jarFile.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - jars.clear(); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ResourceFinder.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ResourceFinder.java deleted file mode 100644 index ae6a68d4e93..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/ResourceFinder.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.classserver; - -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStream; - -public abstract class ResourceFinder { - - public abstract byte[] find(String path) throws IOException; - - public byte[] getBytes(InputStream in, long length) throws IOException { - DataInputStream din = new DataInputStream(in); - byte[] bytes = new byte[(int) length]; - try { - din.readFully(bytes); - } finally { - din.close(); - } - return bytes; - } - - public byte[] getBytes(InputStream stream) throws IOException { - return getBytes(stream, stream.available()); - } - - public abstract void dispose(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/classserver.properties b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/classserver.properties deleted file mode 100644 index d9c2d56f85e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/classserver/classserver.properties +++ /dev/null @@ -1,15 +0,0 @@ - - - -classserver.jar:{0} -classserver.inputerror:exception reading request from {0}:{1} -classserver.request:{0} requested from {1}:{2} -classserver.probe:{0} probed from {1}:{2} -classserver.badrequest:bad request "{0}" from {1}:{2} -classserver.shutdown:shutdown request from {0}:{1} -classserver.notfound:{0} not found -classserver.usage:[-port <port>] [-dir <dir>] [-stoppable] [-verbose] [-trees]\ -\n or\ -\n[-port <port>] -stop -classserver.forbidden:stop request denied -classserver.status:HTTP status code: {0} {1} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/collections/ObjectPool.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/collections/ObjectPool.java deleted file mode 100644 index e16ba417410..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/collections/ObjectPool.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.eclipse.osee.ote.collections; - -import java.util.concurrent.ArrayBlockingQueue; - -public class ObjectPool<T> { - - private final ArrayBlockingQueue<T> objs; - private final ObjectPoolConfiguration<T> config; - - public ObjectPool(ObjectPoolConfiguration<T> config) { - this.config = config; - objs = new ArrayBlockingQueue<>(config.getMaxSize()); - if(config.preallocate()){ - for(int i = 0; i < config.getMaxSize(); i++){ - objs.offer(config.make()); - } - } - } - - public T getObject(){ - T obj = objs.poll(); - if(obj == null){ - obj = config.make(); - } - return obj; - } - - public void returnObj(T obj){ - objs.offer(obj); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/collections/ObjectPoolConfiguration.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/collections/ObjectPoolConfiguration.java deleted file mode 100644 index 7a4b76b6369..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/collections/ObjectPoolConfiguration.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.eclipse.osee.ote.collections; - -public abstract class ObjectPoolConfiguration<T> { - - private int maxSize; - private boolean preallocate; - - public ObjectPoolConfiguration(int maxSize, boolean preallocate){ - this.maxSize = maxSize; - this.preallocate = preallocate; - } - - public int getMaxSize(){ - return maxSize; - } - - public boolean preallocate(){ - return preallocate; - } - - abstract public T make(); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/AbstractRemoteSession.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/AbstractRemoteSession.java deleted file mode 100644 index 40be86edae0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/AbstractRemoteSession.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.rmi.RemoteException; - -public abstract class AbstractRemoteSession implements IRemoteUserSession { - - private final OSEEPerson1_4 user; - - protected AbstractRemoteSession(OSEEPerson1_4 user) { - this.user = user; - } - - @Override - public OSEEPerson1_4 getUser() { - return user; - } - - @Override - public abstract String getAddress() throws RemoteException; - - @Override - public abstract byte[] getFile(String workspacePath) throws RemoteException; - - @Override - public abstract long getFileDate(String workspacePath) throws RemoteException; - - @Override - public abstract boolean isAlive() throws RemoteException; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BaseUdpReceiveRunnable.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BaseUdpReceiveRunnable.java deleted file mode 100644 index a8d85497785..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BaseUdpReceiveRunnable.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.eclipse.osee.ote.core; - -import java.io.IOException; -import java.io.InterruptedIOException; -import java.net.BindException; -import java.net.InetSocketAddress; -import java.nio.ByteBuffer; -import java.nio.channels.ClosedByInterruptException; -import java.nio.channels.DatagramChannel; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.OTEException; - -public abstract class BaseUdpReceiveRunnable implements Runnable { - - private static final int DATA_SIZE = 65536; - private static final int UDP_TIMEOUT = 240000; // 4 MINUTES - private static final int ONE_MEG = 1024 * 1024; - - private volatile boolean run = true; - private Class<BaseUdpReceiveRunnable> logger = BaseUdpReceiveRunnable.class; - private InetSocketAddress address; - - public BaseUdpReceiveRunnable(InetSocketAddress address) { - this.address = address; - } - - public void stop() { - run = false; - } - - @Override - public void run() { - ByteBuffer buffer = ByteBuffer.allocateDirect(DATA_SIZE); - DatagramChannel channel = null; - try { - while (run) { - try { - channel = DatagramChannel.open(); - channel.socket().setReuseAddress(true); - channel.socket().bind(address); - channel.socket().setSoTimeout(UDP_TIMEOUT); - channel.socket().setReceiveBufferSize(ONE_MEG); - channel.configureBlocking(true); - - while (run) { - buffer.clear(); - channel.receive(buffer); - buffer.flip(); - processBuffer(buffer); - } - } catch (BindException ex) { - OseeLog.log(logger, Level.FINEST, ex); - if (channel != null) { - channel.close(); - } - Thread.sleep(1000); - } - } - } catch (InterruptedIOException ex) { - Thread.interrupted(); - if (run) { - OseeLog.log(logger, Level.WARNING, "Unexpected interruption", ex); - } - } catch (ClosedByInterruptException ie) { - Thread.interrupted(); - if (run) { - OseeLog.log(logger, Level.WARNING, "Unexpected interruption", ie); - } - } catch (Throwable t) { - throw new OTEException(t); - } finally { - try { - if (channel != null) { - channel.close(); - } - } catch (IOException ex) { - ex.printStackTrace(); - } - } - } - - protected abstract void processBuffer(ByteBuffer buffer); - - public InetSocketAddress getAddress() { - return address; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BundleInfo.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BundleInfo.java deleted file mode 100644 index eeed594d9a0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/BundleInfo.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -import java.net.URL; -import java.security.NoSuchAlgorithmException; -import java.util.jar.JarFile; -import java.util.jar.Manifest; - -import org.eclipse.osee.framework.jdk.core.util.ChecksumUtil; - -/** - * @author Robert A. Fisher - */ -public class BundleInfo { - private final String symbolicName; - private final String version; - private final URL systemLocation; - private final URL bundleServerLocation; - private final File file; - private final Manifest manifest; - private final boolean systemLibrary; - private String md5Digest; - - public BundleInfo(URL systemLocation, String bundleServerBaseLocation, boolean systemLibrary) throws IOException { - File tmpFile; - try { - tmpFile = new File(systemLocation.toURI()); - } catch (URISyntaxException ex) { - tmpFile = new File(systemLocation.getPath()); - } - this.file = tmpFile; - - JarFile jarFile = new JarFile(file); - this.manifest = jarFile.getManifest(); - this.symbolicName = generateBundleName(manifest); - this.version = manifest.getMainAttributes().getValue("Bundle-Version"); - - this.systemLocation = systemLocation; - this.bundleServerLocation = new URL(bundleServerBaseLocation + symbolicName); - this.systemLibrary = systemLibrary; - this.md5Digest = null; - } - - public BundleInfo(URL systemLocation) throws IOException { - File tmpFile; - try { - tmpFile = new File(systemLocation.toURI()); - } catch (URISyntaxException ex) { - tmpFile = new File(systemLocation.getPath()); - } - this.file = tmpFile; - - JarFile jarFile = new JarFile(file); - this.manifest = jarFile.getManifest(); - this.symbolicName = generateBundleName(manifest); - this.version = manifest.getMainAttributes().getValue("Bundle-Version"); - - this.systemLocation = systemLocation; - this.bundleServerLocation = systemLocation; - this.systemLibrary = true; - this.md5Digest = null; - } - - /** - * @return the name of the bundle - */ - public static String generateBundleName(Manifest jarManifest) { - String nameEntry = jarManifest.getMainAttributes().getValue("Bundle-SymbolicName"); - if(nameEntry == null){ - return "unknown"; - } - // Sometimes there's a semicolon then extra info - ignore this - int index = nameEntry.indexOf(';'); - if (index != -1) { - nameEntry = nameEntry.substring(0, index); - } - - return nameEntry; - } - - /** - * @return the symbolicName - */ - public String getSymbolicName() { - return symbolicName; - } - - /** - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * @return the location - */ - public URL getSystemLocation() { - return systemLocation; - } - - /** - * @return the bundleServerLocation - */ - public URL getServerBundleLocation() { - return bundleServerLocation; - } - - /** - * @return the file - */ - public File getFile() { - return file; - } - - /** - * @return the manifest - */ - public Manifest getManifest() { - return manifest; - } - - @Override - public String toString() { - return getSymbolicName() + ":" + getVersion(); - } - - /** - * @return the systemLibrary - */ - public boolean isSystemLibrary() { - return systemLibrary; - } - - /** - * @return the md5Digest - */ - public String getMd5Digest() { - // Do lazy calculation of this since it can be costly - // and does not get read for all bundle info's - if (md5Digest == null) { - try { - InputStream in = systemLocation.openStream(); - - md5Digest = ChecksumUtil.createChecksumAsString(in, "MD5"); - - in.close(); - } catch (NoSuchAlgorithmException ex) { - throw new IllegalStateException("Always expect MD5 to be available", ex); - } catch (IOException ex) { - throw new IllegalStateException("Always expect local jar file to be available", ex); - } catch (Exception e) { - e.printStackTrace(); - } - } - return md5Digest; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ConnectionRequestResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ConnectionRequestResult.java deleted file mode 100644 index ba38789b770..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ConnectionRequestResult.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.io.Serializable; -import java.util.UUID; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment; - -/** - * @author Ken J. Aguilar - */ -public class ConnectionRequestResult implements Serializable { - private static final long serialVersionUID = -2269465634573908989L; - private final ITestEnvironment environment; - private final UUID sessionKey; - private final ReturnStatus status; - - public ConnectionRequestResult(ITestEnvironment environment, UUID sessionId, ReturnStatus status) { - this.environment = environment; - this.sessionKey = sessionId; - this.status = status; - } - - /** - * @return the environment - */ - public ITestEnvironment getEnvironment() { - return environment; - } - - /** - * @return the sessionKey - */ - public UUID getSessionKey() { - return sessionKey; - } - - /** - * @return the status - */ - public ReturnStatus getStatus() { - return status; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/CopyOnWriteNoIteratorList.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/CopyOnWriteNoIteratorList.java deleted file mode 100644 index d5c0a6f992e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/CopyOnWriteNoIteratorList.java +++ /dev/null @@ -1,128 +0,0 @@ -package org.eclipse.osee.ote.core; - -import java.lang.reflect.Array; -import java.util.Collection; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.locks.ReentrantLock; - -/** - * This class is useful for cases where frequent looping and thread safety happen. - * It forces you to get a reference to the backing array and expects you to do a - * non Iterator based loop so that no Iterator objects are created to minimized GC churn. - * - * @author Andrew M Finkbeiner - * - * @param <E> - */ -public class CopyOnWriteNoIteratorList<E> { - - private ReentrantLock lock = new ReentrantLock(); - private AtomicReference<E[]> data = new AtomicReference<>(); - private Class<E> type; - - public CopyOnWriteNoIteratorList(Class<E> type){ - this.type = type; - data.set(newArray(0)); - } - - @SuppressWarnings("unchecked") - private E[] newArray(int size){ - return (E[]) Array.newInstance(type, size); - } - - public void add(E item){ - try{ - lock.lock(); - E[] ref = data.get(); - E[] newdata = newArray(ref.length + 1); - System.arraycopy(ref, 0, newdata, 0, ref.length); - newdata[newdata.length-1] = item; - data.set(newdata); - } finally{ - lock.unlock(); - } - } - - public boolean remove(E item){ - boolean returnvalue = false; - try{ - lock.lock(); - int index = -1; - E[] ref = data.get(); - for(int i = 0; i < ref.length; i++){ - if(item.equals(ref[i])){ - index = i; - break; - } - } - if(index > -1){ - E[] newdata = newArray(ref.length - 1); - if(index == 0){ - System.arraycopy(ref, 1, newdata, 0, newdata.length); - } else if (index == (ref.length - 1)){ - System.arraycopy(ref, 0, newdata, 0, newdata.length); - } else { - System.arraycopy(ref, 0, newdata, 0, index); - System.arraycopy(ref, index+1, newdata, index, ref.length - (index + 1)); - } - data.set(newdata); - returnvalue = true; - } - } finally { - lock.unlock(); - } - return returnvalue; - } - - public boolean contains(E item){ - boolean returnValue = false; - try{ - lock.lock(); - int index = -1; - E[] ref = data.get(); - for(int i = 0; i < ref.length; i++){ - if(item.equals(ref[i])){ - index = i; - break; - } - } - if(index > -1){ - returnValue = true; - } - } finally { - lock.unlock(); - } - return returnValue; - } - - public E[] get(){ - return data.get(); - } - - public int length() { - return data.get().length; - } - - public void clear() { - try{ - lock.lock(); - data.set(newArray(0)); - } finally{ - lock.unlock(); - } - } - - public Collection<E> fillCollection(Collection<E> arrayList) { - try{ - lock.lock(); - E[] ref = data.get(); - for(int i = 0; i < ref.length; i++){ - arrayList.add(ref[i]); - } - } finally { - lock.unlock(); - } - return arrayList; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ExecutionUnitException.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ExecutionUnitException.java deleted file mode 100644 index ae472754b0b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ExecutionUnitException.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.util.logging.Level; - -public class ExecutionUnitException extends TestException { - - private static final long serialVersionUID = -9119275292591321042L; - - public ExecutionUnitException(String message, Level level, Throwable cause) { - super(message, level, cause); - } - - public ExecutionUnitException(String message, Level level) { - super(message, level); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/GCHelper.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/GCHelper.java deleted file mode 100644 index 14205dd57d2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/GCHelper.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.TreeSet; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; - -/** - * @author Andrew M. Finkbeiner - */ -public class GCHelper { - - private static boolean enableGcHelper = Boolean.parseBoolean(System.getProperty("ote.gc.helper", "false")); - - private final ConcurrentHashMap<String, WeakReference<Object>> map; - private static GCHelper singleton; - - public GCHelper() { - super(); - map = new ConcurrentHashMap<>(1024); - } - - public static GCHelper getGCHelper() { - if (singleton == null) { - singleton = new GCHelper(); - } - return singleton; - } - - public void addRefWatch(Object obj) { - if(enableGcHelper){ - String key = obj.toString() + " [ " + obj.hashCode() + " ] "; - map.put(key, new WeakReference<Object>(obj)); - } - } - - public void printLiveReferences() { - - StringBuilder builder = new StringBuilder(8000); - if(!enableGcHelper){ - builder.append("GCHelper disabled. Enable with '-Dote.gc.helper=true'\n"); - } - writeGCResults(builder); - OseeLog.log(GCHelper.class, Level.INFO, builder.toString()); - } - - public void writeGCResults(StringBuilder builder) { - TreeSet<String> live = new TreeSet<>(); - System.gc(); - for (Map.Entry<String, WeakReference<Object>> entry : map.entrySet()) { - if (entry.getValue().get() != null) { - entry.getValue().get(); - live.add(entry.getKey()); - } - } - - builder.append("Live References:\n"); - for (String key : live) { - builder.append(" "); - builder.append(key); - builder.append("\n"); - } - } - - public List getInstancesOfType(Class type) { - List<Object> listOfObjects = new ArrayList<>(); - System.gc(); - for (Map.Entry<String, WeakReference<Object>> entry : map.entrySet()) { - if (entry.getValue().get() != null) { - if (type.isInstance(entry.getValue().get())) { - listOfObjects.add(entry.getValue().get()); - } - } - } - return listOfObjects; - } - - public void collectGarbage() { - long memBefore = Runtime.getRuntime().freeMemory(); - long timeBefore = System.currentTimeMillis(); - Runtime.getRuntime().runFinalization(); - Runtime.getRuntime().gc(); - System.out.println("Garbage Collection --- Memory Released: " + (Runtime.getRuntime().freeMemory() - memBefore) + " -- Time Elapsed: " + (System.currentTimeMillis() - timeBefore)); - } - - public void collectGarbageAndPrintStats() { - new Thread(new Runnable() { - - @Override - public void run() { - try { - Thread.sleep(5000); - collectGarbage(); - printLiveReferences(); - } catch (InterruptedException ex) { - } - - } - - }).start(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/IRemoteUserSession.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/IRemoteUserSession.java deleted file mode 100644 index cd179ec1241..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/IRemoteUserSession.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import org.eclipse.osee.ote.core.framework.prompt.IPassFailPromptResponse; -import org.eclipse.osee.ote.core.framework.prompt.IResumeResponse; -import org.eclipse.osee.ote.core.framework.prompt.IUserInputPromptResponse; - -/** - * @author Ken J. Aguilar - */ -public interface IRemoteUserSession extends Remote, IUserSession { - @Override - public String getAddress() throws RemoteException; - - @Override - public OSEEPerson1_4 getUser() throws RemoteException; - - @Override - public byte[] getFile(String workspacePath) throws RemoteException; - - @Override - public long getFileDate(String workspacePath) throws RemoteException; - - @Override - public void initiatePassFailPrompt(IPassFailPromptResponse prompt) throws RemoteException; - - @Override - public void initiateUserInputPrompt(IUserInputPromptResponse prompt) throws RemoteException; - - @Override - public void initiateResumePrompt(IResumeResponse prompt) throws RemoteException; - - @Override - public void initiateInformationalPrompt(String message) throws RemoteException; - - @Override - public boolean isAlive() throws RemoteException; - -// @Override -// public void sendMessageToClient(Message message) throws RemoteException; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ITestClient.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ITestClient.java deleted file mode 100644 index e492fc75265..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ITestClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment; -import org.eclipse.osee.ote.core.environment.status.SequentialCommandEnded; - -public interface ITestClient { - - ITestEnvironment getEnvironment(); - - void notifyCmdEmded(SequentialCommandEnded data); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/IUserSession.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/IUserSession.java deleted file mode 100644 index 7919f1ab375..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/IUserSession.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.util.UUID; - -import org.eclipse.osee.ote.core.framework.prompt.IPassFailPromptResponse; -import org.eclipse.osee.ote.core.framework.prompt.IResumeResponse; -import org.eclipse.osee.ote.core.framework.prompt.IUserInputPromptResponse; -import org.eclipse.osee.ote.core.framework.prompt.IYesNoPromptResponse; - -public interface IUserSession { - - public OSEEPerson1_4 getUser() throws Exception; - - public String getAddress() throws Exception; - - /** - * returns the contents of the requested file on the client session - * - * @return the byte contents of the requested file or null if it does not exist - */ - public byte[] getFile(String workspacePath) throws Exception; - - public long getFileDate(String workspacePath) throws Exception; - - public void initiateInformationalPrompt(String message) throws Exception; - - public void initiatePassFailPrompt(IPassFailPromptResponse prompt) throws Exception; - - public void initiateYesNoPrompt(IYesNoPromptResponse prompt) throws Exception; - - public void initiateUserInputPrompt(IUserInputPromptResponse prompt) throws Exception; - - public void initiateResumePrompt(IResumeResponse prompt) throws Exception; - -// public void sendMessageToClient(Message message) throws Exception; - - public void cancelPrompts() throws Exception; - - public boolean isAlive() throws Exception; - - public UUID getUserId() throws Exception; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/MethodFormatter.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/MethodFormatter.java deleted file mode 100644 index 58d7c314351..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/MethodFormatter.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.util.ArrayList; -import java.util.Collection; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.framework.jdk.core.util.EnumBase; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Charles Shaw - * @author Robert A. Fisher - */ -public class MethodFormatter implements Xmlizable, XmlizableStream { - private final Collection<Argument> arguments = new ArrayList<>(); - - public final class Argument { - public final String Class; - public final String Value; - - public Argument(final String Class, final String Value) { - this.Class = Class; - this.Value = Value; - } - - @Override - public String toString() { - return "<" + Class + ">" + Value; - } - } - - public MethodFormatter add(float value) { - arguments.add(new Argument(float.class.getName(), Double.toString(value))); - return this; - } - - public MethodFormatter add(double value) { - arguments.add(new Argument(double.class.getName(), Double.toString(value))); - return this; - } - - public MethodFormatter add(byte value) { - arguments.add(new Argument(byte.class.getName(), Double.toString(value))); - return this; - } - - public MethodFormatter add(short value) { - arguments.add(new Argument(short.class.getName(), Double.toString(value))); - return this; - } - - public MethodFormatter add(int value) { - arguments.add(new Argument(int.class.getName(), Integer.toString(value))); - return this; - } - - public MethodFormatter add(long value) { - arguments.add(new Argument(long.class.getName(), Double.toString(value))); - return this; - } - - public MethodFormatter add(char value) { - arguments.add(new Argument(char.class.getName(), Integer.toString(value))); - return this; - } - - public MethodFormatter add(boolean value) { - arguments.add(new Argument(boolean.class.getName(), Boolean.toString(value))); - return this; - } - - public MethodFormatter add(EnumBase value) { - arguments.add(new Argument(EnumBase.class.getName(), value.getName())); - return this; - } - - public MethodFormatter add(EnumBase[] value) { - final String sep = ", "; - StringBuilder sb = new StringBuilder(); - sb.append("["); - for (int i = 0; i < value.length; i++) { - sb.append(value[i].getName()).append(sep); - } - if (sb.length() > sep.length()) { - sb.setLength(sb.length() - sep.length()); - } - sb.append("]"); - arguments.add(new Argument(EnumBase[].class.getName(), sb.toString())); - return this; - } - - public MethodFormatter add(Object value) { - arguments.add(new Argument(value.getClass().getName(), value.toString())); - return this; - } - - @Override - public String toString() { - final String sep = ", "; - StringBuilder sb = new StringBuilder(); - for (Argument argument : arguments) { - sb.append(argument.toString()).append(sep); - } - if (sb.length() > sep.length()) { - sb.setLength(sb.length() - sep.length()); - } - return sb.toString(); - } - - @Override - public Element toXml(Document doc) { - Element toReturn = doc.createElement("MethodArguments"); - for (Argument argument : arguments) { - Element element = doc.createElement("Argument"); - element.appendChild(Jaxp.createElement(doc, "Type", argument.Class)); - String toLog = argument.Value != null ? XmlSupport.format(argument.Value) : "null"; - element.appendChild(Jaxp.createElement(doc, "Value", toLog)); - toReturn.appendChild(element); - } - return toReturn; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("MethodArguments"); - for (Argument argument : arguments) { - writer.writeStartElement("Argument"); - XMLStreamWriterUtil.writeElement(writer, "Type", argument.Class); - String toLog = argument.Value != null ? XmlSupport.format(argument.Value) : "null"; - XMLStreamWriterUtil.writeElement(writer, "Value", toLog); - writer.writeEndElement(); - } - writer.writeEndElement(); - } - - @JsonProperty - public Collection<Argument> getMethodArguments() { - return arguments; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OSEEPerson1_4.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OSEEPerson1_4.java deleted file mode 100644 index 9c0d1f55bf1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OSEEPerson1_4.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.io.Serializable; - -public class OSEEPerson1_4 implements Serializable { - - private static final long serialVersionUID = 6345874159597384661L; - - private final String name; - - private final String email; - - private final String id; - - public OSEEPerson1_4(String name, String email, String id) { - this.name = name; - this.email = email; - this.id = id; - } - - public String getEmail() { - return email; - } - - public String getId() { - return id; - } - - public String getName() { - return name; - } - - @Override - public boolean equals(Object arg0) { - if (arg0 instanceof OSEEPerson1_4) { - OSEEPerson1_4 person = (OSEEPerson1_4) arg0; - return person.name.equals(this.name) && person.email.equals(this.email) && person.id.equals(this.id); - } - return false; - } - - @Override - public int hashCode() { - int hashCode = 0; - if (name != null) { - hashCode += name.hashCode(); - } - if (email != null) { - hashCode += email.hashCode(); - } - if (id != null) { - hashCode += id.hashCode(); - } - return hashCode; - } - - @Override - public String toString() { - return name + ":" + email + ":" + id + " hash=" + hashCode(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OTESessionManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OTESessionManager.java deleted file mode 100644 index 51dbdae9b2f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OTESessionManager.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.osee.ote.core; - -import java.util.Set; -import java.util.UUID; - -public interface OTESessionManager { - void add(UUID sessionId, IUserSession session); - void remove(UUID sessionId); - IUserSession get(UUID sessionId); - Set<UUID> get(); - IUserSession getActiveUser();//?? - void setActiveUser(UUID sessionId);//?? -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OseeTestThread.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OseeTestThread.java deleted file mode 100644 index e444d94cb47..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OseeTestThread.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.lang.ref.WeakReference; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.HashSet; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.internal.Activator; - -/** - * @author Ken J. Aguilar - */ -public abstract class OseeTestThread { - - private static final Logger logger = Logger.getLogger("osee.test.core.OseeTestThread"); - private final Thread thread; - private final WeakReference<TestEnvironment> env; - private static final HashSet<OseeTestThread> threadList = new HashSet<>(32); - private volatile Throwable causeOfDeath = null; - private volatile Date timeOfDeath = null; - - /** - * Creates the thread with the given name and as a non daemon thread - */ - public OseeTestThread(String name, TestEnvironment env) { - this(name, false, null, env); - } - - public OseeTestThread(String name, ThreadGroup group, TestEnvironment env) { - this(name, false, group, env); - } - - public Thread.State getState() { - return thread.getState(); - } - - /** - * Creates the thread with the given name and daemon flag - * - * @param name the name of this thread - * @param isDaemon marks the thread as a daemon thread - */ - public OseeTestThread(String name, boolean isDaemon, ThreadGroup group, TestEnvironment env) { - GCHelper.getGCHelper().addRefWatch(this); - this.env = new WeakReference<>(env); - thread = new Thread(group, name) { - - @Override - public void run() { - try { - OseeTestThread.this.run(); - synchronized (threadList) { - threadList.remove(OseeTestThread.this); - } - } catch (TestException e) { - OseeLog.log(Activator.class, e.getLevel(), - "TestException in " + e.getThreadName() + ": " + e.getMessage(), e); - cleanupAfterException(e); - } catch (Throwable t) { - OseeLog.log(Activator.class, Level.SEVERE, "Unhandled exception in " + thread.getName(), t); - cleanupAfterException(t); - } - } - }; - thread.setDaemon(isDaemon); - threadList.add(this); - } - - /** - * Starts the thread - */ - public void start() { - thread.start(); - } - - public void setName(String name) { - thread.setName(name); - } - - public String getName() { - return thread.getName(); - } - - public boolean isAlive() { - return thread.isAlive(); - } - - public void interrupt() { - thread.interrupt(); - } - - private static final class Trace extends RuntimeException { - private static final long serialVersionUID = 8520935964300439490L; - - Trace() { - super("call trace"); - } - } - - /** - * This method will be called upon thread execution - */ - protected abstract void run() throws Exception; - - public void join() throws InterruptedException { - thread.join(); - } - - public void join(int milliseconds) throws InterruptedException { - thread.join(milliseconds); - } - - public TestEnvironment getEnvironment() { - return OseeTestThread.this.env.get(); - } - - public static Collection<OseeTestThread> getThreads() { - return threadList; - } - - private synchronized void cleanupAfterException(Throwable t) { - causeOfDeath = t; - timeOfDeath = Calendar.getInstance().getTime(); - this.env.get().handleException(t, Level.OFF); - } - - public Throwable getCauseOfDeath() { - return causeOfDeath; - } - - public Date getTimeOfDeath() { - return timeOfDeath; - } - - public static void clearThreadReferences() { - synchronized (threadList) { - threadList.clear(); - } - } - - public boolean isInterrupted() { - return thread.isInterrupted(); - } - - public void setDaemon(boolean isDaemon) { - thread.setDaemon(isDaemon); - } - - public Thread getThread() { - return thread; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OseeURLClassLoader.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OseeURLClassLoader.java deleted file mode 100644 index 785f3e272a9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OseeURLClassLoader.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.net.URL; -import java.net.URLClassLoader; -import java.net.URLStreamHandlerFactory; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader; - -/** - * @author Andrew M. Finkbeiner - */ -public class OseeURLClassLoader extends URLClassLoader { - - private final String name; - private final ExportClassLoader exportClassLoader; - - public OseeURLClassLoader(String name, URL[] urls, ClassLoader parent) { - super(urls, parent); - this.name = name; - GCHelper.getGCHelper().addRefWatch(this); - exportClassLoader = ExportClassLoader.getInstance(); - - } - - public OseeURLClassLoader(String name, URL[] urls) { - super(urls); - GCHelper.getGCHelper().addRefWatch(this); - this.name = name; - exportClassLoader = ExportClassLoader.getInstance(); - } - - public OseeURLClassLoader(String name, URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) { - super(urls, parent, factory); - GCHelper.getGCHelper().addRefWatch(this); - this.name = name; - exportClassLoader = ExportClassLoader.getInstance(); - } - - @Override - public Class<?> loadClass(String clazz) throws ClassNotFoundException{ - try { - return exportClassLoader.loadClass(clazz); - } catch (Exception ex2) { - int timesTriedToLoad = 0; - while(timesTriedToLoad < 10){ - try { - return super.loadClass(clazz); - } catch (ClassNotFoundException ex) { - System.out.println("Retrying to load from OseeURLClassLoader for class = "+ clazz); - timesTriedToLoad++; //Try to load again - try { - Thread.sleep(1); - } catch (InterruptedException ex1) { - OseeLog.log(OseeURLClassLoader.class, Level.SEVERE, ex1.toString(), ex1); - } - } - } - throw new ClassNotFoundException("Class = " + clazz); - } - } - - @Override - public String toString() { - return this.getClass().getName() + " [ " + name + " ] "; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OteBundleLocator.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OteBundleLocator.java deleted file mode 100644 index 2ab24ef5c4e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OteBundleLocator.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.io.IOException; -import java.util.Collection; -import org.eclipse.core.runtime.CoreException; - -/** - * @author Andrew M. Finkbeiner - */ -public interface OteBundleLocator { - - Collection<BundleInfo> getRuntimeLibs() throws IOException, CoreException; - - Collection<BundleInfo> consumeModifiedLibs() throws IOException, CoreException; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OteLevel.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OteLevel.java deleted file mode 100644 index d1737692010..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OteLevel.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.util.logging.Level; - -/** - * @author Andrew M. Finkbeiner - */ -public class OteLevel extends Level { - - private static final long serialVersionUID = -1545385440588581634L; - - public static final Level TEST_EVENT = new OteLevel("TEST_EVENT", SEVERE.intValue() + 50); - public static final Level TEST_SEVERE = new OteLevel("TEST_SEVERE", SEVERE.intValue() + 100); - public static final Level ENV_SEVERE = new OteLevel("ENV_SEVERE", SEVERE.intValue() + 200); - - protected OteLevel(String name, int value) { - super(name, value); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OteProperties.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OteProperties.java deleted file mode 100644 index 5ba9981b5db..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/OteProperties.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import org.eclipse.osee.framework.jdk.core.util.OseeProperties; - -/** - * @author Roberto E. Escobar - */ -public class OteProperties extends OseeProperties { - private static final OteProperties instance = new OteProperties(); - private static final String OSEE_BENCHMARK = "osee.ote.benchmark"; - private static final String OSEE_CMD_CONSOLE = "osee.ote.cmd.console"; - private static final String OSEE_OTE_SERVER_TITLE = "osee.ote.server.title"; - private static final String OSEE_OTE_BATCH = "osee.ote.batch"; - private static final String OSEE_OTE_LOG_FILE_PATH = "osee.ote.logfilepath"; - private static final String OSEE_PAUSE_ON_FAIL = "ote.pause.on.fail"; - private static final String OSEE_PRINT_FAIL_TO_CONSOLE = "ote.print.fail.to.console"; - - private OteProperties() { - super(); - } - - public static String getOseeOteServerTitle() { - return System.getProperty(OSEE_OTE_SERVER_TITLE, ""); - } - - public static boolean isOseeOteInBatchModeEnabled() { - return System.getProperty(OSEE_OTE_BATCH) != null; - } - - public static String getOseeOteLogFilePath() { - return System.getProperty(OSEE_OTE_LOG_FILE_PATH); - } - - public static boolean isBenchmarkingEnabled() { - return System.getProperty(OSEE_BENCHMARK) != null ? true : false; - } - - public static boolean isOteCmdConsoleEnabled() { - return System.getProperty(OSEE_CMD_CONSOLE) != null ? true : false; - } - - public static boolean isPauseOnFailEnabled(){ - return System.getProperty(OSEE_PAUSE_ON_FAIL) != null ? true : false; - } - - public static boolean isPrintFailToConsoleEnabled(){ - return System.getProperty(OSEE_PRINT_FAIL_TO_CONSOLE) != null ? true : false; - } - /** - * A string representation of all the property setting specified by this class - * - * @return settings for all properties specified by this class - */ - public static String getAllSettings() { - return instance.toString(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ReturnFormatter.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ReturnFormatter.java deleted file mode 100644 index 3022ba1b8d9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ReturnFormatter.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Charles Shaw - * @author Robert A. Fisher - */ -public class ReturnFormatter implements Xmlizable, XmlizableStream { - - private String returnValue; - - public void set(float value) { - returnValue = Double.toString(value); - } - - public void add(double value) { - returnValue = Double.toString(value); - } - - public void add(byte value) { - returnValue = Double.toString(value); - } - - public void add(short value) { - returnValue = Double.toString(value); - } - - public void add(int value) { - returnValue = Integer.toString(value); - } - - public void add(long value) { - returnValue = Double.toString(value); - } - - public void add(char value) { - returnValue = Integer.toString(value); - } - - public void add(boolean value) { - returnValue = Boolean.toString(value); - } - - public void add(Object value) { - returnValue = value == null ? "null" : value.toString(); - } - - @Override - public String toString() { - return returnValue; - } - - @Override - public Element toXml(Document doc) { - return Jaxp.createElement(doc, "ReturnValue", returnValue); - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - if (returnValue != null) { - XMLStreamWriterUtil.writeElement(writer, "ReturnValue", XmlSupport.format(returnValue)); - } - } - - public String getValue() { - return returnValue; - } - - @JsonProperty - public String getReturnValue() { - return returnValue; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ReturnStatus.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ReturnStatus.java deleted file mode 100644 index 164db851063..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ReturnStatus.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.io.Serializable; - -/** - * @author Andrew M. Finkbeiner - */ -public class ReturnStatus implements Serializable { - - private static final long serialVersionUID = -7774073812320127561L; - - private final boolean status; - private final String message; - - public ReturnStatus(String message, boolean status) { - this.status = status; - this.message = message; - } - - public boolean getStatus() { - return status; - } - - public String getMessage() { - return message; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServerApplication.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServerApplication.java deleted file mode 100644 index 3b1f5db576c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServerApplication.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.eclipse.osee.ote.core; - -import org.eclipse.equinox.app.IApplication; -import org.eclipse.equinox.app.IApplicationContext; - -public class ServerApplication implements IApplication { - - @Override - public Object start(IApplicationContext context) throws Exception { - while(true){ - synchronized (this) { - this.wait(); - } - } - } - - @Override - public void stop() { - // TODO Auto-generated method stub - - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServiceUtility.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServiceUtility.java deleted file mode 100644 index 5251df8853e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/ServiceUtility.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; -/** - * @author Michael P. Masterson - */ -public class ServiceUtility { - public static Class<ServiceUtility> getClazz(){ - return ServiceUtility.class; - } - - public static <T> T getService(Class<T> clazz){ - return getService(clazz, true); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public static <T> T[] getServices(Class<T> clazz) throws InvalidSyntaxException{ - ServiceReference[] serviceReferences = getContext().getServiceReferences(clazz.getName(), null); - T[] data = (T[])new Object[serviceReferences.length]; - for(int i = 0; i < serviceReferences.length; i ++){ - data[i] = (T)getContext().getService(serviceReferences[i]); - } - return data; - } - - public static BundleContext getContext(){ - Bundle bundle = FrameworkUtil.getBundle(getClazz()); - if(bundle == null){ - return null; - } - return bundle.getBundleContext(); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public static Object getService(String clazz) { - BundleContext context = getContext(); - if(context == null){ - OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz); - return null; - } - ServiceReference serviceReference = context.getServiceReference(clazz); - if(serviceReference == null){ - OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz); - return null; - } - Object obj = getContext().getService(serviceReference); - if(obj == null){ - OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz); - } - return obj; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - public static <T> T getService(Class<T> clazz, boolean logit) { - BundleContext context = getContext(); - if(context == null){ - if(logit){ - OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz.getName()); - } - return null; - } - ServiceReference serviceReference = context.getServiceReference(clazz.getName()); - if(serviceReference == null){ - if(logit){ - OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz.getName()); - } - return null; - } - T obj = (T)getContext().getService(serviceReference); - if(obj == null && logit){ - OseeLog.log(ServiceUtility.class, Level.SEVERE, "Unable to get service " + clazz.getName()); - } - return obj; - } - - public static <T> T getService(Class<T> clazz, int waitTimeMs) { - int count = 1; - if(waitTimeMs > 50){ - count = waitTimeMs/50; - } - - T obj = getService(clazz, false); - if(obj == null){ - for(int i = 0; i < count && obj == null; i++){ - try{ - Thread.sleep(50); - } catch (InterruptedException ex){ - } - obj = getService(clazz, false); - } - } - return obj; - } -} - diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/StandardShell.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/StandardShell.java deleted file mode 100644 index 62d51aa92ce..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/StandardShell.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.io.InterruptedIOException; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.console.ConsoleCommand; -import org.eclipse.osee.ote.core.environment.console.ConsoleShell; -import org.eclipse.osee.ote.core.environment.console.ICommandManager; - -/** - * @author Ken J. Aguilar - */ -public class StandardShell extends ConsoleShell { - - private final Thread thread; - private volatile boolean run = true; - - public StandardShell(ICommandManager manager) { - super(manager); - thread = new Thread(new Runnable() { - @Override - public void run() { - InputStreamReader stdin = new InputStreamReader(System.in); - BufferedReader consoleIn = new BufferedReader(stdin); - while (run) { - try { - final String line = consoleIn.readLine(); - if (line == null) { - OseeLog.log(StandardShell.class, Level.INFO, "INput stream closed, standard shell closing..."); - run = false; - break; - } - if (line.equals("")) { - continue; - } - parseAndExecuteCmd(line); - - } catch (InterruptedIOException ioe) { - if (run) { - println("Command console interrupted abnormally"); - } - } catch (Throwable t) { - printStackTrace(t); - } - } - } - }, "LBA Test Server Console"); - { - - } - ; - } - - @Override - public void println(String string) { - System.out.println(string); - } - - @Override - public void print(String string) { - System.out.print(string); - } - - @Override - public void println() { - System.out.println(); - } - - public void onCommandComplete(ConsoleCommand cmd) { - System.out.flush(); - } - - public void start() { - thread.start(); - OseeLog.log(StandardShell.class, Level.INFO, "The Standard Command Console has been started"); - } - - public void shutdown() { - run = false; - thread.interrupt(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestCase.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestCase.java deleted file mode 100644 index fef03f98621..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestCase.java +++ /dev/null @@ -1,461 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.enums.PromptResponseType; -import org.eclipse.osee.ote.core.environment.EnvironmentTask; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.IExecutionUnitManagement; -import org.eclipse.osee.ote.core.environment.interfaces.IScriptControl; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.environment.interfaces.ITestLogger; -import org.eclipse.osee.ote.core.environment.interfaces.ITestStation; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.core.environment.interfaces.ITimerControl; -import org.eclipse.osee.ote.core.log.record.RequirementRecord; -import org.eclipse.osee.ote.core.log.record.TestCaseRecord; -import org.eclipse.osee.ote.core.log.record.TestDescriptionRecord; -import org.eclipse.osee.ote.core.log.record.TestRecord; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * TestCase is the abstract base class for all test cases. This class provides the interfaces necessary for a TestCase - * to be part of a {@link org.eclipse.osee.ote.core.TestScript TestScript}. - * <p> - * The TestCase class contains the following information: - * <ul> - * <li><b>Standalone</b> - This is used to determine if a TestCase can be used in a selective run list. - * <ul> - * <li><b>true</b> - The TestCase runs as expected regardless of order. - * <li><b>false</b> - The TestCase must be run in a given order with other test cases to work as expected. - * </ul> - * <li><b>Test Case Number</b> - A serial number automatically assigned at the time of construction. - * <li><b>Tracability</b> - The requirements that are tested by this TestCase. - * </ul> - * <p> - * When building a new TestCase object it is important to remember that the object contains information describing the - * test case in addition to the run time code. It is also important to understand that the when writing classes which - * within a TestScript that the object must be instantiated (typically done in the constructor) with a reference to the - * TestScript it is within or else it will not be executed. - * <p> - * The following sample should be followed closely when building TestCase objects. <br> - * <br> - * <code> - * public class OipCase extends TestCase { - * <ul style="list-style: none"> - * <li> public OipCase(TestScript parent) { - * <ul style="list-style: none"> - * <li> </code><i>Use <b>one</b> of the following constructors based on if this TestCase is standalone</i><code> - * <li> super(parent);</code> <i>Standalone defaulted to <b>false</b></i><code> - * <li> super(parent, true);</code><i>Standalone explicitly set to <b>true</b></i><code> - * <li> - * <li> </code><i>All requirements tested in the test case should be noted here with the </i> - * <code>{@link org.eclipse.osee.ote.core.TestCase#addTracability(String) addTracability}</code><i> method.</i> <code> - * </ul> - * <li> } - * <li> - * <li> </code><i><b>Note:</b>It is very important that </i><code>doTestCase</code><i> always has the </i> - * <code>throws InterrupedException</code><i> in the method declaration. The ability to abort a script relies on this - * statement, and without it many calls would have to be wrapped with a try/catch block.</i><code> - * <li> public void doTestCase(ITestEnvironmentAccessor environment, ITestLogger logger) throws InterruptedException { - * <ul style="list-style: none"> - * <li> </code><i>Place all of the runtime code for the test case here.</i><code> - * </ul> - * <li> } - * </ul> - * } - * </code> - * - * @see org.eclipse.osee.ote.core.TestScript - * @author Ryan D. Brooks - * @author Robert A. Fisher - */ -public abstract class TestCase implements ITestEnvironmentAccessor, Xmlizable, XmlizableStream { - protected ITestLogger logger; - private final ITestEnvironmentAccessor environment; - private final boolean standAlone; - private final WeakReference<TestScript> testScript; - private final TestDescriptionRecord testDescription; - @JsonProperty - public int number; - protected List<RequirementRecord> traceability = new ArrayList<>(); - - /** - * TestCase Constructor. - */ - public TestCase(TestScript testScript) { - this(testScript, false); - } - - /** - * TestCase Constructor. - */ - public TestCase(TestScript testScript, boolean standAlone) { - this(testScript, standAlone, true); - } - - /** - * TestCase Constructor. - */ - protected TestCase(TestScript testScript, boolean standAlone, boolean addToRunList) { - super(); - this.testDescription = new TestDescriptionRecord(testScript.getTestEnvironment()); - this.standAlone = standAlone; - if (addToRunList) { - this.number = testScript.addTestCase(this); - } - this.testScript = new WeakReference<>(testScript); - this.environment = testScript.getTestEnvironment(); - GCHelper.getGCHelper().addRefWatch(this); - } - - public TestCase(ITestEnvironmentAccessor accessor) { - this.testDescription = new TestDescriptionRecord(accessor); - - // TODO we have two different traceability tags here.... we need to combine these or get rid - // of them all together since define and the artifact framework specifies traceability - // this.tracability = new ArrayList(); - this.traceability = new ArrayList<>(); - - this.standAlone = false; - ; - this.number = 1; - this.testScript = null; - this.environment = accessor; - - } - - /** - * Called by baseDoTestCase(). This is implemented by the tester's in each test case in the test script. - * - * @param environment The Test environment. - */ - public abstract void doTestCase(ITestEnvironmentAccessor environment, ITestLogger logger) throws InterruptedException; - - public Element getTastCaseNumberXml(Document doc) { - return Jaxp.createElement(doc, "Number", String.valueOf(number)); - } - - public void writeTestCaseNumber(XMLStreamWriter writer) throws XMLStreamException { - XMLStreamWriterUtil.writeElement(writer, "Number", String.valueOf(number)); - } - - public void writeTestCaseClassName(XMLStreamWriter writer) throws XMLStreamException { - String name = this.getClass().getName(); - if (name == null || name.length() == 0) { - name = ""; - } - XMLStreamWriterUtil.writeElement(writer, "Name", name); - } - - @JsonProperty - public String getName() { - return this.getClass().getName(); - } - - public void writeTracability(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("Tracability"); - for (RequirementRecord record : traceability) { - record.toXml(writer); - } - writer.writeEndElement(); - } - - public Element getTestCaseClassName(Document doc) { - String name = this.getClass().getName(); - if (name == null || name.length() == 0) { - name = ""; - } - return Jaxp.createElement(doc, "Name", name); - } - - public String getTestCaseClassName() { - return this.getClass().getName(); - } - - public TestCase getTestCase() { - return this; - } - - /** - * @return Returns the testCaseNumber. - */ - public int getTestCaseNumber() { - return number; - } - - public ITestEnvironmentAccessor getTestEnvironment() { - return environment; - } - - public TestRecord getTestRecord() { - return new TestCaseRecord(getTestEnvironment(), this); - } - - /** - * @return Returns the testScript. - */ - @Override - public TestScript getTestScript() { - return testScript.get(); - } - - public Element getTracabilityXml(Document doc) { - Element traceElement = doc.createElement("Tracability"); - for (RequirementRecord record : traceability) { - traceElement.appendChild(record.toXml(doc)); - - } - return traceElement; - } - - /** - * @return Returns the standAlone. - */ - public boolean isStandAlone() { - return standAlone; - } - - public void prompt() throws InterruptedException { - getTestScript().prompt(); - } - - public void prompt(String message) throws InterruptedException { - getTestScript().prompt(new TestPrompt(message, PromptResponseType.NONE)); - } - - public void promptPassFail(String message) throws InterruptedException { - getTestScript().getLogger().methodCalled(getTestScript().getTestEnvironment(), new MethodFormatter().add(message)); - - getTestScript().promptPassFail(message); - - getTestScript().getLogger().methodEnded(getTestScript().getTestEnvironment()); - } - - public void promptPause(String message) throws InterruptedException { - getTestScript().promptPause(message); - } - - public void promptStep(String message) throws InterruptedException { - getTestScript().prompt(new TestPrompt(message, PromptResponseType.SCRIPT_STEP)); - } - - public String promptInput(String message) throws InterruptedException { - return getTestScript().prompt(new TestPrompt(message, PromptResponseType.USER_INPUT)); - } - - /** - * Logs the results of a test point. - * - * @param passed boolean T/F - * @param expected The expected information - * @param actual The actual information - */ - public void testpoint(boolean passed, String testPointName, String expected, String actual) { - logger.testpoint(this.getTestEnvironment(), this.getTestScript(), this, passed, testPointName, expected, actual); - } - - @Override - public String toString() { - String description = getTestScript().getClass().getName() + "Test Case " + number + ":"; - if (traceability != null) { - for (RequirementRecord record : traceability) { - description += "\n\t" + record; - } - } - return description; - } - - @Override - public Element toXml(Document doc) { - Element testCaseElement = doc.createElement("TestCase"); - testCaseElement.appendChild(getTastCaseNumberXml(doc)); - testCaseElement.appendChild(getTestCaseClassName(doc)); - testCaseElement.appendChild(getTracabilityXml(doc)); - return testCaseElement; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("TestCase"); - writeTestCaseNumber(writer); - writeTestCaseClassName(writer); - writeTracability(writer); - } - - /** - * Starts running the test case. Calls doTestCase(), which is implemented by the tester in each test case. - * - * @param environment The Test Enviornment. - */ - public void baseDoTestCase(ITestEnvironmentAccessor environment) throws InterruptedException { - this.logger = environment.getLogger(); - - logger.testCaseBegan(this); // This is required for valid outfile. - //This creates the test case outfile logging. - - environment.getTestScript().setTestCase(this); - OseeLog.logf(TestEnvironment.class, OteLevel.TEST_EVENT, "Starting Test Case %s.%s", - this.getTestScript().getClass().getSimpleName(), this.getClass().getSimpleName()); - doTestCase(environment, environment.getLogger()); - } - - @Override - public void abortTestScript() { - environment.abortTestScript(); - } - - @Override - public boolean addTask(EnvironmentTask task) { - return environment.addTask(task); - } - - @Override - public void associateObject(Class<?> c, Object obj) { - environment.associateObject(c, obj); - } - - @Override - public Object getAssociatedObject(Class<?> c) { - return environment.getAssociatedObject(c); - } - - @Override - public Set<Class<?>> getAssociatedObjects() { - return environment.getAssociatedObjects(); - } - - /* - * public ITestEnvironmentCommandCallback getClientCallback() { return environment.getClientCallback(); } - */ - - // public EnvironmentType getEnvironmentType() { - // return environment.getEnvironmentType(); - // } - @Override - public long getEnvTime() { - return environment.getEnvTime(); - } - - @Override - public IExecutionUnitManagement getExecutionUnitManagement() { - return environment.getExecutionUnitManagement(); - } - - @Override - public ITestLogger getLogger() { - return environment.getLogger(); - } - - @Override - public IScriptControl getScriptCtrl() { - return environment.getScriptCtrl(); - } - - /* - * public StatusBoard getStatusBoard() { return environment.getStatusBoard(); } - */ - - @Override - public ITestStation getTestStation() { - return environment.getTestStation(); - } - - @Override - public ITimerControl getTimerCtrl() { - return environment.getTimerCtrl(); - } - - @Override - public void onScriptComplete() throws InterruptedException { - environment.onScriptComplete(); - } - - @Override - public void onScriptSetup() { - environment.onScriptSetup(); - } - - @Override - public ICancelTimer setTimerFor(ITimeout listener, int time) { - return environment.setTimerFor(listener, time); - } - - public void logTestPoint(boolean isPassed, String testPointName, String expected, String actual) { - this.getLogger().testpoint(this.getTestEnvironment(), this.getTestScript(), this, isPassed, testPointName, - expected, actual); - } - - public void setPurpose(String purpose) { - testDescription.setPurpose(purpose); - } - - public void setPreCondition(String preCondition) { - testDescription.setPreCondition(preCondition); - } - - public void setPostCondition(String postCondition) { - testDescription.setPostCondition(postCondition); - } - - public List<RequirementRecord> getScriptReqRecordTraceability() { - return traceability; - } - - public void addTraceability(String description) { - this.traceability.add(new RequirementRecord(this.getTestEnvironment(), description)); - } - - public void writeToConsole(String message) { - TestPrompt p = new TestPrompt(message); - - try { - testScript.get().prompt(p); - } catch (Throwable e) { - OseeLog.log(TestEnvironment.class, Level.INFO, e.getMessage(), e); - } - } - - public void setTestScript(TestScript script) { - throw new IllegalStateException("Why are you calling this one?!?!?!?"); - } - - @Override - public void abortTestScript(Throwable t) { - testScript.get().abortDueToThrowable(t); - } - - @JsonProperty - public List<RequirementRecord> getTraceability() { - if (traceability.isEmpty()) { - return null; - } else { - return traceability; - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestException.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestException.java deleted file mode 100644 index bd54922cdd8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestException.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.IHealthStatus; - -public class TestException extends RuntimeException { - - private static final long serialVersionUID = -5628986844200418864L; - - private final String threadCauseName; - private final Level level; - private List<IHealthStatus> status = new ArrayList<>(); - - public TestException(String message, Level level) { - this(message, level, null); - } - - public TestException(String message, Level level, Throwable cause) { - super(message, cause); - this.level = level; - threadCauseName = Thread.currentThread().getName(); - } - - public TestException(String message, List<IHealthStatus> status) { - this(message, Level.SEVERE); - this.status = status; - } - - public String getThreadName() { - return threadCauseName; - } - - public Level getLevel() { - return level; - } - - public List<IHealthStatus> getHealthStatus() { - return status; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestPointTally.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestPointTally.java deleted file mode 100644 index 59c3cef795b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestPointTally.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard; -import org.eclipse.osee.ote.core.log.ITestPointTally; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestPointTally implements ITestPointTally { - private int testPointSuccesses; - private int testPointFailures; - private final String testName; - private final OTEStatusBoard statusBoard; - - public TestPointTally(String testName) { - this.testName = testName; - statusBoard = ServiceUtility.getService(OTEStatusBoard.class);//tracker.getService(); - } - - @Override - public void reset() { - this.testPointSuccesses = 0; - this.testPointFailures = 0; - sendUpdate(); - } - - @Override - public int tallyTestPoint(boolean pass) { - if (pass) { - testPointSuccesses++; - } else { - testPointFailures++; - } - sendUpdate(); - return getTestPointTotal(); - } - - private void sendUpdate() { - statusBoard.onTestPointUpdate(testPointSuccesses, testPointFailures, testName); - } - - @Override - public int getTestPointTotal() { - return testPointSuccesses + testPointFailures; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestPrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestPrompt.java deleted file mode 100644 index f9f409973c6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestPrompt.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.io.Serializable; - -import org.eclipse.osee.ote.core.enums.PromptResponseType; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class TestPrompt implements Serializable { - - private static final long serialVersionUID = 5960067878239875110L; - private final String prompt; - private final boolean waitForResponse; - private final boolean ofpStep; - private final PromptResponseType type; - - public TestPrompt(String prompt) { - this(prompt, PromptResponseType.NONE); - } - - public TestPrompt(String prompt, PromptResponseType type) { - super(); - this.prompt = XmlSupport.convertNonPrintableCharacers(prompt); - this.waitForResponse = - type == PromptResponseType.SCRIPT_PAUSE || type == PromptResponseType.PASS_FAIL || type == PromptResponseType.SCRIPT_STEP || type == PromptResponseType.USER_INPUT ? true : false; - this.ofpStep = type == PromptResponseType.SCRIPT_STEP ? true : false; - this.type = type; - } - - public PromptResponseType getType() { - return type; - } - - public boolean isWaiting() { - return this.waitForResponse; - } - - @Override - public String toString() { - return this.prompt; - } - - /** - * @return Returns the ofpStep. - */ - public boolean isOfpStep() { - return ofpStep; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestPromptImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestPromptImpl.java deleted file mode 100644 index cdad9b74531..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestPromptImpl.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.eclipse.osee.ote.core; - -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; - -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.enums.PromptResponseType; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.prompt.InformationalPrompt; -import org.eclipse.osee.ote.core.framework.prompt.PassFailPromptImpl; -import org.eclipse.osee.ote.core.framework.prompt.PassFailPromptResult; -import org.eclipse.osee.ote.core.framework.prompt.ScriptPausePromptImpl; -import org.eclipse.osee.ote.core.framework.prompt.UserInputPromptImpl; -import org.eclipse.osee.ote.core.framework.prompt.YesNoPromptImpl; -import org.eclipse.osee.ote.core.framework.prompt.YesNoPromptResult; -import org.eclipse.osee.ote.core.log.record.AttentionRecord; -import org.eclipse.osee.ote.core.log.record.TestPointRecord; -import org.eclipse.osee.ote.core.log.record.TestRecord; -import org.eclipse.osee.ote.core.testPoint.CheckPoint; - -class TestPromptImpl { - - private final Executor promptInitWorker; - - public TestPromptImpl() { - promptInitWorker = Executors.newSingleThreadExecutor(); - } - - - public String prompt(final TestPrompt prompt, final TestEnvironment environment, final TestScript test) throws InterruptedException { - - if (environment.isInBatchMode()) { - promptInitWorker.execute(new Runnable() { - @Override - public void run() { - try { - test.getUserSession().initiateInformationalPrompt(prompt.toString()); - } catch (Exception e) { - System.out.println(prompt.toString()); - } - } - }); - if (prompt.getType() == PromptResponseType.PASS_FAIL) { - test.getLogger().log( - new TestPointRecord(environment, new CheckPoint(prompt.toString(), "PROMPT DURING BATCH", "N/A", false), - true)); - } else { - test.getLogger().log(new AttentionRecord(environment, prompt.getType().name() + " : " + prompt.toString(), true)); - } - return ""; - } else if (!environment.getRunManager().isCurrentThreadScript()){ - promptInitWorker.execute(new Runnable() { - @Override - public void run() { - try { - test.getUserSession().initiateInformationalPrompt(prompt.toString()); - } catch (Exception e) { - System.out.println(prompt.toString()); - } - } - }); - if (prompt.getType() != PromptResponseType.NONE) { - test.getLogger().log(new AttentionRecord(environment, String.format("ERROR: Blocking prompt type[%s] in non script thread[%s] message[%s]", prompt.getType().name(), Thread.currentThread().getName(), prompt.toString()), true)); - } else { - test.getLogger().log(new AttentionRecord(environment, prompt.getType().name() + " : " + prompt.toString(), true)); - } - return ""; - } else { - try { - final String returnValue; - String logOutput; - final TestRecord testRecord; - final IServiceConnector connector = environment.getConnector(); - synchronized (test){ - switch (prompt.getType()) { - case NONE: - InformationalPrompt infoPrompt = new InformationalPrompt(connector, "", prompt.toString()); - infoPrompt.open(test.getUserSession(), promptInitWorker); - infoPrompt.close(); - returnValue = ""; - testRecord = new AttentionRecord(environment, String.format("PROMPT [%s]\n{\n%s\n}\n", PromptResponseType.NONE.name(), prompt.toString()), true); - break; - case PASS_FAIL: - PassFailPromptImpl passFailPrompt = new PassFailPromptImpl(connector, test, "", prompt.toString()); - PassFailPromptResult result = passFailPrompt.open(promptInitWorker); - returnValue = result.getText(); - passFailPrompt.close(); - testRecord = - new TestPointRecord(environment, new CheckPoint("Pass/Fail Prompt", prompt.toString(), - returnValue, result.isPass()), true); - break; - case YES_NO: - YesNoPromptImpl yesNoPrompt = new YesNoPromptImpl(connector, test, "", prompt.toString()); - YesNoPromptResult yesNo = yesNoPrompt.open(promptInitWorker); - if (yesNo.isYes()) { - returnValue = "YES"; - } else { - returnValue = "NO"; - } - logOutput = - String.format("PROMPT [%s]\n{\n%s\n}\n\tRETURN VALUE : %s", PromptResponseType.YES_NO.name(), - prompt.toString(), returnValue); - yesNoPrompt.close(); - testRecord = new AttentionRecord(environment, logOutput, true); - break; - case SCRIPT_PAUSE: - ScriptPausePromptImpl scriptPausePrompt = - new ScriptPausePromptImpl(connector, test, "", prompt.toString()); - returnValue = scriptPausePrompt.open(promptInitWorker); - scriptPausePrompt.close(); - if (returnValue != null && returnValue.length() > 0) { - logOutput = - String.format("PROMPT [%s]\n{\n%s\n}\n\tRETURN VALUE : %s", PromptResponseType.SCRIPT_PAUSE.name(), - prompt.toString(), returnValue); - } else { - logOutput = - String.format("PROMPT [%s]\n{\n%s\n}\n", PromptResponseType.SCRIPT_PAUSE.name(), prompt.toString()); - } - - testRecord = new AttentionRecord(environment, logOutput, true); - ; - break; - case USER_INPUT: - UserInputPromptImpl userInputPrompt = new UserInputPromptImpl(connector, test, "", prompt.toString()); - returnValue = userInputPrompt.open(promptInitWorker); - userInputPrompt.close(); - if (returnValue != null && returnValue.length() > 0) { - logOutput = - String.format("PROMPT [%s]\n{\n%s\n}\n\tRETURN VALUE : %s", PromptResponseType.USER_INPUT.name(), - prompt.toString(), returnValue); - } else { - logOutput = - String.format("PROMPT [%s]\n{\n%s\n}\n", PromptResponseType.USER_INPUT.name(), prompt.toString()); - } - testRecord = new AttentionRecord(environment, logOutput, true); - break; - case SCRIPT_STEP: - returnValue = ""; - testRecord = - new AttentionRecord(environment, - PromptResponseType.SCRIPT_STEP.name() + " : " + prompt.toString(), true); - break; - case OFP_DEBUG_RESPONSE: - returnValue = ""; - testRecord = null; - break; - default: - returnValue = ""; - testRecord = null; - } - } - if (testRecord != null) { - testRecord.setStackTrace(new Throwable()); - test.getLogger().log(testRecord); - } - return returnValue; - } catch (InterruptedException e) { - throw new InterruptedException(); - } catch (Exception e) { - // what - } - return ""; - } - - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java deleted file mode 100644 index 0d92ceccda8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScript.java +++ /dev/null @@ -1,628 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.atomic.AtomicLong; -import java.util.logging.Level; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.framework.logging.ILoggerFilter; -import org.eclipse.osee.framework.logging.ILoggerListener; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.enums.PromptResponseType; -import org.eclipse.osee.ote.core.enums.ScriptTypeEnum; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; -import org.eclipse.osee.ote.core.environment.interfaces.IScriptCompleteListener; -import org.eclipse.osee.ote.core.environment.interfaces.IScriptInitializer; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.environment.interfaces.ITestLogger; -import org.eclipse.osee.ote.core.environment.interfaces.ITestStation; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.core.environment.status.CommandEndedStatusEnum; -import org.eclipse.osee.ote.core.framework.testrun.ITestRunListener; -import org.eclipse.osee.ote.core.framework.testrun.ITestRunListenerProvider; -import org.eclipse.osee.ote.core.log.ITestPointTally; -import org.eclipse.osee.ote.core.log.record.ScriptResultRecord; - -/** - * TestScript is the abstract base class for all test scripts. This class provides the interfaces necessary to allow a - * script to be run against remote testing environment servers. - * <p> - * The TestScript class contains the following information: - * <ul> - * <li><b>crew</b> - Defines if the script is for pilot or copilot. - * <li><b>isBatchable</b> - Defines whether or not the script is batchable. This typically indicates whether or not - * there are any prompts in the script. - * <li><b>isMpLevel</b> - Defines if the script tests at the Mission Processor level or if it tests at the node level. - * <li>Selective run list of TestCase's for test case skipping - * <li>ScriptInitializer object - * <li>TestCase objects that make up the runtime of the script - * </ul> - * <p> - * When building a new TestScript object it is important to understand that the object does not only contain the runtime - * code for performing the test, but also contains information about the test being performed that can be retrieved by - * instantiating the object with out necessarily running it. - * <p> - * The following sample should be followed closely when building TestScript objects. <br> - * <br> - * <hr> - * <br> - * <code> - * public class SampleScript extends TestCase { - * <ul style="list-style: none"> - * <li> </code><i>Place declarations for <b>LRU Models</b>,<b>Messages</b>, and <b>Support</b> classes here.</i><code> - * <li> - * <li> </code><i>This constructor is necessary for instantiating the TestScript object to get data!</i><code> - * <li> SampleScript () { - * <ul style="list-style: none"> - * <li> this (null,null); - * </ul> - * <li> } - * <li> - * <li> </code><i>This constructor is used at runtime.</i><code> - * <li> SampleScript (TestEnvironment environment, TestEnvironmentController connection) { - * <ul style="list-style: none"> - * <li> super (environment, connection, [batchability, true or false]); - * <li> - * <li> </code><i>Place construction for <b>LRU Models</b>,<b>Messages</b>, and <b>Support</b> classes here.</i><code> - * <li> - * <li> </code><i>Construct all test cases here. The base TestCase constructor will automatically add - * <li>itself to the run list of the TestScript.</i><code> - * <li> new OipCase(this); - * <li> </code><i>...</i><code> - * </ul> - * <li> } - * <li> - * <li> </code><i>This inner class defines the setup for the script and must be present.</i><code> - * <li> private class LocalSetupTestCase extends SetupTestCase { - * <ul style="list-style: none"> - * <li> - * <li> </code><i>Allows the setup to add itself to the runlist.</i><code> - * <li> protected LocalSetupTestCase(TestScript parent) { - * <ul style="list-style: none"> - * <li> super(parent); - * </ul> - * <li> } - * <li> - * <li> </code><i>Provides the runtime code for initialization.</i><code> - * <li> public void doTestCase(ITestEnvironmentAccessor environment, ITestLogger logger) { - * <ul style="list-style: none"> - * <li> </code><i>Place any necessary setup code here and it will be run prior to any of the test cases.</i><code> - * </ul> - * <li> } - * </ul> - * <li> } - * <li> <br> - * <li> </code><i>Place all of the test cases here. These will be inner classes that extend </i> - * {@link org.eclipse.osee.ote.core.TestCase TestCase}<i>. - * <li><b>NOTE:</b>All of these inner classes must be instantiated in the constructor for the TestScript object. If an - * inner class is not instantiated then it will <b>not</b> be run, and information within the class will not be - * available when the TestScript is instantiated for data retrieval.</i><code> - * <li> public class OipCase extends TestCase { - * <ul style="list-style: none"> - * <li> public OipCase(TestScript parent) { - * <ul style="list-style: none"> - * <li> </code><i>Use <b>one</b> of the following constructors based on if this TestCase is standalone</i><code> - * <li> super(parent);</code> <i>Standalone defaulted to <b>false</b></i><code> - * <li> super(parent, true);</code><i>Standalone explicitly set to <b>true</b></i><code> - * <li> - * <li> </code><i>All requirements tested in the test case should be noted here with the </i> - * <code>{@link org.eclipse.osee.ote.core.TestCase#addTracability(String) addTracability}</code><i> method.</i> <code> - * </ul> - * <li> } - * <li> - * <li> </code><i><b>Note:</b>It is very important that </i><code>doTestCase</code><i> always has the </i> - * <code>throws InterrupedException</code><i> in the method declaration. The ability to abort a script relies on this - * statement, and without it many calls would have to be wrapped with a try/catch block.</i><code> - * <li> public void doTestCase(ITestEnvironmentAccessor environment, ITestLogger logger) throws InterruptedException { - * <ul style="list-style: none"> - * <li> </code><i>Place all of the runtime code for the test case here.</i><code> - * </ul> - * <li> } - * </ul> - * <li> } - * </ul> - * } - * </code> <br> - * <hr> - * - * @author Ryan D. Brooks - * @author Robert A. Fisher - * @see org.eclipse.osee.ote.core.TestCase - */ -public abstract class TestScript implements ITimeout { - private static final Set<Class<? extends TestScript>> instances = - Collections.synchronizedSet(new HashSet<Class<? extends TestScript>>()); - private static final AtomicLong constructed = new AtomicLong(0); - private static final AtomicLong finalized = new AtomicLong(0); - private final boolean isBatchable; - private final ITestStation testStation; - private CommandDescription cmdDescription; - protected TestCase currentTestCase; - protected final TestEnvironment environment; - private final boolean isMpLevel; - private IScriptInitializer scriptInitializer; - private final ScriptTypeEnum scriptType; - private final ArrayList<TestCase> selectiveRunList = new ArrayList<>(32); - private Date startTime; - private final ArrayList<TestCase> testCases = new ArrayList<>(32); - private final ITestPointTally testPointTally; - protected CommandEndedStatusEnum status; - private Throwable rootCause; - private volatile boolean timedOut; - private volatile boolean aborted = false; - private final ArrayList<IScriptCompleteListener> scriptCompleteListeners = - new ArrayList<IScriptCompleteListener>(32); - - private final ScriptResultRecord scriptResultRecord; - private int pass; - private int fail; - private ScriptLoggingListener loggingListener; - private final TestPromptImpl promptImpl; - private ITestRunListenerProvider listenerProvider; - private boolean shouldPauseOnFail; - private boolean printFailToConsole; - - public TestScript(TestEnvironment environment, IUserSession callback, ScriptTypeEnum scriptType, boolean isBatchable) { - constructed.incrementAndGet(); - this.scriptType = scriptType; - this.isBatchable = isBatchable; - this.isMpLevel = false; - - promptImpl = new TestPromptImpl(); - scriptResultRecord = new ScriptResultRecord(this); - if (environment != null) { - this.environment = environment; - this.startTime = new Date(0); - testStation = this.environment.getTestStation(); - GCHelper.getGCHelper().addRefWatch(this); - instances.add(getClass()); - } else { - throw new TestException("No environment found: Can not run script ", Level.SEVERE); - } - this.testPointTally = new TestPointTally(this.getClass().getName()); - shouldPauseOnFail = OteProperties.isPauseOnFailEnabled(); - printFailToConsole = OteProperties.isPrintFailToConsoleEnabled(); - } - - public void abort() { - OseeLog.log(TestEnvironment.class, Level.SEVERE, "Aborting script", new Exception()); - aborted = true; - } - - public void abortDueToThrowable(Throwable cause) { - this.rootCause = cause; - abort(); - } - - /** - * Removes all of the test cases from the selective run list. The list will be empty after this call returns. - */ - public void clearRunList() { - selectiveRunList.clear(); - } - - public void endTest() { - // provided as a hook for scripts to override - } - - /** - * @return Returns the startTime. - */ - public Date getStartTime() { - return startTime; - } - - public TestCase getTestCase() { - return currentTestCase; - } - - /** - * Get list of test cases. - * - * @return reference to arrayList testCases. - */ - public/* TestCase */List<TestCase> getTestCases() { - ArrayList<TestCase> testCaseList = new ArrayList<>(); - testCaseList.add(getSetupTestCase()); - testCaseList.addAll(testCases); - testCaseList.add(getTearDownTestCase()); - return testCaseList; - } - - public ITestEnvironmentAccessor getTestEnvironment() { - return environment; - } - - public IUserSession getUserSession() { - return ServiceUtility.getService(OTESessionManager.class).getActiveUser(); - } - - public TestScript getTestScript() { - return this; - } - - public ITestLogger getLogger() { - return environment.getLogger(); - } - - public ScriptTypeEnum getType() { - return this.scriptType; - } - - public final boolean isBatchable() { - return isBatchable; - } - - public final boolean isMpLevel() { - return isMpLevel; - } - - public String prompt(final TestPrompt prompt) throws InterruptedException { - return promptImpl.prompt(prompt, environment, this); - } - - /** - * This method will display a null prompt to the console. - */ - public void prompt() throws InterruptedException { - getTestScript().prompt(new TestPrompt(null, PromptResponseType.NONE)); - } - - /** - * This method will display the message input to the console. - */ - public void prompt(String message) throws InterruptedException { - getTestScript().prompt(new TestPrompt(message, PromptResponseType.NONE)); - } - - /** - * This method will display the message input to the console. It will also prompt the user with a dialog box to input - * whether the condition passed or failed. - */ - public void promptPassFail(String message) throws InterruptedException { - getTestScript().prompt(new TestPrompt(message, PromptResponseType.PASS_FAIL)); - } - - /** - * This method will display the message input to the console. It also pauses the script running, and will prompt the - * user with a dialog box to continue on with the running of the script. - */ - public void promptPause(String message) throws InterruptedException { - prompt(new TestPrompt(message, PromptResponseType.SCRIPT_PAUSE)); - } - - public void pauseScriptOnFail(int testPoint) throws InterruptedException{ - if (shouldPauseOnFail){ - promptPause("Test point " + testPoint + " failed.\n"); - } - } - - public void pauseScriptOnFail(int testPoint, String name, String expected, String actual, String stackTrace) throws InterruptedException{ - if (shouldPauseOnFail){ - promptPause("TP " + testPoint + ": " + name + "\nExpected: " + expected + "\nActual: " + actual + "\n\n" + stackTrace ); - } - } - - public void printFailure(int testPoint) throws InterruptedException{ - if (printFailToConsole){ - prompt("Test point " + testPoint + " failed.\n"); - } - } - public void printFailure(int testPoint, String name, String expected, String actual, String stackTrace) throws InterruptedException{ - if (printFailToConsole){ - prompt("TP " + testPoint + ": " + name + "\nExpected: " + expected + "\nActual: " + actual + "\n\n" + stackTrace ); - } - } - - /** - * Do not use this method from tests instead use {@link #logTestPoint(boolean, String, String, String)}. Takes result of test point and updates the total test point tally. - * - * @return total number of test points completed as an int. - */ - public int __recordTestPoint(boolean passed) { - return testPointTally.tallyTestPoint(passed); - } - - public int getCurrentPointNumber() { - return testPointTally.getTestPointTotal(); - } - - public void addScriptSummary(XmlizableStream xml) { - scriptResultRecord.addChildElement((XmlizableStream) xml); - } - - /** - * Add a single test case to selective run list. - */ - public void selectTestCase(int testCaseNumber) { - TestCase testCase = testCases.get(testCaseNumber - 1); - if (!testCase.isStandAlone()) { - throw new IllegalArgumentException("Test case " + testCaseNumber + " is not stand alone."); - } - selectiveRunList.add(testCase); - } - - /** - * Add multiple test cases to the selective run list. - */ - public void selectTestCases(int testCaseNumberStart, int testCaseNumberEnd) { - for (int i = testCaseNumberStart; i <= testCaseNumberEnd; i++) { - selectTestCase(i); - } - } - - /** - * Sets the script initializer. - */ - public void setScriptInitializer(IScriptInitializer scriptInitializer) { - - this.scriptInitializer = scriptInitializer; - - } - - public IScriptInitializer getScriptInitializer() { - return scriptInitializer; - } - - /** - * Causes current thread to wait until another thread invokes the {@link java.lang.Object#notify()}method or the - * {@link java.lang.Object#notifyAll()}method for this object. - */ - public synchronized void testWait(int milliseconds) throws InterruptedException { - if (milliseconds < 2) { - return; - } - environment.getLogger().methodCalled(this.environment, new MethodFormatter().add(milliseconds)); - environment.setTimerFor(this, milliseconds); - wait(); - this.getTestEnvironment().getScriptCtrl().lock(); - environment.getLogger().methodEnded(this.environment); - } - - public synchronized void testWaitNoLog(int milliseconds) throws InterruptedException { - if (milliseconds < 2) { - return; - } - environment.setTimerFor(this, milliseconds); - wait(); - this.getTestEnvironment().getScriptCtrl().lock(); - } - - /** - * Prints text to the console informing the user of how much time is left in the wait. Any wait time can be passed - * in, but this is intended for long waits; usually > 20 seconds. Will not print any info is the time is less than - * 1000 ms. - * - * @param ms Milliseconds to wait for. - */ - public synchronized void testWaitWithInfo(int ms) throws InterruptedException { - int mult = 0; - if (ms > 999) { - prompt(new TestPrompt("\tWaiting for " + ms / 1000.0 + " seconds.")); - while (ms >= 30000) { - mult++; - ms -= 20000; - testWait(20000); - prompt(new TestPrompt("\t" + 20 * mult + " seconds elapsed.")); - } - - prompt(new TestPrompt("\tFinishing up; " + ms / 1000.0 + " more seconds.")); - } - testWait(ms); - prompt(new TestPrompt("\ttestWait done.")); - } - - // public String toString() { - - // String description = "Test Script:\n"; - - // for (Iterator iter = testCases.iterator(); iter.hasNext();) { - // TestCase testCase = (TestCase) iter.next(); - // description += "\t" + testCase + "\n"; - // } - - // return description; - // } - - /** - * Add test case to the test scripts list of test cases. - * - * @return the number of test cases in the arrayList testCases as an int. - */ - protected int addTestCase(TestCase testCase) { - testCases.add(testCase); - return testCases.size(); - } - - @Deprecated - public CommandDescription getCommandDescription() { - return this.cmdDescription; - } - - protected TestCase getSetupTestCase() { - return null; - } - - protected TestCase getTearDownTestCase() { - return null; - } - - /** - * Log a test point to the test. - * - * @param isPassed - * @param testPointName - * @param expected - * @param actual - */ - public void logTestPoint(boolean isPassed, String testPointName, String expected, String actual) { - this.getLogger().testpoint(this.getTestEnvironment(), this, this.getTestCase(), isPassed, testPointName, - expected, actual); - } - - @Override - public boolean isTimedOut() { - return this.timedOut; - } - - @Override - public void setTimeout(boolean timeout) { - this.timedOut = timeout; - } - - /** - * Use addTestRunListener(ITestRunListener listener) instead. - * - * @see #addTestRunListener(ITestRunListener listener) - */ - @Deprecated - public void addScriptCompleteListener(IScriptCompleteListener listener) { - scriptCompleteListeners.add(listener); - } - - public ITestStation getTestStation() { - return testStation; - } - - protected void dispose() { - OseeLog.log(TestScript.class, Level.FINEST, "calling dispose on the TestScript.class"); - } - - /** - * Do not use this method from tests instead use {@link #logTestPoint(boolean, String, String, String)}. - * - */ - public void __addTestPoint(boolean pass) { - if (pass) { - this.pass++; - } else { - this.fail++; - } - } - - private class ScriptLoggingListener implements ILoggerListener { - - ILoggerFilter filter = new TestScriptLogFilter(); - - public ILoggerFilter getFilter() { - return filter; - } - - @Override - public void log(String loggerName, Level level, String message, Throwable th) { - if (environment.getLogger() != null) { - environment.getLogger().log(level, message, th); - } - } - - } - - @Override - protected void finalize() throws Throwable { - instances.remove(getClass()); - finalized.incrementAndGet(); - super.finalize(); - } - - public static long getConstructed() { - return constructed.get(); - } - - public static long getFinalized() { - return finalized.get(); - } - - public static Collection<Class<? extends TestScript>> getInstances() { - return new HashSet<Class<? extends TestScript>>(instances); - } - - public void disposeTest() { - dispose(); - } - - public boolean isAborted() { - return aborted; - } - - @Deprecated - public void processScriptcompleteListeners() { - for (IScriptCompleteListener listener : scriptCompleteListeners) { - try { - listener.onScriptComplete(); - } catch (Throwable t) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, - "exception while notifying script complete listener " + listener.getClass().getName(), t); - } - } - } - - public void setListenerProvider(ITestRunListenerProvider listenerProvider) { - this.listenerProvider = listenerProvider; - } - - public boolean addTestRunListener(ITestRunListener listener) { - if (listenerProvider == null) { - String message = - String.format("Could not add run listener %s since listener provider is null.", - listener.getClass().getName()); - OseeLog.log(getClass(), Level.WARNING, message, new Exception()); - return false; - } - return this.listenerProvider.addTestRunListener(listener); - } - - public boolean removeTestRunListener(ITestRunListener listener) { - if (listenerProvider == null) { - String message = - String.format("Could not remove run listener %s since listener provider is null.", - listener.getClass().getName()); - OseeLog.log(getClass(), Level.WARNING, message, new Exception()); - return false; - } - return this.listenerProvider.removeTestRunListener(listener); - } - - public int getPasses() { - return pass; - } - - public int getFails() { - return fail; - } - - @JsonProperty - public ScriptResultRecord getScriptResultRecord() { - return scriptResultRecord; - } - - public void setAborted(boolean aborted) { - this.aborted = aborted; - } - - void setTestCase(TestCase currentTestCase) { - this.currentTestCase = currentTestCase; - } - - public String getOutfileComment() { - return "\nNO_OUTFILE_COMMENT\n"; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScriptLogFilter.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScriptLogFilter.java deleted file mode 100644 index ccbc5febbde..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/TestScriptLogFilter.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.util.logging.Level; -import java.util.regex.Pattern; -import org.eclipse.osee.framework.logging.ILoggerFilter; - -public class TestScriptLogFilter implements ILoggerFilter { - private static Level level; - static { - level = Level.parse(System.getProperty("ote.testscript.filter.level", "SEVERE")); - } - - @Override - public Pattern bundleId() { - return null; - } - - @Override - public Level getLoggerLevel() { - return level; - } - - @Override - public Pattern name() { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/XmlSupport.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/XmlSupport.java deleted file mode 100644 index bf8fb3b3f96..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/XmlSupport.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet; - -/** - * @author Roberto E. Escobar - */ -public class XmlSupport { - - private static final Matcher xmlPatternMatcher = Pattern.compile( - "[^" + "a-zA-Z0-9" + "!@#$%\\^&*\\(\\)" + "+ _.-=" + "\'\"<>{}\\[\\]|:;,\n\r\t?/`~\\\\]+").matcher(""); - private static final String CDATA_TEMPLATE = "<![CDATA[%s]]>"; - private static final String HEX_START = " 0x"; - private static final String CDATA_END = "]]>"; - - // Prevent Instantiation - private XmlSupport() { - } - - public static String format(String value) { - return XmlSupport.isValidCharaterData(value) ? value : asCDATA(value); - } - - public static String asCDATA(String value) { - if (!isValidCDATA(value)) { - ChangeSet changeSet = null; - xmlPatternMatcher.reset(value); - while (xmlPatternMatcher.find()) { - char[] charToConvert = xmlPatternMatcher.group().toCharArray(); - StringBuilder converted = new StringBuilder(); - for (int index = 0; index < charToConvert.length; index++) { - converted.append(HEX_START); - converted.append(Integer.toString(charToConvert[index], 16)); - } - if (changeSet == null) { - changeSet = new ChangeSet(value); - } - changeSet.replace(xmlPatternMatcher.start(), xmlPatternMatcher.end(), converted.toString()); - } - if (changeSet != null) { - value = changeSet.applyChangesToSelf().toString(); - } - } - return String.format(CDATA_TEMPLATE, value); - } - - public static String sanitizeXMLContent(String str) { - return str.replace((char) 0x1a, ' '); - } - - private static boolean isValidCDATA(String text) { - return isValidCharaterData(text) && !text.contains(CDATA_END); - } - - public static boolean isValidCharaterData(String text) { - if (text != null) { - int size = text.length(); - for (int index = 0; index < size; index++) { - int character = text.charAt(index); - if (isSurrogatePair(character)) { - index++; - if (index < size) { - // Check the lower part of the surrogate pair - char lowerPart = text.charAt(index); - if (isValidLowerSurrogate(lowerPart)) { - character = toInt(character, lowerPart); - } else { - return false; - } - } else { - return false; - } - } - if (!isHTMLCharacter(character)) { - return false; - } - } - return true; - } - return false; - } - - private static boolean isSurrogatePair(int character) { - return 0xD800 <= character && character <= 0xDBFF; - } - - private static boolean isValidLowerSurrogate(char toCheck) { - return 0xDC00 <= toCheck && toCheck <= 0xDFFF; - } - - private static int toInt(int higher, char lower) { - return 0x10000 + (higher - 0xD800) * 0x400 + lower - 0xDC00; - } - - private static boolean isHTMLCharacter(int c) { - if (c == '\n' || c == '\r' || c == '\t') { - return true; - } - if (c >= 0x20 && c < 0x7F) { - return true; - } - return false; - } - - /** - * Replaces non printable characters with 'ASCII=###' human readable text - */ - public static String convertNonPrintableCharacers(String message) { - return convertCharacers(message, true, false); - } - - /** - * Replaces XML specific characters '<', '>', '&' with human readable text. - * Note: also converts non-printable characters - */ - public static String convertXmlCharacters(String message) { - return convertCharacers(message, true, true); - } - - private static String convertCharacers(String message, boolean printable, boolean xml) { - - StringBuilder buff = new StringBuilder(message.length()); - for (int i = 0; i < message.length(); i++) { - char currentChar = message.charAt(i); - if (printable && (currentChar < 32 || currentChar > 126) && currentChar != '\n' && currentChar != '\r' && currentChar != '\t') { - buff.append("[ASCII=" + (int) currentChar + "]"); - } else if (xml && currentChar == '<') { - buff.append("[less-than]"); - } else if (xml && currentChar == '>') { - buff.append("[greater-than]"); - } else if (xml && currentChar == '&') { - buff.append("[ampersand]"); - } else { - buff.append(currentChar); - } - } - - return buff.toString(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/annotations/OteEventTopic.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/annotations/OteEventTopic.java deleted file mode 100644 index 5b7b21b04c8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/annotations/OteEventTopic.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface OteEventTopic { - String[] value(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/annotations/OteProperty.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/annotations/OteProperty.java deleted file mode 100644 index 22aa50562fd..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/annotations/OteProperty.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface OteProperty { - String[] value(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/CommandId.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/CommandId.java deleted file mode 100644 index 2dcf81c2d70..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/CommandId.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.cmd; - -/** - * @author Andrew M. Finkbeiner - */ -public interface CommandId { - Namespace getNamespace(); - - Name getName(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/Name.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/Name.java deleted file mode 100644 index 6229c1b753d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/Name.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.cmd; - -public interface Name { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/Namespace.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/Namespace.java deleted file mode 100644 index 51f534b2d59..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/Namespace.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.cmd; - -public interface Namespace { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/Source.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/Source.java deleted file mode 100644 index 9b564a62232..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/Source.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.cmd; - -/** - * @author Andrew M. Finkbeiner - */ -public interface Source { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/StringCommandId.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/StringCommandId.java deleted file mode 100644 index 8d10b5ec701..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/StringCommandId.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.cmd; - -import java.io.Serializable; - -/** - * @author Andrew M. Finkbeiner - */ -public class StringCommandId implements CommandId, Serializable { - - private static final long serialVersionUID = 2236967568467058971L; - private final Namespace namespace; - private final Name name; - - public StringCommandId(Namespace namespace, Name name) { - this.namespace = namespace; - this.name = name; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof StringCommandId) { - return namespace.equals(((StringCommandId) obj).namespace) && name.equals(((StringCommandId) obj).name); - } else { - return false; - } - } - - @Override - public int hashCode() { - int hash = 7; - hash = 31 * hash + namespace.hashCode(); - hash = 31 * hash + name.hashCode(); - return hash; - } - - @Override - public Name getName() { - return name; - } - - @Override - public Namespace getNamespace() { - return namespace; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/StringName.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/StringName.java deleted file mode 100644 index bdea6bb074d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/StringName.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.cmd; - -import java.io.Serializable; - -public class StringName implements Name, Serializable { - private static final long serialVersionUID = -7215226960243262972L; - private final String name; - - public StringName(String name) { - this.name = name; - } - - @Override - public boolean equals(Object arg0) { - if (arg0 instanceof StringName) { - return name.equals(((StringName) arg0).name); - } else { - return false; - } - } - - @Override - public int hashCode() { - return name.hashCode(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/StringNamespace.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/StringNamespace.java deleted file mode 100644 index 2d0ef9f7eba..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/StringNamespace.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.cmd; - -import java.io.Serializable; - -public class StringNamespace implements Namespace, Serializable { - private static final long serialVersionUID = -8903438134102328929L; - private final String namespace; - - public StringNamespace(String namespace) { - this.namespace = namespace; - } - - @Override - public boolean equals(Object arg0) { - if (arg0 instanceof StringNamespace) { - return namespace.equals(((StringNamespace) arg0).namespace); - } else { - return false; - } - } - - @Override - public int hashCode() { - return namespace.hashCode(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/UriSource.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/UriSource.java deleted file mode 100644 index 7618bf89678..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/cmd/UriSource.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.cmd; - -import java.io.Serializable; -import java.net.URI; - -/** - * @author Andrew M. Finkbeiner - */ -public class UriSource implements Source, Serializable { - - private static final long serialVersionUID = -917397242786038197L; - private final URI source; - - public UriSource(URI source) { - this.source = source; - } - - public URI getSource() { - return source; - } - - @Override - public boolean equals(Object obj) { - return source.equals(obj); - } - - @Override - public int hashCode() { - return source.hashCode(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/PromptResponseType.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/PromptResponseType.java deleted file mode 100644 index d8546959046..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/PromptResponseType.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.enums; - -/** - * @author Andrew M. Finkbeiner - */ -public enum PromptResponseType { - - NONE, - /** - * Wait for the a response from the user confirming that they have started the debug ofp. - */ - OFP_DEBUG_RESPONSE, - /** - * Pause script execution until a response is recieved from a client. - */ - SCRIPT_PAUSE, - PASS_FAIL, - SCRIPT_STEP, - USER_INPUT, - YES_NO; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/ScriptTypeEnum.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/ScriptTypeEnum.java deleted file mode 100644 index da2ae2b2735..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/ScriptTypeEnum.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.enums; - -import java.io.Serializable; - -public enum ScriptTypeEnum implements Serializable { - - MSG_FUNCTIONAL, - UNIT_TEST, - FUNCTIONAL_TEST, - UNKNOWN, - INVALID; - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/SkynetTestTypes.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/SkynetTestTypes.java deleted file mode 100644 index 91110f17e48..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/SkynetTestTypes.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.enums; - -/** - * @author Ryan D. Brooks - */ -public class SkynetTestTypes { - public static final String EXECUTION_DATE = "Execution Date"; - public static final String TEST_STATUS = "Test Status"; - public static final String TEST_RUN = "Test Run"; - public static final String EXEC5UTION_DATE = "Execution Date"; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/SupportedScriptTypes.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/SupportedScriptTypes.java deleted file mode 100644 index cadab6a808e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/enums/SupportedScriptTypes.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.enums; - -import java.io.Serializable; -import java.util.EnumSet; - -public class SupportedScriptTypes implements Serializable { - - private static final long serialVersionUID = 8403281090133318485L; - public EnumSet<ScriptTypeEnum> supportedClasses = EnumSet.noneOf(ScriptTypeEnum.class); - - public void add(ScriptTypeEnum scriptType) { - supportedClasses.add(scriptType); - } - - /* - * public HashSet<ScriptTypeEnum> getSupportedClasses(){ return supportedClasses; } - */ - - public boolean isSupported(ScriptTypeEnum type) { - return supportedClasses.contains(type); - } - - public String getFormmatedString() { - return "Supported Script Types : " + supportedClasses + "\n"; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/AsynchRemoteJobs.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/AsynchRemoteJobs.java deleted file mode 100644 index 20621c0f813..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/AsynchRemoteJobs.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.util.LinkedList; -import java.util.WeakHashMap; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; - -public class AsynchRemoteJobs implements Runnable { - - private final LinkedList<Runnable> jobs; - private static WeakHashMap<Object, AsynchRemoteJobs> map = new WeakHashMap<>(); - - public static AsynchRemoteJobs getInstance(Object obj) { - AsynchRemoteJobs asynchRemoteJobs = null; - asynchRemoteJobs = map.get(obj); - if (asynchRemoteJobs == null) { - asynchRemoteJobs = new AsynchRemoteJobs(); - map.put(obj, asynchRemoteJobs); - } - return asynchRemoteJobs; - } - - public AsynchRemoteJobs() { - jobs = new LinkedList<>(); - Thread th = new Thread(this); - th.setName("AsynchRemoteJobs[Test Environment]"); - th.start(); - } - - public void addJob(Runnable job) { - synchronized (jobs) { - jobs.addLast(job); - } - synchronized (this) { - this.notify(); - } - } - - @Override - public void run() { - while (true) { - while (jobs.size() > 0) { - Runnable run = null; - synchronized (jobs) { - run = jobs.removeFirst(); - } - run.run(); - } - try { - synchronized (this) { - this.wait(); - } - } catch (InterruptedException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleConfigurationReport.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleConfigurationReport.java deleted file mode 100644 index 0224f4918ea..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleConfigurationReport.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.io.Serializable; -import java.util.List; - -public class BundleConfigurationReport implements Serializable { - private static final long serialVersionUID = 2948282371713776849L; - private final List<BundleDescription> missing; - private final List<BundleDescription> versionMismatch; - private final List<BundleDescription> partOfInstallation; - - public static long getSerialversionuid() { - return serialVersionUID; - } - - public List<BundleDescription> getMissing() { - return missing; - } - - public List<BundleDescription> getVersionMismatch() { - return versionMismatch; - } - - public List<BundleDescription> getPartOfInstallation() { - return partOfInstallation; - } - - public BundleConfigurationReport(List<BundleDescription> missing, List<BundleDescription> versionMismatch, List<BundleDescription> partOfInstallation) { - this.missing = missing; - this.partOfInstallation = partOfInstallation; - this.versionMismatch = versionMismatch; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleDescription.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleDescription.java deleted file mode 100644 index 5fc37de69e8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleDescription.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.net.URL; -import java.util.jar.Manifest; - -/** - * Describes the location where a bundle can be acquired from and provides the manifest of the bundle so that an - * educated decision can be made about whether a bundle is needed or not. - * - * @author Robert A. Fisher - */ -public class BundleDescription implements Serializable { - private static final long serialVersionUID = 546754001181908641L; - - private final URL location; - private final boolean systemLibrary; - private final byte[] manifestData; - private final String md5Digest; - private transient Manifest manifest; - - /** - * Deserialization constructor - */ - protected BundleDescription() { - this.location = null; - this.manifestData = null; - this.manifest = null; - this.systemLibrary = false; - this.md5Digest = null; - } - - public BundleDescription(URL systemLocation, URL serverLocation, Manifest manifest, boolean systemLibrary, String md5Digest) { - if (systemLocation == null) { - throw new IllegalArgumentException("systemLocation must not be null"); - } - if (serverLocation == null) { - throw new IllegalArgumentException("serverLocation must not be null"); - } - if (manifest == null) { - throw new IllegalArgumentException("manifest must not be null"); - } - if (md5Digest == null) { - throw new IllegalArgumentException("md5Digest must not be null"); - } - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - try { - manifest.write(out); - } catch (IOException ex) { - throw new IllegalStateException("ByteArrayOutputStream never should throw IOException", ex); - } - - this.location = serverLocation; - this.manifestData = out.toByteArray(); - this.systemLibrary = systemLibrary; - this.md5Digest = md5Digest; - } - - public InputStream getBundleData() throws IOException { - return location.openConnection().getInputStream(); - } - - /** - * @return the manifestData - */ - public Manifest getManifest() { - try { - if (manifest == null) { - manifest = new Manifest(new ByteArrayInputStream(manifestData)); - } - return manifest; - } catch (IOException ex) { - throw new IllegalStateException("ByteArrayInputStream never should throw IOException", ex); - } - } - - public String getSymbolicName() { - return getManifestEntry("Bundle-SymbolicName"); - } - - public String getVersion() { - return getManifestEntry("Bundle-Version"); - } - - private String getManifestEntry(String attribute) { - String entry = getManifest().getMainAttributes().getValue(attribute).trim(); - - // Sometimes there's a semicolon then extra info - ignore this - int index = entry.indexOf(';'); - if (index != -1) { - entry = entry.substring(0, index); - } - - return entry; - } - - /** - * @return the systemLibrary - */ - public boolean isSystemLibrary() { - return systemLibrary; - } - - /** - * @return the md5Digest - */ - public String getMd5Digest() { - return md5Digest; - } - - public boolean isLocalFile() { - String protocol = location.getProtocol(); - return protocol.equals("file"); - } - - public String getLocation() { - return location.toString(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleResolveException.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleResolveException.java deleted file mode 100644 index cd2dea22d02..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/BundleResolveException.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.util.Collection; -import org.eclipse.osee.framework.jdk.core.util.Collections; -import org.osgi.framework.BundleException; - -/** - * @author Robert A. Fisher - */ -public class BundleResolveException extends Exception { - private static final long serialVersionUID = 5506351677181297953L; - private final Collection<BundleException> bundleExceptions; - - public BundleResolveException(String message, Collection<BundleException> bundleExceptions) { - super(message); - this.bundleExceptions = bundleExceptions; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - - builder.append(super.toString() + "\n"); - builder.append(Collections.toString("\n", bundleExceptions)); - - return builder.toString(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ConsoleOutputJob.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ConsoleOutputJob.java deleted file mode 100644 index 7941fc10de6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ConsoleOutputJob.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import org.eclipse.osee.ote.core.IUserSession; - -public class ConsoleOutputJob implements Runnable { - - private final IUserSession callback; - private final String message; - - public ConsoleOutputJob(IUserSession callback, String message) { - this.callback = callback; - this.message = message; - } - - @Override - public void run() { - try { - callback.initiateInformationalPrompt(message); - } catch (Throwable e) { - System.out.println(message); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/EnvironmentTask.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/EnvironmentTask.java deleted file mode 100644 index 7c433f6fead..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/EnvironmentTask.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.util.TimerTask; -import java.util.logging.Level; -import org.eclipse.osee.framework.jdk.core.util.benchmark.Benchmark; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.GCHelper; -import org.eclipse.osee.ote.core.TestException; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public abstract class EnvironmentTask { - public static final double cycleResolution = 300.0; - private final double hzRate; - private final int phase; - private final int runEveryNcycles; - private boolean running; - private TimerTask timerTask; - - private double averateRate; - - private final Benchmark bm; - - public EnvironmentTask(double hzRate) { - this(hzRate, 0); - } - - public EnvironmentTask(double hzRate, int phase) { - this.hzRate = hzRate; - this.running = true; - this.phase = phase; - runEveryNcycles = (int) Math.round(cycleResolution / hzRate); - bm = new Benchmark(getClass().getName(), (long) (1000000.0 / hzRate)); - GCHelper.getGCHelper().addRefWatch(this); - } - - public EnvironmentTask(double hzRate, TestEnvironment environment) { - this(hzRate); - environment.addTask(this); - } - - public void baseRunOneCycle(int cycleCount) throws TestException { - if (cycleCount == -1 || cycleCount % runEveryNcycles == phase && running) { // if my turn - - bm.samplePoint(); - try { - runOneCycle(); - } catch (InterruptedException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - - } - } - - public void cancel() { - if (timerTask != null) { - timerTask.cancel(); - } - } - - public void disable() { - this.running = false; - } - - public void enable() { - this.running = true; - } - - /** Gets the hzRate. */ - public double getHzRate() { - return hzRate; - } - - public boolean isRunning() { - return this.running; - } - - public abstract void runOneCycle() throws InterruptedException, TestException; - - public void setTimerTask(TimerTask timerTask) { - this.timerTask = timerTask; - } - - public double getAverateRate() { - return averateRate; - } - - @Override - public String toString() { - return this.getClass().getName() + "{ Task: " + hzRate + "Hz, Phase " + phase + ", running=" + (running ? "true" : "false") + " }"; - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/IScriptCompleteEvent.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/IScriptCompleteEvent.java deleted file mode 100644 index c699bd2ceaa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/IScriptCompleteEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IScriptCompleteEvent { - void scriptComplete(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/IScriptSetupEvent.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/IScriptSetupEvent.java deleted file mode 100644 index e24594f02c3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/IScriptSetupEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IScriptSetupEvent { - void scriptSetup(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/OteLogFile.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/OteLogFile.java deleted file mode 100644 index 784b9f5e014..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/OteLogFile.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.eclipse.osee.framework.logging.ILoggerListener; - -public class OteLogFile implements ILoggerListener { - - public Set<Logger> initializedLoggers; - private final FileOutputStream fos; - private final StringBuilder sb; - private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - - public OteLogFile(File file) throws FileNotFoundException { - fos = new FileOutputStream(file); - sb = new StringBuilder(); - } - - @Override - public synchronized void log(String loggerName, Level level, String message, Throwable th) { - try { - sb.append(String.format("<record name=\"%s\" level=\"%s\" >\n", loggerName, level.getName())); - sb.append("<Time>"); - sb.append(sdf.format(new Date())); - sb.append("</Time>\n"); - sb.append("<message>\n"); - sb.append(message); - sb.append("\n"); - sb.append("</message>\n"); - if (th != null) { - sb.append("<stacktrace>"); - writeStackTrace(sb, th); - sb.append("</stacktrace>\n"); - } - sb.append("</record>\n"); - fos.write(sb.toString().getBytes()); - fos.flush(); - sb.setLength(0); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - - private void writeStackTrace(StringBuilder sb, Throwable th) { - while (th != null) { - sb.append(th.getMessage()); - sb.append("\n"); - for (StackTraceElement el : th.getStackTrace()) { - sb.append(el.toString()); - sb.append("\n"); - } - th = th.getCause(); - } - } - - @Override - protected void finalize() throws Throwable { - fos.close(); - super.finalize(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ReportDataControl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ReportDataControl.java deleted file mode 100644 index 53b4c3efa60..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ReportDataControl.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.rmi.RemoteException; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; - -import org.eclipse.osee.framework.jdk.core.reportdata.ReportData; -import org.eclipse.osee.framework.jdk.core.reportdata.ReportDataListener; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.command.TestEnvironmentCommand; -import org.eclipse.osee.ote.core.environment.interfaces.IReportData; - -public class ReportDataControl implements IReportData { - private final ReportData queueData; - // private ArrayList<ReportDataListener> queueListeners; - private final ArrayList<ReportDataListener> queueListeners; - - public ReportDataControl() { - this.queueListeners = new ArrayList<>(); - ArrayList<String> queueHeaders = new ArrayList<>(); - queueHeaders.add("User"); - queueHeaders.add("Script"); - this.queueData = new ReportData(queueHeaders); - } - - @Override - @SuppressWarnings("unchecked") - public void addQueueListener(ReportDataListener listener, List cmds) { - queueListeners.add(listener); - updateQueueData(cmds); - try { - listener.updateData(queueData); - } catch (RemoteException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - } - - @Override - public void removeQueueListener(ReportDataListener listener) { - queueListeners.remove(listener); - } - - @Override - @SuppressWarnings("unchecked") - public void updateQueueListeners(List cmds) { - updateQueueData(cmds); - for (int i = 0; i < queueListeners.size(); i++) { - try { - queueListeners.get(i).updateData(queueData); - } catch (RemoteException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - } - } - - private void updateQueueData(List<TestEnvironmentCommand> cmds) { - queueData.clearItems(); - ArrayList<String> values; - for (int i = 0; i < cmds.size(); i++) { - TestEnvironmentCommand cmd = cmds.get(i); - values = new ArrayList<>(); - values.add(cmd.getDescription().getDescription()); - queueData.addItem(cmd.getDescription().getGuid(), values); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ScriptControl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ScriptControl.java deleted file mode 100644 index 1a6bbe2729b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/ScriptControl.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import org.eclipse.osee.ote.core.environment.interfaces.IScriptControl; - -public class ScriptControl implements IScriptControl { - - protected boolean isOfpPaused = false; - protected boolean isScriptPaused = false; - protected boolean isScriptReady = false; - - public ScriptControl() { - } - - @Override - public boolean isLocked() { - return false; - } - - @Override - public boolean isExecutionUnitPaused() { - return isOfpPaused; - } - - @Override - public boolean isScriptPaused() { - return isScriptPaused; - } - - @Override - public boolean isScriptReady() { - return isScriptReady; - } - - @Override - public void lock() { - } - - @Override - public void setExecutionUnitPause(boolean pause) { - isOfpPaused = pause; - } - - @Override - public void setScriptPause(boolean pause) { - isScriptPaused = pause; - } - - @Override - public void setScriptReady(boolean ready) { - isScriptReady = ready; - } - - @Override - public boolean shouldStep() { - return isScriptPaused() && !isExecutionUnitPaused(); - } - - @Override - public void unlock() { - } - - @Override - public boolean hasLock() { - return false; - } - - @Override - public boolean isHeldByCurrentThread() { - return false; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java deleted file mode 100644 index 2d68ba2228a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironment.java +++ /dev/null @@ -1,594 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.InetAddress; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.UnknownHostException; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.server.ExportException; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; - -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.connection.service.LocalConnector; -import org.eclipse.osee.framework.jdk.core.reportdata.ReportDataListener; -import org.eclipse.osee.framework.jdk.core.util.EnhancedProperties; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.jdk.core.util.Strings; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.OseeLogStatusCallback; -import org.eclipse.osee.ote.core.GCHelper; -import org.eclipse.osee.ote.core.OseeTestThread; -import org.eclipse.osee.ote.core.OteProperties; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.interfaces.IAssociatedObjectListener; -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.IEnvironmentFactory; -import org.eclipse.osee.ote.core.environment.interfaces.IExecutionUnitManagement; -import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager; -import org.eclipse.osee.ote.core.environment.interfaces.IScriptControl; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentListener; -import org.eclipse.osee.ote.core.environment.interfaces.ITestLogger; -import org.eclipse.osee.ote.core.environment.interfaces.ITestStation; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.core.environment.interfaces.ITimerControl; -import org.eclipse.osee.ote.core.framework.IRunManager; -import org.eclipse.osee.ote.core.framework.command.ICommandHandle; -import org.eclipse.osee.ote.core.framework.command.ITestContext; -import org.eclipse.osee.ote.core.framework.command.ITestServerCommand; -import org.eclipse.osee.ote.core.internal.Activator; -import org.eclipse.osee.ote.properties.OtePropertiesCore; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceRegistration; -import org.osgi.util.tracker.ServiceTracker; -import org.osgi.util.tracker.ServiceTrackerCustomizer; - -/** - * @author Andrew M. Finkbeiner - */ -public abstract class TestEnvironment implements TestEnvironmentInterface, ITestEnvironmentAccessor, ITestContext { - - private final List<ITestEnvironmentListener> envListeners = new ArrayList<>(32); - private IExecutionUnitManagement executionUnitManagement; - - private File outDir = null; - private final ITestStation testStation; - private boolean batchMode = false; - private final HashMap<String, Remote> controlInterfaces = new HashMap<>(); - private final IEnvironmentFactory factory; - private IServiceConnector connector; - private final IRuntimeLibraryManager runtimeManager; - - @Deprecated - private final HashMap<Class<?>, Object> associatedObjects; - @Deprecated - private final HashMap<Class<?>, ArrayList<IAssociatedObjectListener>> associatedObjectListeners; - @Deprecated - private boolean isEnvSetup = false; - @Deprecated - private final List<IScriptCompleteEvent> scriptCompleteListeners = new ArrayList<>(); - @Deprecated - private final List<IScriptSetupEvent> scriptSetupListeners = new ArrayList<>(); - -// private OteServerSideEndprointRecieve oteServerSideEndpointRecieve; -// private OteServerSideEndpointSender oteServerSideEndpointSender; -// private final ServiceTracker messagingServiceTracker; - - private volatile boolean isShutdown = false; -// private NodeInfo oteEmbeddedBroker; - private ServiceRegistration<TestEnvironmentInterface> myRegistration; - - protected TestEnvironment(IEnvironmentFactory factory) { - GCHelper.getGCHelper().addRefWatch(this); -// try { -// oteEmbeddedBroker = new NodeInfo("OTEEmbeddedBroker", new URI("vm://localhost?broker.persistent=false")); -// } catch (URISyntaxException ex) { -// OseeLog.log(TestEnvironment.class, Level.SEVERE, ex); -// } - this.factory = factory; - this.testStation = factory.getTestStation(); - this.runtimeManager = factory.getRuntimeManager(); - - this.associatedObjectListeners = new HashMap<>(); - this.associatedObjects = new HashMap<>(100); - this.batchMode = OteProperties.isOseeOteInBatchModeEnabled(); - -// messagingServiceTracker = setupOteMessagingSenderAndReceiver(); - } - - public void init(IServiceConnector connector) { - this.connector = connector; - } - - private void setupDefaultConnector() { - EnhancedProperties props = new EnhancedProperties(); - try { - props.setProperty("station", InetAddress.getLocalHost().getHostName()); - } catch (UnknownHostException ex) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, ex); - } - props.setProperty("date", new Date()); - props.setProperty("group", "OSEE Test Environment"); - props.setProperty("owner", OtePropertiesCore.userName.getValue()); - connector = new LocalConnector(this, Integer.toString(this.getUniqueId()), props); - } - -// private ServiceTracker setupOteMessagingSenderAndReceiver() { -// oteServerSideEndpointRecieve = new OteServerSideEndprointRecieve(); -// oteServerSideEndpointSender = new OteServerSideEndpointSender(this); -// BundleContext context = Platform.getBundle("org.eclipse.osee.ote.core").getBundleContext(); -// return getServiceTracker(MessagingGateway.class.getName(), new OteEnvironmentTrackerCustomizer(context, -// oteServerSideEndpointRecieve, oteServerSideEndpointSender, -// OteServerSideEndpointSender.OTE_SERVER_SIDE_SEND_PROTOCOL)); -// } -// -// public void sendMessageToServer(Message message) { -// oteServerSideEndpointRecieve.recievedMessage(message); -// } - - public ServiceTracker getServiceTracker(String clazz, ServiceTrackerCustomizer customizer) { - return Activator.getInstance().getServiceTracker(clazz, customizer); - } - - @Override - public ServiceTracker getServiceTracker(String clazz) { - return getServiceTracker(clazz, null); - } - - @Override - public ICommandHandle addCommand(ITestServerCommand cmd) throws ExportException { - return factory.getCommandManager().addCommand(cmd, this); - } - - @Override - public IRunManager getRunManager() { - return factory.getRunManager(); - } - - @Override - public IRuntimeLibraryManager getRuntimeManager() { - return this.runtimeManager; - } - - @Override - public IEnvironmentFactory getEnvironmentFactory() { - return factory; - } - - @Override - public boolean isInBatchMode() { - return batchMode; - } - - @Override - public void setBatchMode(boolean isInBatchMode) { - if (!OteProperties.isOseeOteInBatchModeEnabled()) { - this.batchMode = isInBatchMode; - } - } - - @Override - public void addEnvironmentListener(ITestEnvironmentListener listener) { - envListeners.add(listener); - } - - @Override - public boolean addTask(EnvironmentTask task) { - factory.getTimerControl().addTask(task, this); - return true; - } - - public boolean equals(ITestEnvironment testEnvironment) throws RemoteException { - if (testEnvironment.getUniqueId() == getUniqueId()) { - return true; - } else { - return false; - } - } - - @Override - public long getEnvTime() { - return getTimerCtrl().getEnvTime(); - } - - @Override - public IExecutionUnitManagement getExecutionUnitManagement() { - return this.executionUnitManagement; - } - - @Override - public ITestLogger getLogger() { - return factory.getTestLogger(); - } - - @Override - public List<String> getQueueLabels() { - List<String> list = new ArrayList<>(); - list.add("Description"); - return list; - } - - @Override - public abstract Object getModel(String modelClassName); - - @Override - public IScriptControl getScriptCtrl() { - return factory.getScriptControl(); - } - - @Override - public byte[] getScriptOutfile(String filepath) throws RemoteException { - try { - File file = new File(filepath); - InputStream is = new FileInputStream(file); - long length = file.length(); - byte[] bytes = new byte[(int) length]; - - int numRead = is.read(bytes); - if (numRead < bytes.length) { - throw new IOException("Could not completely read file " + file.getName()); - } - is.close(); - OseeLog.log(TestEnvironment.class, Level.FINE, "going to send " + bytes.length + " bytes to the client"); - - return bytes; - } catch (Exception ex) { - throw new RemoteException("Error retrieving the script output", ex); - } - } - - @Override - public ITestStation getTestStation() { - return testStation; - } - - @Override - public ITimerControl getTimerCtrl() { - return factory.getTimerControl(); - } - - @Override - public int getUniqueId() { - return this.hashCode(); - } - - private final void removeAllTasks() { - factory.getTimerControl().cancelAllTasks(); - } - - @Override - public URL setBatchLibJar(byte[] batchJar) throws IOException { - String path = OtePropertiesCore.userHome.getValue() + File.separator + TestEnvironment.class.getName(); - - File dir = new File(path, "batchLibCache"); - if (!dir.isDirectory()) { - dir.mkdir(); - } - File jar = File.createTempFile("Batch", ".jar", dir); - Lib.writeBytesToFile(batchJar, jar); - return jar.toURI().toURL(); - } - - @Override - public ICancelTimer setTimerFor(ITimeout listener, int time) { - return getTimerCtrl().setTimerFor(listener, time); - } - - @Override - public void setupOutfileDir(String outfileDir) throws IOException { - if (Strings.isValid(outfileDir)) { - outDir = new File(outfileDir); - if (!outDir.isDirectory()) { - if (!outDir.mkdirs()) { - throw new IOException("Failed to create the output directory"); - } - OseeLog.logf(TestEnvironment.class, Level.INFO, - "Outfile Dir [%s] created.", outDir.getAbsolutePath()); - } else { - OseeLog.logf(TestEnvironment.class, Level.FINE, - "Outfile Dir [%s] exists.", outDir.getAbsolutePath()); - } - } else { - throw new IOException("A valid outfile directory must be specified."); - } - } - - @Override - public void shutdown() { - if (isShutdown) { - return; - } - isShutdown = true; - runtimeManager.uninstall(new OseeLogStatusCallback()); - Activator.getInstance().unregisterTestEnvironment(); - // here we remove all environment tasks (emulators) - removeAllTasks(); - if (associatedObjects != null) { - this.associatedObjects.clear();// get rid of all models and support - } - -// messagingServiceTracker.close(); - - OseeLog.log(TestEnvironment.class, Level.FINE, "shutting down environment"); - factory.getTimerControl().cancelTimers(); - stop(); - cleanupClassReferences(); - OseeTestThread.clearThreadReferences(); - for (ITestEnvironmentListener listener : envListeners) { - try { - listener.onEnvironmentKilled(this); - } catch (Exception e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, "exception during listener notification", e); - } - } - envListeners.clear(); - if (getRunManager() != null) { - getRunManager().clearAllListeners(); - } - } - - protected abstract void loadExternalDrivers(); - - public void startup(String outfileDir) throws Exception { - try { - setupOutfileDir(outfileDir); - } catch (IOException ex) { - throw new Exception("Error in directory setup. " + outfileDir, ex); - } - if(myRegistration != null){ - myRegistration.unregister(); - } - myRegistration = FrameworkUtil.getBundle(getClass()).getBundleContext().registerService(TestEnvironmentInterface.class, this, null); - } - - protected void stop() { - try{ - myRegistration.unregister(); - } catch (IllegalStateException ex){ - //ignore if it's already unregistered - } - } - - protected void cleanupClassReferences() { - OseeLog.log(TestEnvironment.class, Level.FINE, "cleanupreferences"); - - System.out.println("Associated objects that are getting cleaned up."); - for (Class<?> clazz : associatedObjects.keySet()) { - System.out.println(clazz.toString()); - } - - if (associatedObjects != null) { - associatedObjects.clear(); - } - OseeLog.log(TestEnvironment.class, Level.FINE, "got the other PM REF"); - if (associatedObjectListeners != null) { - associatedObjectListeners.clear(); - } - GCHelper.getGCHelper().printLiveReferences(); - } - - public void setExecutionUnitManagement(IExecutionUnitManagement executionUnitManagement) { - this.executionUnitManagement = executionUnitManagement; - } - - @Override - public File getOutDir() { - return outDir; - } - - @Override - public Remote getControlInterface(String id) { - return controlInterfaces.get(id); - } - - @Override - public void registerControlInterface(String id, Remote controlInterface) { - controlInterfaces.put(id, controlInterface); - } - - @Override - public IServiceConnector getConnector() { - return connector; - } - - @Deprecated - public void setEnvSetup(boolean isEnvSetup) { - this.isEnvSetup = isEnvSetup; - } - - @Deprecated - public void addScriptCompleteListener(IScriptCompleteEvent scriptComplete) { - this.scriptCompleteListeners.add(scriptComplete); - } - - @Deprecated - public void removeScriptCompleteListener(IScriptCompleteEvent scriptComplete) { - this.scriptCompleteListeners.remove(scriptComplete); - } - - @Deprecated - public void addScriptSetupListener(IScriptSetupEvent scriptSetup) { - this.scriptSetupListeners.add(scriptSetup); - } - - @Deprecated - public void removeScriptSetupListener(IScriptSetupEvent scriptSetup) { - this.scriptSetupListeners.remove(scriptSetup); - } - - @Deprecated - protected boolean isEnvSetup() { - return isEnvSetup; - } - - @Deprecated - /** - * alerts the environment of an exception. The environment will take any necessary actions and alert any interested - * entities of the problem. Any runing test script will be terminated - * - */ - public void handleException(Throwable t, Level logLevel) { - handleException(t, "An exception has occurred in the environment", logLevel, true); - } - - @Deprecated - /** - * @param abortScript true will cause the currently running script to abort - */ - public void handleException(Throwable t, Level logLevel, boolean abortScript) { - handleException(t, "An exception has occurred in the environment", logLevel, abortScript); - } - - @Deprecated - /** - * alerts the environment of an exception. The environment will take any necessary actions and alert any interested - * entities of the problem - * - * @param t the exception - * @param logLevel the severity of the exception. Specifing a Level.OFF will - * @param abortScript cause the exception to not be logged - */ - public void handleException(Throwable t, String message, Level logLevel, boolean abortScript) { - if (logLevel != Level.OFF) { - OseeLog.log(TestEnvironment.class, logLevel, message, t); - } - if (getTestScript() != null && abortScript) { - getTestScript().abortDueToThrowable(t); - } - Iterator<ITestEnvironmentListener> iter = envListeners.iterator(); - while (iter.hasNext()) { - final ITestEnvironmentListener listener = iter.next(); - listener.onException(message, t); - } - } - - @Deprecated - public void testEnvironmentCommandComplete(ICommandHandle handle) { - for (ITestEnvironmentListener listener : envListeners) { - try { - listener.onTestServerCommandFinished(this, handle); - } catch (Throwable th) { - System.out.println(listener.getClass().getName()); - th.printStackTrace(); - } - } - } - - @Override - @Deprecated - /** - * marks the script as ready as well as clears any objects that are associated with the environment. - */ - public synchronized void onScriptSetup() { - - for (IScriptSetupEvent listeners : scriptSetupListeners) { - listeners.scriptSetup(); - } - - this.associatedObjects.clear(); - } - - @Deprecated - public void removeQueueListener(ReportDataListener listener) throws RemoteException { - factory.getReportDataControl().removeQueueListener(listener); - } - - @Override - @Deprecated - public void onScriptComplete() throws InterruptedException { - factory.getScriptControl().setScriptReady(false); - - for (int i = 0; i < scriptCompleteListeners.size(); i++) { - try { - scriptCompleteListeners.get(i).scriptComplete(); - } catch (Exception e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, "problem with script complete listener", e); - } - } - - // here we remove all environment tasks (emulators) - if (associatedObjects != null) { - this.associatedObjects.clear();// get rid of all models and support - } - } - - @Override - @Deprecated - public void associateObject(Class<?> c, Object obj) { - associatedObjects.put(c, obj); - ArrayList<IAssociatedObjectListener> listeners = this.associatedObjectListeners.get(c); - if (listeners != null) { - for (int i = 0; i < listeners.size(); i++) { - try { - listeners.get(i).updateAssociatedListener(); - } catch (RemoteException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e.getMessage(), e); - } - - } - } - } - - @Override - @Deprecated - public Object getAssociatedObject(Class<?> c) { - return associatedObjects.get(c); - } - - @Override - @Deprecated - public Set<Class<?>> getAssociatedObjects() { - return associatedObjects.keySet(); - } - - @Override - @Deprecated - /** - * Use getRunManager().getCurrentScript() instead of this method. - */ - public TestScript getTestScript() { - return getRunManager().getCurrentScript(); - } - - @Override - @Deprecated - public void abortTestScript() { - getRunManager().abort(); - } - - @Override - @Deprecated - public void abortTestScript(Throwable t) { - getRunManager().abort(t, false); - } - -// public void setOteNodeInfo(NodeInfo oteEmbeddedBroker) { -// this.oteEmbeddedBroker = oteEmbeddedBroker; -// } -// -// public NodeInfo getOteNodeInfo() { -// return oteEmbeddedBroker; -// } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentConfig.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentConfig.java deleted file mode 100644 index bc40c53bf1b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentConfig.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.io.Serializable; -import java.util.Map; - -public class TestEnvironmentConfig implements Serializable { - private static final long serialVersionUID = -382800417464413074L; - private Map<String, String> envVars; - private String CLEARCASE_VIEW; - private String[] jarVersions; - - public TestEnvironmentConfig(String[] jarVersions) { - this.jarVersions = jarVersions; - } - - public TestEnvironmentConfig(Map<String, String> envVars, String CLEARCASE_VIEW) { - this.CLEARCASE_VIEW = CLEARCASE_VIEW; - this.envVars = envVars; - } - - public Map<String, String> getLibrarySearchPath() { - return envVars; - } - - public String getClearCaseView() { - return CLEARCASE_VIEW; - } - - /** - * @return the jarVersions - */ - public String[] getJarVersions() { - return jarVersions; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java deleted file mode 100644 index 36897fbd29a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentInterface.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.server.ExportException; -import java.util.List; - -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.IEnvironmentFactory; -import org.eclipse.osee.ote.core.environment.interfaces.IExecutionUnitManagement; -import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager; -import org.eclipse.osee.ote.core.environment.interfaces.IScriptControl; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentListener; -import org.eclipse.osee.ote.core.environment.interfaces.ITestLogger; -import org.eclipse.osee.ote.core.environment.interfaces.ITestStation; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.core.environment.interfaces.ITimerControl; -import org.eclipse.osee.ote.core.framework.IRunManager; -import org.eclipse.osee.ote.core.framework.command.ICommandHandle; -import org.eclipse.osee.ote.core.framework.command.ITestServerCommand; -import org.osgi.util.tracker.ServiceTracker; - -/** - * @author Andrew M. Finkbeiner - */ -public interface TestEnvironmentInterface { - public ServiceTracker getServiceTracker(String clazz); - - public ICommandHandle addCommand(ITestServerCommand cmd) throws ExportException; - - public IRunManager getRunManager(); - - public IRuntimeLibraryManager getRuntimeManager(); - - public boolean isInBatchMode(); - - public void setBatchMode(boolean isInBatchMode); - - public void addEnvironmentListener(ITestEnvironmentListener listener); - - public boolean addTask(EnvironmentTask task); - - public long getEnvTime(); - - public IExecutionUnitManagement getExecutionUnitManagement(); - - public ITestLogger getLogger(); - - public List<String> getQueueLabels(); - - public abstract Object getModel(String modelClassName); - - public IScriptControl getScriptCtrl(); - - public byte[] getScriptOutfile(String filepath) throws RemoteException; - - public ITestStation getTestStation(); - - public ITimerControl getTimerCtrl(); - - public int getUniqueId(); - - public URL setBatchLibJar(byte[] batchJar) throws IOException; - - public ICancelTimer setTimerFor(ITimeout listener, int time); - - public void shutdown(); - - public File getOutDir(); - - public Remote getControlInterface(String id); - - public void registerControlInterface(String id, Remote controlInterface); - - public IServiceConnector getConnector(); - - public IEnvironmentFactory getEnvironmentFactory(); - - void setupOutfileDir(String outfileDir) throws IOException; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentLogFilter.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentLogFilter.java deleted file mode 100644 index 2473861d06a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestEnvironmentLogFilter.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.util.logging.Level; -import java.util.regex.Pattern; - -import org.eclipse.osee.framework.logging.ILoggerFilter; -import org.eclipse.osee.ote.properties.OtePropertiesCore; - -public class TestEnvironmentLogFilter implements ILoggerFilter { - private static Level level; - static { - level = Level.parse(System.getProperty("ote.testenv.filter.level", "INFO")); - } - - @Override - public Pattern bundleId() { - return null; - } - - @Override - public Level getLoggerLevel() { - return level; - } - - @Override - public Pattern name() { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestServerMode.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestServerMode.java deleted file mode 100644 index e68c6f38659..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TestServerMode.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import javax.print.attribute.EnumSyntax; -import org.eclipse.osee.framework.jdk.core.util.EnumBase; - -/** - * @author Robert A. Fisher - */ -public class TestServerMode extends EnumBase { - private static final long serialVersionUID = 6600576749632500352L; - public static final TestServerMode MULTI = new TestServerMode(0); - public static final TestServerMode SINGLE = new TestServerMode(1); - private static final String[] stringTable = new String[] {"multi", "single"}; - private static final TestServerMode[] enumValueTable = new TestServerMode[] {MULTI, SINGLE}; - - private TestServerMode(int value) { - super(value); - } - - public static TestServerMode toEnum(String str) { - return (TestServerMode) getEnum(str, stringTable, enumValueTable); - } - - protected static TestServerMode toEnum(int value) { - return (TestServerMode) getEnum(value, enumValueTable); - } - - @Override - protected String[] getStringTable() { - return stringTable; - } - - @Override - protected EnumSyntax[] getEnumValueTable() { - return enumValueTable; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TimerControl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TimerControl.java deleted file mode 100644 index 7d76924a5da..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/TimerControl.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -import org.eclipse.osee.ote.core.environment.interfaces.BasicTimeout; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.core.environment.interfaces.ITimerControl; -import org.eclipse.osee.ote.core.framework.IRunManager; - -public abstract class TimerControl implements ITimerControl { - - private final ScheduledExecutorService executor; - private IRunManager runManager; - - - public TimerControl(int maxTimers) { - executor = Executors.newScheduledThreadPool(maxTimers); - } - - @Override - public void cancelTimers() { - executor.shutdown(); - } - - public ScheduledFuture<?> schedulePeriodicTask(Runnable task, long initialDelay, long period) { - return executor.scheduleAtFixedRate(task, initialDelay, period, TimeUnit.MILLISECONDS); - } - - public ScheduledFuture<?> scheduleOneShotTask(Runnable task, long delay) { - return executor.schedule(task, delay, TimeUnit.MILLISECONDS); - } - - @Override - public void envWait(int milliseconds) throws InterruptedException { - envWait(new BasicTimeout(), milliseconds); - } - - @Override - public void envWait(ITimeout obj, int milliseconds) throws InterruptedException { - synchronized (obj) { - setTimerFor(obj, milliseconds); - obj.wait(); - } - } - - @Override - public void setRunManager(IRunManager runManager) { - this.runManager = runManager; - } - - @Override - public IRunManager getRunManager() { - return runManager; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/CommandDescription.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/CommandDescription.java deleted file mode 100644 index 89900f7f893..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/CommandDescription.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.command; - -import java.io.Serializable; -import org.eclipse.osee.framework.jdk.core.util.GUID; - -/** - * @author Robert A. Fisher - */ -public class CommandDescription implements Serializable { - private static final long serialVersionUID = 538355585678229304L; - protected final String guid; - protected final String description; - - /** - * CommandDescription Constructor. Sets the command's description. - */ - public CommandDescription(String description) { - super(); - this.guid = GUID.create(); - this.description = description; - } - - /** - * @return Returns the description. - */ - public String getDescription() { - return description; - } - - @Override - public boolean equals(Object obj) { - - if (obj instanceof GUID) { - return guid.equals(obj); - } else if (obj instanceof CommandDescription) { - return guid.equals(((CommandDescription) obj).guid); - } - - return false; - } - - /** - * @return Returns the guid. - */ - public String getGuid() { - return guid; - } - - @Override - public String toString() { - return "GUID: " + guid + "\n" + "Desc: " + description; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/RunTestScriptDescription.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/RunTestScriptDescription.java deleted file mode 100644 index 50eb0bd95c9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/RunTestScriptDescription.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.command; - -import java.util.logging.Level; -import org.eclipse.osee.ote.core.environment.config.ScriptVersionConfig; -import org.eclipse.osee.ote.core.environment.config.TesterConfig; - -/** - * @author Andrew M. Finkbeiner - */ -public class RunTestScriptDescription extends CommandDescription { - - private static final long serialVersionUID = 8824248434175577382L; - private String clientOutfilePath; - private String serverOutfilePath; - private ScriptVersionConfig scriptVersion; - private final TesterConfig testerConfig; - private Level logLevel; - - public RunTestScriptDescription(String description, String clientOutfilePath, ScriptVersionConfig scriptVersion, Level logLevel) { - super(description); - this.clientOutfilePath = clientOutfilePath; - this.scriptVersion = scriptVersion; - this.testerConfig = new TesterConfig(); - this.logLevel = logLevel; - if (this.logLevel == null) { - this.logLevel = Level.ALL; - } - /* - * if(user != null){ testerConfig.setEmail(user.getEmail()); testerConfig.setName(user.getName()); - * testerConfig.setId(user.getId()); } - */ - } - - public RunTestScriptDescription(String description, String clientOutfilePath, ScriptVersionConfig scriptVersion) { - this(description, clientOutfilePath, scriptVersion, Level.WARNING); - } - - /** - * @return Returns the outfile. - */ - public String getClientOutfilePath() { - return clientOutfilePath; - } - - /** - * @return Returns the serverOutfilePath. - */ - public String getServerOutfilePath() { - return serverOutfilePath; - } - - /** - * @param serverOutfilePath The serverOutfilePath to set. - */ - public void setServerOutfilePath(String serverOutfilePath) { - this.serverOutfilePath = serverOutfilePath; - } - - /** - * @param clientOutfilePath The clientOutfilePath to set. - */ - public void setClientOutfilePath(String clientOutfilePath) { - this.clientOutfilePath = clientOutfilePath; - } - - public void setScriptVersion(ScriptVersionConfig scriptVersion) { - this.scriptVersion = scriptVersion; - } - - public ScriptVersionConfig getScriptVersion() { - return this.scriptVersion; - } - - public TesterConfig getTesterConfig() { - return this.testerConfig; - } - - /** - * @return Returns the logLevel. - */ - public Level getLogLevel() { - return logLevel; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/TestEnvironmentCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/TestEnvironmentCommand.java deleted file mode 100644 index 5fcef4eeeb0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/command/TestEnvironmentCommand.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.command; - -import java.io.Serializable; -import java.util.UUID; - -import org.eclipse.osee.ote.core.TestException; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.IServiceCommand; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public abstract class TestEnvironmentCommand implements Serializable, IServiceCommand { - private static final long serialVersionUID = -921447917279635626L; - private final UUID key; - private final CommandDescription commandDescription; - - public TestEnvironmentCommand(UUID key, CommandDescription commandDescription) { - this.key = key; - this.commandDescription = commandDescription; - } - - public UUID getUserKey() { - return key; - } - - public void executeBase(TestEnvironment environment) { - execute(environment); - } - - @Override - public abstract void execute(TestEnvironment environment) throws TestException; - - public CommandDescription getDescription() { - return commandDescription; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/config/ScriptVersionConfig.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/config/ScriptVersionConfig.java deleted file mode 100644 index 0ab46f067fa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/config/ScriptVersionConfig.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.config; - -import java.io.Serializable; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.ote.core.test.tags.BaseTestTags; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ScriptVersionConfig implements Xmlizable, XmlizableStream, Serializable { - - private static final long serialVersionUID = -4021198751318075600L; - private String repositoryType; - private String location; - private String lastChangedRevision; - private String lastAuthor; - private String lastModificationDate; - private String modifiedFlag; - - public ScriptVersionConfig() { - repositoryType = "UNKNOWN"; - location = "-"; - lastChangedRevision = "-"; - lastAuthor = "-"; - lastModificationDate = "-"; - modifiedFlag = "-"; - } - - public ScriptVersionConfig(String repositoryType, String location, String lastChangedRevision, String lastAuthor, String lastModificationDate, String modifiedFlag) { - this.repositoryType = repositoryType; - this.location = location; - this.lastChangedRevision = lastChangedRevision; - this.lastAuthor = lastAuthor; - this.lastModificationDate = lastModificationDate; - this.modifiedFlag = modifiedFlag; - } - - /** - * @return the location - */ - @JsonProperty - public String getLocation() { - return location; - } - - /** - * @param location the location to set - */ - public void setLocation(String location) { - this.location = location; - } - - /** - * @return the repositoryType - */ - @JsonProperty - public String getRepositoryType() { - return repositoryType; - } - - /** - * @param repositoryType the repositoryType to set - */ - public void setRepositoryType(String repositoryType) { - this.repositoryType = repositoryType; - } - - /** - * @return the revision - */ - @JsonProperty - public String getLastChangedRevision() { - return lastChangedRevision; - } - - /** - * @param lastChangedRevision the revision to set - */ - public void setLastChangedRevision(String lastChangedRevision) { - this.lastChangedRevision = lastChangedRevision; - } - - /** - * @return the lastAuthor - */ - @JsonProperty - public String getLastAuthor() { - return lastAuthor; - } - - /** - * @param lastAuthor the lastAuthor to set - */ - public void setLastAuthor(String lastAuthor) { - this.lastAuthor = lastAuthor; - } - - /** - * @return the lastDateModified - */ - @JsonProperty - public String getLastModificationDate() { - return lastModificationDate; - } - - /** - * @param lastModified the lastModified to set - */ - public void setLastModificationDate(String lastModificationDate) { - this.lastModificationDate = lastModificationDate; - } - - /** - * @return the modifiedFlag - */ - @JsonProperty - public String getModifiedFlag() { - return modifiedFlag; - } - - /** - * @param modifiedFlag the modifiedFlag to set - */ - public void setModifiedFlag(String modifiedFlag) { - this.modifiedFlag = modifiedFlag; - } - - @Override - public Element toXml(Document doc) { - Element scriptVersion = doc.createElement(BaseTestTags.SCRIPT_VERSION); - scriptVersion.setAttribute(BaseTestTags.REVISION_FIELD, getLastChangedRevision()); - scriptVersion.setAttribute(BaseTestTags.REPOSITORY_TYPE, getRepositoryType()); - scriptVersion.setAttribute(BaseTestTags.LAST_AUTHOR_FIELD, getLastAuthor()); - scriptVersion.setAttribute(BaseTestTags.LAST_MODIFIED, getLastModificationDate()); - scriptVersion.setAttribute(BaseTestTags.MODIFIED_FIELD, getModifiedFlag()); - scriptVersion.setAttribute(BaseTestTags.URL, getLocation()); - return scriptVersion; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement(BaseTestTags.SCRIPT_VERSION); - writer.writeAttribute(BaseTestTags.REVISION_FIELD, getLastChangedRevision()); - writer.writeAttribute(BaseTestTags.REPOSITORY_TYPE, getRepositoryType()); - writer.writeAttribute(BaseTestTags.LAST_AUTHOR_FIELD, getLastAuthor()); - writer.writeAttribute(BaseTestTags.LAST_MODIFIED, getLastModificationDate()); - writer.writeAttribute(BaseTestTags.MODIFIED_FIELD, getModifiedFlag()); - writer.writeAttribute(BaseTestTags.URL, getLocation()); - writer.writeEndElement(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/config/TestScriptConfig.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/config/TestScriptConfig.java deleted file mode 100644 index 97f94953bb7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/config/TestScriptConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.config; - -import java.io.Serializable; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestScriptConfig implements Serializable { - - private static final long serialVersionUID = 6791547338404192517L; - private final String outFile; - private final String fullScriptName; - private final String[] classPathStrs; - private final boolean isExe; - private final ScriptVersionConfig scriptVersion; - - /** - * TestScriptConfig Constructor. - * - * @param classPathStrs The classPathStrs to set. - * @param fullScriptName The fullScriptName to set. - * @param outFile The outFile to set. - */ - public TestScriptConfig(String[] classPathStrs, String fullScriptName, String outFile, ScriptVersionConfig scriptVersion) { - this.fullScriptName = fullScriptName; - this.outFile = outFile; - this.isExe = false; - this.scriptVersion = scriptVersion; - this.classPathStrs = classPathStrs; - } - - public String getOutFile() { - return outFile; - } - - public String getFullScriptName() { - return fullScriptName; - } - - public String[] getClassPathStrs() { - return classPathStrs; - } - - public boolean isExe() { - return isExe; - } - - public ScriptVersionConfig getScriptVersion() { - return this.scriptVersion; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/config/TesterConfig.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/config/TesterConfig.java deleted file mode 100644 index 2104c19a608..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/config/TesterConfig.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.config; - -import java.io.Serializable; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.ote.core.test.tags.BaseTestTags; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class TesterConfig implements Xmlizable, Serializable { - - private static final long serialVersionUID = -6513354260245950581L; - private String name; - private String id; - private String email; - - public TesterConfig() { - name = ""; - id = ""; - email = ""; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public Element toXml(Document doc) { - Element testerElement = doc.createElement(BaseTestTags.EXECUTED_BY); - testerElement.appendChild(Jaxp.createElement(doc, BaseTestTags.NAME_FIELD, name)); - testerElement.appendChild(Jaxp.createElement(doc, BaseTestTags.BEMS_FIELD, id)); - testerElement.appendChild(Jaxp.createElement(doc, BaseTestTags.EMAIL_FIELD, email)); - return testerElement; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ConsoleCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ConsoleCommand.java deleted file mode 100644 index 3f3cfb34e59..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ConsoleCommand.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.console; - -import java.util.regex.Pattern; -import org.eclipse.osee.framework.jdk.core.util.Strings; - -public abstract class ConsoleCommand { - private static final Pattern SPLITTER = Pattern.compile("\\s"); - - private final String cmdName; - private final String description; - - private ConsoleShell shell; - - protected ConsoleCommand(String cmdName, String description) { - this.cmdName = cmdName; - this.description = description; - } - - public String getName() { - return cmdName; - } - - public String getDescription() { - return description; - } - - public final synchronized void execute(ConsoleShell shell, String switches, String args) { - this.shell = shell; - final String[] argArray; - if (Strings.isValid(args)) { - argArray = SPLITTER.split(args); - } else { - argArray = new String[0]; - } - final String[] switchesArray; - if (Strings.isValid(switches)) { - switchesArray = SPLITTER.split(switches); - } else { - switchesArray = new String[0]; - } - doCmd(shell, switchesArray, argArray); - } - - protected abstract void doCmd(ConsoleShell shell, String[] switches, String[] args); - - public void dispose() { - - } - - protected final void print(String msg) { - shell.print(msg); - } - - protected final void println(String msg) { - shell.println(msg); - } - - protected final void println() { - shell.println(); - } - - protected final void printStackTrace(Throwable t) { - shell.printStackTrace(t); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ConsoleCommandManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ConsoleCommandManager.java deleted file mode 100644 index 3a360c9002e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ConsoleCommandManager.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.console; - -import java.util.Collection; -import java.util.Hashtable; - -public class ConsoleCommandManager implements ICommandManager { - - private final Hashtable<String, ConsoleCommand> cmdMap = new Hashtable<>(64); - - private boolean isShutdown = false; - - @Override - public void registerCommand(ConsoleCommand cmd) { - if (!isShutdown) { - cmdMap.put(cmd.getName(), cmd); - } else { - throw new IllegalStateException("Can't register command: This manager has been shutdown"); - } - } - - @Override - public ConsoleCommand unregisterCommand(ConsoleCommand cmd) { - if (!isShutdown) { - return cmdMap.remove(cmd.getName()); - } else { - throw new IllegalStateException("Can't register command: This manager has been shutdown"); - } - } - - @Override - public ConsoleCommand getCommand(String name) { - return cmdMap.get(name); - } - - @Override - public Collection<ConsoleCommand> getCommands() { - return cmdMap.values(); - } - - public void shutdown() { - isShutdown = true; - for (ConsoleCommand cmd : cmdMap.values()) { - cmd.dispose(); - } - cmdMap.clear(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ConsoleShell.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ConsoleShell.java deleted file mode 100644 index 1025085ae6a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ConsoleShell.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.console; - -import java.lang.ref.WeakReference; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public abstract class ConsoleShell { - private static final Pattern CMD_PATTERN = Pattern.compile("^(\\S+)\\s*((-[a-zA-Z]\\S*\\s*)*)\\s*((\\S+(\\s+|$))*)"); - - private final WeakReference<ICommandManager> manager; - private volatile ConsoleCommand lastCmd; - private volatile String lastSwitches; - private volatile String lastArgs; - private boolean saveLastCmdFlag = true; - - public ConsoleShell(ICommandManager manager) { - this.manager = new WeakReference<>(manager); - } - - public abstract void println(String string); - - public abstract void print(String string); - - public abstract void println(); - - public ICommandManager getCommandManager() { - return manager.get(); - } - - public void runLast() { - lastCmd.execute(this, lastSwitches, lastArgs); - } - - public final void parseAndExecuteCmd(String line) throws Throwable { - final Matcher matcher = CMD_PATTERN.matcher(line); - if (matcher.matches()) { - String cmdName = matcher.group(1); - String switches = matcher.group(2); - String args = matcher.group(4); - final ConsoleCommand cmd = getCommandManager().getCommand(cmdName); - if (cmd != null) { - cmd.execute(this, switches, args); - if (saveLastCmdFlag) { - lastCmd = cmd; - lastSwitches = switches; - lastArgs = args; - } else { - // we do not save the last command as instructed but we reset the flag - saveLastCmdFlag = true; - } - } else { - println(cmdName + " is not recognized as a command"); - } - } else { - println("invalid command format"); - } - } - - /** - * Prevents the currently running command from being saved as the last executed command. This is useful for commands - * that process the last executed command but do not want themselves to become the last command executed - */ - public void setSaveLastCmdFlag(boolean save) { - saveLastCmdFlag = save; - } - - public void printStackTrace(Throwable t) { - println(t.toString() + ":"); - StackTraceElement[] elements = t.getStackTrace(); - for (int i = 0; i < elements.length; i++) { - println(" " + elements[i].toString()); - } - t = t.getCause(); - while (t != null) { - println("Caused by: " + t.toString()); - elements = t.getStackTrace(); - for (int i = 0; i < elements.length; i++) { - println(" " + elements[i].toString()); - } - t = t.getCause(); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ICommandManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ICommandManager.java deleted file mode 100644 index 96628865f95..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/ICommandManager.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.console; - -import java.util.Collection; - -public interface ICommandManager { - - public void registerCommand(ConsoleCommand cmd); - - public ConsoleCommand unregisterCommand(ConsoleCommand cmd); - - public ConsoleCommand getCommand(String name); - - public Collection<ConsoleCommand> getCommands(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/BenchmarkCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/BenchmarkCommand.java deleted file mode 100644 index 5a2d81d40c7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/BenchmarkCommand.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.console.cmd; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.PrintWriter; -import java.util.Iterator; -import java.util.Map; -import org.eclipse.osee.framework.jdk.core.util.benchmark.Benchmark; -import org.eclipse.osee.ote.core.environment.console.ConsoleCommand; -import org.eclipse.osee.ote.core.environment.console.ConsoleShell; - -/** - * @author Ken J. Aguilar - */ -public class BenchmarkCommand extends ConsoleCommand { - private static final String NAME = "b"; - private static final String DESCRIPTION = "outputs results from the benchmarking utility"; - - public BenchmarkCommand() { - super(NAME, DESCRIPTION); - } - - @Override - protected void doCmd(ConsoleShell shell, String[] switches, String[] args) { - if (Benchmark.isBenchmarkingEnabled()) { - if (switches.length > 0) { - processSwitches(switches, args); - } - print("Current Benchmarks\n"); - final StringBuilder buffer = new StringBuilder(4096); - final Iterator<Benchmark> iter = Benchmark.getAllBenchamrks().iterator(); - while (iter.hasNext()) { - Benchmark bm = iter.next(); - float val = bm.getLongestSample() / 1000.0f; - buffer.append(bm.getName()).append(": total samples: ").append(bm.getTotalSamples()); - buffer.append(". Max Time: ").append(val).append("ms. Min: "); - val = bm.getShortestSample() / 1000.0f; - buffer.append(val).append("ms. Avg: "); - val = bm.getAverage() / 1000.0f; - buffer.append(val).append("ms. Exceed Count: ").append(bm.getExceedCount()).append(" (threshold=").append( - bm.getThreshold() / 1000.0f); - val = bm.getAverageExceedAmount() / 1000.0f; - buffer.append("ms) avg. exceed time: ").append(val).append("ms\n"); - for (Map.Entry<String, Integer> entry : bm.getExceeders()) { - buffer.append("\tExceeder ").append(entry.getKey()).append(": counted ").append(entry.getValue()).append( - '\n'); - } - } - print(buffer.toString()); - } else { - print("Benchmarks disabled\n"); - } - } - - private void processSwitches(String[] switches, String[] args) { - for (String sw : switches) { - if (sw.equals("-f")) { - try { - writeToCSV(args[0]); - println("wrote results to file " + args[0]); - } catch (Exception e) { - printStackTrace(e); - } - } else if (sw.equals("-r")) { - Benchmark.resetAll(); - println("benchmarks reset"); - } else { - println("unknown switch '" + sw + "'"); - } - } - } - - private void writeToCSV(String fileName) throws FileNotFoundException { - File file = new File(fileName); - BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file)); - PrintWriter out = new PrintWriter(bos); - final Iterator<Benchmark> iter = Benchmark.getAllBenchamrks().iterator(); - out.println("NAME,TOTAL SAMPLES,MAX TIME,MIN TIME,AVG TIME,EXCEED CNT,THRESHOLD,AVG EXCEED TIME,EXCEEDERS"); - while (iter.hasNext()) { - final Benchmark bm = iter.next(); - out.format("%s,%d,%f,%f,%f,%d,%f,%f", bm.getName(), bm.getTotalSamples(), bm.getLongestSample() / 1000.0f, - bm.getShortestSample() / 1000.0f, bm.getAverage() / 1000.0f, bm.getExceedCount(), - bm.getThreshold() / 1000.0f, bm.getAverageExceedAmount() / 1000.0f); - for (Map.Entry<String, Integer> entry : bm.getExceeders()) { - out.format(",Exceeder %s:%d", entry.getKey(), entry.getValue()); - } - out.println(); - } - out.close(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/HostCmd.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/HostCmd.java deleted file mode 100644 index ae043a3c409..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/HostCmd.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.console.cmd; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import org.eclipse.osee.ote.core.environment.console.ConsoleCommand; -import org.eclipse.osee.ote.core.environment.console.ConsoleShell; - -/** - * @author Ken J. Aguilar - */ -public class HostCmd extends ConsoleCommand { - - private static final String NAME = "host"; - private static final String DESCRIPTION = "displays the local host"; - - public HostCmd() { - super(NAME, DESCRIPTION); - } - - @Override - protected void doCmd(ConsoleShell shell, String[] switches, String[] args) { - try { - println(InetAddress.getLocalHost().toString()); - } catch (UnknownHostException e) { - println("problems getting local host"); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/LastCmd.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/LastCmd.java deleted file mode 100644 index 4dd4d1e46ec..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/LastCmd.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.console.cmd; - -import org.eclipse.osee.ote.core.environment.console.ConsoleCommand; -import org.eclipse.osee.ote.core.environment.console.ConsoleShell; - -/** - * @author Ken J. Aguilar - */ -public class LastCmd extends ConsoleCommand { - - private static final String NAME = "lc"; - private static final String DESCRIPTION = "Executes the last command executed"; - - public LastCmd() { - super(NAME, DESCRIPTION); - } - - @Override - protected void doCmd(ConsoleShell shell, String[] switches, String[] args) { - shell.runLast(); - shell.setSaveLastCmdFlag(false); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/ListSystemPropertiesCmd.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/ListSystemPropertiesCmd.java deleted file mode 100644 index a575962895b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/ListSystemPropertiesCmd.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.console.cmd; - -import java.util.Map; -import java.util.Properties; -import org.eclipse.osee.ote.core.environment.console.ConsoleCommand; -import org.eclipse.osee.ote.core.environment.console.ConsoleShell; - -/** - * @author Ken J. Aguilar - */ -public class ListSystemPropertiesCmd extends ConsoleCommand { - private static final String NAME = "sys_props"; - private static final String DESCRIPTION = "list JVM system properties"; - - public ListSystemPropertiesCmd() { - super(NAME, DESCRIPTION); - } - - @Override - protected void doCmd(ConsoleShell shell, String[] switches, String[] args) { - Properties props = System.getProperties(); - if (args.length == 0) { - for (Map.Entry<Object, Object> entry : props.entrySet()) { - println(entry.getKey() + "=" + entry.getValue()); - } - } else { - for (String arg : args) { - String val = System.getProperty(arg); - if (val != null) { - println(arg + "=" + val); - } else { - println("no property defined for " + arg); - } - } - } - - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/MemoryUsageCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/MemoryUsageCommand.java deleted file mode 100644 index 4dc4173d445..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/console/cmd/MemoryUsageCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.console.cmd; - -import java.text.NumberFormat; -import org.eclipse.osee.ote.core.environment.console.ConsoleCommand; -import org.eclipse.osee.ote.core.environment.console.ConsoleShell; - -/** - * @author Ken J. Aguilar - */ -public class MemoryUsageCommand extends ConsoleCommand { - private static final String NAME = "mem"; - private static final String DESCRIPTION = "outputs the system memory used by this JVM"; - - public MemoryUsageCommand() { - super(NAME, DESCRIPTION); - } - - @Override - public void doCmd(ConsoleShell shell, String[] switches, String[] args) { - - print("JVM Heap space allocated: " + NumberFormat.getInstance().format(Runtime.getRuntime().totalMemory()) + "\n"); - print("JVM Heap space used:" + NumberFormat.getInstance().format( - Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) + "\n"); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/BasicTimeout.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/BasicTimeout.java deleted file mode 100644 index 53169be1685..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/BasicTimeout.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -public class BasicTimeout implements ITimeout { - - private volatile boolean timeout; - - @Override - public boolean isTimedOut() { - return timeout; - } - - @Override - public void setTimeout(boolean timeout) { - this.timeout = timeout; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IAssociatedObjectListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IAssociatedObjectListener.java deleted file mode 100644 index de0f3cf20ed..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IAssociatedObjectListener.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -public interface IAssociatedObjectListener extends Remote { - void updateAssociatedListener() throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ICancelTimer.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ICancelTimer.java deleted file mode 100644 index 9a85de16631..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ICancelTimer.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public interface ICancelTimer { - public void cancelTimer(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IEnvironmentFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IEnvironmentFactory.java deleted file mode 100644 index d5c54512b75..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IEnvironmentFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import org.eclipse.osee.ote.core.framework.ICommandContextFactory; -import org.eclipse.osee.ote.core.framework.IRunManager; -import org.eclipse.osee.ote.core.framework.command.ICommandManager; - -public interface IEnvironmentFactory { - - ITimerControl getTimerControl(); - - IScriptControl getScriptControl(); - - IReportData getReportDataControl(); - - ITestLogger getTestLogger(); - - ICommandManager getCommandManager(); - - IRunManager getRunManager(); - - ICommandContextFactory getCommandContextFactory(); - - IRuntimeLibraryManager getRuntimeManager(); - - ITestStation getTestStation(); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IExecutionUnitManagement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IExecutionUnitManagement.java deleted file mode 100644 index 4cce3f4e4b3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IExecutionUnitManagement.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import org.eclipse.osee.ote.core.TestException; - -/** - * This interface provides the basic abilities that must be able to be performed on any ExecutionUnit being run by the - * system. All classes which provide control over an ExecutionUnit should implement at least this interface so the - * environments can make use of them. - * - * @author Robert A. Fisher - */ -public interface IExecutionUnitManagement { - public void startExecutionUnit() throws Exception; - - public void setupExecutionUnit(Object execUnitConfig) throws Exception; - - public void runPrimaryOneCycle() throws InterruptedException, TestException; - - public void stopExecutionUnit() throws InterruptedException; - - public void init() throws Exception; - - public void dispose(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java deleted file mode 100644 index 9faa3bd01cb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IHostTestEnvironment.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.UUID; - -import org.eclipse.osee.framework.jdk.core.util.EnhancedProperties; -import org.eclipse.osee.ote.core.ConnectionRequestResult; -import org.eclipse.osee.ote.core.IRemoteUserSession; -import org.eclipse.osee.ote.core.environment.TestEnvironmentConfig; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IHostTestEnvironment extends Remote { - EnhancedProperties getProperties() throws RemoteException; - - ConnectionRequestResult requestEnvironment(IRemoteUserSession session, UUID id, TestEnvironmentConfig config) throws RemoteException; - void disconnect(UUID sessionId) throws RemoteException; - -// public NodeInfo getBroker() throws RemoteException; - - public String getHttpURL() throws RemoteException; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IOTypeDefinition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IOTypeDefinition.java deleted file mode 100644 index a10acd53f64..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IOTypeDefinition.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IOTypeDefinition { - String getName(); - - String getDescription(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IOTypeHandlerDefinition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IOTypeHandlerDefinition.java deleted file mode 100644 index ca426ed4254..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IOTypeHandlerDefinition.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.util.List; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IOTypeHandlerDefinition { - String getName(); - - String getDescription(); - - List<IOTypeDefinition> getIOTypesHandled(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IOutfileResults.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IOutfileResults.java deleted file mode 100644 index 9dce77abc3d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IOutfileResults.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.io.File; - -public interface IOutfileResults { - public File genOutfileResults(ITestEnvironmentServiceConfig serverConfig); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRemoteCommandConsole.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRemoteCommandConsole.java deleted file mode 100644 index a8c90b4807f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRemoteCommandConsole.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -/** - * @author Ken J. Aguilar - */ -public interface IRemoteCommandConsole extends Remote { - public String doCommand(String cmd) throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IReportData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IReportData.java deleted file mode 100644 index f3a96abd9c4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IReportData.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.util.List; -import org.eclipse.osee.framework.jdk.core.reportdata.ReportDataListener; - -public interface IReportData { - // void addQueueListener(ReportDataListener listener, List<TestEnvironmentCommand> cmds); - void addQueueListener(ReportDataListener listener, List cmds); - - void removeQueueListener(ReportDataListener listener); - - // void updateQueueListeners(List<TestEnvironmentCommand> cmds); - void updateQueueListeners(List cmds); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRuntimeLibraryManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRuntimeLibraryManager.java deleted file mode 100644 index e8ce60952ca..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IRuntimeLibraryManager.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.ote.Configuration; -import org.eclipse.osee.ote.ConfigurationStatus; -import org.eclipse.osee.ote.OTEStatusCallback; - -/** - * An interface for loading and installing bundles in the running test environment. - * - * @author Andrew M. Finkbeiner - * - */ -public interface IRuntimeLibraryManager extends XmlizableStream { - - Class<?> loadFromScriptClassLoader(String path) throws ClassNotFoundException; - - Class<?> loadFromRuntimeLibraryLoader(String path) throws ClassNotFoundException; - - boolean installed(); - - boolean uninstall(OTEStatusCallback<ConfigurationStatus> callable); - - boolean install(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable); - - boolean start(OTEStatusCallback<ConfigurationStatus> callable); - - void clearJarCache(); - - boolean acquireBundles(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable); - - void resetScriptLoader(Configuration configuration, String[] strings) throws Exception; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IScriptCompleteListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IScriptCompleteListener.java deleted file mode 100644 index 729049df9e7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IScriptCompleteListener.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IScriptCompleteListener { - - void onScriptComplete(); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IScriptControl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IScriptControl.java deleted file mode 100644 index 4758e2fa238..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IScriptControl.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -public interface IScriptControl { - - boolean isExecutionUnitPaused(); - - boolean isScriptPaused(); - - boolean isScriptReady(); - - boolean isLocked(); - - void lock(); - - void setExecutionUnitPause(boolean pause); - - void setScriptPause(boolean pause); - - void setScriptReady(boolean ready); - - boolean shouldStep(); - - void unlock(); - - boolean hasLock(); - - boolean isHeldByCurrentThread(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IScriptInitializer.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IScriptInitializer.java deleted file mode 100644 index ddc27e08ab1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IScriptInitializer.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -/** - * @author Andy Jury - * @author Charles Shaw - */ -public interface IScriptInitializer { - - public void doScriptInitialProcessing() throws Exception; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IServiceCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IServiceCommand.java deleted file mode 100644 index bf32ff2b8b9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/IServiceCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -public interface IServiceCommand { - - public abstract void execute(TestEnvironment environment); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java deleted file mode 100644 index b20870af5be..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironment.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import org.eclipse.osee.ote.core.model.IModelManagerRemote; -import org.eclipse.osee.ote.message.IInstrumentationRegistrationListener; - -/** - * @author Andrew M. Finkbeiner - */ -public interface ITestEnvironment extends Remote { - - Remote getControlInterface(String controlInterfaceID) throws RemoteException; - - IRemoteCommandConsole getCommandConsole() throws RemoteException; - public void closeCommandConsole(IRemoteCommandConsole console) throws RemoteException; - - public IModelManagerRemote getModelManager() throws RemoteException; - - byte[] getScriptOutfile(String outfilePath) throws RemoteException; - - int getUniqueId() throws RemoteException; - - public void setBatchMode(boolean isBatched) throws RemoteException; - -// public void sendMessage(Message message) throws RemoteException; - - void addInstrumentationRegistrationListener(IInstrumentationRegistrationListener listener) throws RemoteException; - - void removeInstrumentationRegistrationListener(IInstrumentationRegistrationListener listener) throws RemoteException; - - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironmentAccessor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironmentAccessor.java deleted file mode 100644 index 613732993da..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironmentAccessor.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.util.Set; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.EnvironmentTask; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public interface ITestEnvironmentAccessor { - void abortTestScript(); - - void abortTestScript(Throwable t); - - boolean addTask(EnvironmentTask task); - - void associateObject(Class<?> c, Object obj); - - Object getAssociatedObject(Class<?> c); - - Set<Class<?>> getAssociatedObjects(); - - TestScript getTestScript(); - - long getEnvTime(); - - IExecutionUnitManagement getExecutionUnitManagement(); - - ITestLogger getLogger(); - - IScriptControl getScriptCtrl(); - - ITestStation getTestStation(); - - ITimerControl getTimerCtrl(); - - void onScriptComplete() throws InterruptedException; - - void onScriptSetup(); - - ICancelTimer setTimerFor(ITimeout listener, int time); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironmentListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironmentListener.java deleted file mode 100644 index 57532130e65..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironmentListener.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; -import org.eclipse.osee.ote.core.environment.command.TestEnvironmentCommand; -import org.eclipse.osee.ote.core.environment.status.CommandEndedStatusEnum; -import org.eclipse.osee.ote.core.framework.command.ICommandHandle; - -public interface ITestEnvironmentListener { - void onEnvironmentKilled(TestEnvironment env); - - void onCommandAdded(TestEnvironment env, TestEnvironmentCommand cmd); - - void onCommandBegan(TestEnvironment env, CommandDescription cmdDesc); - - void onCommandFinished(TestEnvironment env, CommandDescription cmdDesc, CommandEndedStatusEnum status); - - void onTestServerCommandFinished(TestEnvironment env, ICommandHandle handle); - - void onCommandRemoved(TestEnvironment env, CommandDescription cmdDesc, CommandEndedStatusEnum status); - - void onException(String message, Throwable t); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironmentServiceConfig.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironmentServiceConfig.java deleted file mode 100644 index 60bff94eed4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestEnvironmentServiceConfig.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.lang.reflect.Constructor; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -public interface ITestEnvironmentServiceConfig { - /** - * gets the maximum number of environments allowed in this service - */ - public int getMaxEnvironments(); - - public int getMaxUsersPerEnvironment(); - - public String getName(); - - public String getServerTitle(); - - public String getOutfileLocation(); - - /** - * gets the Constructor for the creating new environments - */ - public Constructor<? extends TestEnvironment> getEnvironmentConstructor(); - - /** - * gets the parameter instances need to calling the constructor when new environments are created - */ - public Object[] getConstructorParameters(); - - /** - * tells whether the environment should stay running when the last user disconnects - * - * @return true if the environment should stay active when no users are connected or false otherwise - */ - public boolean keepEnvAliveWithNoUsers(); - - /** - * returns whether an environment should be created and started up upon service initialization - * - * @return true if an environment should be started up or false if no evionment should be created until requested - */ - public boolean startEnvionrmnetOnServiceInit(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestGroup.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestGroup.java deleted file mode 100644 index e4235e47ab9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestGroup.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.util.ArrayList; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.annotate.JsonSubTypes; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.core.testPoint.RetryGroup; - -/** - * The TestPoint interface should be implemented by objects that store pass/fail - * data. - * - * @author Robert A. Fisher - */ -@JsonSubTypes({ @JsonSubTypes.Type(value = CheckGroup.class), // - @JsonSubTypes.Type(value = RetryGroup.class) }) -public interface ITestGroup extends ITestPoint { - public int size(); - - @JsonProperty - public ArrayList<ITestPoint> getTestPoints(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestLogger.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestLogger.java deleted file mode 100644 index 0aad8b0d0d1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestLogger.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.util.logging.Handler; -import java.util.logging.Level; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.ReturnFormatter; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.log.record.TestPointRecord; -import org.eclipse.osee.ote.core.log.record.TestRecord; - -public interface ITestLogger { - public void addHandler(Handler handler); - - public void debug(ITestEnvironmentAccessor source, String message); - - public void debug(ITestEnvironmentAccessor source, String message, boolean timeStamp); - - public void info(String message); - - public void log(TestRecord record); - - public void log(Level level, String message, Throwable th); - - public void methodCalled(ITestEnvironmentAccessor source); - - public void methodCalled(ITestEnvironmentAccessor source, MethodFormatter methodFormat); - - public void methodCalledOnObject(ITestEnvironmentAccessor source, String objectName); - - public void methodCalledOnObject(ITestEnvironmentAccessor source, String objectName, MethodFormatter methodFormat); - - public void methodCalledOnObject(ITestEnvironmentAccessor source, String objectName, MethodFormatter methodFormat, Xmlizable xmlObject); - - public void methodEnded(ITestEnvironmentAccessor source); - - public void methodEnded(ITestEnvironmentAccessor source, ReturnFormatter returnFormatter); - - public void removeHandler(Handler handler); - - public void support(ITestEnvironmentAccessor source, String message); - - public void severe(ITestEnvironmentAccessor source, String message); - - public void severe(Object source, Throwable thrown); - - public void severe(String message); - - public void testCaseBegan(TestCase testCase); - - public void testpoint(ITestEnvironmentAccessor env, TestScript script, TestCase testCase, boolean passed, String testPointName, String expected, String actual); - - public void testpoint(ITestEnvironmentAccessor env, TestScript script, TestCase testCase, ITestPoint testPoint); - - public void testpoint(TestPointRecord record); - - public void warning(ITestEnvironmentAccessor source, String message); - - public void warning(String message); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestPoint.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestPoint.java deleted file mode 100644 index dbad799d46e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestPoint.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.annotate.JsonSubTypes; -import org.codehaus.jackson.annotate.JsonTypeInfo; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.ote.core.testPoint.CheckPoint; - -/** - * The TestPoint interface should be implemented by objects that store pass/fail - * data. - * - * @author Robert A. Fisher - */ -public interface ITestPoint extends Xmlizable, XmlizableStream { - @JsonProperty - public boolean isPass(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestStation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestStation.java deleted file mode 100644 index 3679216f202..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITestStation.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import java.util.List; - -/** - * @author Robert A. Fisher - */ -public interface ITestStation { - - public String getOutletIp(); - - public void setOutletIp(String outletIp); - - public int getOutletPort(); - - public void setOutletPort(int outletPort); - - public String getVmeConnectionName(); - - public void turnPowerSupplyOnOff(boolean turnOn); - - public List<IOTypeHandlerDefinition> getSupportedDriverTypes(); - - public boolean isPhysicalTypeAvailable(IOTypeDefinition physicalType); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITimeTypeControl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITimeTypeControl.java deleted file mode 100644 index 7b9fe58b104..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITimeTypeControl.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -public interface ITimeTypeControl { - - void step(); - - ICancelTimer setTimerFor(Object objToNotify, int milliseconds); - - long getEnvTime(); - - void singleStepEnv(); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITimeout.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITimeout.java deleted file mode 100644 index 5f3bbbf3bba..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITimeout.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -public interface ITimeout { - boolean isTimedOut(); - - void setTimeout(boolean timeout); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITimerControl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITimerControl.java deleted file mode 100644 index dc96aa66f00..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/ITimerControl.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -import org.eclipse.osee.ote.core.environment.EnvironmentTask; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.IRunManager; - -public interface ITimerControl { - void addTask(EnvironmentTask task, TestEnvironment environment); - - void removeTask(EnvironmentTask task); - - void cancelTimers(); - - long getEnvTime(); - - ICancelTimer setTimerFor(ITimeout objToNotify, int milliseconds); - - void envWait(ITimeout obj, int milliseconds) throws InterruptedException; - - void envWait(int milliseconds) throws InterruptedException; - - int getCycleCount(); - - void incrementCycleCount(); - - void setCycleCount(int cycle); - - void dispose(); - - public void cancelAllTasks(); - - public void step(); - - long getTimeOfDay(); - - public void setRunManager(IRunManager runManager); - - public IRunManager getRunManager(); - - public boolean isRealtime(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/OteUtil.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/OteUtil.java deleted file mode 100644 index c900d78f20d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/OteUtil.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -public class OteUtil { - - public static String generateBundleVersionString(String bundleSpecificVersion, String symbolicName, String version, String md5) { - StringBuilder sb = new StringBuilder(); - if (bundleSpecificVersion != null) { - sb.append(bundleSpecificVersion); - sb.append("_"); - } - sb.append(symbolicName); - sb.append("_"); - sb.append(version); - sb.append("_"); - sb.append(md5); - return sb.toString(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/RuntimeLibraryListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/RuntimeLibraryListener.java deleted file mode 100644 index 90ead44f705..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/interfaces/RuntimeLibraryListener.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.interfaces; - -/** - * @author Andrew M. Finkbeiner - */ -public interface RuntimeLibraryListener { - void onPostRuntimeLibraryUpdated(ClassLoader classloader); - - void onRuntimeLibraryUnload(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsolePrintStream.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsolePrintStream.java deleted file mode 100644 index dbfbe516144..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsolePrintStream.java +++ /dev/null @@ -1,234 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.jini; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.IUserSession; -import org.eclipse.osee.ote.core.environment.AsynchRemoteJobs; -import org.eclipse.osee.ote.core.environment.ConsoleOutputJob; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -/** - * @author Andrew M. Finkbeiner - */ -public class EclipseConsolePrintStream extends PrintStream { - - private final IUserSession callback; - private final StringBuffer builder; - - public EclipseConsolePrintStream(OutputStream stream, IUserSession callback) { - super(stream); - this.callback = callback; - builder = new StringBuffer(); - } - - public EclipseConsolePrintStream(final InputStream instream, final OutputStream outstream, IUserSession callback) { - this(outstream, callback); - - new Thread(new Runnable() { - - @Override - public void run() { - try { - String line; - BufferedReader in = new BufferedReader(new InputStreamReader(instream)); - while ((line = in.readLine()) != null) { - println(line); - } - flush(); - } catch (IOException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - } - }).start(); - } - - // public void write(byte[] cbuf, int off, int len) { - // super.write(cbuf, off, len); - // buffer.append(cbuf, off, len); - // masterBuffer.append(cbuf, off, len); - // } - - @Override - public void flush() { - if (builder.length() == 0) { - return; - } - AsynchRemoteJobs.getInstance(this).addJob(new ConsoleOutputJob(callback, builder.toString())); - builder.delete(0, builder.length()); - } - - @Override - public void close() { - flush(); - } - - //public PrintStream append(char c) { - // return super.append(c); - //} - //public PrintStream append(CharSequence csq, int start, int end) { - // CharSequence cs = (csq == null ? "null" : csq); - // write(cs.subSequence(start, end).toString()); - // return super.append(csq, start, end); - //} - //public PrintStream append(CharSequence csq) { - // return super.append(csq); - //} - @Override - public boolean checkError() { - return super.checkError(); - } - - //public PrintStream format(Locale l, String format, Object[] args) { - // return super.format(l, format, args); - //} - //public PrintStream format(String format, Object[] args) { - // return super.format(format, args); - //} - - private void newLine() { - flush(); - } - - @Override - public void print(boolean b) { - builder.append(b ? "true" : "false"); - super.print(b); - } - - @Override - public void print(char c) { - builder.append(c); - super.print(c); - } - - @Override - public void print(char[] s) { - builder.append(s); - super.print(s); - } - - @Override - public void print(double d) { - builder.append(d); - super.print(d); - } - - @Override - public void print(float f) { - builder.append(f); - super.print(f); - } - - @Override - public void print(int i) { - builder.append(i); - super.print(i); - } - - @Override - public void print(long l) { - builder.append(l); - super.print(l); - } - - @Override - public void print(Object obj) { - builder.append(String.valueOf(obj)); - super.print(obj); - } - - @Override - public void print(String s) { - builder.append(s); - super.print(s); - } - - //public PrintStream printf(Locale l, String format, Object[] args) { - // return super.printf(l, format, args); - //} - //public PrintStream printf(String format, Object[] args) { - // return super.printf(format, args); - //} - @Override - public void println() { - super.println(); - newLine(); - } - - @Override - public void println(boolean x) { - super.println(x); - newLine(); - } - - @Override - public void println(char x) { - super.println(x); - newLine(); - } - - @Override - public void println(char[] x) { - super.println(x); - newLine(); - } - - @Override - public void println(double x) { - newLine(); - super.println(x); - } - - @Override - public void println(float x) { - super.println(x); - newLine(); - } - - @Override - public void println(int x) { - super.println(x); - newLine(); - } - - @Override - public void println(long x) { - super.println(x); - newLine(); - } - - @Override - public void println(Object x) { - super.println(x); - newLine(); - } - - @Override - public void println(String x) { - super.println(x); - newLine(); - } - - @Override - public void write(int b) { - builder.append(b); - super.write(b); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsoleWriter.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsoleWriter.java deleted file mode 100644 index 2adfe48b52d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/EclipseConsoleWriter.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.jini; - -import java.io.IOException; -import java.io.Writer; - -import org.eclipse.osee.ote.core.IUserSession; - -/** - * @author Andrew M. Finkbeiner - */ -public class EclipseConsoleWriter extends Writer { - - private final IUserSession callback; - private final StringBuffer buffer; - private StringBuffer masterBuffer; - - public EclipseConsoleWriter(IUserSession callback, boolean createMasterBuffer) { - this.callback = callback; - buffer = new StringBuffer(256); - masterBuffer = new StringBuffer(256); - } - - public EclipseConsoleWriter(IUserSession callback) { - this.callback = callback; - buffer = new StringBuffer(256); - } - - @Override - public synchronized void write(char[] cbuf, int off, int len) { - buffer.append(cbuf, off, len); - if(masterBuffer != null){ - masterBuffer.append(cbuf, off, len); - } - } - - @Override - public synchronized void flush() throws IOException { - if (buffer.length() > 0 && buffer.charAt(buffer.length() - 1) == '\n') { - buffer.deleteCharAt(buffer.length() - 1); - } - try { - callback.initiateInformationalPrompt(buffer.toString()); - } catch (Exception ex) { - System.out.println(buffer.toString()); - } - buffer.delete(0, buffer.length()); - } - - @Override - public synchronized void close() throws IOException { - flush(); - } - - public synchronized String getAllOutput() { - if(masterBuffer != null){ - return masterBuffer.toString(); - } else { - return "MASTER BUFFER NOT ENABLED"; - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/ITestEnvironmentCommandCallback.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/ITestEnvironmentCommandCallback.java deleted file mode 100644 index 4123412a832..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/ITestEnvironmentCommandCallback.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.jini; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import org.eclipse.osee.ote.core.TestPrompt; -import org.eclipse.osee.ote.core.environment.status.ExceptionEvent; - -/** - * @author Andrew M. Finkbeiner - */ -public interface ITestEnvironmentCommandCallback extends Remote { - void initiatePrompt(TestPrompt prompt) throws RemoteException; - - void exceptionReceived(ExceptionEvent event) throws RemoteException; - - long getFileDate(String workspacePath) throws RemoteException; - - byte[] getFile(String workspacePath) throws RemoteException; - - Object[] getValues(String key) throws RemoteException; - - boolean isAlive() throws RemoteException; - - String getFileVersion(String workspacePath) throws RemoteException; - - String getAddress() throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/InputStreamConnection.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/InputStreamConnection.java deleted file mode 100644 index f529fe32951..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/jini/InputStreamConnection.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.jini; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.io.PrintWriter; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -public class InputStreamConnection extends PipedInputStream { - - private final PrintWriter writer; - - public InputStreamConnection() { - PipedOutputStream piped = new PipedOutputStream(); - writer = new PrintWriter(piped); - try { - this.connect(piped); - } catch (IOException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - } - - public InputStreamConnection(OutputStream output) { - writer = new PrintWriter(output); - } - - public void write(String string) { - writer.println(string); - writer.flush(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandAdded.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandAdded.java deleted file mode 100644 index 27701767057..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandAdded.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; - -public class CommandAdded implements IServiceStatusDataCommand, Serializable { - - private static final long serialVersionUID = -2555474494093618398L; - - private CommandDescription description; - - public CommandAdded(CommandDescription description) { - this.description = description; - } - - public CommandAdded() { - } - - @Override - public CommandDescription getDescription() { - return description; - } - - public void set(CommandDescription description) { - this.description = description; - } - - @Override - public void accept(IServiceStatusDataVisitor visitor) { - if (visitor != null) { - visitor.asCommandAdded(this); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandEndedStatusEnum.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandEndedStatusEnum.java deleted file mode 100644 index 3be3942b85f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandEndedStatusEnum.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -public enum CommandEndedStatusEnum { - - UNDEFINED, - ABORTED, - HUNG, - EXCEPTION, - RAN_TO_COMPLETION; -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandRemoved.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandRemoved.java deleted file mode 100644 index 536c3a08fdf..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandRemoved.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; - -public class CommandRemoved implements Serializable, IServiceStatusDataCommand { - - private static final long serialVersionUID = -177791874608013281L; - private CommandDescription description; - private CommandEndedStatusEnum reason; - - public CommandRemoved(CommandDescription description, CommandEndedStatusEnum reason) { - this.description = description; - this.reason = reason; - } - - public CommandRemoved() { - } - - @Override - public CommandDescription getDescription() { - return description; - } - - public void setDescription(CommandDescription description) { - this.description = description; - } - - public void setReason(CommandEndedStatusEnum reason) { - this.reason = reason; - } - - public CommandEndedStatusEnum getReason() { - return reason; - } - - @Override - public void accept(IServiceStatusDataVisitor visitor) { - if (visitor != null) { - visitor.asCommandRemoved(this); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandStatusEvent.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandStatusEvent.java deleted file mode 100644 index 27c4fa3c00b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/CommandStatusEvent.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class CommandStatusEvent implements Serializable { - - private static final long serialVersionUID = -567005567921815848L; - private final CommandDescription description; - - /** - * CommandStatusEvent Constructor. - * - * @param description The command description. - */ - public CommandStatusEvent(CommandDescription description) { - super(); - this.description = description; - } - - /** - * @return Returns the description. - */ - public CommandDescription getDescription() { - return description; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/EnvironmentError.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/EnvironmentError.java deleted file mode 100644 index e902db4f2c4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/EnvironmentError.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; - -public class EnvironmentError implements IServiceStatusData, Serializable { - - private static final long serialVersionUID = -7077313410529981519L; - private Throwable err; - - public EnvironmentError(Throwable err) { - this.err = err; - } - - public EnvironmentError() { - } - - public Throwable getErr() { - return err; - } - - public void set(Throwable err) { - this.err = err; - } - - @Override - public void accept(IServiceStatusDataVisitor visitor) { - if (visitor != null) { - visitor.asEnvironmentError(this); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/ExceptionEvent.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/ExceptionEvent.java deleted file mode 100644 index a5a42fd9758..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/ExceptionEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class ExceptionEvent extends CommandStatusEvent implements Serializable { - - private static final long serialVersionUID = -831107014787093973L; - private final Throwable throwable; - - public ExceptionEvent(CommandDescription description, Throwable exception) { - super(description); - this.throwable = exception; - } - - public Throwable getException() { - return this.throwable; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/IServiceStatusData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/IServiceStatusData.java deleted file mode 100644 index a9006a1c21d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/IServiceStatusData.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; - -public interface IServiceStatusData extends Serializable { - - public void accept(IServiceStatusDataVisitor visitor); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/IServiceStatusDataCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/IServiceStatusDataCommand.java deleted file mode 100644 index e6954373b79..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/IServiceStatusDataCommand.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import org.eclipse.osee.ote.core.environment.command.CommandDescription; - -/** - * @author Roberto E. Escobar - */ -public interface IServiceStatusDataCommand extends IServiceStatusData { - - public CommandDescription getDescription(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/IServiceStatusDataVisitor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/IServiceStatusDataVisitor.java deleted file mode 100644 index 51fae4c3616..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/IServiceStatusDataVisitor.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -/** - * @author Roberto E. Escobar - */ -public interface IServiceStatusDataVisitor { - - public void asCommandAdded(CommandAdded commandAdded); - - public void asCommandRemoved(CommandRemoved commandRemoved); - - public void asEnvironmentError(EnvironmentError environmentError); - - public void asSequentialCommandBegan(SequentialCommandBegan sequentialCommandBegan); - - public void asSequentialCommandEnded(SequentialCommandEnded sequentialCommandEnded); - - public void asTestPointUpdate(TestPointUpdate testPointUpdate); - - public void asTestServerCommandComplete(TestServerCommandComplete end); - - public void asTestComplete(TestComplete testComplete); - - public void asTestStart(TestStart testStart); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/OTEStatusBoard.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/OTEStatusBoard.java deleted file mode 100644 index b4704338dfe..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/OTEStatusBoard.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.util.List; - -import org.eclipse.osee.framework.logging.IHealthStatus; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; -import org.eclipse.osee.ote.core.environment.command.TestEnvironmentCommand; -import org.eclipse.osee.ote.core.framework.command.ICommandHandle; - -/** - * @author Andrew M. Finkbeiner - */ -public interface OTEStatusBoard { - public void onCommandAdded(TestEnvironment env, TestEnvironmentCommand cmd); - - public void onCommandRemoved(TestEnvironment env, CommandDescription cmdDesc, CommandEndedStatusEnum status); - - public void onException(String message, Throwable t); - - public void onCommandBegan(TestEnvironment env, CommandDescription cmdDesc); - - public void onCommandFinished(TestEnvironment env, CommandDescription cmdDesc, CommandEndedStatusEnum status); - - public void onTestPointUpdate(int pass, int fail, String testClassName); - - public void onEnvironmentKilled(TestEnvironment env); - - public void dispose(); - - public void onTestServerCommandFinished(TestEnvironment env, ICommandHandle handle); - - public void onTestComplete(String className, String serverOutfilePath, String clientOutfilePath, CommandEndedStatusEnum status, List<IHealthStatus> healthStatus); - - public void onTestStart(String className, String serverOutfilePath, String clientOutfilePath); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/SequentialCommandBegan.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/SequentialCommandBegan.java deleted file mode 100644 index b6182124a85..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/SequentialCommandBegan.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import org.eclipse.osee.ote.core.environment.command.CommandDescription; - -public class SequentialCommandBegan implements IServiceStatusDataCommand { - - private static final long serialVersionUID = -3278399375292593249L; - private CommandDescription description; - - public SequentialCommandBegan(CommandDescription description) { - this.description = description; - } - - public SequentialCommandBegan() { - } - - public void set(CommandDescription description) { - this.description = description; - } - - @Override - public CommandDescription getDescription() { - return description; - } - - @Override - public void accept(IServiceStatusDataVisitor visitor) { - if (visitor != null) { - visitor.asSequentialCommandBegan(this); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/SequentialCommandEnded.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/SequentialCommandEnded.java deleted file mode 100644 index 46ab777b590..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/SequentialCommandEnded.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; - -public class SequentialCommandEnded implements IServiceStatusDataCommand, Serializable { - - private static final long serialVersionUID = 9093713855323793915L; - private CommandDescription description; - private CommandEndedStatusEnum status; - - public SequentialCommandEnded(CommandDescription description, CommandEndedStatusEnum status) { - this.description = description; - this.status = status; - } - - public SequentialCommandEnded() { - } - - @Override - public CommandDescription getDescription() { - return description; - } - - public CommandEndedStatusEnum getStatus() { - return status; - } - - public void set(CommandDescription description, CommandEndedStatusEnum status) { - this.description = description; - this.status = status; - } - - @Override - public void accept(IServiceStatusDataVisitor visitor) { - if (visitor != null) { - visitor.asSequentialCommandEnded(this); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoard.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoard.java deleted file mode 100644 index 8789d706cde..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoard.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.IOException; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.IHealthStatus; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.GCHelper; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; -import org.eclipse.osee.ote.core.environment.command.TestEnvironmentCommand; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentListener; -import org.eclipse.osee.ote.core.environment.status.msg.CommandAddedMessage; -import org.eclipse.osee.ote.core.environment.status.msg.CommandRemovedMessage; -import org.eclipse.osee.ote.core.environment.status.msg.EnvErrorMessage; -import org.eclipse.osee.ote.core.environment.status.msg.SequentialCommandBeganMessage; -import org.eclipse.osee.ote.core.environment.status.msg.SequentialCommandEndedMessage; -import org.eclipse.osee.ote.core.environment.status.msg.TestCompleteMessage; -import org.eclipse.osee.ote.core.environment.status.msg.TestPointUpdateMessage; -import org.eclipse.osee.ote.core.environment.status.msg.TestServerCommandCompleteMessage; -import org.eclipse.osee.ote.core.environment.status.msg.TestStartMessage; -import org.eclipse.osee.ote.core.framework.command.ICommandHandle; -import org.eclipse.osee.ote.core.framework.command.ITestCommandResult; -import org.eclipse.osee.ote.core.framework.command.TestCommandStatus; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; -import org.osgi.service.event.EventAdmin; - -/** - * @author Robert A. Fisher - * @author Ryan D. Brooks - */ -public class StatusBoard implements ITestEnvironmentListener, OTEStatusBoard { - private static final long TP_UPDATE_THROTTLE = 5000; - - private long lastTpUpdateTime = 0; - - private final ThreadPoolExecutor executor; - private final ScheduledExecutorService scheduledExecutor; - private final Object testPointLock = new Object(); - private TestPointStatusBoardRunnable latestTestPointUpdate; - private final AtomicBoolean executeLatestTestPointUpdate = new AtomicBoolean(); -private EventAdmin eventAdmin; - - // private Future<?> lastTestPointUpdate; - - /** - * StatusBoard Constructor. This class handles passing status information from the test enviornment to the UI's - * (StatusHandler Class). - */ - public StatusBoard() { - super(); - GCHelper.getGCHelper().addRefWatch(this); - executeLatestTestPointUpdate.set(false); - executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(1); - scheduledExecutor = Executors.newSingleThreadScheduledExecutor(); - scheduledExecutor.scheduleAtFixedRate(new Runnable() { - - @Override - public void run() { - synchronized (testPointLock) { - if (executeLatestTestPointUpdate.get()) { - executeLatestTestPointUpdate.set(false); - lastTpUpdateTime = System.currentTimeMillis(); - executor.submit(latestTestPointUpdate); - } - } - } - - }, TP_UPDATE_THROTTLE, TP_UPDATE_THROTTLE, TimeUnit.MILLISECONDS); - } - - - public void start(){ - - } - - public void stop(){ - dispose(); - } - - public void bindEventAdmin(EventAdmin eventAdmin){ - this.eventAdmin = eventAdmin; - } - - public void unbindEventAdmin(EventAdmin eventAdmin){ - this.eventAdmin = null; - } - - @Override - public void onCommandAdded(TestEnvironment env, TestEnvironmentCommand cmd) { - CommandAdded cmdAdded = new CommandAdded(); - cmdAdded.set(cmd.getDescription()); - try { - CommandAddedMessage msg = new CommandAddedMessage(cmdAdded); - notifyListeners(msg); - } catch (IOException e) { - OseeLog.log(StatusBoard.class, Level.SEVERE, e); - } - } - - @Override - public void onCommandRemoved(TestEnvironment env, CommandDescription cmdDesc, CommandEndedStatusEnum status) { - CommandRemoved cmdRemoved = new CommandRemoved(); - cmdRemoved.setDescription(cmdDesc); - cmdRemoved.setReason(status); - try { - CommandRemovedMessage msg = new CommandRemovedMessage(cmdRemoved); - notifyListeners(msg); - } catch (IOException e) { - OseeLog.log(StatusBoard.class, Level.SEVERE, e); - } - } - - @Override - public void onException(String message, Throwable t) { - EnvironmentError envError = new EnvironmentError(); - envError.set(t); - try { - EnvErrorMessage msg = new EnvErrorMessage(envError); - notifyListeners(msg); - } catch (IOException e) { - OseeLog.log(StatusBoard.class, Level.SEVERE, e); - } - } - - @Override - public void onCommandBegan(TestEnvironment env, CommandDescription cmdDesc) { - SequentialCommandBegan seqCmdBegan = new SequentialCommandBegan(); - seqCmdBegan.set(cmdDesc); - try { - SequentialCommandBeganMessage msg = new SequentialCommandBeganMessage(seqCmdBegan); - notifyListeners(msg); - } catch (IOException e) { - OseeLog.log(StatusBoard.class, Level.SEVERE, e); - } - } - - @Override - public void onCommandFinished(TestEnvironment env, CommandDescription cmdDesc, CommandEndedStatusEnum status) { - OseeLog.log(TestEnvironment.class, Level.INFO, "To End: " + cmdDesc.getGuid()); - - SequentialCommandEnded seqCmdEnded = new SequentialCommandEnded(); - seqCmdEnded.set(cmdDesc, status); - try { - SequentialCommandEndedMessage msg = new SequentialCommandEndedMessage(seqCmdEnded); - notifyListeners(msg); - } catch (IOException e) { - OseeLog.log(StatusBoard.class, Level.SEVERE, e); - } - } - - @Override - public void onTestPointUpdate(int pass, int fail, String testClassName) { - try { - TestPointStatusBoardRunnable runnable = - new TestPointStatusBoardRunnable(new TestPointUpdateMessage(new TestPointUpdate(pass, fail, testClassName)), eventAdmin); - if (System.currentTimeMillis() - lastTpUpdateTime > TP_UPDATE_THROTTLE) { - lastTpUpdateTime = System.currentTimeMillis(); - executor.submit(runnable); - } else { - synchronized (testPointLock) { - latestTestPointUpdate = runnable; - executeLatestTestPointUpdate.set(true); - } - } - } catch (IOException e) { - OseeLog.log(StatusBoard.class, Level.SEVERE, e); - } - } - - @SuppressWarnings("rawtypes") - void notifyListeners(final SerializedClassMessage msg) { - executor.execute(new StatusBoardRunnable(msg) { - @Override - public void run() { - OteEventMessageUtil.sendEvent(msg, eventAdmin); - } - }); - } - - @Override - public void onEnvironmentKilled(TestEnvironment env) { - - } - - @Override - public void dispose() { - } - - @Override - public void onTestServerCommandFinished(TestEnvironment env, ICommandHandle handle) { - try { - ITestCommandResult status = handle.get(); - TestCommandStatus cmdStatus = null; - Throwable th = null; - if(status != null){ - cmdStatus = status.getStatus(); - th = status.getThrowable(); - } - TestServerCommandCompleteMessage msg = new TestServerCommandCompleteMessage(new TestServerCommandComplete(cmdStatus, th)); - notifyListeners(msg); - } catch (IOException e) { - OseeLog.log(StatusBoard.class, Level.SEVERE, e); - } - } - - @Override - public void onTestComplete(String className, String serverOutfilePath, String clientOutfilePath, CommandEndedStatusEnum status, List<IHealthStatus> healthStatus) { - try { - TestCompleteMessage msg = new TestCompleteMessage(new TestComplete(className, serverOutfilePath, clientOutfilePath, status, healthStatus)); - notifyListeners(msg); - } catch (IOException e) { - OseeLog.log(StatusBoard.class, Level.SEVERE, e); - } - } - - @Override - public void onTestStart(String className, String serverOutfilePath, String clientOutfilePath ) { - try { - TestStartMessage msg = new TestStartMessage(new TestStart(className, serverOutfilePath, clientOutfilePath)); - notifyListeners(msg); - } catch (IOException e) { - OseeLog.log(StatusBoard.class, Level.SEVERE, e); - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoardRunnable.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoardRunnable.java deleted file mode 100644 index 7cbb6e51cbb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/StatusBoardRunnable.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public abstract class StatusBoardRunnable implements Runnable { - - private final SerializedClassMessage data; - - public StatusBoardRunnable(SerializedClassMessage msg) { - this.data = msg; - } - - protected SerializedClassMessage getData() { - return data; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestComplete.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestComplete.java deleted file mode 100644 index 1c5083d5c8d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestComplete.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; -import java.util.List; -import org.eclipse.osee.framework.logging.IHealthStatus; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestComplete implements Serializable, IServiceStatusData { - private static final long serialVersionUID = -7969548718769021626L; - private final String className; - private final CommandEndedStatusEnum status; - private final String serverOutfilePath; - private final String clientOutfilePath; - private final List<IHealthStatus> healthStatus; - - public TestComplete(String className, String serverOutfilePath, String clientOutfilePath, CommandEndedStatusEnum status, List<IHealthStatus> healthStatus) { - this.className = className; - this.serverOutfilePath = serverOutfilePath; - this.clientOutfilePath = clientOutfilePath; - this.status = status; - this.healthStatus = healthStatus; - } - - @Override - public void accept(IServiceStatusDataVisitor visitor) { - visitor.asTestComplete(this); - } - - public String getClassName() { - return className; - } - - public CommandEndedStatusEnum getStatus() { - return status; - } - - public String getServerOutfilePath() { - return serverOutfilePath; - } - - public String getClientOutfilePath() { - return clientOutfilePath; - } - - public List<IHealthStatus> getHealthStatus() { - return this.healthStatus; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestPointStatusBoardRunnable.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestPointStatusBoardRunnable.java deleted file mode 100644 index 6ced1e169f5..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestPointStatusBoardRunnable.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import org.eclipse.osee.ote.core.environment.status.msg.TestPointUpdateMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.osgi.service.event.EventAdmin; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestPointStatusBoardRunnable extends StatusBoardRunnable { - - private final EventAdmin eventAdmin; - - public TestPointStatusBoardRunnable(TestPointUpdateMessage testPointUpdateMessage, EventAdmin eventAdmin) { - super(testPointUpdateMessage); - this.eventAdmin = eventAdmin; - } - - @Override - public void run() { - OteEventMessageUtil.sendEvent(getData(), eventAdmin); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestPointUpdate.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestPointUpdate.java deleted file mode 100644 index 676e7706a5d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestPointUpdate.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; -import org.eclipse.osee.ote.core.environment.command.CommandDescription; - -public class TestPointUpdate implements Serializable, IServiceStatusDataCommand { - - private static final long serialVersionUID = 7157851807444983673L; - private int pass; - private int fail; - private CommandDescription description; - private String testClassName; - - public TestPointUpdate(int pass, int fail, CommandDescription description) { - this.pass = pass; - this.fail = fail; - this.description = description; - } - - public TestPointUpdate(int pass, int fail, String testClassName) { - this.pass = pass; - this.fail = fail; - this.testClassName = testClassName; - } - - public TestPointUpdate() { - } - - public int getFail() { - return fail; - } - - public int getPass() { - return pass; - } - - public String getClassName() { - return testClassName; - } - - @Override - public CommandDescription getDescription() { - return description; - } - - public void set(int pass, int fail, CommandDescription description) { - this.pass = pass; - this.fail = fail; - this.description = description; - } - - @Override - public void accept(IServiceStatusDataVisitor visitor) { - if (visitor != null) { - visitor.asTestPointUpdate(this); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestServerCommandComplete.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestServerCommandComplete.java deleted file mode 100644 index ca2310c903f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestServerCommandComplete.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; - -import org.eclipse.osee.ote.core.framework.command.TestCommandStatus; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestServerCommandComplete implements Serializable, IServiceStatusData { - - private static final long serialVersionUID = -2678833105694275416L; - private TestCommandStatus cmdStatus; - private Throwable th; - - public TestServerCommandComplete(TestCommandStatus cmdStatus, Throwable th) { - this.cmdStatus = cmdStatus; - this.th = th; - } - - @Override - public void accept(IServiceStatusDataVisitor visitor) { - visitor.asTestServerCommandComplete(this); - } - - public TestCommandStatus getCmdStatus() { - return cmdStatus; - } - - public Throwable getThrowable() { - return th; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestStart.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestStart.java deleted file mode 100644 index 0d8f90cb72f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/TestStart.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status; - -import java.io.Serializable; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestStart implements IServiceStatusData, Serializable { - - private static final long serialVersionUID = -3458459132672153638L; - private final String testClassName; - private final String serverOutfilePath; - private final String clientOutfilePath; - - public TestStart(String testClassName, String serverOutfilePath, String clientOutfilePath) { - this.testClassName = testClassName; - this.serverOutfilePath = serverOutfilePath; - this.clientOutfilePath = clientOutfilePath; - } - - @Override - public void accept(IServiceStatusDataVisitor visitor) { - visitor.asTestStart(this); - } - - public String getTestClassName() { - return testClassName; - } - - public String getServerOutfilePath() { - return serverOutfilePath; - } - - public String getClientOutfilePath() { - return clientOutfilePath; - } - - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/CommandAddedMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/CommandAddedMessage.java deleted file mode 100644 index 893f1885fe4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/CommandAddedMessage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status.msg; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.environment.status.CommandAdded; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class CommandAddedMessage extends SerializedClassMessage<CommandAdded> { - - public static final String EVENT = "ote/status/commandAdded"; - - public CommandAddedMessage() { - super(EVENT); - } - - public CommandAddedMessage(CommandAdded commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public CommandAddedMessage(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/CommandRemovedMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/CommandRemovedMessage.java deleted file mode 100644 index 70c7cd6a5c2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/CommandRemovedMessage.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status.msg; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.environment.status.CommandRemoved; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class CommandRemovedMessage extends SerializedClassMessage<CommandRemoved> { - - public static final String EVENT = "ote/status/commandRemoved"; - - public CommandRemovedMessage() { - super(EVENT); - } - - public CommandRemovedMessage(CommandRemoved cmdRemoved) throws IOException { - super("ote/status/commandRemoved", cmdRemoved); - } - - public CommandRemovedMessage(byte[] bytes){ - super(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/EnvErrorMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/EnvErrorMessage.java deleted file mode 100644 index 344684b661b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/EnvErrorMessage.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status.msg; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.environment.status.EnvironmentError; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class EnvErrorMessage extends SerializedClassMessage<EnvironmentError> { - - public static final String EVENT = "ote/status/envError"; - - public EnvErrorMessage() { - super(EVENT); - } - - public EnvErrorMessage(EnvironmentError envError) throws IOException { - super(EVENT, envError); - } - - public EnvErrorMessage(byte[] bytes) { - super(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/SequentialCommandBeganMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/SequentialCommandBeganMessage.java deleted file mode 100644 index f7363d8f5f7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/SequentialCommandBeganMessage.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status.msg; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.environment.status.SequentialCommandBegan; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SequentialCommandBeganMessage extends SerializedClassMessage<SequentialCommandBegan> { - - public static final String EVENT = "ote/status/sequentialCommandBegan"; - - public SequentialCommandBeganMessage() { - super(EVENT); - } - - public SequentialCommandBeganMessage(SequentialCommandBegan seqCmdBegan) throws IOException { - super(EVENT, seqCmdBegan); - } - - public SequentialCommandBeganMessage(byte[] bytes){ - super(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/SequentialCommandEndedMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/SequentialCommandEndedMessage.java deleted file mode 100644 index 8e53ca2539e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/SequentialCommandEndedMessage.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status.msg; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.environment.status.SequentialCommandEnded; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SequentialCommandEndedMessage extends SerializedClassMessage<SequentialCommandEnded> { - - public static final String EVENT = "ote/status/sequentialCommandEnded"; - - public SequentialCommandEndedMessage() { - super(EVENT); - } - - public SequentialCommandEndedMessage(SequentialCommandEnded seqCmdEnded) throws IOException { - super(EVENT, seqCmdEnded); - } - - public SequentialCommandEndedMessage(byte[] bytes){ - super(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestCompleteMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestCompleteMessage.java deleted file mode 100644 index 5efa08a29bb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestCompleteMessage.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status.msg; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.environment.status.TestComplete; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class TestCompleteMessage extends SerializedClassMessage<TestComplete> { - - public static final String EVENT = "ote/status/testComplete"; - - public TestCompleteMessage() { - super(EVENT); - } - - public TestCompleteMessage(TestComplete testComplete) throws IOException { - super(EVENT, testComplete); - } - - public TestCompleteMessage(byte[] bytes){ - super(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestPointUpdateMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestPointUpdateMessage.java deleted file mode 100644 index 82795ccc31b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestPointUpdateMessage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status.msg; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.environment.status.TestPointUpdate; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class TestPointUpdateMessage extends SerializedClassMessage<TestPointUpdate> { - - public static final String EVENT = "ote/status/testPointUpdate"; - - public TestPointUpdateMessage() { - super(EVENT); - } - - public TestPointUpdateMessage(TestPointUpdate testPointUpdate) throws IOException { - super(EVENT, testPointUpdate); - } - - public TestPointUpdateMessage(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestServerCommandCompleteMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestServerCommandCompleteMessage.java deleted file mode 100644 index ca7306d8a4b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestServerCommandCompleteMessage.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status.msg; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.environment.status.TestServerCommandComplete; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class TestServerCommandCompleteMessage extends SerializedClassMessage<TestServerCommandComplete> { - - public static final String EVENT = "ote/status/testServerCommandComplete"; - - public TestServerCommandCompleteMessage() { - super(EVENT); - } - - public TestServerCommandCompleteMessage( - TestServerCommandComplete testServerCommandComplete) throws IOException { - super(EVENT, testServerCommandComplete); - } - - public TestServerCommandCompleteMessage(byte[] bytes){ - super(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestStartMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestStartMessage.java deleted file mode 100644 index 88dae160352..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/environment/status/msg/TestStartMessage.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.environment.status.msg; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.environment.status.TestStart; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class TestStartMessage extends SerializedClassMessage<TestStart> { - - public static final String EVENT = "ote/status/testStart"; - - public TestStartMessage() { - super(EVENT); - } - - public TestStartMessage(TestStart testStart) throws IOException { - super(EVENT, testStart); - } - - public TestStartMessage(byte[] bytes) { - super(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/BaseCommandContextFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/BaseCommandContextFactory.java deleted file mode 100644 index b2eb2f9b190..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/BaseCommandContextFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.command.ITestContext; -import org.eclipse.osee.ote.core.framework.command.ITestServerCommand; - -public class BaseCommandContextFactory implements ICommandContextFactory { - @Override - public ITestContext getContext(final TestEnvironment testEnvironment, final ITestServerCommand cmd) { - return testEnvironment; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/BaseRunManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/BaseRunManager.java deleted file mode 100644 index 16e25578dcc..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/BaseRunManager.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import java.util.logging.Level; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.framework.logging.BaseStatus; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.testrun.ITestResultCollector; -import org.eclipse.osee.ote.core.framework.testrun.ITestResultCollectorFactory; -import org.eclipse.osee.ote.core.framework.testrun.ITestRunManager; - -public class BaseRunManager implements IRunManager { - - private final ITestRunManager testRunManager; - private final ITestLifecycleListenerProvider lifecycleListenerProvider; - private final ITestResultCollectorFactory resultCollectorFactory; - private ITestResultCollector resultCollector; - - public BaseRunManager(ITestRunManager testRunManager, ITestLifecycleListenerProvider lifecycleListenerProvider, ITestResultCollectorFactory resultCollectorFactory) { - this.lifecycleListenerProvider = lifecycleListenerProvider; - this.testRunManager = testRunManager; - this.resultCollectorFactory = resultCollectorFactory; - } - - @Override - public boolean addListener(ITestLifecycleListener listener) { - return lifecycleListenerProvider.addListener(listener); - } - - @Override - public void clearAllListeners() { - lifecycleListenerProvider.clear(); - } - - @Override - public boolean removeListener(ITestLifecycleListener listener) { - return lifecycleListenerProvider.removeListener(listener); - } - - @Override - public IMethodResult run(TestEnvironment env, IPropertyStore propertyStore) { - try { - this.resultCollector = resultCollectorFactory.createCollector(); - this.resultCollector.initialize(propertyStore, env); - ResultBuilder rb = new ResultBuilder(true); - rb.append(lifecycleListenerProvider.notifyPreInstantiation(propertyStore, env)); - if (rb.isReturnStatusOK()) { - rb.append(testRunManager.initialize(env, propertyStore)); - if (rb.isReturnStatusOK()) { - try { - rb.append(lifecycleListenerProvider.notifyPostInstantiation(propertyStore, testRunManager.getTest(), - env)); - } catch (Throwable th) { - MethodResultImpl result = new MethodResultImpl(ReturnCode.ERROR); - result.addStatus(new BaseStatus(this.getClass().getName(), Level.SEVERE, th)); - rb.append(result); - } - if (rb.isReturnStatusOK()) { - try { - rb.append(testRunManager.run(propertyStore, env)); - } catch (Throwable th) { - MethodResultImpl result = new MethodResultImpl(ReturnCode.ERROR); - result.addStatus(new BaseStatus(this.getClass().getName(), Level.SEVERE, th)); - rb.append(result); - } - } - } - rb.append(lifecycleListenerProvider.notifyPreDispose(propertyStore, testRunManager.getTest(), env)); - rb.append(testRunManager.dispose()); - rb.append(lifecycleListenerProvider.notifyPostDispose(propertyStore, env)); - } - this.resultCollector.dispose(env); - this.resultCollector = null; - if (!rb.isReturnStatusOK()) { - OseeLog.log(BaseRunManager.class, Level.SEVERE, rb.toString()); - } - return rb.get(); - } catch (Throwable th) { - th.printStackTrace(); - MethodResultImpl status = new MethodResultImpl(ReturnCode.ERROR); - status.addStatus(new BaseStatus(BaseRunManager.class.getName(), Level.SEVERE, th)); - return status; - } - } - - @Override - public boolean abort() { - return testRunManager.abort(); - } - - @Override - public boolean abort(Throwable th, boolean wait) { - return testRunManager.abort(th, wait); - } - - @Override - public boolean isAborted() { - return testRunManager.isAborted(); - } - - @Override - public TestScript getCurrentScript() { - return testRunManager.getTest(); - } - - @Override - public boolean isCurrentThreadScript() { - return testRunManager.isCurrentThreadScript(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/BaseTestLifecycleListenerProvider.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/BaseTestLifecycleListenerProvider.java deleted file mode 100644 index 2a85d0357f7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/BaseTestLifecycleListenerProvider.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.logging.Level; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.framework.logging.BaseStatus; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.event.IEventData; -import org.eclipse.osee.ote.core.framework.event.IEventDataProvider; - -public class BaseTestLifecycleListenerProvider implements ITestLifecycleListenerProvider { - - private final IEventDataProvider eventProvider; - private final List<ITestLifecycleListener> listeners; - private int listenerCountAtPreinit = 0; - - public BaseTestLifecycleListenerProvider(IEventDataProvider eventProvider) { - this.eventProvider = eventProvider; - listeners = new CopyOnWriteArrayList<>(); - } - - @Override - public void clear() { - listeners.clear(); - } - - @Override - public boolean addListener(ITestLifecycleListener listener) { - return listeners.add(listener); - } - - @Override - public IMethodResult notifyPostDispose(IPropertyStore propertyStore, TestEnvironment env) { - IEventData eventData = eventProvider.getEventData(propertyStore, null); - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - for (ITestLifecycleListener listener : listeners) { - try { - result = collectStatus(result, listener.postDispose(eventData, env)); - } catch (Throwable th) { - result = collectStatus(result,new MethodResultImpl(ReturnCode.ERROR)); - result.addStatus(new BaseStatus(this.getClass().getName(), Level.SEVERE, th)); - } - } - - int newSize = listeners.size(); - if( this.listenerCountAtPreinit != newSize) - { - System.err.printf("+++++++++++++++++++++++++++++++++++++++++There are now %s listeners when there were %s to start with\n", listenerCountAtPreinit, newSize ); - for (ITestLifecycleListener listener : listeners) { - System.err.println("Listener: " + listener.getClass().getName()); - } - System.err.println("-----------------------------------------------------------------------------------------------------"); - } - return result; - } - - @Override - public IMethodResult notifyPostInstantiation(IPropertyStore propertyStore, TestScript test, TestEnvironment env) { - IEventData eventData = eventProvider.getEventData(propertyStore, test); - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - for (ITestLifecycleListener listener : listeners) { - result = collectStatus(result, listener.postInstantiation(eventData, env)); - } - return result; - } - - @Override - public IMethodResult notifyPreDispose(IPropertyStore propertyStore, TestScript test, TestEnvironment env) { - IEventData eventData = eventProvider.getEventData(propertyStore, test); - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - for (ITestLifecycleListener listener : listeners) { - try { - result = collectStatus(result, listener.preDispose(eventData, env)); - } catch (Throwable th) { - result = collectStatus(result,new MethodResultImpl(ReturnCode.ERROR)); - result.addStatus(new BaseStatus(this.getClass().getName(), Level.SEVERE, th)); - } - } - return result; - } - - @Override - public IMethodResult notifyPreInstantiation(IPropertyStore propertyStore, TestEnvironment env) { - IEventData eventData = eventProvider.getEventData(propertyStore, null); - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - - for (ITestLifecycleListener listener : listeners) { - result = collectStatus(result, listener.preInstantiation(eventData, env)); - } - - this.listenerCountAtPreinit = listeners.size(); - return result; - } - - @Override - public boolean removeListener(ITestLifecycleListener listener) { - return listeners.remove(listener); - } - - private MethodResultImpl collectStatus(MethodResultImpl result, IMethodResult listenerResult) { - if (listenerResult.getReturnCode() != ReturnCode.OK) { - if (result.getReturnCode() == ReturnCode.OK) { - result = new MethodResultImpl(ReturnCode.OK); - } - result.setReturnCode(listenerResult.getReturnCode()); - result.addStatus(listenerResult.getStatus()); - } - return result; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/DestroyableService.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/DestroyableService.java deleted file mode 100644 index 5fefb422a2d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/DestroyableService.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -public interface DestroyableService { - void destroy(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ICommandContextFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ICommandContextFactory.java deleted file mode 100644 index ecae76d592d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ICommandContextFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.command.ITestContext; -import org.eclipse.osee.ote.core.framework.command.ITestServerCommand; - -public interface ICommandContextFactory { - - ITestContext getContext(TestEnvironment testEnvironment, ITestServerCommand cmd); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/IMethodResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/IMethodResult.java deleted file mode 100644 index 8b912431212..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/IMethodResult.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import java.util.List; -import org.eclipse.osee.framework.logging.IHealthStatus; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IMethodResult { - List<IHealthStatus> getStatus(); - - ReturnCode getReturnCode(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/IRunManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/IRunManager.java deleted file mode 100644 index ff2082eb5c3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/IRunManager.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -public interface IRunManager { - - public boolean addListener(ITestLifecycleListener listener); - - public void clearAllListeners(); - - public boolean removeListener(ITestLifecycleListener listener); - - public IMethodResult run(TestEnvironment env, IPropertyStore propertyStore); - - public boolean abort(); - - public boolean abort(Throwable th, boolean wait); - - public boolean isAborted(); - - public TestScript getCurrentScript(); - - public boolean isCurrentThreadScript(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ITestLifecycleListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ITestLifecycleListener.java deleted file mode 100644 index c17c58f0cc8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ITestLifecycleListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.event.IEventData; - -public interface ITestLifecycleListener { - - IMethodResult preInstantiation(IEventData eventData, TestEnvironment env); - - IMethodResult postInstantiation(IEventData eventData, TestEnvironment env); - - IMethodResult preDispose(IEventData eventData, TestEnvironment env); - - IMethodResult postDispose(IEventData eventData, TestEnvironment env); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ITestLifecycleListenerProvider.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ITestLifecycleListenerProvider.java deleted file mode 100644 index 616e290cb6d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ITestLifecycleListenerProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -public interface ITestLifecycleListenerProvider { - void clear(); - - boolean addListener(ITestLifecycleListener listener); - - boolean removeListener(ITestLifecycleListener listener); - - IMethodResult notifyPostDispose(IPropertyStore propertyStore, TestEnvironment env); - - IMethodResult notifyPostInstantiation(IPropertyStore propertyStore, TestScript test, TestEnvironment env); - - IMethodResult notifyPreDispose(IPropertyStore propertyStore, TestScript test, TestEnvironment env); - - IMethodResult notifyPreInstantiation(IPropertyStore propertyStore, TestEnvironment env); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/MethodResultImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/MethodResultImpl.java deleted file mode 100644 index 7b13317a55c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/MethodResultImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.osee.framework.logging.IHealthStatus; - -/** - * @author Andrew M. Finkbeiner - */ -public class MethodResultImpl implements IMethodResult { - - public static MethodResultImpl combine(IMethodResult result1, IMethodResult result2) { - if (result1.getReturnCode() == ReturnCode.OK && result2.getReturnCode() == ReturnCode.OK) { - return new MethodResultImpl(ReturnCode.OK); - } else { - return new MethodResultImpl(result1, result2); - } - } - - private List<IHealthStatus> statuses; - private ReturnCode returnCode; - - public MethodResultImpl(ReturnCode returnCode) { - statuses = new ArrayList<>(); - this.returnCode = returnCode; - } - - private MethodResultImpl(IMethodResult result1, IMethodResult result2) { - if (result1.getReturnCode() != ReturnCode.OK) { - addStatus(result1.getStatus()); - setReturnCode(result1.getReturnCode()); - } - if (result2.getReturnCode() != ReturnCode.OK) { - addStatus(result2.getStatus()); - setReturnCode(result2.getReturnCode()); - } - } - - @Override - public ReturnCode getReturnCode() { - return returnCode; - } - - @Override - public List<IHealthStatus> getStatus() { - return statuses; - } - - public void setReturnCode(ReturnCode returnCode) { - this.returnCode = returnCode; - } - - public void addStatus(IHealthStatus status) { - statuses.add(status); - } - - public void addStatus(List<IHealthStatus> status) { - statuses.addAll(status); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(returnCode.toString()); - sb.append("\n"); - for (IHealthStatus status : statuses) { - sb.append(status.toString()); - sb.append("\n"); - } - return sb.toString(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ResultBuilder.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ResultBuilder.java deleted file mode 100644 index 5012056827c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ResultBuilder.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -import org.eclipse.osee.framework.logging.OseeLog; - -/** - * @author Andrew M. Finkbeiner - */ -public class ResultBuilder { - - private final MethodResultImpl result; - private final boolean logToHM; - - public ResultBuilder(boolean logToHM) { - result = new MethodResultImpl(ReturnCode.OK); - this.logToHM = logToHM; - } - - public MethodResultImpl append(IMethodResult result) { - if (logToHM) { - OseeLog.reportStatus(result.getStatus()); - } - this.result.addStatus(result.getStatus()); - if (result.getReturnCode() != ReturnCode.OK) { - this.result.setReturnCode(result.getReturnCode()); - } - return this.result; - } - - public IMethodResult get() { - return this.result; - } - - public boolean isReturnStatusOK() { - return this.result.getReturnCode() == ReturnCode.OK; - } - - @Override - public String toString() { - return result.toString(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ReturnCode.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ReturnCode.java deleted file mode 100644 index c5fd6dcd699..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/ReturnCode.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework; - -/** - * @author Andrew M. Finkbeiner - */ -public enum ReturnCode { - OK, - ERROR, - ABORTED -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/adapter/TestLifecycleListenerAdapter.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/adapter/TestLifecycleListenerAdapter.java deleted file mode 100644 index 21ed3946ed0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/adapter/TestLifecycleListenerAdapter.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.adapter; - -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.IMethodResult; -import org.eclipse.osee.ote.core.framework.ITestLifecycleListener; -import org.eclipse.osee.ote.core.framework.MethodResultImpl; -import org.eclipse.osee.ote.core.framework.ReturnCode; -import org.eclipse.osee.ote.core.framework.event.IEventData; - -/** - * @author Roberto E. Escobar - */ -public class TestLifecycleListenerAdapter implements ITestLifecycleListener { - - @Override - public IMethodResult postDispose(IEventData eventData, TestEnvironment env) { - return new MethodResultImpl(ReturnCode.OK); - } - - @Override - public IMethodResult postInstantiation(IEventData eventData, TestEnvironment env) { - return new MethodResultImpl(ReturnCode.OK); - } - - @Override - public IMethodResult preDispose(IEventData eventData, TestEnvironment env) { - return new MethodResultImpl(ReturnCode.OK); - } - - @Override - public IMethodResult preInstantiation(IEventData eventData, TestEnvironment env) { - return new MethodResultImpl(ReturnCode.OK); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BaseCommandManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BaseCommandManager.java deleted file mode 100644 index 1f9e984a189..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BaseCommandManager.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -import java.rmi.server.ExportException; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import org.eclipse.osee.ote.core.OTESessionManager; -import org.eclipse.osee.ote.core.ServiceUtility; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard; -import org.eclipse.osee.ote.core.framework.thread.OteThreadManager; - -public class BaseCommandManager implements ICommandManager { - - private final ExecutorService commands; - private final ExecutorService commandResponse; - private final Map<ITestServerCommand, Future<ITestCommandResult>> cmdMap; - - public BaseCommandManager() { - OteThreadManager threadManager = OteThreadManager.getInstance(); - commands = Executors.newSingleThreadExecutor(threadManager.createNewFactory("ote.command")); - commandResponse = Executors.newSingleThreadExecutor(threadManager.createNewFactory("ote.command.response")); - cmdMap = new ConcurrentHashMap<>(); - } - - @Override - public ICommandHandle addCommand(ITestServerCommand cmd, TestEnvironment context) throws ExportException { - OTEStatusBoard statusBoard = ServiceUtility.getService(OTEStatusBoard.class); - OTESessionManager sessionManager = ServiceUtility.getService(OTESessionManager.class); - - Future<ITestCommandResult> result = - commands.submit(new TestCallableWrapper(this, cmd, context,statusBoard, sessionManager)); - cmdMap.put(cmd, result); - return cmd.createCommandHandle(result, context); - } - - public void commandComplete(ITestServerCommand cmd, TestEnvironment context) { - commandResponse.submit(new TestCommandComplete(context, cmd, cmdMap.get(cmd))); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BatchLog.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BatchLog.java deleted file mode 100644 index 25635ec1fbb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/BatchLog.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.osee.ote.core.framework.command; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.ILoggerListener; -import org.eclipse.osee.framework.logging.OseeLog; - -public class BatchLog implements ILoggerListener { - - private File fileToWriteTo; - private FileOutputStream fos; - private PrintWriter out; - - public BatchLog(File fileToWriteTo){ - this.fileToWriteTo = fileToWriteTo; - } - - public void open() throws FileNotFoundException{ - fos = new FileOutputStream(fileToWriteTo); - out = new PrintWriter(fileToWriteTo); - OseeLog.registerLoggerListener(this); - } - - public void close(){ - try { - fos.close(); - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - OseeLog.unregisterLoggerListener(this); - } - } - - public void flush(){ - out.flush(); - } - - @Override - public void log(String loggerName, Level level, String message, Throwable th) { - if(level.intValue() >= Level.SEVERE.intValue()){ - out.printf("%s %s\n", level.getName(), message); - if(th != null){ - th.printStackTrace(out); - } - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/CommandCompleteListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/CommandCompleteListener.java deleted file mode 100644 index a5b243b1f84..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/CommandCompleteListener.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -/** - * @author Andrew M. Finkbeiner - */ -public interface CommandCompleteListener { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandHandle.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandHandle.java deleted file mode 100644 index 7b709894b3a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandHandle.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - - -public interface ICommandHandle { - boolean cancelAll(boolean mayInterruptIfRunning); - - boolean cancelSingle(boolean mayInterruptIfRunning); - - ITestCommandResult get(); - - boolean isCancelled(); - - boolean isDone(); - - String getCommandKey(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandManager.java deleted file mode 100644 index 4bd98b303c2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ICommandManager.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -import java.rmi.server.ExportException; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -public interface ICommandManager { - public ICommandHandle addCommand(ITestServerCommand cmd, TestEnvironment context) throws ExportException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestCommandResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestCommandResult.java deleted file mode 100644 index f21c08b39ae..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestCommandResult.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -import java.io.Serializable; - -public interface ITestCommandResult extends Serializable { - TestCommandStatus getStatus(); - - Throwable getThrowable(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestContext.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestContext.java deleted file mode 100644 index 3d4f4032e9e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestContext.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -import java.io.File; - -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.framework.IRunManager; - -public interface ITestContext { - IRunManager getRunManager(); - - File getOutDir(); - - IServiceConnector getConnector(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestServerCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestServerCommand.java deleted file mode 100644 index ffd304a9764..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/ITestServerCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -import java.rmi.server.ExportException; -import java.util.UUID; -import java.util.concurrent.Future; - -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard; - -public interface ITestServerCommand { - - UUID getUserSessionKey(); - - ICommandHandle createCommandHandle(Future<ITestCommandResult> result, ITestContext context) throws ExportException; - - ITestCommandResult execute(TestEnvironment context, OTEStatusBoard statusBoard) throws Exception; - - String getGUID(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTests.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTests.java deleted file mode 100644 index 462dde7ccf0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTests.java +++ /dev/null @@ -1,257 +0,0 @@ -package org.eclipse.osee.ote.core.framework.command; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.Serializable; -import java.rmi.server.ExportException; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Future; -import java.util.logging.Level; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.logging.IHealthStatus; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.Configuration; -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.core.ServiceUtility; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.status.CommandEndedStatusEnum; -import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard; -import org.eclipse.osee.ote.core.framework.IMethodResult; -import org.eclipse.osee.ote.core.framework.ReturnCode; -import org.eclipse.osee.ote.core.framework.saxparse.ProcessOutfileOverview; -import org.eclipse.osee.ote.io.OTEServerFolder; -import org.eclipse.osee.ote.message.IMessageTestContext; - -public class RunTests implements ITestServerCommand, Serializable { - - private static final long serialVersionUID = 7408758537342855854L; - private static final String DEVELOPMENT = "Development"; - - private final IPropertyStore global; - private final List<IPropertyStore> scripts; - private volatile boolean cancelAll = false; - private volatile boolean isRunning = false; - private final UUID sessionKey; - private final String commandId; - private TestEnvironment environment; - private final Configuration configuration; - - public RunTests(String commandId, UUID sessionKey, Configuration configuration, IPropertyStore global, List<IPropertyStore> scripts) { - this.global = global; - this.scripts = scripts; - this.sessionKey = sessionKey; - this.commandId = commandId; - this.configuration = configuration; - } - - public UUID getSessionKey() { - return sessionKey; - } - - @Override - public ICommandHandle createCommandHandle(Future<ITestCommandResult> result, ITestContext context) throws ExportException { - return new RunTestsHandle(result, context, this); - } - - @Override - public ITestCommandResult execute(TestEnvironment environment, OTEStatusBoard statusBoard) throws Exception { - ITestCommandResult retVal = TestCommandResult.SUCCESS; - isRunning = true; - IMessageTestContext msgContext = (IMessageTestContext) environment; - this.environment = environment; - - OTEApi ote = ServiceUtility.getService(OTEApi.class); - OTEServerFolder serverFolder = ote.getServerFolder(); - - String testType = getTestType(); - File batchFolder = serverFolder.getNewBatchFolder(testType); - batchFolder.mkdirs(); - if(!isFolderToKeep(testType)){ - serverFolder.markFolderForDelete(batchFolder); - } - BatchLog batchLog = new BatchLog(serverFolder.getBatchLogFile(batchFolder)); - batchLog.open(); - - File batchStatusFile = serverFolder.getBatchStatusFile(batchFolder); - File batchRunList = serverFolder.getBatchRunList(batchFolder); - - setBatchStatus(batchStatusFile, "running"); - setBatchRunList(batchRunList, scripts); - - environment.setupOutfileDir(batchFolder.getAbsolutePath()); - msgContext.resetScriptLoader(configuration, global.getArray(RunTestsKeys.classpath.name())); - - //Override the command line option only if batch abort has been selected in TestManager - boolean batchAbortFailMode = global.getBoolean(RunTestsKeys.batchFailAbortMode.name()); - if(batchAbortFailMode){ - System.setProperty("ote.abort.on.fail", "true"); - } - else { - System.clearProperty("ote.abort.on.fail"); - } - - //Override the command line option only if batch pause has been selected in TestManager - boolean batchPauseFailMode = global.getBoolean(RunTestsKeys.batchFailPauseMode.name()); - if(batchPauseFailMode){ - System.setProperty("ote.pause.on.fail", "true"); - } - else { - System.clearProperty("ote.pause.on.fail"); - } - - //Override the command line option only if batch pause has been selected in TestManager - boolean printOnFailMode = global.getBoolean(RunTestsKeys.printFailToConsoleMode.name()); - if(printOnFailMode){ - System.setProperty("ote.print.fail.to.console", "true"); - } - else { - System.clearProperty("ote.print.fail.to.console"); - } - - for (IPropertyStore store : scripts) { - Set<String> arrayKeySet = global.arrayKeySet(); - for(String key:arrayKeySet){ - String[] array = global.getArray(key); - if(array != null ){ - store.put(key, array); - } - } - Set<String> keySet = global.keySet(); - for(String key:keySet){ - String val = global.get(key); - if(val != null ){ - store.put(key, val); - } - } - - if (cancelAll) { - statusBoard.onTestComplete(store.get(RunTestsKeys.testClass.name()), - store.get(RunTestsKeys.serverOutfilePath.name()), - store.get(RunTestsKeys.clientOutfilePath.name()), CommandEndedStatusEnum.ABORTED, - new ArrayList<IHealthStatus>()); - retVal = TestCommandResult.CANCEL; - continue; - - } - statusBoard.onTestStart(store.get(RunTestsKeys.testClass.name()), store.get(RunTestsKeys.serverOutfilePath.name()), store.get(RunTestsKeys.clientOutfilePath.name())); - IMethodResult runResults = environment.getRunManager().run(environment, store); - - CommandEndedStatusEnum status = CommandEndedStatusEnum.RAN_TO_COMPLETION; - if (runResults.getReturnCode() == ReturnCode.ABORTED) { - status = CommandEndedStatusEnum.ABORTED; - } - if (runResults.getReturnCode() == ReturnCode.ERROR) { - status = CommandEndedStatusEnum.EXCEPTION; - } - - statusBoard.onTestComplete(store.get(RunTestsKeys.testClass.name()), - store.get(RunTestsKeys.serverOutfilePath.name()), store.get(RunTestsKeys.clientOutfilePath.name()), - status, runResults.getStatus()); - batchLog.flush(); - - File outfile = new File(store.get(RunTestsKeys.serverOutfilePath.name())); - generateOutfileSummary(outfile, serverFolder.getResultsFile(outfile)); - } - setBatchStatus(batchStatusFile, "complete"); - isRunning = false; - batchLog.close(); - return retVal; - } - - private void setBatchRunList(File batchRunList, List<IPropertyStore> scripts2) { - StringBuilder sb = new StringBuilder(); - for (IPropertyStore store : scripts) { - sb.append(store.get(RunTestsKeys.testClass.name())); - sb.append("\n"); - } - try { - Lib.writeStringToFile(sb.toString(), batchRunList); - } catch (IOException ex) { - OseeLog.log(getClass(), Level.SEVERE, "Failed to write batch run list", ex); - } - } - - private void setBatchStatus(File batchStatusFile, String string) { - try { - Lib.writeStringToFile(string, batchStatusFile); - } catch (IOException ex) { - OseeLog.log(getClass(), Level.SEVERE, "Failed to write batch status", ex); - } - } - - private void generateOutfileSummary(File outfile, File resultsFile){ - String summary = getResults(outfile); - writeSummaryToFile(resultsFile, summary); - } - - private void writeSummaryToFile(File file, String summary) { - try { - Lib.writeStringToFile(summary, file); - } catch (IOException ex) { - OseeLog.log(getClass(), Level.SEVERE, "Failed to write outfile summary", ex); - } - } - - private String getResults(File outfile){ - ProcessOutfileOverview overview = new ProcessOutfileOverview(); - FileInputStream fis = null; - try{ - fis = new FileInputStream(outfile); - overview.run(fis); - } catch (Exception ex) { - OseeLog.log(getClass(), Level.SEVERE, "Failed to write outfile summary", ex); - } finally { - if(fis != null){ - try { - fis.close(); - } catch (IOException e) { - OseeLog.log(getClass(), Level.SEVERE, "Failed to close outfile", e); - } - } - } - return String.format("%s,%s,%s", overview.getScriptName(), overview.getResults(), overview.getElapsedTime()); - } - - private String getTestType(){ - IPropertyStore props = scripts.get(0); - return props.get("FormalTestType"); - } - - private boolean isFolderToKeep(String testType) { - if(testType != null && testType.equalsIgnoreCase(DEVELOPMENT)){ - return false; - } else { - return true; - } - } - - public boolean cancel() { - cancelAll = true; - return environment.getRunManager().abort(); - } - - public boolean cancelSingle() { - return environment.getRunManager().abort(); - } - - @Override - public String getGUID() { - return commandId; - } - - @Override - public UUID getUserSessionKey() { - return sessionKey; - } - - boolean isRunning() { - return isRunning; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsHandle.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsHandle.java deleted file mode 100644 index 1b1bbe1b6c1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsHandle.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.eclipse.osee.ote.core.framework.command; - -import java.io.Serializable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -import org.eclipse.osee.framework.jdk.core.util.GUID; - -public class RunTestsHandle implements ICommandHandle, Serializable { - - private static final long serialVersionUID = 3643208660033506154L; - - private final transient Future<ITestCommandResult> result; - private final transient ITestContext context; - private final transient RunTests command; - private final String guid; - - public RunTestsHandle(Future<ITestCommandResult> result, ITestContext context, RunTests command) { - this.result = result; - this.context = context; - this.command = command; - this.guid = GUID.create(); - } - - @Override - public boolean cancelAll(boolean mayInterruptIfRunning) { - return command.cancel(); - } - - @Override - public boolean cancelSingle(boolean mayInterruptIfRunning) { - return command.cancelSingle(); - } - - @Override - public ITestCommandResult get() { - try { - return result.get(); - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (ExecutionException e) { - e.printStackTrace(); - } - return null; - } - - @Override - public boolean isCancelled() { - return false; - } - - @Override - public boolean isDone() { - return command.isRunning(); - } - - @Override - public String getCommandKey() { - return guid; - } - - - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java deleted file mode 100644 index a92904874d7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/RunTestsKeys.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.osee.ote.core.framework.command; - -public enum RunTestsKeys { - distributionStatement, - executablePath, - classpath, - version_repositoryType, - version_location, - version_revision, - version_lastAuthor, - version_lastModificationDate, - version_modifiedFlag, - serverOutfilePath, - executableOutputPath, - executableDebug, - testClass, - clientOutfilePath, - testVersion, - serverOutfileFolderOverride, - executablePathsArray, - executableArg1Array, - executableArg2Array, - spare1, - batchFailAbortMode, - batchmode, - batchFailPauseMode, - printFailToConsoleMode; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCallableWrapper.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCallableWrapper.java deleted file mode 100644 index 70ca276bac2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCallableWrapper.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -import java.util.concurrent.Callable; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.OTESessionManager; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard; - -public class TestCallableWrapper implements Callable<ITestCommandResult> { - - private final ITestServerCommand cmd; - private final TestEnvironment context; - private final BaseCommandManager cmdManager; - private final OTEStatusBoard statusBoard; - private final OTESessionManager sessionManager; - - public TestCallableWrapper(BaseCommandManager cmdManager, ITestServerCommand cmd, TestEnvironment context, OTEStatusBoard statusBoard, OTESessionManager sessionManager) { - this.cmd = cmd; - this.context = context; - this.cmdManager = cmdManager; - this.statusBoard = statusBoard; - this.sessionManager = sessionManager; - } - - @Override - public ITestCommandResult call() throws Exception { - ITestCommandResult result; - try { - sessionManager.setActiveUser(cmd.getUserSessionKey()); - result = cmd.execute(context, statusBoard); - if (result.getThrowable() != null) { - OseeLog.log(TestCallableWrapper.class, Level.SEVERE, result.getThrowable()); - } - } catch (Throwable ex) { - result = new TestCommandResult(TestCommandStatus.FAIL, ex); - OseeLog.log(TestCallableWrapper.class, Level.SEVERE, ex); - } finally { - cmdManager.commandComplete(cmd, context); - } - return result; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCommandComplete.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCommandComplete.java deleted file mode 100644 index 2c1c4220914..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCommandComplete.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -import java.util.concurrent.Callable; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestCommandComplete implements Callable<ITestCommandResult> { - - private ICommandHandle handle; - private final TestEnvironment env; - private Future<ITestCommandResult> future; - private ITestServerCommand cmd; - - public TestCommandComplete(TestEnvironment env, ITestServerCommand cmd, Future<ITestCommandResult> future) { - this.future = future; - this.cmd = cmd; - this.env = env; - } - - public TestCommandComplete(TestEnvironment env, ICommandHandle handle) { - this.env = env; - this.handle = handle; - } - - @Override - public ITestCommandResult call() throws Exception { - ITestCommandResult result; - try { - result = future.get(30, TimeUnit.SECONDS); - ICommandHandle handle = cmd.createCommandHandle(future, env); - env.testEnvironmentCommandComplete(handle); - } catch (Throwable th) { - result = new TestCommandResult(TestCommandStatus.FAIL, new Exception("Failed to retrieve command result", th)); - } - return result; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCommandResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCommandResult.java deleted file mode 100644 index 01c228b1afa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCommandResult.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -public class TestCommandResult implements ITestCommandResult { - - private static final long serialVersionUID = -7905997520977718355L; - - public static final ITestCommandResult CANCEL = new TestCommandResult(TestCommandStatus.CANCEL); - public static final ITestCommandResult SUCCESS = new TestCommandResult(TestCommandStatus.SUCCESS); - public static final ITestCommandResult FAIL = new TestCommandResult(TestCommandStatus.FAIL); - - private final TestCommandStatus status; - private Throwable th; - - public TestCommandResult(TestCommandStatus status) { - this.status = status; - } - - public TestCommandResult(TestCommandStatus status, Throwable th) { - this.status = status; - this.th = th; - } - - @Override - public TestCommandStatus getStatus() { - return status; - } - - @Override - public Throwable getThrowable() { - return th; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCommandStatus.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCommandStatus.java deleted file mode 100644 index 9683ac2152f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/command/TestCommandStatus.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.command; - -public enum TestCommandStatus { - SUCCESS, - FAIL, - CANCEL -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/BaseEvent.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/BaseEvent.java deleted file mode 100644 index 75654310aab..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/BaseEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.event; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestScript; - -public class BaseEvent implements IEventData { - - private final IPropertyStore propertyStore; - private final TestScript test; - private final TestCase testCase; - - public BaseEvent(IPropertyStore propertyStore, TestScript test) { - this.propertyStore = propertyStore; - this.test = test; - this.testCase = null; - } - - public BaseEvent(IPropertyStore propertyStore, TestScript test, TestCase testCase) { - this.propertyStore = propertyStore; - this.test = test; - this.testCase = testCase; - } - - public BaseEvent(TestScript test, TestCase testCase) { - this.propertyStore = null; - this.test = test; - this.testCase = testCase; - } - - public BaseEvent(TestScript test) { - this.test = test; - this.testCase = null; - this.propertyStore = null; - } - - @Override - public TestScript getTest() { - return test; - } - - @Override - public TestCase getTestCase() { - return testCase; - } - - @Override - public IPropertyStore getProperties() { - return propertyStore; - } - - public String getScriptClass() { - return propertyStore.get("classname"); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/BaseEventDataProvider.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/BaseEventDataProvider.java deleted file mode 100644 index 389599722f3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/BaseEventDataProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.event; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestScript; - -public class BaseEventDataProvider implements IEventDataProvider { - - @Override - public IEventData getEventData(IPropertyStore propertyStore, TestScript script) { - return new BaseEvent(propertyStore, script); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/IEventData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/IEventData.java deleted file mode 100644 index 294be540a83..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/IEventData.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.event; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestScript; - -public interface IEventData { - public TestScript getTest(); - - public TestCase getTestCase(); - - public IPropertyStore getProperties(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/IEventDataProvider.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/IEventDataProvider.java deleted file mode 100644 index aa57fd2575b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/event/IEventDataProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.event; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestScript; - -public interface IEventDataProvider { - - IEventData getEventData(IPropertyStore propertyStore, TestScript script); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractInteractivePrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractInteractivePrompt.java deleted file mode 100644 index 6ba914813ae..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractInteractivePrompt.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.util.concurrent.Executor; -import java.util.logging.Level; -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -/** - * @author Ken J. Aguilar - */ -public abstract class AbstractInteractivePrompt<T> extends AbstractRemotePrompt implements IPromptHandle { - - private final TestScript script; - protected Exception exception; - protected T response; - - public AbstractInteractivePrompt(IServiceConnector connector, TestScript script, String id, String message) throws UnknownHostException { - super(connector, id, message); - this.script = script; - } - - public T open(Executor executor) throws InterruptedException, Exception { - response = null; - exception = null; - if (executor != null) { - // run the prompt in the background - executor.execute(new Runnable() { - - @Override - public void run() { - try { - doPrompt(); - } catch (Exception e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, "exception while performing prompt", e); - // the thread that activated the prompt will be waiting on the script object's notifyAll() to - // be called. If an exception occurs this may not happen so we should do it here - endPrompt(null, new Exception("exception while performing prompt", e)); - } - } - }); - } else { - doPrompt(); - } - return waitForResponse(script, false); - } - - protected void endPrompt(T response, Exception exception) { - - script.getTestEnvironment().getScriptCtrl().setExecutionUnitPause(false); - script.getTestEnvironment().getScriptCtrl().setScriptPause(false); - synchronized (script) { - this.response = response; - this.exception = exception; - script.notifyAll(); - } - } - - protected abstract void doPrompt() throws Exception; - - protected void terminatePrompt() throws Exception { - getScript().getUserSession().cancelPrompts(); - } - - protected T waitForResponse(TestScript script, boolean executionUnitPause) throws InterruptedException, Exception { - synchronized (script) { - script.getTestEnvironment().getScriptCtrl().setScriptPause(true); - script.getTestEnvironment().getScriptCtrl().setExecutionUnitPause(executionUnitPause); - script.getTestEnvironment().getScriptCtrl().unlock(); - try { - script.wait(); - } catch (InterruptedException e) { - terminatePrompt(); - throw new InterruptedException(); - } finally { - script.getTestEnvironment().getScriptCtrl().lock(); - } - return response; - } - } - - /** - * @return the script - */ - public TestScript getScript() { - return script; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractRemotePrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractRemotePrompt.java deleted file mode 100644 index e1e2722fdee..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/AbstractRemotePrompt.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.rmi.RemoteException; -import java.rmi.server.ExportException; -import org.eclipse.osee.connection.service.IServiceConnector; - -/** - * @author Ken J. Aguilar - */ -public class AbstractRemotePrompt implements IPromptHandle { - private final String id; - private final String message; - private final IServiceConnector connector; - - public AbstractRemotePrompt(IServiceConnector connector, String id, String message) throws UnknownHostException { - this.connector = connector; - this.id = id; - this.message = message; - } - - @Override - public String getPromptId() throws RemoteException { - return id; - } - - @Override - public String getPromptMessage() throws RemoteException { - return message; - } - - /** - * returns a reference to the specified remote interface whose remote methods will be bound to this prompt object - * - */ - protected final <U extends IPromptHandle> U createRemoteReference(Class<U> remoteInterface) throws ExportException { - return remoteInterface.cast(connector.export(this)); - } - - public void close() throws Exception { - connector.unexport(this); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/BlockingMessagePrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/BlockingMessagePrompt.java deleted file mode 100644 index 2385333ebdd..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/BlockingMessagePrompt.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.rmi.RemoteException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.ReentrantLock; -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.IUserSession; - -/** - * @author Ken J. Aguilar - */ -public class BlockingMessagePrompt extends AbstractRemotePrompt implements IResumeResponse { - - private final ReentrantLock lock = new ReentrantLock(); - private final Condition responseAvailable = lock.newCondition(); - private boolean responded; - - public BlockingMessagePrompt(IServiceConnector connector, String id, String message) throws UnknownHostException { - super(connector, id, message); - } - - /** - * @return true if the user did not respond within the time specified and false if the user responded in time - */ - public boolean open(IUserSession session, int timeout) throws Exception { - lock.lock(); - try { - responded = false; - session.initiateResumePrompt(this); - long nanos = TimeUnit.SECONDS.toNanos(timeout); - - while (!responded) { - if (nanos > 0) { - nanos = responseAvailable.awaitNanos(0); - } else { - return true; - } - } - return false; - } finally { - lock.unlock(); - } - } - - @Override - public void resume() throws RemoteException { - lock.lock(); - try { - responded = true; - responseAvailable.notifyAll(); - } finally { - lock.unlock(); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IPassFailPromptResponse.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IPassFailPromptResponse.java deleted file mode 100644 index f9d31abc3d7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IPassFailPromptResponse.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.rmi.RemoteException; - -/** - * @author Ken J. Aguilar - */ -public interface IPassFailPromptResponse extends IPromptHandle { - void respond(boolean pass, String text) throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IPromptHandle.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IPromptHandle.java deleted file mode 100644 index 0346e11beed..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IPromptHandle.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -/** - * @author Ken J. Aguilar - */ -public interface IPromptHandle extends Remote { - String getPromptId() throws RemoteException; - - String getPromptMessage() throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IResumeResponse.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IResumeResponse.java deleted file mode 100644 index 622e37d5043..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IResumeResponse.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.rmi.RemoteException; - -/** - * @author Ken J. Aguilar - */ -public interface IResumeResponse extends IPromptHandle { - void resume() throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/ISteppingPrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/ISteppingPrompt.java deleted file mode 100644 index 8f81017d8a1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/ISteppingPrompt.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.rmi.RemoteException; - -/** - * @author Ken J. Aguilar - */ -public interface ISteppingPrompt extends IPromptHandle { - void step() throws RemoteException; - - void resume() throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IUserInputPromptResponse.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IUserInputPromptResponse.java deleted file mode 100644 index d4aaa6fa733..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IUserInputPromptResponse.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.rmi.RemoteException; - -/** - * @author Ken J. Aguilar - */ -public interface IUserInputPromptResponse extends IPromptHandle { - void respond(String text) throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IYesNoPromptResponse.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IYesNoPromptResponse.java deleted file mode 100644 index a9a4861abcd..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/IYesNoPromptResponse.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.rmi.RemoteException; - -public interface IYesNoPromptResponse extends IPromptHandle { - void respond(boolean yes) throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/InformationalPrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/InformationalPrompt.java deleted file mode 100644 index 07ddce254fb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/InformationalPrompt.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.util.concurrent.Executor; - -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.IUserSession; - -/** - * @author Ken J. Aguilar - */ -public class InformationalPrompt extends AbstractRemotePrompt { - - public InformationalPrompt(IServiceConnector connector, String id, String message) throws UnknownHostException { - super(connector, id, message); - } - - public void open(final IUserSession session, Executor executor) throws Exception { - if (executor != null) { - executor.execute(new Runnable() { - - @Override - public void run() { - String message = null; - try { - message = getPromptMessage(); - if (message != null) { - session.initiateInformationalPrompt(getPromptMessage()); - } else { - session.initiateInformationalPrompt("null message"); - } - } catch (Exception e) { - System.out.println(message); - } - } - }); - } else { - session.initiateInformationalPrompt(getPromptMessage()); - } - } - - @Override - public void close() { - - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/NonBlockingMessagePrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/NonBlockingMessagePrompt.java deleted file mode 100644 index 31b3d2abac2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/NonBlockingMessagePrompt.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.rmi.RemoteException; -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.IUserSession; - -/** - * @author Ken J. Aguilar - */ -public class NonBlockingMessagePrompt extends AbstractRemotePrompt implements IResumeResponse { - - public NonBlockingMessagePrompt(IServiceConnector connector, String id, String message) throws UnknownHostException { - super(connector, id, message); - } - - public void open(IUserSession session) throws Exception { - - session.initiateResumePrompt(this); - - } - - @Override - public void resume() throws RemoteException { - - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/OfpDebugPrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/OfpDebugPrompt.java deleted file mode 100644 index 0df027b5fd7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/OfpDebugPrompt.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.rmi.RemoteException; -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.TestScript; - -/** - * @author Ken J. Aguilar - */ -public class OfpDebugPrompt extends ScriptPausePromptImpl { - - public OfpDebugPrompt(IServiceConnector connector, TestScript script, String id, String message) throws UnknownHostException { - super(connector, script, id, message); - } - - @Override - public void resume() throws RemoteException { - super.resume(); - } - - @Override - protected String waitForResponse(TestScript script, boolean executionUnitPause) throws InterruptedException, Exception { - synchronized (script) { - script.getTestEnvironment().getScriptCtrl().setScriptPause(true); - script.getTestEnvironment().getScriptCtrl().setExecutionUnitPause(executionUnitPause); - script.getTestEnvironment().getScriptCtrl().unlock(); - script.wait(); - if (exception != null) { - throw exception; - } - return response; - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/PassFailPromptImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/PassFailPromptImpl.java deleted file mode 100644 index 759a855df0c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/PassFailPromptImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.rmi.RemoteException; -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.TestScript; - -/** - * @author Ken J. Aguilar - */ -public class PassFailPromptImpl extends AbstractInteractivePrompt<PassFailPromptResult> implements IPassFailPromptResponse { - - public PassFailPromptImpl(IServiceConnector connector, TestScript script, String id, String message) throws UnknownHostException { - super(connector, script, id, message); - } - - @Override - public void doPrompt() throws Exception { - getScript().getUserSession().initiatePassFailPrompt(createRemoteReference(IPassFailPromptResponse.class)); - } - - @Override - public void respond(boolean pass, String text) throws RemoteException { - endPrompt(new PassFailPromptResult(pass, text), null); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/PassFailPromptResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/PassFailPromptResult.java deleted file mode 100644 index 7a8861faa80..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/PassFailPromptResult.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -public class PassFailPromptResult { - private final boolean pass; - private final String text; - - public PassFailPromptResult(boolean pass, String text) { - this.pass = pass; - this.text = text; - } - - /** - * @return the pass - */ - public boolean isPass() { - return pass; - } - - /** - * @return the text - */ - public String getText() { - return text; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/ScriptPausePromptImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/ScriptPausePromptImpl.java deleted file mode 100644 index a900523db80..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/ScriptPausePromptImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.rmi.RemoteException; -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.TestScript; - -/** - * @author Ken J. Aguilar - */ -public class ScriptPausePromptImpl extends AbstractInteractivePrompt<String> implements IResumeResponse { - - public ScriptPausePromptImpl(IServiceConnector connector, TestScript script, String id, String message) throws UnknownHostException { - super(connector, script, id, message); - } - - @Override - public void doPrompt() throws Exception { - getScript().getUserSession().initiateResumePrompt(createRemoteReference(IResumeResponse.class)); - } - - @Override - public void resume() throws RemoteException { - endPrompt("CONTINUE", null); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/ScriptSteppingPrompt.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/ScriptSteppingPrompt.java deleted file mode 100644 index 318205ea469..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/ScriptSteppingPrompt.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.rmi.RemoteException; -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.TestScript; - -/** - * @author Ken J. Aguilar - */ -public class ScriptSteppingPrompt extends AbstractInteractivePrompt<String> implements ISteppingPrompt { - - public ScriptSteppingPrompt(IServiceConnector connector, TestScript script, String id, String message) throws UnknownHostException { - super(connector, script, id, message); - } - - @Override - public void doPrompt() throws Exception { - getScript().getUserSession().initiateResumePrompt(createRemoteReference(IResumeResponse.class)); - } - - @Override - public void step() throws RemoteException { - // environment.singleStepEnv(); - endPrompt("RESUME", null); - } - - @Override - public void resume() throws RemoteException { - - endPrompt("CONTINUE", null); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/UserInputPromptImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/UserInputPromptImpl.java deleted file mode 100644 index b12e6058ec0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/UserInputPromptImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.rmi.RemoteException; -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.TestScript; - -/** - * @author Ken J. Aguilar - */ -public class UserInputPromptImpl extends AbstractInteractivePrompt<String> implements IUserInputPromptResponse { - - public UserInputPromptImpl(IServiceConnector connector, TestScript script, String id, String message) throws UnknownHostException { - super(connector, script, id, message); - } - - @Override - public void doPrompt() throws Exception { - getScript().getUserSession().initiateUserInputPrompt(createRemoteReference(IUserInputPromptResponse.class)); - } - - @Override - public void respond(String text) throws RemoteException { - endPrompt(text, null); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/YesNoPromptImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/YesNoPromptImpl.java deleted file mode 100644 index 7a1a6b154b6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/YesNoPromptImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -import java.net.UnknownHostException; -import java.rmi.RemoteException; - -import org.eclipse.osee.connection.service.IServiceConnector; -import org.eclipse.osee.ote.core.TestScript; - -public class YesNoPromptImpl extends AbstractInteractivePrompt<YesNoPromptResult> implements IYesNoPromptResponse { - - public YesNoPromptImpl(IServiceConnector connector, TestScript script, String id, String message) throws UnknownHostException { - super(connector, script, id, message); - } - - @Override - public void doPrompt() throws Exception { - getScript().getUserSession().initiateYesNoPrompt(createRemoteReference(IYesNoPromptResponse.class)); - } - - @Override - public void respond(boolean yes) throws RemoteException { - endPrompt(new YesNoPromptResult(yes), null); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/YesNoPromptResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/YesNoPromptResult.java deleted file mode 100644 index 4ebd66471f7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/prompt/YesNoPromptResult.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.prompt; - -public class YesNoPromptResult { - private final boolean yes; - - public YesNoPromptResult(boolean yes) { - this.yes = yes; - } - - public boolean isYes() { - return yes; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ElementHandlers.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ElementHandlers.java deleted file mode 100644 index d7efe949e88..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ElementHandlers.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse; - -import java.util.ArrayList; -import java.util.List; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * @author Andrew M. Finkbeiner - */ -public abstract class ElementHandlers { - - private final String name; - private final List<IBaseSaxElementListener> listeners = new ArrayList<>(); - - public ElementHandlers(String name) { - this.name = name; - } - - public final String getElementName() { - return this.name; - } - - public final void addListener(IBaseSaxElementListener listener) { - listeners.add(listener); - } - - public final void removeListener(IBaseSaxElementListener listener) { - listeners.remove(listener); - } - - void endElementFound(String uri, String localName, String name, String content) throws SAXException { - if (listeners.isEmpty()) { - return; - } - Object obj = createEndElementFoundObject(uri, localName, name, content); - for (IBaseSaxElementListener listener : listeners) { - listener.onEndElement(obj); - } - } - - void startElementFound(String uri, String localName, String name, Attributes attributes) throws SAXException { - if (listeners.isEmpty()) { - return; - } - Object obj = createStartElementFoundObject(uri, localName, name, attributes); - for (IBaseSaxElementListener listener : listeners) { - listener.onStartElement(obj); - } - } - - public abstract Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes); - - public Object createEndElementFoundObject(String uri, String localName, String name, String content) { - return content; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/IBaseSaxElementListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/IBaseSaxElementListener.java deleted file mode 100644 index f64bd7e21f2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/IBaseSaxElementListener.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IBaseSaxElementListener { - - void onStartElement(Object obj); - - void onEndElement(Object obj); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/OteSaxHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/OteSaxHandler.java deleted file mode 100644 index 856a7732ced..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/OteSaxHandler.java +++ /dev/null @@ -1,214 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.osee.framework.jdk.core.util.io.xml.AbstractSaxHandler; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Actual; -import org.eclipse.osee.ote.core.framework.saxparse.elements.AdditionalInfo; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Argument; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Attention; -import org.eclipse.osee.ote.core.framework.saxparse.elements.CheckGroup; -import org.eclipse.osee.ote.core.framework.saxparse.elements.CheckPoint; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Config; -import org.eclipse.osee.ote.core.framework.saxparse.elements.CurrentProcessor; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Debug; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ElapsedTime; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Environment; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ExecutedBy; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ExecutionDate; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Expected; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Global; -import org.eclipse.osee.ote.core.framework.saxparse.elements.GroupName; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Info; -import org.eclipse.osee.ote.core.framework.saxparse.elements.InfoGroup; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Location; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Message; -import org.eclipse.osee.ote.core.framework.saxparse.elements.MethodArguments; -import org.eclipse.osee.ote.core.framework.saxparse.elements.MethodName; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Name; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Notes; -import org.eclipse.osee.ote.core.framework.saxparse.elements.NumberOfTransmissions; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ObjectName; -import org.eclipse.osee.ote.core.framework.saxparse.elements.OfpErrorEntry; -import org.eclipse.osee.ote.core.framework.saxparse.elements.OfpLoggingInfo; -import org.eclipse.osee.ote.core.framework.saxparse.elements.OteLog; -import org.eclipse.osee.ote.core.framework.saxparse.elements.PropertyElementHandler; -import org.eclipse.osee.ote.core.framework.saxparse.elements.PropertyStoreElementHandler; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Qualification; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Requirement; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Result; -import org.eclipse.osee.ote.core.framework.saxparse.elements.RetryGroup; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ReturnValue; -import org.eclipse.osee.ote.core.framework.saxparse.elements.RuntimeVersions; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ScriptInit; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ScriptName; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ScriptResult; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ScriptVersion; -import org.eclipse.osee.ote.core.framework.saxparse.elements.SoftKeyInfoGroup; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Stacktrace; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Summary; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Support; -import org.eclipse.osee.ote.core.framework.saxparse.elements.SystemInfo; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TestCase; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TestEventElement; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TestPoint; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TestPointName; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TestPointResults; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TestScript; -import org.eclipse.osee.ote.core.framework.saxparse.elements.ThrowableElement; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Time; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TimeSummary; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Tracability; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Trace; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TraceEnd; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Type; -import org.eclipse.osee.ote.core.framework.saxparse.elements.User; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Value; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Version; -import org.eclipse.osee.ote.core.framework.saxparse.elements.VersionInformation; -import org.eclipse.osee.ote.core.framework.saxparse.elements.Witnesses; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * XMLReader xmlReader = XMLReaderFactory.createXMLReader(); CollectionParser handler = new - * CollectionParser(collectors); xmlReader.setContentHandler(handler); xmlReader.parse(new InputSource(inputStream)); - * - * @author Andrew M. Finkbeiner - */ -public class OteSaxHandler extends AbstractSaxHandler { - - Map<String, ElementHandlers> handlers; - - public OteSaxHandler() throws Exception { - handlers = new HashMap<>(); - addHandlers(new Global()); - addHandlers(new AdditionalInfo()); - addHandlers(new Actual()); - addHandlers(new Argument()); - addHandlers(new Attention()); - addHandlers(new CheckGroup()); - addHandlers(new CheckPoint()); - addHandlers(new Config()); - addHandlers(new CurrentProcessor()); - addHandlers(new Debug()); - addHandlers(new ElapsedTime()); - addHandlers(new Environment()); - addHandlers(new ExecutedBy()); - addHandlers(new ExecutionDate()); - addHandlers(new Expected()); - addHandlers(new GroupName()); - addHandlers(new Info()); - addHandlers(new InfoGroup()); - addHandlers(new Location()); - addHandlers(new Message()); - addHandlers(new MethodArguments()); - addHandlers(new MethodName()); - addHandlers(new Name()); - addHandlers(new Notes()); - addHandlers(new org.eclipse.osee.ote.core.framework.saxparse.elements.Number()); - addHandlers(new NumberOfTransmissions()); - addHandlers(new ObjectName()); - addHandlers(new OfpErrorEntry()); - addHandlers(new OfpLoggingInfo()); - addHandlers(new OteLog()); - addHandlers(new PropertyStoreElementHandler()); - addHandlers(new PropertyElementHandler()); - addHandlers(new Qualification()); - addHandlers(new Requirement()); - addHandlers(new Result()); - addHandlers(new RetryGroup()); - addHandlers(new ReturnValue()); - addHandlers(new RuntimeVersions()); - addHandlers(new ScriptInit()); - addHandlers(new ScriptName()); - addHandlers(new ScriptResult()); - addHandlers(new ScriptVersion()); - addHandlers(new SoftKeyInfoGroup()); - addHandlers(new Stacktrace()); - addHandlers(new Summary()); - addHandlers(new Support()); - addHandlers(new SystemInfo()); - addHandlers(new TestCase()); - addHandlers(new TestPoint()); - addHandlers(new ThrowableElement()); - addHandlers(new TestEventElement()); - addHandlers(new TestPointName()); - addHandlers(new TestPointResults()); - addHandlers(new TestScript()); - addHandlers(new Time()); - addHandlers(new TimeSummary()); - addHandlers(new Tracability()); - addHandlers(new Trace()); - addHandlers(new TraceEnd()); - addHandlers(new Type()); - addHandlers(new User()); - addHandlers(new Value()); - addHandlers(new Version()); - addHandlers(new VersionInformation()); - addHandlers(new Witnesses()); - } - - @Override - public void endElementFound(String uri, String localName, String name) throws SAXException { - ElementHandlers handler; - - handler = handlers.get("*"); - if (handler != null) { - handler.endElementFound(uri, localName, name, stripCData(getContents().trim())); - } - - handler = handlers.get(name); - if (handler != null) { - handler.endElementFound(uri, localName, name, stripCData(getContents().trim())); - } - } - - private String stripCData(String content) { - if (content.startsWith("<![CDATA[")) { - return content.subSequence(9, content.length() - 3).toString(); - } else { - return content; - } - - } - - @Override - public void startElementFound(String uri, String localName, String name, Attributes attributes) throws SAXException { - ElementHandlers handler; - - handler = handlers.get("*"); - if (handler != null) { - handler.startElementFound(uri, localName, name, attributes); - } - - handler = handlers.get(name); - if (handler != null) { - handler.startElementFound(uri, localName, name, attributes); - } else { - System.out.println("No Handler for ELEMENT type " + name); - } - } - - public void addHandlers(ElementHandlers handler) throws Exception { - Object obj = handlers.put(handler.getElementName(), handler); - if (obj != null) { - throw new Exception("Duplicate handler."); - } - } - - public ElementHandlers getHandler(String elementName) { - return handlers.get(elementName); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ProcessOutfileOverview.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ProcessOutfileOverview.java deleted file mode 100644 index f47eb0125f1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/ProcessOutfileOverview.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse; - -import java.io.InputStream; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TestPointResultsData; -import org.eclipse.osee.ote.core.framework.saxparse.elements.TimeSummaryData; -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLReaderFactory; - -/** - * @author Andrew M. Finkbeiner - */ -public class ProcessOutfileOverview { - - private String elapsedTime; - private String scriptName; - private String results = ""; - - public ProcessOutfileOverview() { - } - - public void run(InputStream inputStream) throws Exception { - - long time = System.currentTimeMillis(); - - XMLReader xmlReader = XMLReaderFactory.createXMLReader(); - OteSaxHandler handler = new OteSaxHandler(); - xmlReader.setContentHandler(handler); - xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); - - handler.getHandler("TimeSummary").addListener(new IBaseSaxElementListener() { - - @Override - public void onEndElement(Object obj) { - } - - @Override - public void onStartElement(Object obj) { - if (obj instanceof TimeSummaryData) { - TimeSummaryData data = (TimeSummaryData) obj; - elapsedTime = data.getElapsed(); - } - } - - }); - handler.getHandler("TestPointResults").addListener(new IBaseSaxElementListener() { - - @Override - public void onEndElement(Object obj) { - } - - @Override - public void onStartElement(Object obj) { - if (obj instanceof TestPointResultsData) { - TestPointResultsData data = (TestPointResultsData) obj; - String fail = data.getFail(); - String pass = data.getPass(); - String aborted = data.getAborted(); - try { - int failedTestPoints = Integer.parseInt(fail); - int passedTestPoints = Integer.parseInt(pass); - int totalTestPoints = passedTestPoints + failedTestPoints; - boolean abort = false; - if (aborted != null && aborted.length() > 0) { - abort = Boolean.parseBoolean(aborted); - } - results = ""; - if (abort) { - results = String.format("ABORTED - Total[%d] Fail[%d]", totalTestPoints, failedTestPoints); - } else if (failedTestPoints > 0) { - results = String.format("FAILED - Total[%d] Fail[%d]", totalTestPoints, failedTestPoints); - } else { - results = String.format("PASSED - Total[%d] Fail[%d]", totalTestPoints, failedTestPoints); - } - } catch (NumberFormatException ex) { - - } - } - } - - }); - handler.getHandler("ScriptName").addListener(new IBaseSaxElementListener() { - - @Override - public void onEndElement(Object obj) { - scriptName = obj.toString(); - } - - @Override - public void onStartElement(Object obj) { - } - }); - - xmlReader.parse(new InputSource(inputStream)); - - long all = System.currentTimeMillis() - time; - - OseeLog.logf(getClass(), Level.INFO, "It took %d ms total to process.", all); - } - - public String getElapsedTime() { - return elapsedTime; - } - - public String getResults() { - return results; - } - - public String getScriptName() { - return scriptName; - } - - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Actual.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Actual.java deleted file mode 100644 index fb181c68ee9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Actual.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Actual extends ElementHandlers { - - public Actual() { - super("Actual"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/AdditionalInfo.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/AdditionalInfo.java deleted file mode 100644 index 09985cc2eed..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/AdditionalInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class AdditionalInfo extends ElementHandlers { - - public AdditionalInfo() { - super("AdditionalInfo"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Argument.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Argument.java deleted file mode 100644 index beac9fd6beb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Argument.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Argument extends ElementHandlers { - - public Argument() { - super("Argument"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Attention.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Attention.java deleted file mode 100644 index 097aaff6c9f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Attention.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Attention extends ElementHandlers { - - public Attention() { - super("Attention"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CheckGroup.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CheckGroup.java deleted file mode 100644 index af91245d790..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CheckGroup.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class CheckGroup extends ElementHandlers { - - public CheckGroup() { - super("CheckGroup"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new CheckGroupData(attributes.getValue("Mode")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CheckGroupData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CheckGroupData.java deleted file mode 100644 index 893ee745db3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CheckGroupData.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class CheckGroupData { - - private final String mode; - - /** - * @return the mode - */ - public String getMode() { - return mode; - } - - CheckGroupData(String mode) { - this.mode = mode; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CheckPoint.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CheckPoint.java deleted file mode 100644 index 6ca0712dcae..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CheckPoint.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class CheckPoint extends ElementHandlers { - - public CheckPoint() { - super("CheckPoint"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Config.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Config.java deleted file mode 100644 index 1c18290d34d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Config.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Config extends ElementHandlers { - - public Config() { - super("Config"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new ConfigData(attributes.getValue("machineName")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ConfigData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ConfigData.java deleted file mode 100644 index 5fa71f66dcb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ConfigData.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class ConfigData { - private final String machineName; - - /** - * @return the machineName - */ - public String getMachineName() { - return machineName; - } - - public ConfigData(String machineName) { - this.machineName = machineName; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CurrentProcessor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CurrentProcessor.java deleted file mode 100644 index f615b142d6d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/CurrentProcessor.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class CurrentProcessor extends ElementHandlers { - - public CurrentProcessor() { - super("CurrentProcessor"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return attributes.getValue("proc"); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Debug.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Debug.java deleted file mode 100644 index 2db07a73210..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Debug.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Debug extends ElementHandlers { - - public Debug() { - super("Debug"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ElapsedTime.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ElapsedTime.java deleted file mode 100644 index 907e1fe20d4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ElapsedTime.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ElapsedTime extends ElementHandlers { - - public ElapsedTime() { - super("ElapsedTime"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Environment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Environment.java deleted file mode 100644 index 9b882c20f25..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Environment.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Environment extends ElementHandlers { - - public Environment() { - super("Environment"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ExecutedBy.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ExecutedBy.java deleted file mode 100644 index 476ea07706e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ExecutedBy.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ExecutedBy extends ElementHandlers { - - public ExecutedBy() { - super("ExecutedBy"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ExecutionDate.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ExecutionDate.java deleted file mode 100644 index 53577e7ba02..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ExecutionDate.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ExecutionDate extends ElementHandlers { - - public ExecutionDate() { - super("ExecutionDate"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Expected.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Expected.java deleted file mode 100644 index 2e58af71293..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Expected.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Expected extends ElementHandlers { - - public Expected() { - super("Expected"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Global.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Global.java deleted file mode 100644 index b5a3ac4ed99..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Global.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Robert A. Fisher - */ -public class Global extends ElementHandlers { - - public Global() { - super("*"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return name; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/GroupName.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/GroupName.java deleted file mode 100644 index 2a6f0fa2409..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/GroupName.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class GroupName extends ElementHandlers { - - public GroupName() { - super("GroupName"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Info.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Info.java deleted file mode 100644 index 9db505ba05b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Info.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Info extends ElementHandlers { - - public Info() { - super("Info"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new InfoData(attributes.getValue("title")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/InfoData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/InfoData.java deleted file mode 100644 index a809c57bf22..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/InfoData.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class InfoData { - - private final String title; - - InfoData(String title) { - this.title = title; - } - - /** - * @return the title - */ - public String getTitle() { - return title; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/InfoGroup.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/InfoGroup.java deleted file mode 100644 index 77ebb4dabdd..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/InfoGroup.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class InfoGroup extends ElementHandlers { - - public InfoGroup() { - super("InfoGroup"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new InfoGroupData(attributes.getValue("title")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/InfoGroupData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/InfoGroupData.java deleted file mode 100644 index ae7a17f2412..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/InfoGroupData.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class InfoGroupData { - - private final String title; - - InfoGroupData(String title) { - this.title = title; - } - - /** - * @return the title - */ - public String getTitle() { - return title; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Location.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Location.java deleted file mode 100644 index 35649fb6761..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Location.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Location extends ElementHandlers { - - public Location() { - super("Location"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Message.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Message.java deleted file mode 100644 index 24bd66c8fb2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Message.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Message extends ElementHandlers { - - public Message() { - super("Message"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/MethodArguments.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/MethodArguments.java deleted file mode 100644 index bd05ce5e017..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/MethodArguments.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class MethodArguments extends ElementHandlers { - - public MethodArguments() { - super("MethodArguments"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/MethodName.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/MethodName.java deleted file mode 100644 index 2bb33c3205e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/MethodName.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class MethodName extends ElementHandlers { - - public MethodName() { - super("MethodName"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Name.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Name.java deleted file mode 100644 index 7f3ef635371..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Name.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Name extends ElementHandlers { - - public Name() { - super("Name"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Notes.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Notes.java deleted file mode 100644 index 20935d93651..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Notes.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Notes extends ElementHandlers { - - public Notes() { - super("Notes"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Number.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Number.java deleted file mode 100644 index 5e99840bf55..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Number.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Number extends ElementHandlers { - - public Number() { - super("Number"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/NumberOfTransmissions.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/NumberOfTransmissions.java deleted file mode 100644 index 29473b64a0f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/NumberOfTransmissions.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class NumberOfTransmissions extends ElementHandlers { - - public NumberOfTransmissions() { - super("NumberOfTransmissions"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ObjectName.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ObjectName.java deleted file mode 100644 index c8755db20f6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ObjectName.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ObjectName extends ElementHandlers { - - public ObjectName() { - super("ObjectName"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OfpErrorEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OfpErrorEntry.java deleted file mode 100644 index 024e891089d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OfpErrorEntry.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class OfpErrorEntry extends ElementHandlers { - - public OfpErrorEntry() { - super("OfpErrorEntry"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new OfpErrorEntryData(attributes.getValue("NODE_ID"), attributes.getValue("count"), - attributes.getValue("severity"), attributes.getValue("version")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OfpErrorEntryData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OfpErrorEntryData.java deleted file mode 100644 index 12a89d17211..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OfpErrorEntryData.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class OfpErrorEntryData { - - private final String nodeId; - private final String count; - private final String severity; - private final String version; - - /** - * @return the nodeId - */ - public String getNodeId() { - return nodeId; - } - - /** - * @return the count - */ - public String getCount() { - return count; - } - - /** - * @return the severity - */ - public String getSeverity() { - return severity; - } - - /** - * @return the version - */ - public String getVersion() { - return version; - } - - OfpErrorEntryData(String nodeId, String count, String severity, String version) { - this.nodeId = nodeId; - this.count = count; - this.severity = severity; - this.version = version; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OfpLoggingInfo.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OfpLoggingInfo.java deleted file mode 100644 index c57acf82c46..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OfpLoggingInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class OfpLoggingInfo extends ElementHandlers { - - public OfpLoggingInfo() { - super("OfpLoggingInfo"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OteLog.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OteLog.java deleted file mode 100644 index 3ddec0d40de..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OteLog.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class OteLog extends ElementHandlers { - - public OteLog() { - super("OteLog"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new OteLogData(attributes.getValue("Level"), attributes.getValue("Logger")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OteLogData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OteLogData.java deleted file mode 100644 index 3e4be63bb98..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/OteLogData.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class OteLogData { - - private final String level; - private final String logger; - - OteLogData(String level, String logger) { - this.level = level; - this.logger = logger; - } - - /** - * @return the level - */ - public String getLevel() { - return level; - } - - /** - * @return the logger - */ - public String getLogger() { - return logger; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/PropertyElementHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/PropertyElementHandler.java deleted file mode 100644 index a04065409ff..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/PropertyElementHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class PropertyElementHandler extends ElementHandlers { - - public PropertyElementHandler() { - super("Property"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new PropertyElementHandlerData(attributes.getValue("key")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/PropertyElementHandlerData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/PropertyElementHandlerData.java deleted file mode 100644 index e203f98daab..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/PropertyElementHandlerData.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -public class PropertyElementHandlerData { - - private final String key; - - protected PropertyElementHandlerData(String key){ - this.key = key; - } - - public String getKey() { - return key; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/PropertyStoreElementHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/PropertyStoreElementHandler.java deleted file mode 100644 index 575f4813cfa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/PropertyStoreElementHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class PropertyStoreElementHandler extends ElementHandlers { - - public PropertyStoreElementHandler() { - super("PropertyStore"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Qualification.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Qualification.java deleted file mode 100644 index 2594011c51c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Qualification.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Qualification extends ElementHandlers { - - public Qualification() { - super("Qualification"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new QualificationData(attributes.getValue("buildId"), attributes.getValue("level")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/QualificationData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/QualificationData.java deleted file mode 100644 index 9ed1f3f2b84..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/QualificationData.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class QualificationData { - - private final String buildId; - private final String level; - - public QualificationData(String buildId, String level) { - this.buildId = buildId; - this.level = level; - } - - /** - * @return the buildId - */ - public String getBuildId() { - return buildId; - } - - /** - * @return the level - */ - public String getLevel() { - return level; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Requirement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Requirement.java deleted file mode 100644 index d14aa956300..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Requirement.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Requirement extends ElementHandlers { - - public Requirement() { - super("Requirement"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Result.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Result.java deleted file mode 100644 index 0f81c786a0c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Result.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Result extends ElementHandlers { - - public Result() { - super("Result"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/RetryGroup.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/RetryGroup.java deleted file mode 100644 index 279f797b259..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/RetryGroup.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class RetryGroup extends ElementHandlers { - - public RetryGroup() { - super("RetryGroup"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new RetryGroupData(attributes.getValue("Mode")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/RetryGroupData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/RetryGroupData.java deleted file mode 100644 index cd6c5556780..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/RetryGroupData.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class RetryGroupData { - - private final String mode; - - /** - * @return the mode - */ - public String getMode() { - return mode; - } - - RetryGroupData(String mode) { - this.mode = mode; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ReturnValue.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ReturnValue.java deleted file mode 100644 index 4087b010e8e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ReturnValue.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ReturnValue extends ElementHandlers { - - public ReturnValue() { - super("ReturnValue"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/RuntimeVersions.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/RuntimeVersions.java deleted file mode 100644 index ff168c6aaff..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/RuntimeVersions.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class RuntimeVersions extends ElementHandlers { - - public RuntimeVersions() { - super("RuntimeVersions"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptInit.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptInit.java deleted file mode 100644 index b749e819033..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptInit.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ScriptInit extends ElementHandlers { - - public ScriptInit() { - super("ScriptInit"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptName.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptName.java deleted file mode 100644 index c64ec2eea7c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptName.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ScriptName extends ElementHandlers { - - public ScriptName() { - super("ScriptName"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptResult.java deleted file mode 100644 index 2001e3cf74c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptResult.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ScriptResult extends ElementHandlers { - - public ScriptResult() { - super("ScriptResult"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptVersion.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptVersion.java deleted file mode 100644 index 787a88a2e86..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptVersion.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ScriptVersion extends ElementHandlers { - - public ScriptVersion() { - super("ScriptVersion"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new ScriptVersionData(attributes.getValue("lastAuthor"), attributes.getValue("lastModified"), - attributes.getValue("modifiedFlag"), attributes.getValue("repositoryType"), attributes.getValue("revision"), - attributes.getValue("url")); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptVersionData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptVersionData.java deleted file mode 100644 index dcc323ff60c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ScriptVersionData.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class ScriptVersionData { - - private final String lastAuthor; - private final String lastModified; - private final String modifiedFlag; - private final String repositoryType; - private final String revision; - private final String url; - - ScriptVersionData(String lastAuthor, String lastModified, String modifiedFlag, String repositoryType, String revision, String url) { - this.lastAuthor = lastAuthor; - this.lastModified = lastModified; - this.modifiedFlag = modifiedFlag; - this.repositoryType = repositoryType; - this.revision = revision; - this.url = url; - } - - /** - * @return the lastAuthor - */ - public String getLastAuthor() { - return lastAuthor; - } - - /** - * @return the lastModified - */ - public String getLastModified() { - return lastModified; - } - - /** - * @return the modifiedFlag - */ - public String getModifiedFlag() { - return modifiedFlag; - } - - /** - * @return the repositoryType - */ - public String getRepositoryType() { - return repositoryType; - } - - /** - * @return the revision - */ - public String getRevision() { - return revision; - } - - /** - * @return the url - */ - public String getUrl() { - return url; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SoftKeyInfoGroup.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SoftKeyInfoGroup.java deleted file mode 100644 index 97377c95897..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SoftKeyInfoGroup.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class SoftKeyInfoGroup extends ElementHandlers { - - public SoftKeyInfoGroup() { - super("SoftKeyInfoGroup"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new SoftKeyInfoGroupData(attributes.getValue("title")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SoftKeyInfoGroupData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SoftKeyInfoGroupData.java deleted file mode 100644 index 2ac772d721c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SoftKeyInfoGroupData.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class SoftKeyInfoGroupData { - - private final String title; - - SoftKeyInfoGroupData(String title) { - this.title = title; - } - - /** - * @return the title - */ - public String getTitle() { - return title; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Stacktrace.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Stacktrace.java deleted file mode 100644 index d9335537e92..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Stacktrace.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Stacktrace extends ElementHandlers { - - public Stacktrace() { - super("Stacktrace"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new StacktraceData(attributes.getValue("line"), attributes.getValue("source")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/StacktraceData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/StacktraceData.java deleted file mode 100644 index ba18bcd22bb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/StacktraceData.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class StacktraceData { - - private String line; - private String source; - - StacktraceData() { - } - - public StacktraceData(String line, String source) { - this.line = line; - this.source = source; - } - - /** - * @return the line - */ - public String getLine() { - return line; - } - - /** - * @return the source - */ - public String getSource() { - return source; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Summary.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Summary.java deleted file mode 100644 index 9a7bfb28b3c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Summary.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Summary extends ElementHandlers { - - public Summary() { - super("Summary"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new SummaryData(attributes.getValue("CRITICAL_COUNT"), attributes.getValue("EXCEPTION_COUNT"), - attributes.getValue("INFORMATIONAL_COUNT"), attributes.getValue("MINOR_COUNT"), - attributes.getValue("NODE_ID"), attributes.getValue("SERIOUS_COUNT"), attributes.getValue("START_NUMBER")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SummaryData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SummaryData.java deleted file mode 100644 index 531681d5403..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SummaryData.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class SummaryData { - - private final String criticalCount; - private final String exceptionCount; - private final String informationCount; - private final String minorCount; - private final String nodeId; - private final String seriousCount; - private final String startNumber; - - SummaryData(String criticalCount, String exceptionCount, String informationCount, String minorCount, String nodeId, String seriousCount, String startNumber) { - this.criticalCount = criticalCount; - this.exceptionCount = exceptionCount; - this.informationCount = informationCount; - this.minorCount = minorCount; - this.nodeId = nodeId; - this.seriousCount = seriousCount; - this.startNumber = startNumber; - } - - /** - * @return the criticalCount - */ - public String getCriticalCount() { - return criticalCount; - } - - /** - * @return the exceptionCount - */ - public String getExceptionCount() { - return exceptionCount; - } - - /** - * @return the informationCount - */ - public String getInformationCount() { - return informationCount; - } - - /** - * @return the minorCount - */ - public String getMinorCount() { - return minorCount; - } - - /** - * @return the nodeId - */ - public String getNodeId() { - return nodeId; - } - - /** - * @return the seriousCount - */ - public String getSeriousCount() { - return seriousCount; - } - - /** - * @return the startNumber - */ - public String getStartNumber() { - return startNumber; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Support.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Support.java deleted file mode 100644 index a948eda3ee7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Support.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Support extends ElementHandlers { - - public Support() { - super("Support"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SystemInfo.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SystemInfo.java deleted file mode 100644 index 260f8d888ad..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SystemInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class SystemInfo extends ElementHandlers { - - public SystemInfo() { - super("SystemInfo"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - SystemInfoData data = - new SystemInfoData(attributes.getValue("osArch"), attributes.getValue("osName"), - attributes.getValue("osVersion"), attributes.getValue("oseeVersion"), - attributes.getValue("oseeServerTitle")); - return data; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SystemInfoData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SystemInfoData.java deleted file mode 100644 index 86045751c23..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/SystemInfoData.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class SystemInfoData { - - private final String osArch; - private final String osName; - private final String osVersion; - private final String oseeVersion; - private final String oseeServerTitle; - - /** - * @return the osArch - */ - public String getOsArch() { - return osArch; - } - - /** - * @return the osName - */ - public String getOsName() { - return osName; - } - - /** - * @return the osVersion - */ - public String getOsVersion() { - return osVersion; - } - - /** - * @return the oseeVersion - */ - public String getOseeVersion() { - return oseeVersion; - } - - /** - * @return the oseeServerTitle - */ - public String getOseeServerTitle() { - return oseeServerTitle; - } - - SystemInfoData(String osArch, String osName, String osVersion, String oseeVersion, String oseeServerTitle) { - this.osArch = osArch; - this.osName = osName; - this.osVersion = osVersion; - this.oseeVersion = oseeVersion; - this.oseeServerTitle = oseeServerTitle; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestCase.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestCase.java deleted file mode 100644 index 0890f34ac7b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestCase.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestCase extends ElementHandlers { - - public TestCase() { - super("TestCase"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestEventElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestEventElement.java deleted file mode 100644 index c1eff0ac874..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestEventElement.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestEventElement extends ElementHandlers { - - public TestEventElement() { - super("TEST_EVENT"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPoint.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPoint.java deleted file mode 100644 index 30ad854e594..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPoint.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestPoint extends ElementHandlers { - - public TestPoint() { - super("TestPoint"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPointName.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPointName.java deleted file mode 100644 index d4cae71dcb2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPointName.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestPointName extends ElementHandlers { - - public TestPointName() { - super("TestPointName"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPointResults.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPointResults.java deleted file mode 100644 index f64147957f4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPointResults.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestPointResults extends ElementHandlers { - - public TestPointResults() { - super("TestPointResults"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - TestPointResultsData data = - new TestPointResultsData(attributes.getValue("aborted"), attributes.getValue("fail"), - attributes.getValue("pass"), attributes.getValue("total")); - return data; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPointResultsData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPointResultsData.java deleted file mode 100644 index 260999ea6e0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestPointResultsData.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestPointResultsData { - - private final String aborted; - - /** - * @return the aborted - */ - public String getAborted() { - return aborted; - } - - /** - * @return the fail - */ - public String getFail() { - return fail; - } - - /** - * @return the pass - */ - public String getPass() { - return pass; - } - - /** - * @return the total - */ - public String getTotal() { - return total; - } - - private final String fail; - private final String pass; - private final String total; - - public TestPointResultsData(String aborted, String fail, String pass, String total) { - this.aborted = aborted; - this.fail = fail; - this.pass = pass; - this.total = total; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestScript.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestScript.java deleted file mode 100644 index fc52df5fe78..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TestScript.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class TestScript extends ElementHandlers { - - public TestScript() { - super("TestScript"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ThrowableElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ThrowableElement.java deleted file mode 100644 index 990e972f5a8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/ThrowableElement.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class ThrowableElement extends ElementHandlers { - - public ThrowableElement() { - super("Throwable"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Time.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Time.java deleted file mode 100644 index 97b5143098d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Time.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Time extends ElementHandlers { - - public Time() { - super("Time"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TimeSummary.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TimeSummary.java deleted file mode 100644 index df14221ceaf..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TimeSummary.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class TimeSummary extends ElementHandlers { - - public TimeSummary() { - super("TimeSummary"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - TimeSummaryData data = - new TimeSummaryData(attributes.getValue("elapsed"), attributes.getValue("endDate"), - attributes.getValue("milliseconds"), attributes.getValue("startDate")); - return data; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TimeSummaryData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TimeSummaryData.java deleted file mode 100644 index f36f31a8bf2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TimeSummaryData.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class TimeSummaryData { - - private final String elapsed; - - /** - * @return the elapsed - */ - public String getElapsed() { - return elapsed; - } - - /** - * @return the endDate - */ - public String getEndDate() { - return endDate; - } - - /** - * @return the milliseconds - */ - public String getMilliseconds() { - return milliseconds; - } - - /** - * @return the startDate - */ - public String getStartDate() { - return startDate; - } - private final String endDate; - private final String milliseconds; - private final String startDate; - - TimeSummaryData(String elapsed, String endDate, String milliseconds, String startDate) { - this.elapsed = elapsed; - this.endDate = endDate; - this.milliseconds = milliseconds; - this.startDate = startDate; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Tracability.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Tracability.java deleted file mode 100644 index 6cdb5ec31e4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Tracability.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Tracability extends ElementHandlers { - - public Tracability() { - super("Tracability"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Trace.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Trace.java deleted file mode 100644 index 61bfd7dec10..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Trace.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Trace extends ElementHandlers { - - public Trace() { - super("Trace"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TraceEnd.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TraceEnd.java deleted file mode 100644 index e67e3a3a455..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/TraceEnd.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class TraceEnd extends ElementHandlers { - - public TraceEnd() { - super("TraceEnd"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Type.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Type.java deleted file mode 100644 index 11daefc7532..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Type.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Type extends ElementHandlers { - - public Type() { - super("Type"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/User.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/User.java deleted file mode 100644 index 9f0269c2ffa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/User.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class User extends ElementHandlers { - - public User() { - super("User"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new UserData(attributes.getValue("email"), attributes.getValue("id"), attributes.getValue("name")); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/UserData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/UserData.java deleted file mode 100644 index 656a2beb7fc..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/UserData.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class UserData { - - private final String email; - private final String id; - private final String name; - - UserData(String email, String id, String name) { - this.email = email; - this.id = id; - this.name = name; - } - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Value.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Value.java deleted file mode 100644 index c8ffaecbf46..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Value.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Value extends ElementHandlers { - - public Value() { - super("Value"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Version.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Version.java deleted file mode 100644 index daead80a4d1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Version.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Version extends ElementHandlers { - - public Version() { - super("Version"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return new VersionData(attributes.getValue("name"), attributes.getValue("underTest"), - attributes.getValue("version"), attributes.getValue("versionUnit")); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/VersionData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/VersionData.java deleted file mode 100644 index 09a49164f43..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/VersionData.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -/** - * @author Andrew M. Finkbeiner - */ -public class VersionData { - - private final String name; - private final String underTest; - private final String version; - private final String versionUnit; - - VersionData(String name, String underTest, String version, String versionUnit) { - this.name = name; - this.underTest = underTest; - this.version = version; - this.versionUnit = versionUnit; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the underTest - */ - public String getUnderTest() { - return underTest; - } - - /** - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * @return the versionUnit - */ - public String getVersionUnit() { - return versionUnit; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/VersionInformation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/VersionInformation.java deleted file mode 100644 index d869146be27..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/VersionInformation.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class VersionInformation extends ElementHandlers { - - public VersionInformation() { - super("VersionInformation"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Witnesses.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Witnesses.java deleted file mode 100644 index 6d7f568c303..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/saxparse/elements/Witnesses.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.saxparse.elements; - -import org.eclipse.osee.ote.core.framework.saxparse.ElementHandlers; -import org.xml.sax.Attributes; - -/** - * @author Andrew M. Finkbeiner - */ -public class Witnesses extends ElementHandlers { - - public Witnesses() { - super("Witnesses"); - } - - @Override - public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunListenerDataProvider.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunListenerDataProvider.java deleted file mode 100644 index 0b98b90ad69..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunListenerDataProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.framework.event.BaseEvent; -import org.eclipse.osee.ote.core.framework.event.IEventData; - -public class BaseTestRunListenerDataProvider implements ITestRunListenerDataProvider { - - public IEventData create(IPropertyStore properties, TestScript test, TestCase testCase) { - return new BaseEvent(properties, test, testCase); - } - - @Override - public IEventData createOnPostRun(IPropertyStore propertyStore, TestScript test) { - return new BaseEvent(propertyStore, test); - } - - @Override - public IEventData createOnPostTestCase(IPropertyStore propertyStore, TestScript test, TestCase testCase) { - return new BaseEvent(propertyStore, test, testCase); - } - - @Override - public IEventData createOnPreRun(IPropertyStore propertyStore, TestScript test) { - return new BaseEvent(propertyStore, test); - } - - @Override - public IEventData createOnPreTestCase(IPropertyStore propertyStore, TestScript test, TestCase testCase) { - return new BaseEvent(propertyStore, test, testCase); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunListenerProvider.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunListenerProvider.java deleted file mode 100644 index 7f93cde3206..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunListenerProvider.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.BaseStatus; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.IMethodResult; -import org.eclipse.osee.ote.core.framework.MethodResultImpl; -import org.eclipse.osee.ote.core.framework.ReturnCode; -import org.eclipse.osee.ote.core.framework.event.IEventData; - -public class BaseTestRunListenerProvider implements ITestRunListenerProvider { - - List<ITestRunListener> listeners; - - public BaseTestRunListenerProvider() { - listeners = new CopyOnWriteArrayList<>(); - } - - @Override - public boolean addTestRunListener(ITestRunListener listener) { - return listeners.add(listener); - } - - @Override - public boolean removeTestRunListener(ITestRunListener listener) { - return listeners.remove(listener); - } - - @Override - public IMethodResult notifyPostRun(IEventData eventData) { - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - boolean failed = false; - for (ITestRunListener listener : listeners) { - try { - result = collectStatus(result, listener.postRun(eventData)); - } catch (Throwable th) { - failed = true; - result.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, th)); - } - } - if (failed) { - result.setReturnCode(ReturnCode.ERROR); - } - return result; - } - - @Override - public IMethodResult notifyPostTestCase(IEventData eventData) { - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - boolean failed = false; - for (ITestRunListener listener : listeners) { - try { - result = collectStatus(result, listener.postTestCase(eventData)); - } catch (Throwable th) { - failed = true; - result.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, th)); - } - } - if (failed) { - result.setReturnCode(ReturnCode.ERROR); - } - return result; - } - - @Override - public IMethodResult notifyPreRun(IEventData eventData) { - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - boolean failed = false; - for (ITestRunListener listener : listeners) { - try { - result = collectStatus(result, listener.preRun(eventData)); - } catch (Throwable th) { - failed = true; - result.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, th)); - } - } - if (failed) { - result.setReturnCode(ReturnCode.ERROR); - } - return result; - } - - @Override - public IMethodResult notifyPreTestCase(IEventData eventData) { - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - boolean failed = false; - for (ITestRunListener listener : listeners) { - try { - result = collectStatus(result, listener.preTestCase(eventData)); - } catch (Throwable th) { - failed = true; - result.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, th)); - } - } - if (failed) { - result.setReturnCode(ReturnCode.ERROR); - } - return result; - } - - private MethodResultImpl collectStatus(MethodResultImpl result, IMethodResult listenerResult) { - if (listenerResult.getReturnCode() != ReturnCode.OK) { - if (result.getReturnCode() == ReturnCode.OK) { - result = new MethodResultImpl(ReturnCode.OK); - } - result.setReturnCode(listenerResult.getReturnCode()); - result.addStatus(listenerResult.getStatus()); - } - return result; - } - - /** - * Clearing out the listeners. - */ - @Override - public void clear() { - listeners.clear(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunListenerProviderFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunListenerProviderFactory.java deleted file mode 100644 index 545ee1477be..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunListenerProviderFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -public class BaseTestRunListenerProviderFactory implements ITestRunListenerProviderFactory { - - @Override - public ITestRunListenerDataProvider createListenerDataProvider() { - return new BaseTestRunListenerDataProvider(); - } - - @Override - public ITestRunListenerProvider createRunListenerProvider() { - return new BaseTestRunListenerProvider(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunManager.java deleted file mode 100644 index c5676299514..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/BaseTestRunManager.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import java.util.logging.Level; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.framework.logging.BaseStatus; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.IMethodResult; -import org.eclipse.osee.ote.core.framework.MethodResultImpl; -import org.eclipse.osee.ote.core.framework.ReturnCode; -import org.eclipse.osee.ote.core.internal.Activator; - -public class BaseTestRunManager implements ITestRunManager { - - private final ITestFactory testFactory; - private final ITestRunListenerProviderFactory testRunListenerProviderFactory; - - private TestScript test; - private TestRunThread testRunThread; - private ITestRunListenerDataProvider dataProvider; - private ITestRunListenerProvider listenerProvider; - private boolean aborted; - - public BaseTestRunManager(ITestFactory testFactory, ITestRunListenerProviderFactory testRunListenerProviderFactory) { - this.testFactory = testFactory; - this.testRunListenerProviderFactory = testRunListenerProviderFactory; - } - - @Override - public boolean abort() { - if (test != null) { - test.abort(); - } - aborted = true; - if (testRunThread != null) { - return testRunThread.abort(); - } - return true; - } - - @Override - public IMethodResult run(IPropertyStore propertyStore, TestEnvironment environment) { - IMethodResult result = new MethodResultImpl(ReturnCode.OK); - if (aborted) { - aborted = false; - MethodResultImpl methodresult = new MethodResultImpl(ReturnCode.ABORTED); - methodresult.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, "USER ABORTED")); - result = methodresult; - return result; - } - try { - testRunThread = new TestRunThread(propertyStore, test, environment, listenerProvider, dataProvider); - testRunThread.start(); - testRunThread.join(); - result = testRunThread.getResult(); - } catch (Exception ex) { - MethodResultImpl methodresult = new MethodResultImpl(ReturnCode.ERROR); - methodresult.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, ex)); - result = methodresult; - OseeLog.log(Activator.class, Level.SEVERE, ex); - } finally { - aborted = false; - testRunThread = null; - } - return result; - } - - @Override - public TestScript getTest() { - return test; - } - - @Override - public IMethodResult dispose() { - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - try { - this.test.disposeTest(); - this.dataProvider = null; - this.listenerProvider.clear(); - this.listenerProvider = null; - this.test = null; - } catch (Exception ex) { - result = new MethodResultImpl(ReturnCode.ERROR); - result.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, ex)); - OseeLog.log(Activator.class, Level.SEVERE, ex); - } - return result; - } - - @Override - public IMethodResult initialize(TestEnvironment env, IPropertyStore propertyStore) { - MethodResultImpl result = new MethodResultImpl(ReturnCode.OK); - try { - aborted = false; - this.dataProvider = testRunListenerProviderFactory.createListenerDataProvider(); - this.listenerProvider = testRunListenerProviderFactory.createRunListenerProvider(); - this.test = testFactory.createInstance(env, propertyStore); - this.test.setListenerProvider(listenerProvider); - } catch (Exception ex) { - result = new MethodResultImpl(ReturnCode.ERROR); - result.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, ex)); - OseeLog.log(Activator.class, Level.SEVERE, ex); - } - return result; - } - - @Override - public boolean abort(Throwable th, boolean wait) { - if (test != null) { - test.abort(); - } - aborted = true; - if (testRunThread != null) { - return testRunThread.abort(th, wait); - } - return true; - } - - @Override - public boolean isAborted() { - return aborted; - } - - @Override - public boolean isCurrentThreadScript() { - if (testRunThread != null) { - return Thread.currentThread() == testRunThread.getThread(); - } - return false; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestFactory.java deleted file mode 100644 index 94f074e4254..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -public interface ITestFactory { - - TestScript createInstance(TestEnvironment env, IPropertyStore properties) throws Exception; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestResultCollector.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestResultCollector.java deleted file mode 100644 index 44fd62f0a0a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestResultCollector.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -/** - * @author Roberto E. Escobar - */ -public interface ITestResultCollector { - - public void initialize(IPropertyStore propertyStore, TestEnvironment testEnvironment) throws Exception; - - public void dispose(TestEnvironment testEnvironment) throws Exception; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestResultCollectorFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestResultCollectorFactory.java deleted file mode 100644 index 7f1c25aea4b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestResultCollectorFactory.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -/** - * @author Roberto E. Escobar - */ -public interface ITestResultCollectorFactory { - - public ITestResultCollector createCollector(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListener.java deleted file mode 100644 index 1a7cd8683a8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import org.eclipse.osee.ote.core.framework.IMethodResult; -import org.eclipse.osee.ote.core.framework.event.IEventData; - -public interface ITestRunListener { - - IMethodResult preRun(IEventData eventData); - - IMethodResult preTestCase(IEventData eventData); - - IMethodResult postTestCase(IEventData eventData); - - IMethodResult postRun(IEventData eventData); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListenerDataProvider.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListenerDataProvider.java deleted file mode 100644 index 7326f7ce7ce..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListenerDataProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.framework.event.IEventData; - -public interface ITestRunListenerDataProvider { - - IEventData createOnPreRun(IPropertyStore propertyStore, TestScript test); - - IEventData createOnPreTestCase(IPropertyStore propertyStore, TestScript test, TestCase object); - - IEventData createOnPostTestCase(IPropertyStore propertyStore, TestScript test, TestCase object); - - IEventData createOnPostRun(IPropertyStore propertyStore, TestScript test); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListenerProvider.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListenerProvider.java deleted file mode 100644 index 1eaeee0f0a6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListenerProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import org.eclipse.osee.ote.core.framework.IMethodResult; -import org.eclipse.osee.ote.core.framework.event.IEventData; - -public interface ITestRunListenerProvider { - - boolean addTestRunListener(ITestRunListener listener); - - boolean removeTestRunListener(ITestRunListener listener); - - IMethodResult notifyPreRun(IEventData eventData); - - IMethodResult notifyPreTestCase(IEventData eventData); - - IMethodResult notifyPostTestCase(IEventData eventData); - - IMethodResult notifyPostRun(IEventData eventData); - - void clear(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListenerProviderFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListenerProviderFactory.java deleted file mode 100644 index 0e4f4a31bbb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunListenerProviderFactory.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -public interface ITestRunListenerProviderFactory { - ITestRunListenerProvider createRunListenerProvider(); - - ITestRunListenerDataProvider createListenerDataProvider(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunManager.java deleted file mode 100644 index 93974e9fd75..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/ITestRunManager.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.IMethodResult; - -public interface ITestRunManager { - - IMethodResult initialize(TestEnvironment env, IPropertyStore propertyStore); - - IMethodResult run(IPropertyStore propertyStore, TestEnvironment environment); - - IMethodResult dispose(); - - TestScript getTest(); - - boolean abort(); - - boolean abort(Throwable th, boolean wait); - - boolean isAborted(); - - boolean isCurrentThreadScript(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/TestRunThread.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/TestRunThread.java deleted file mode 100644 index ceb90ddf5b9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/testrun/TestRunThread.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.testrun; - -import java.util.List; -import java.util.logging.Level; -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; -import org.eclipse.osee.framework.logging.BaseStatus; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.OseeTestThread; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestException; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.framework.IMethodResult; -import org.eclipse.osee.ote.core.framework.MethodResultImpl; -import org.eclipse.osee.ote.core.framework.ResultBuilder; -import org.eclipse.osee.ote.core.framework.ReturnCode; -import org.eclipse.osee.ote.core.internal.Activator; -import org.eclipse.osee.ote.properties.OtePropertiesCore; - -public class TestRunThread extends OseeTestThread { - - private final TestScript test; - private final ITestRunListenerProvider listenerProvider; - private final ITestRunListenerDataProvider dataProvider; - private final IPropertyStore propertyStore; - private volatile boolean abort = false; - private final ResultBuilder rb = new ResultBuilder(false); - - public TestRunThread(IPropertyStore propertyStore, TestScript test, TestEnvironment env, ITestRunListenerProvider listenerProvider, ITestRunListenerDataProvider dataProvider) { - super(test.getClass().getSimpleName(), env); - this.test = test; - this.listenerProvider = listenerProvider; - this.dataProvider = dataProvider; - this.propertyStore = propertyStore; - } - - @Override - protected void run() throws Exception { - try { - rb.append(listenerProvider.notifyPreRun(dataProvider.createOnPreRun(propertyStore, test))); - if (rb.isReturnStatusOK()) { - List<TestCase> testCases = test.getTestCases(); - for (int i = 0; i < testCases.size(); i++) { - if (abort) { - Thread.interrupted();//clear the interrupted flag so that cleanup can occur without exception - addAbortResult(null); - i = testCases.size() - 1;//set to the last test case - TearDown - } - TestCase testCase = testCases.get(i); - if (testCase == null) { - continue; - } - - rb.append( - listenerProvider.notifyPreTestCase(dataProvider.createOnPreTestCase(propertyStore, test, testCase))); - try { - testCase.baseDoTestCase(getEnvironment()); - if (Thread.interrupted()) { - throw new InterruptedException("Thread probably aborted"); - } - } catch (Throwable ex) { - if (abort) { - addAbortResult(null); - } else { - abort = true; - this.test.setAborted(true); - MethodResultImpl methodresult = new MethodResultImpl(ReturnCode.ABORTED); - Throwable clientSideThrowable = ex; - if (!ex.getClass().getName().startsWith("java")) { - String msg = ex.getClass().getName(); - if (ex.getMessage() != null && !ex.getMessage().isEmpty()) { - msg += ": " + ex.getMessage(); - } - Throwable removeThisOnceWeGetRidOfSerializationOnAssociatedException = new Throwable(msg); - removeThisOnceWeGetRidOfSerializationOnAssociatedException.setStackTrace(ex.getStackTrace()); - clientSideThrowable = removeThisOnceWeGetRidOfSerializationOnAssociatedException; - } - methodresult.addStatus( - new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, clientSideThrowable)); - rb.append(methodresult); - OseeLog.log(Activator.class, Level.SEVERE, - "Exception running Test Case [" + testCase.getClass().getName() + "]", ex); - } - } - rb.append(listenerProvider.notifyPostTestCase( - dataProvider.createOnPostTestCase(propertyStore, test, testCase))); - } - } - } finally { - Thread.interrupted();//clear the interrupted flag so that cleanup can occur without exception - rb.append(listenerProvider.notifyPostRun(dataProvider.createOnPostRun(propertyStore, test))); - if (getEnvironment().getScriptCtrl().isLocked()) { - getEnvironment().getScriptCtrl().unlock(); - } - } - } - - private void addAbortResult(Throwable th) { - if (rb.isReturnStatusOK()) { - MethodResultImpl methodresult = new MethodResultImpl(ReturnCode.ABORTED); - if (th == null) { - methodresult.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, "USER ABORTED")); - } else { - methodresult.addStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, th)); - } - rb.append(methodresult); - } - } - - public boolean abort() { - abort = true; - this.test.setAborted(true); - if (Thread.currentThread() == this.getThread()) { - throw new TestException("", Level.SEVERE); - } - if (OtePropertiesCore.abortMultipleInterrupt.getBooleanValue()) { - this.interrupt(); - try { - this.join(1000 * 60); - } catch (InterruptedException ex) { - } - } else { - int count = 0; - do { - this.interrupt(); - try { - this.join(10); - } catch (InterruptedException ex) { - } - count++; - } while (this.isAlive() && count < 200); - } - if (this.isAlive()) { - OseeLog.reportStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, - "Waited 60s for test to abort but the thread did not die.")); - return false; - } - return true; - } - - public boolean abort(Throwable th, boolean wait) { - if (abort) { - return true; - } - abort = true; - this.test.setAborted(true); - addAbortResult(th); - if (Thread.currentThread() == this.getThread()) { - throw new TestException("", Level.SEVERE); - } - this.interrupt(); - return true; - } - - public IMethodResult getResult() { - return rb.get(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/thread/OteThread.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/thread/OteThread.java deleted file mode 100644 index add930bb711..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/thread/OteThread.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.thread; - -public class OteThread extends Thread { - - protected OteThread(String name) { - super(name); - - } - - protected OteThread(Runnable arg0, String name) { - super(arg0, name); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/thread/OteThreadFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/thread/OteThreadFactory.java deleted file mode 100644 index ba82b5eb314..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/thread/OteThreadFactory.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.thread; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.ThreadFactory; - -/** - * @author Roberto E. Escobar - */ -public class OteThreadFactory implements ThreadFactory { - - private final List<WeakReference<OteThread>> threads; - private final String threadName; - - protected OteThreadFactory(String threadName) { - this.threadName = threadName; - this.threads = new CopyOnWriteArrayList<>(); - } - - @Override - public Thread newThread(Runnable runnable) { - OteThread thread = new OteThread(runnable, threadName + ":" + threads.size()); - this.threads.add(new WeakReference<OteThread>(thread)); - return thread; - } - - public List<OteThread> getThreads() { - List<OteThread> toReturn = new ArrayList<>(); - for (WeakReference<OteThread> weak : threads) { - OteThread thread = weak.get(); - if (thread != null) { - toReturn.add(thread); - } - } - return toReturn; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/thread/OteThreadManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/thread/OteThreadManager.java deleted file mode 100644 index d5c4f7af2de..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/framework/thread/OteThreadManager.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.framework.thread; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ThreadFactory; - -/** - * @author Roberto E. Escobar - */ -public class OteThreadManager { - - private static OteThreadManager instance = null; - - private final Map<String, OteThreadFactory> factories; - - private OteThreadManager() { - this.factories = new HashMap<>(); - } - - public static OteThreadManager getInstance() { - if (instance == null) { - instance = new OteThreadManager(); - } - return instance; - } - - public ThreadFactory createNewFactory(String threadName) { - OteThreadFactory factory = new OteThreadFactory(threadName); - factories.put(threadName, factory); - return factory; - } - - public List<OteThread> getThreadsFromFactory(String key) { - OteThreadFactory factory = factories.get(key); - return factory.getThreads(); - } - - public Set<String> getFactories() { - return factories.keySet(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/Activator.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/Activator.java deleted file mode 100644 index b9b19b35780..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/Activator.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.internal; - -import java.util.Hashtable; -import java.util.logging.Level; - -import org.eclipse.osee.framework.core.util.ServiceDependencyTracker; -import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.OteProperties; -import org.eclipse.osee.ote.core.StandardShell; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface; -import org.eclipse.osee.ote.core.environment.console.ConsoleCommandManager; -import org.eclipse.osee.ote.core.environment.console.ICommandManager; -import org.eclipse.osee.ote.message.internal.MessageIoManagementStarter; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; -import org.osgi.util.tracker.ServiceTracker; -import org.osgi.util.tracker.ServiceTrackerCustomizer; - -/** - * @author Andrew M. Finkbeiner - * @author Ryan D. Brooks - */ -public class Activator implements BundleActivator { - - private ServiceRegistration testEnvironmentRegistration; - private static Activator activator; - private BundleContext bundleContext; - private final CompositeKeyHashMap<String, ServiceTrackerCustomizer, ServiceTracker> serviceTrackers = - new CompositeKeyHashMap<String, ServiceTrackerCustomizer, ServiceTracker>(); - private ConsoleCommandManager consoleCommandManager; - private StandardShell stdShell; - private ServiceRegistration consoleCommandRegistration; - private ServiceDependencyTracker serviceDependencyTracker; - private MessageIoManagementStarter messageIoManagementStarter; - private ServiceTracker testEnvTracker; - - @Override - public void start(BundleContext context) throws Exception { - activator = this; - bundleContext = context; - consoleCommandManager = new ConsoleCommandManager(); - if (OteProperties.isOteCmdConsoleEnabled()) { - stdShell = new StandardShell(consoleCommandManager); - stdShell.start(); - } else { - stdShell = null; - } - consoleCommandRegistration = - context.registerService(ICommandManager.class.getName(), consoleCommandManager, new Hashtable()); - - serviceDependencyTracker = new ServiceDependencyTracker(bundleContext, new StatusBoardRegistrationHandler()); - serviceDependencyTracker.open(); - - testEnvTracker = new ServiceTracker(context, TestEnvironmentInterface.class.getName(), null); - testEnvTracker.open(true); - - messageIoManagementStarter = new MessageIoManagementStarter(context); - messageIoManagementStarter.open(true); - } - - @Override - public void stop(BundleContext context) throws Exception { - serviceDependencyTracker.close(); - closeAllValidServiceTrackers(); - unregisterTestEnvironment(); - if (stdShell != null) { - stdShell.shutdown(); - } - consoleCommandManager.shutdown(); - consoleCommandRegistration.unregister(); - - messageIoManagementStarter.close(); - testEnvTracker.close(); - } - - public static Activator getInstance() { - return activator; - } - - public void registerTestEnvironment(TestEnvironment env) { - if (testEnvironmentRegistration != null) { - testEnvironmentRegistration.unregister(); - } - testEnvironmentRegistration = - bundleContext.registerService(TestEnvironmentInterface.class.getName(), env, new Hashtable()); - } - - public void unregisterTestEnvironment() { - if (testEnvironmentRegistration != null) { - testEnvironmentRegistration.unregister(); - testEnvironmentRegistration = null; - } - } - - public ServiceTracker getServiceTracker(String clazz, ServiceTrackerCustomizer customizer) { - ServiceTracker tracker = findServiceTracker(clazz, customizer); - if (tracker == null) { - tracker = createNewServiceTracker(clazz, customizer); - } - return tracker; - } - - private ServiceTracker createNewServiceTracker(String clazz, ServiceTrackerCustomizer customizer) { - ServiceTracker tracker = new ServiceTracker(bundleContext, clazz, customizer); - tracker.open(true); - serviceTrackers.put(clazz, customizer, tracker); - return tracker; - } - - private ServiceTracker findServiceTracker(String clazz, ServiceTrackerCustomizer customizer) { - return serviceTrackers.get(clazz, customizer); - } - - private void closeAllValidServiceTrackers() { - for (ServiceTracker tracker : serviceTrackers.values()) { - if (tracker != null) { - tracker.close(); - } - } - } - - public static TestEnvironmentInterface getTestEnvironment() { - try { - return (TestEnvironmentInterface) getInstance().testEnvTracker.waitForService(20000); - } catch (InterruptedException e) { - OseeLog.log(Activator.class, Level.SEVERE, e); - } - return null; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/OTESessionManagerImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/OTESessionManagerImpl.java deleted file mode 100644 index 7476b892fd5..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/OTESessionManagerImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.osee.ote.core.internal; - -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -import org.eclipse.osee.ote.core.IUserSession; -import org.eclipse.osee.ote.core.OTESessionManager; - -public class OTESessionManagerImpl implements OTESessionManager { - - private Map<UUID, IUserSession> userMap; - private UUID activeUserId; - - public OTESessionManagerImpl(){ - userMap = new ConcurrentHashMap<>(); - } - - @Override - public void add(UUID sessionId, IUserSession session) { - userMap.put(sessionId, session); - } - - @Override - public void remove(UUID sessionId) { - userMap.remove(sessionId); - } - - @Override - public IUserSession get(UUID sessionId) { - if(sessionId == null){ - return null; - } - return userMap.get(sessionId); - } - - @Override - public Set<UUID> get() { - return userMap.keySet(); - } - - @Override - public IUserSession getActiveUser() { - IUserSession session = get(activeUserId); - if(session == null){ - if(userMap.size() > 0){ - UUID id = userMap.keySet().iterator().next(); - session = get(id); - } - } - return session; - } - - @Override - public void setActiveUser(UUID sessionId) { - this.activeUserId = sessionId; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/StatusBoardRegistrationHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/StatusBoardRegistrationHandler.java deleted file mode 100644 index dfcc023d815..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/StatusBoardRegistrationHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.internal; - -import java.util.Map; -import org.eclipse.osee.framework.core.util.AbstractTrackingHandler; -import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface; -import org.eclipse.osee.ote.core.environment.status.OTEStatusBoard; -import org.eclipse.osee.ote.core.environment.status.StatusBoard; -import org.osgi.framework.BundleContext; - -public class StatusBoardRegistrationHandler extends AbstractTrackingHandler { - - private final static Class<?>[] SERVICE_DEPENDENCIES = new Class<?>[] { - OTEStatusBoard.class, - TestEnvironmentInterface.class}; - private TestEnvironmentInterface testEnv; - private StatusBoard statusBoard; - - @Override - public Class<?>[] getDependencies() { - return SERVICE_DEPENDENCIES; - } - - @Override - public void onActivate(BundleContext context, Map<Class<?>, Object> services) { - - testEnv = getService(TestEnvironmentInterface.class, services); - statusBoard = (StatusBoard) getService(OTEStatusBoard.class, services); - testEnv.addEnvironmentListener(statusBoard); - } - - @Override - public void onDeActivate() { - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/Env.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/Env.java deleted file mode 100644 index 5ea731c5411..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/Env.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log; - -import java.util.logging.ConsoleHandler; -import java.util.logging.FileHandler; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -/** - * @author Andrew M. Finkbeiner - */ -public class Env extends Logger { - - private static Env instance = null; - - public static Env getInstance() { - if (instance == null) { - instance = new Env(null, Level.ALL); // FileHandler was giving problems sometimes. - } - return instance; - } - - public static Env getInstance(Class<?> newClass, Level level) { - if (instance == null) { - instance = new Env(newClass, level); - } - return instance; - } - - private Env(Class<?> handlerType, Level level) { - super("osee.test.core.log.EnvServiceLogger", null); - Handler handler; - if (handlerType == FileHandler.class) { - try { - handler = new FileHandler("TestEnvLog_" + this.hashCode() + "%g.log"); - } catch (Exception e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - handler = new ConsoleHandler(); - } - } else { - handler = new ConsoleHandler(); - } - handler.setLevel(level); - this.setLevel(level); - this.addHandler(handler); - } - - public void debug(String message) { - try { - log(Level.FINE, message); - } catch (Exception e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - } - - public void exception(Throwable ex) { - try { - throwing("", "", ex); - } catch (Exception e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - } - - public void message(String message) { - try { - log(Level.INFO, message); - } catch (Exception e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - } - - public void close() { - Handler[] handlers = Env.instance.getHandlers(); - for (int i = 0; i < handlers.length; i++) { - handlers[i].close(); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/ITestPointTally.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/ITestPointTally.java deleted file mode 100644 index b30196b4979..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/ITestPointTally.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log; - -/** - * @author John Butler - */ -public interface ITestPointTally { - - /** - * Resets the test point pass and fail counts to zero. - */ - public void reset(); - - /** - * Records test point result. - * - * @param pass test point result. <b>True</b> for passing. <b>False</b> for failing. - * @return The total number of test points recorded. - */ - public int tallyTestPoint(boolean pass); - - /** - * @return The total number of test points recorded. - */ - public int getTestPointTotal(); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/ScriptLogHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/ScriptLogHandler.java deleted file mode 100644 index d6c51d959f1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/ScriptLogHandler.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log; - -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.LogRecord; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.GCHelper; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.log.record.ScriptInitRecord; -import org.eclipse.osee.ote.core.log.record.ScriptResultRecord; -import org.eclipse.osee.ote.core.log.record.TestCaseRecord; -import org.eclipse.osee.ote.core.log.record.TestRecord; -import org.eclipse.osee.ote.core.log.record.TraceRecord; -import org.eclipse.osee.ote.core.log.record.TraceRecordEnd; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.ProcessingInstruction; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - * @author Charles Shaw - * @author Robert A. Fisher - */ -public class ScriptLogHandler extends Handler { - private final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - protected Element testCaseElement; - protected Element parent; - protected Element child; - protected Element testScriptElement; - protected Element scriptInitElement; - protected Document document; - private final File outFile; - private final List<LogRecord> records; - - /** - * ScriptLogHandler Constructor. Sets the outfile to log to and the test script that will be logged. It also - * establishes the xml format to be used. - * - * @param outFile Reference to the outfile that will be used to output the log. - */ - public ScriptLogHandler(File outFile, TestEnvironment testEnvironment) { - GCHelper.getGCHelper().addRefWatch(this); - this.outFile = outFile; - OseeLog.log(TestEnvironment.class, Level.FINE, outFile.getAbsolutePath()); - - try { - factory.setNamespaceAware(true); - DocumentBuilder builder = factory.newDocumentBuilder(); - document = builder.newDocument(); - } catch (ParserConfigurationException ex) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, ex); - } - - ProcessingInstruction processingInstruction = - document.createProcessingInstruction("xml-stylesheet", - "type=\"text/xsl\" href=\"" + getXSLTransformName() + "\""); - document.appendChild(processingInstruction); - records = new ArrayList<>(); - - document.appendChild(document.createComment("OUTFILE_COMMNET")); - - this.testScriptElement = document.createElement("TestScript"); - this.scriptInitElement = document.createElement("ScriptInit"); - document.appendChild(testScriptElement); - this.parent = this.testScriptElement; - } - - public String getXSLTransformName() { - return "outputNormal.xsl"; - } - - /** - * Write out the log file to the outfile. - */ - public void writeOutFile() { - try { - Jaxp.writeXmlDocument(document, outFile, Jaxp.getPrettyFormat()); - } catch (Throwable th) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, th); - } - } - - @Override - public synchronized void publish(LogRecord logRecord) { - if (isLoggable(logRecord)) { - records.add(logRecord); - } - } - - public synchronized void flushRecords() { - try { - for (int i = 0; i < records.size(); i++) { - LogRecord logRecord = records.get(i); - - if (logRecord instanceof TestRecord) { - TestRecord record = (TestRecord) logRecord; - child = record.toXml(document); - - if (record instanceof TestCaseRecord) { - testCaseElement = child; - testScriptElement.appendChild(testCaseElement); - parent = testCaseElement; - } else { - - if (record instanceof ScriptResultRecord) { - testScriptElement.appendChild(child); - } else if (record instanceof ScriptInitRecord) { - if (((ScriptInitRecord) record).getStartFlag()) { - // We are doing it this way so that it is chronologically accurate in the xml. - if (scriptInitElement.getParentNode() == null) { - testScriptElement.appendChild(scriptInitElement); - } - parent = scriptInitElement; - } else { - parent = testScriptElement; - } - } else { - parent.appendChild(child); - if (record instanceof TraceRecord) {// method began - parent = child; - } else if (record instanceof TraceRecordEnd) {// method ended - if (parent.getParentNode() != null) { - parent = (Element) parent.getParentNode(); - } - } - } - } - } else { - if (parent != null) { - Element el = document.createElement("OteLog"); - el.setAttribute("Level", logRecord.getLevel().getLocalizedName()); - el.setAttribute("Logger", logRecord.getLoggerName()); - Element msg = document.createElement("Message"); - msg.appendChild(document.createTextNode(logRecord.getMessage())); - el.appendChild(msg); - - if (logRecord.getThrown() != null) { - - try { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - logRecord.getThrown().printStackTrace(pw); - pw.close(); - - Element thrown = document.createElement("Throwable"); - thrown.appendChild(document.createTextNode(sw.toString())); - el.appendChild(thrown); - } catch (Exception ex) { - } - } - parent.appendChild(el); - } - } - } - } catch (Exception ex) { - ex.printStackTrace(); - } finally { - records.clear(); - } - } - - @Override - public void close() throws SecurityException { - - writeOutFile(); - } - - @Override - public void flush() { - // don't call this method - - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/TestLevel.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/TestLevel.java deleted file mode 100644 index 919ac24fd0e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/TestLevel.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log; - -import java.util.logging.Level; - -/** - * @author Michael A. Winston - */ -public class TestLevel extends Level { - - private static final long serialVersionUID = -3898810954576373823L; - - public final static TestLevel TEST_POINT = new TestLevel("TestPoint", Level.SEVERE.intValue() + 10); - public final static TestLevel ATTENTION = new TestLevel("Attention", Level.WARNING.intValue() + 30); - public final static TestLevel REQUIREMENT = new TestLevel("Requirement", Level.WARNING.intValue() + 20); - public final static TestLevel SUPPORT = new TestLevel("Support", Level.INFO.intValue() + 30); - public final static TestLevel MESSAGING = new TestLevel("Messaging", Level.INFO.intValue() + 20); - public final static TestLevel TRACE = new TestLevel("Trace", Level.INFO.intValue() + 10); - public final static TestLevel DEBUG = new TestLevel("Debug", Level.FINE.intValue()); - - /** - * TestLevel Constructor. Sets a level name and value. - * - * @param name The level name. - * @param value The level value. - */ - private TestLevel(String name, int value) { - super(name, value); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/TestLogger.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/TestLogger.java deleted file mode 100644 index 6aa2131486d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/TestLogger.java +++ /dev/null @@ -1,300 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log; - -import java.util.logging.Level; -import java.util.logging.LogRecord; -import java.util.logging.Logger; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.ReturnFormatter; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.environment.interfaces.ITestLogger; -import org.eclipse.osee.ote.core.environment.interfaces.ITestPoint; -import org.eclipse.osee.ote.core.log.record.AttentionRecord; -import org.eclipse.osee.ote.core.log.record.DebugRecord; -import org.eclipse.osee.ote.core.log.record.RequirementRecord; -import org.eclipse.osee.ote.core.log.record.SevereRecord; -import org.eclipse.osee.ote.core.log.record.SupportRecord; -import org.eclipse.osee.ote.core.log.record.TestPointRecord; -import org.eclipse.osee.ote.core.log.record.TestRecord; -import org.eclipse.osee.ote.core.log.record.TraceRecord; -import org.eclipse.osee.ote.core.log.record.TraceRecordEnd; -import org.eclipse.osee.ote.core.log.record.WarningRecord; - -/** - * @author Ryan D. Brooks - * @author Robert A. Fisher - * @author Andrew M. Finkbeiner - * @author Charles Shaw - */ -public class TestLogger extends Logger implements ITestLogger { - - /** - * TestLogger Constructor. Sets logging level and filter. - */ - public TestLogger() { - super("osee.test.core.log", null); - setLevel(Level.ALL); - } - - /** - * For communicating with the user running an interactive script only allowed in interactive scripts (use sparingly). - */ - public void attention(ITestEnvironmentAccessor source, String message) { - // TODO: this is not just a straight log - log(new AttentionRecord(source, message)); - } - - /** - * Records a debugging message in the log. Will never be seen during demos. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param message The log message. - */ - @Override - public void debug(ITestEnvironmentAccessor source, String message) { - log(new DebugRecord(source, message)); - } - - /** - * Records a debugging message in the log. Will never be seen during the demos. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param message The log message. - * @param timeStamp <b>True</b> if you want a time stamp included, <b>False</b> if you do not. - */ - @Override - public void debug(ITestEnvironmentAccessor source, String message, boolean timeStamp) { - log(new DebugRecord(source, message, timeStamp)); - } - - /** - * Records a warning message in the log. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param message The log message. - */ - @Override - public void warning(ITestEnvironmentAccessor source, String message) { - log(new WarningRecord(source, message)); - } - - /** - * Internal - logging from, say, guts of messaging API - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param message The log message. - */ - @Override - public void support(ITestEnvironmentAccessor source, String message) { - log(new SupportRecord(source, message)); - } - - /** - * Records a severe message in the log. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param message The log message. - */ - @Override - public void severe(ITestEnvironmentAccessor source, String message) { - log(new SevereRecord(source, message)); - } - - /** - * Records a severe message in the log. - * - * @param source The object requesting the logging (Usually "this" is passed in). - */ - @Override - public void severe(Object source, Throwable thrown) { - throwing(source.getClass().getName(), null, thrown); - } - - @Override - public void testpoint(ITestEnvironmentAccessor env, TestScript script, TestCase testCase, boolean passed, String testPointName, String exp, String act) { - log(new TestPointRecord(env, script, testCase, testPointName, exp, act, passed)); - } - - @Override - public void testpoint(TestPointRecord record) { - log(record); - } - - @Override - public void testpoint(ITestEnvironmentAccessor env, TestScript script, TestCase testCase, ITestPoint testPoint) { - log(new TestPointRecord(env, script, testCase, testPoint)); - } - - /** - * Records that a test case began in the log. - * - * @param testCase The test case whose start is to be recorded. - */ - @Override - public void testCaseBegan(TestCase testCase) { - log(testCase.getTestRecord()); - } - - /** - * Record a trace event. Such as when a function starts or stops. - * - * @param source The object requesting the logging (Usually "this" is passed in). - */ - public void trace(ITestEnvironmentAccessor source, String objectName, String methodName, MethodFormatter methodArguments) { - log(new TraceRecord(source, objectName, methodName, methodArguments)); - } - - public void endtrace(ITestEnvironmentAccessor source, ReturnFormatter methodArguments) { - log(new TraceRecordEnd(source, methodArguments)); - } - - /** - * Record a requirement to the log. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param message The log message. - */ - public void requirement(ITestEnvironmentAccessor source, String message) { - log(new RequirementRecord(source, message)); - } - - /** - * Log the beginning of a method with no arguments. - * - * @param source The object requesting the logging (Usually "this" is passed in). - */ - @Override - public void methodCalled(ITestEnvironmentAccessor source) { - methodCalled(source, new MethodFormatter(), 2); - } - - /** - * Log the beginning of a method with a formatted string holding the arguments. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param arguments The arguments in a formatted string. - */ - @Override - public void methodCalled(ITestEnvironmentAccessor source, MethodFormatter arguments) { - methodCalled(source, arguments, 2); - } - - // /** - // * Log the beginning of a method with a the MethodFormatter formatted argument object. - // * - // * @param source The object requesting the logging (Usually "this" is passed in). - // * @param methodFormat Reference to the MethodFormatter formatted argument list. - // */ - // public void methodCalled(ITestEnvironmentAccessor source, MethodFormatter methodFormat) { - // methodCalled(source, methodFormat, 2); - // } - - /** - * Log the beginning of a method. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param arguments The arguments in a formatted string. - * @param methodCount The number of methods called to reach this point. - */ - public void methodCalled(ITestEnvironmentAccessor source, MethodFormatter arguments, int methodCount) { - String methodName = new Exception().getStackTrace()[methodCount].getMethodName(); - trace(source, "", methodName, arguments); - } - - /** - * Log the start of a method with the object variable name. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param objectName The class variable name. - */ - @Override - public void methodCalledOnObject(ITestEnvironmentAccessor source, String objectName) { - methodCalledOnObject(source, objectName, new MethodFormatter(), 2); - } - - // /** - // * Log the start of a method with the object variable name and a formatted string with the - // * arguments. - // * - // * @param source The object requesting the logging (Usually "this" is passed in). - // * @param objectName The class variable name. - // * @param arguments The arguments in a formatted string. - // */ - // public void methodCalledOnObject(ITestEnvironmentAccessor source, String objectName, MethodFormatter arguments) { - // methodCalledOnObject(source, objectName, arguments, 2); - // } - - /** - * Log the start of a method with the object variable name and a MethodFormatter formatted argument object. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param objectName The class variable name. - * @param methodFormat Reference to the MethodFormatter formatted argument list. - */ - @Override - public void methodCalledOnObject(ITestEnvironmentAccessor source, String objectName, MethodFormatter methodFormat) { - methodCalledOnObject(source, objectName, methodFormat, 2); - } - - /** - * Log the start of a method with the object variable name. - * - * @param source The object requesting the logging (Usually "this" is passed in). - * @param objectName The class variable name. - * @param arguments The arguments in a formatted string. - * @param methodCount The number of methods called to reach this point. - */ - public void methodCalledOnObject(ITestEnvironmentAccessor source, String objectName, MethodFormatter arguments, int methodCount) { - - String methodName = new Exception().getStackTrace()[methodCount].getMethodName(); - trace(source, objectName, methodName, arguments); - } - - /** - * Specifies that a method has ended. This must be paired with the methodBegin() call. - * - * @param source The object requesting the logging (Usually "this" is passed in). - */ - @Override - public void methodEnded(ITestEnvironmentAccessor source) { - endtrace(source, new ReturnFormatter()); - } - - @Override - public void methodEnded(ITestEnvironmentAccessor source, ReturnFormatter returnFormatter) { - endtrace(source, returnFormatter); - } - - @Override - public void log(TestRecord record) { - this.log((LogRecord) record); - } - - @Override - public void methodCalledOnObject(ITestEnvironmentAccessor source, String objectName, MethodFormatter methodFormat, Xmlizable xmlObject) { - methodCalledOnObject(source, objectName, methodFormat, xmlObject, 2); - } - - private void methodCalledOnObject(ITestEnvironmentAccessor source, String objectName, MethodFormatter methodFormat, Xmlizable xmlObject, int methodCount) { - String methodName = new Exception().getStackTrace()[methodCount].getMethodName(); - TraceRecord record = new TraceRecord(source, objectName, methodName, methodFormat, true); - record.addAdditionalElement(xmlObject); - if (xmlObject instanceof XmlizableStream) { - record.addAdditionalElement((XmlizableStream) xmlObject); - } - log(record); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/AttentionRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/AttentionRecord.java deleted file mode 100644 index 018aa08f3ac..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/AttentionRecord.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.logging.Level; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.log.TestLevel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Charles Shaw - */ -public class AttentionRecord extends TestRecord { - - private static final long serialVersionUID = -6974833259038544176L; - - /** - * AttentionRecord Constructor. Sets up generic message log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - * @param timeStamp <b>True</b> if a timestamp should be recorded, <b>False</b> if not. - */ - public AttentionRecord(ITestEnvironmentAccessor source, String msg, boolean timeStamp) { - super(source, TestLevel.ATTENTION, msg, timeStamp); - } - - /** - * MessagingRecord Constructor. Sets up generic message log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - */ - public AttentionRecord(ITestEnvironmentAccessor source, String msg) { - this(source, msg, true); - } - - /** - * Converts log element to XML format. - * - * @return xml formated element. - */ - @Override - public Element toXml(Document doc) { - Element recordElement = doc.createElement(getLevel().getName()); - recordElement.appendChild(Jaxp.createElement(doc, "Message", getMessage())); - // for (Xmlizable object : getAdditionalXml()) { - // recordElement.appendChild(object.toXml(doc)); - // } - if (TestRecord.getLocationLoggingOn()) { - recordElement.appendChild(getLocation(doc)); - } - return recordElement; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement(getLevel().getName()); - writeLocationCheckLocationLoggingOn(writer); - writeMessage(writer); - writer.writeEndElement(); - } - - @JsonProperty - @Override - public Level getLevel() { - return super.getLevel(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/DebugRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/DebugRecord.java deleted file mode 100644 index 3d28e0744fa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/DebugRecord.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.log.TestLevel; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class DebugRecord extends TestRecord { - - private static final long serialVersionUID = -5340996017961551683L; - - /** - * DebugRecord Constructor. Invokes TestRecord with the log message source, the log message, and the ability to - * include a timestamp. - * - * @param source The object requesting the logging. - * @param msg The log message. - * @param timeStamp <b>True </b> if time stamp should be logged, <b>False </b> if not. - */ - public DebugRecord(ITestEnvironmentAccessor source, String msg, boolean timeStamp) { - super(source, TestLevel.DEBUG, msg, timeStamp); - } - - /** - * DebugRecord Constructor. Invokes TestRecord with the log message source and the log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - */ - public DebugRecord(ITestEnvironmentAccessor source, String msg) { - this(source, msg, true); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ErrorRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ErrorRecord.java deleted file mode 100644 index 4ec5383b7df..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ErrorRecord.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Date; -import java.util.logging.Level; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.XmlSupport; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class ErrorRecord extends TestRecord { - private static final long serialVersionUID = -9083013356154141017L; - private final String executionResult; - private final String executionMessage; - private final boolean printTimeStamp; - private long timeStamp; - - public ErrorRecord(ITestEnvironmentAccessor source, Level level, String executionResult, Throwable throwable, boolean timeStamp) { - super(source, level, executionResult, false); - this.executionResult = executionResult; - this.executionMessage = getThrowbableMessage(throwable); - this.printTimeStamp = timeStamp; - if (timeStamp) { - if (source != null) { - if (source instanceof TestEnvironment) { - TestEnvironment env = (TestEnvironment) source; - if (env.getTestScript() != null) { - this.timeStamp = System.currentTimeMillis() - env.getTestScript().getStartTime().getTime(); - } else { - this.timeStamp = new Date().getTime(); - } - } - } else { - this.timeStamp = new Date().getTime(); - try { - throw new Exception("source was null"); - } catch (Exception e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - } - } - } - - private String getThrowbableMessage(Throwable throwable) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - pw.println("Exception " + throwable.getClass().getName() + ": " + throwable.getMessage()); - throwable.printStackTrace(new PrintWriter(sw)); - return sw.toString(); - } - - @Override - public Element toXml(Document doc) { - Element root = doc.createElement("ExecutionStatus"); - if (this.printTimeStamp) { - root.appendChild(Jaxp.createElement(doc, "Time", Long.toString(timeStamp))); - } - root.appendChild(Jaxp.createElement(doc, "ExecutionResult", XmlSupport.sanitizeXMLContent(executionResult))); - root.appendChild(Jaxp.createElement(doc, "ExecutionDetails", XmlSupport.sanitizeXMLContent(executionMessage))); - return root; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("ExecutionStatus"); - writeTime(writer); - writeElement(writer, "ExecutionResult", XmlSupport.sanitizeXMLContent(executionResult)); - writeElement(writer, "ExecutionDetails", XmlSupport.sanitizeXMLContent(executionMessage)); - writer.writeEndElement(); - } - - public String getExecutionResult() { - return executionResult; - } - - public String getExecutionMessage() { - return executionMessage; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ParentLogRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ParentLogRecord.java deleted file mode 100644 index e12af0dc309..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ParentLogRecord.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.osee.ote.core.log.record; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.logging.Level; -import java.util.logging.LogRecord; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ParentLogRecord extends LogRecord { - private static final long serialVersionUID = 684361479587503820L; - private Collection<LogRecord> records = new ArrayList<>(); - - public ParentLogRecord() { - super(Level.OFF, ""); - } - - public void addChild(final LogRecord testPoint) { - records.add(testPoint); - } - - @JsonProperty - public Collection<LogRecord> getChildRecords() { - return records; - } - - @Override - @JsonIgnore - public Level getLevel() { - return super.getLevel(); - }; - - @Override - @JsonIgnore - public String getMessage() { - return super.getMessage(); - }; -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecord.java deleted file mode 100644 index 30576b63d65..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/PropertyStoreRecord.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Level; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.type.IPropertyStore; - -public class PropertyStoreRecord extends TestRecord { - - private static final long serialVersionUID = -6515147544821433102L; - private IPropertyStore store; - - public PropertyStoreRecord(IPropertyStore store) { - super(null, Level.INFO, "PropertyStoreRecord", false); - this.store = store; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("PropertyStore"); - if(store != null){ - for(String key:store.keySet()){ - String message = store.get(key); - writer.writeStartElement("Property"); - writer.writeAttribute("key", key); - writer.writeCharacters(message); - writer.writeEndElement(); - } - } - writer.writeEndElement(); - } - - @JsonProperty - public Map<String, String> getProperties() { - Map<String, String> result = new HashMap<>(); - if (store != null && !store.isEmpty()) { - for (String key : store.keySet()) { - if (nonEmptyString(store.get(key)) != null) { - result.put(key, store.get(key)); - } - } - return result; - } else { - return null; - } - } - - @Override - @JsonIgnore - public String getMessage() { - return super.getMessage(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/RequirementRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/RequirementRecord.java deleted file mode 100644 index 927c7502bea..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/RequirementRecord.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.log.TestLevel; - -/** - * @author Ryan D. Brooks - */ -public class RequirementRecord extends TestRecord { - - private static final long serialVersionUID = -3533522844275324310L; - - /** - * RequirementRecord Constructor. Sets up a Requirement log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - * @param timeStamp <b>True </b> if a timestamp should be recorded, <b>False </b> if not. - */ - public RequirementRecord(ITestEnvironmentAccessor source, String msg, boolean timeStamp) { - super(source, TestLevel.REQUIREMENT, msg, timeStamp); - } - - /** - * RequirementRecord Constructor. Sets up a Requirement log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - */ - public RequirementRecord(ITestEnvironmentAccessor source, String msg) { - this(source, msg, true); - } - - @JsonProperty - public String getRequirement() { - return getMessage(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptConfigRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptConfigRecord.java deleted file mode 100644 index 02c5a3b91a4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptConfigRecord.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.text.DateFormat; -import java.util.Date; -import java.util.List; -import java.util.logging.Level; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.config.ScriptVersionConfig; -import org.eclipse.osee.ote.core.log.TestLevel; -import org.eclipse.osee.ote.core.test.tags.BaseTestTags; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class ScriptConfigRecord extends TestRecord { - private ScriptVersionConfig scriptVersionRecord; - private String userName; - private String userEmail; - private String userId; - private static final long serialVersionUID = 6919229589873467398L; - - /** - * ScriptConfigRecord Constructor. Constructs test script configuration log - * message with timestamp. - * - * @param script - * The test script who's configuration is to be recorded. - * @param timeStamp - * <b>True </b> if a timestamp should be recorded, <b>False </b> - * if not. - */ - public ScriptConfigRecord(TestScript script, boolean timeStamp) { - super(script.getTestEnvironment(), TestLevel.TEST_POINT, script.getClass().getName(), timeStamp); - } - - /** - * ScriptConfigRecord Constructor. Constructs test script configuration log - * message. - * - * @param script - * The test script who's configuration is to be recorded. - */ - public ScriptConfigRecord(TestScript script) { - this(script, true); - } - - /** - * Convert an element to XML format. - * - * @return XML formated config element. - */ - @Override - public Element toXml(Document doc) { - Element configElement = doc.createElement(BaseTestTags.CONFIG_ENTRY); - try { - configElement.setAttribute("machineName", InetAddress.getLocalHost().getHostName()); - } catch (DOMException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } catch (UnknownHostException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - configElement.appendChild(Jaxp.createElement(doc, BaseTestTags.SCRIPT_NAME, getMessage())); - Element user = doc.createElement("User"); - user.setAttribute("name", this.userName); - user.setAttribute("email", this.userEmail); - user.setAttribute("id", this.userId); - configElement.appendChild(user); - if (scriptVersionRecord != null) { - configElement.appendChild(scriptVersionRecord.toXml(doc)); - } - // if (executedBy != null) { - // configElement.appendChild(executedBy.toXml(doc)); - // } - DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG); - configElement.appendChild(Jaxp.createElement(doc, BaseTestTags.EXECUTION_DATE, dateFormat.format(new Date()).toString())); - TestScript script = ((TestEnvironment) this.getSource()).getTestScript(); - if (script != null) { - configElement.appendChild(Jaxp.createElement(doc, BaseTestTags.ENVIRONMENT_FIELD, script.getType().toString())); - } else { - // script is null - configElement.appendChild(Jaxp.createElement(doc, BaseTestTags.ENVIRONMENT_FIELD, "Null Script")); - } - return configElement; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement(BaseTestTags.CONFIG_ENTRY); - try { - writer.writeAttribute("machineName", InetAddress.getLocalHost().getHostName()); - } catch (DOMException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } catch (UnknownHostException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e); - } - writeElement(writer, BaseTestTags.SCRIPT_NAME, getMessage()); - writer.writeStartElement("User"); - writer.writeAttribute("name", this.userName); - writer.writeAttribute("email", this.userEmail); - writer.writeAttribute("id", this.userId); - writer.writeEndElement(); - if (scriptVersionRecord != null) { - scriptVersionRecord.toXml(writer); - } - DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG); - writeElement(writer, BaseTestTags.EXECUTION_DATE, dateFormat.format(new Date()).toString()); - TestScript script = ((TestEnvironment) this.getSource()).getTestScript(); - if (script != null) { - writeElement(writer, BaseTestTags.ENVIRONMENT_FIELD, script.getType().toString()); - } else { - // script is null - writeElement(writer, BaseTestTags.ENVIRONMENT_FIELD, "Null Script"); - } - writer.writeEndElement(); - } - - @JsonProperty - public ScriptVersionConfig getScriptVersionRecord() { - return scriptVersionRecord; - } - - public void setScriptVersion(ScriptVersionConfig scriptVersionRecord) { - this.scriptVersionRecord = scriptVersionRecord; - } - - public void setExecutedBy(String name, String email, String id) { - this.userName = name; - this.userEmail = email; - this.userId = id; - } - - @JsonProperty - public String getMachineName() { - try { - return InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - - @JsonProperty - public User getUser() { - return new User(this.userName, this.userEmail, this.userId); - } - - public class User { - private String name, email, id; - - @JsonCreator - public User(final String name, final String email, final String id) { - this.name = name; - this.email = email; - this.id = id; - } - - @JsonProperty - public String getName() { - return nonEmptyString(name); - } - - @JsonProperty - public String getEmail() { - return nonEmptyString(email); - } - - @JsonProperty - public String getId() { - return nonEmptyString(id); - } - } - - @JsonProperty - public String getExecutionDate() { - DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG); - return dateFormat.format(new Date()).toString(); - } - - @JsonProperty - public String getEnvironment() { - TestScript script = ((TestEnvironment) this.getSource()).getTestScript(); - if (script != null) { - return script.getType().toString(); - } else { - return null; - } - } - - @JsonIgnore - @Override - public List<String> getLocation() { - return super.getLocation(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptInitRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptInitRecord.java deleted file mode 100644 index 82f75cb41c7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptInitRecord.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.LogRecord; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.log.TestLevel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class ScriptInitRecord extends TestRecord { - - private static final long serialVersionUID = -8573603873316659237L; - private final boolean startFlag; - - /** - * ScriptInitRecord Constructor. Constructs test script configuration log message with timestamp. - * - * @param script The test script who's configuration is to be recorded. - * @param timeStamp <b>True</b> if a timestamp should be recorded, <b>False</b> if not. - */ - public ScriptInitRecord(TestScript script, boolean timeStamp, boolean startFlag) { - super(script.getTestEnvironment(), TestLevel.TEST_POINT, script.getClass().getName(), timeStamp); - this.startFlag = startFlag; - } - - /** - * ScriptConfigRecord Constructor. Constructs test script configuration log message. - * - * @param script The test script who's configuration is to be recorded. - * @param startFlag true for the beginning of init, false for the end. - */ - public ScriptInitRecord(TestScript script, boolean startFlag) { - this(script, true, startFlag); - } - - /** - * Returns whether this is the start of the init or end. - * - * @return <b>true</b> if start of the script init, <b>false</b> if the end. - */ - public boolean getStartFlag() { - return startFlag; - } - - @Override - public Element toXml(Document doc) { - //This element is not added to the output xml. - //It is here because ScriptLogHandler creates an - //element out of the record and adds it to the xml. - //We don't add it, but it was necessary to create the - //element so that we could test for ScriptInitRecord. - return doc.createElement("ScriptInit"); - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("ScriptInit"); - } - - @Override - @JsonProperty("Script") - public String getMessage() { - return super.getMessage(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptResultRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptResultRecord.java deleted file mode 100644 index bd2ca9351fa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/ScriptResultRecord.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.log.TestLevel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class ScriptResultRecord extends TestRecord { - private static final long serialVersionUID = -6132341487630154239L; - private final List<Xmlizable> childElements; - private final List<XmlizableStream> childStreamElements; - - /** - * ScriptConfigRecord Constructor. Constructs test script configuration log - * message with timestamp. - * - * @param script - * The test script who's configuration is to be recorded. - * @param timeStamp - * <b>True </b> if a timestamp should be recorded, <b>False </b> - * if not. - */ - public ScriptResultRecord(TestScript script) { - super(script.getTestEnvironment(), TestLevel.TEST_POINT, script.getClass().getName(), false); - childElements = new ArrayList<>(1000); - childStreamElements = new ArrayList<>(100); - } - - public void addChildElement(Xmlizable xml) { - childElements.add(xml); - } - - public void addChildElement(XmlizableStream xml) { - childStreamElements.add(xml); - } - - /** - * Convert an element to XML format. - * - * @return XML formated config element. - */ - @Override - public Element toXml(Document doc) { - Element result = doc.createElement("ScriptResult"); - for (Xmlizable xml : childElements) { - result.appendChild(xml.toXml(doc)); - } - childElements.clear(); - return result; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("ScriptResult"); - for (XmlizableStream xml : childStreamElements) { - xml.toXml(writer); - } - writer.writeEndElement(); - } - - @JsonProperty - public List<XmlizableStream> getResults() { - return childStreamElements; - } - - @Override - @JsonProperty("ScriptName") - public String getMessage() { - return super.getMessage(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/SevereRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/SevereRecord.java deleted file mode 100644 index 37449876f39..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/SevereRecord.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.logging.Level; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class SevereRecord extends TestRecord { - - private static final long serialVersionUID = -2717539209163922501L; - - /** - * SevereRecord Constructor. Sets up a Severe log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - * @param timeStamp <b>True </b> if a timestamp should be recorded, <b>False </b> if not. - */ - public SevereRecord(ITestEnvironmentAccessor source, String msg, boolean timeStamp) { - super(source, Level.SEVERE, msg, timeStamp); - } - - /** - * SevereRecord Constructor. Sets up a Severe log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - */ - public SevereRecord(ITestEnvironmentAccessor source, String msg) { - this(source, msg, true); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/SupportRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/SupportRecord.java deleted file mode 100644 index bd6a08c8d04..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/SupportRecord.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.log.TestLevel; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class SupportRecord extends TestRecord { - - private static final long serialVersionUID = 6889265206495780451L; - - /** - * SupportRecord Constructor. Sets up a Support log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - * @param timeStamp <b>True </b> if a timestamp should be recorded, <b>False </b> if not. - */ - public SupportRecord(ITestEnvironmentAccessor source, String msg, boolean timeStamp) { - super(source, TestLevel.SUPPORT, msg, timeStamp); - } - - /** - * SupportRecord Constructor. Sets up a Support log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - */ - public SupportRecord(ITestEnvironmentAccessor source, String msg) { - this(source, msg, true); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestCaseRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestCaseRecord.java deleted file mode 100644 index a99f64b2bb3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestCaseRecord.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.logging.Level; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.log.TestLevel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class TestCaseRecord extends TestRecord { - private static final long serialVersionUID = -5049608072548003705L; - private final TestCase testCase; - - /** - * TestCaseRecorded Constructor. Sets up a test case log message. - * - * @param source - * The object requesting the logging. - * @param testCase - * The current test case to be logged. - */ - public TestCaseRecord(ITestEnvironmentAccessor source, TestCase testCase) { - super(source, TestLevel.TEST_POINT, "Test Case " + testCase.getTestCaseNumber() + " began.", true); - this.testCase = testCase; - if (testCase.getTestEnvironment() == null) { - OseeLog.log(TestEnvironment.class, Level.INFO, "env null"); - } - /* - * else if (testCase.getTestEnvironment().getStatusBoard() == null) - * OseeLog.log(Activator.class, Level.INFO, "nullstatus board"); - * testCase - * .getTestEnvironment().getStatusBoard().setCurrentScriptCurrentTestCase - * (testCase.getTestCaseNumber()); - */ - } - - /** - * Convert an element to XML format. - * - * @return XML formated element. - */ - @Override - public Element toXml(Document doc) { - return testCase.toXml(doc); - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - testCase.toXml(writer); - } - - @JsonProperty - public TestCase getTestCase() { - return testCase; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestDescriptionRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestDescriptionRecord.java deleted file mode 100644 index d4fb6ba2a44..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestDescriptionRecord.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.log.TestLevel; -import org.eclipse.osee.ote.core.test.tags.BaseTestTags; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class TestDescriptionRecord extends TestRecord { - - private static final long serialVersionUID = -2188431468814850228L; - private String purpose; - private String preCondition; - private String postCondition; - - public TestDescriptionRecord(ITestEnvironmentAccessor testEnvironment) { - super(testEnvironment, TestLevel.TEST_POINT, "Description Record", false); - this.purpose = " "; - this.preCondition = " "; - this.postCondition = " "; - } - - public void setPurpose(String purpose) { - this.purpose = purpose; - } - - public void setPreCondition(String preCondition) { - this.preCondition = preCondition; - } - - public void setPostCondition(String postCondition) { - this.postCondition = postCondition; - } - - @Override - public Element toXml(Document doc) { - Element root = doc.createElement(BaseTestTags.DESCRIPTION_FIELD); - root.appendChild(Jaxp.createElement(doc, BaseTestTags.PURPOSE_FIELD, purpose)); - root.appendChild(Jaxp.createElement(doc, BaseTestTags.PRECONDITION_FIELD, preCondition)); - root.appendChild(Jaxp.createElement(doc, BaseTestTags.POSTCONDITION_FIELD, postCondition)); - return root; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestPointRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestPointRecord.java deleted file mode 100644 index 31406c565e6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestPointRecord.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.logging.Level; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.environment.interfaces.ITestPoint; -import org.eclipse.osee.ote.core.log.TestLevel; -import org.eclipse.osee.ote.core.testPoint.CheckPoint; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - * @author Robert A. Fisher - * @author Charles Shaw - */ -public class TestPointRecord extends TestRecord { - private static final long serialVersionUID = 921875066237859323L; - private int number; - protected ITestPoint testPoint; - - public TestPointRecord(ITestEnvironmentAccessor source, ITestPoint testPoint, boolean timeStamp) { - this(source, source.getTestScript(), source.getTestScript().getTestCase(), testPoint, timeStamp); - } - - /** - * TestPointRecord Constructor. Sets up a test point record of the result of the test point. - * - * @param source The object requesting the logging. - * @param accessor The test case the test point is in. - * @param testPoint The TestSubPoint object for the test point. - * @param timeStamp <b>True </b> if a timestamp should be recorded, <b>False </b> if not. - */ - public TestPointRecord(ITestEnvironmentAccessor source, TestScript script, TestCase accessor, ITestPoint testPoint, boolean timeStamp) { - super(source, TestLevel.TEST_POINT, "", timeStamp); - this.testPoint = testPoint; - script.__addTestPoint(testPoint.isPass()); - // this.testCase = accessor.getTestCase(); - if (accessor == null) { - // OseeLog.log(Activator.class, Level.INFO, "test case null"); - } else if (accessor.getTestScript() == null) { - OseeLog.log(TestEnvironment.class, Level.INFO, "test script null"); - } - - this.number = script.__recordTestPoint(testPoint.isPass()); - } - - /** - * TestPointRecord Constructor. Sets up a test point record of the result of the test point - * - * @param source The object requesting the logging. - * @param testPoint The TestPoint object for the test point. - */ - public TestPointRecord(ITestEnvironmentAccessor source, TestScript script, TestCase testCase, ITestPoint testPoint) { - this(source, script, testCase, testPoint, true); - int point = script.getCurrentPointNumber(); - - if (!testPoint.isPass()) { - try { - if (testPoint instanceof CheckPoint) { - CheckPoint cp = (CheckPoint) testPoint; - String exp = cp.getExpected(); - String act = cp.getActual(); - String name = cp.getTestPointName(); - Throwable th = new Throwable(); - StringBuilder stack = new StringBuilder(); - boolean printLine = false; - for (StackTraceElement element : th.getStackTrace()) { - if (!printLine && !element.toString().startsWith("org.eclipse.osee")) { - printLine = true; - } - if (printLine) { - stack.append(element.toString()); - stack.append("\n"); - } - } - script.pauseScriptOnFail(point, name, exp, act, stack.toString()); - script.printFailure(point, name, exp, act, stack.toString()); - } else { - script.pauseScriptOnFail(point); - script.printFailure(point); - } - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - - /** - * TestPointRecord Constructor. Sets up a test point record of the result of the test point. - * - * @param source The object requesting the logging. - * @param script The test script object - * @param testCase The test case object - * @param testPointName The name of the item being tested. - * @param expected The expected value for the test point. - * @param actual The actual value for the test point. - * @param passed <b>True </b> if the test point passed, <b>False </b> if not. - * @param timeStamp <b>True </b> if a timestamp should be recorded, <b>False </b> if not. - */ - public TestPointRecord(ITestEnvironmentAccessor source, TestScript script, TestCase testCase, String testPointName, String expected, String actual, boolean passed, boolean timeStamp) { - this(source, script, testCase, new CheckPoint(testPointName, expected, actual, passed), timeStamp); - } - - /** - * TestPointRecord Constructor. Sets up a test point record of the result of the test point. - * - * @param source The object requesting the logging. - * @param accessor The test case the test point is in. - * @param testPointName The name of the item being tested. - * @param expected The expected value for the test point. - * @param actual The actual value for the test point. - * @param passed <b>True </b> if the test point passed, <b>False </b> if not. - */ - public TestPointRecord(ITestEnvironmentAccessor source, TestScript script, TestCase accessor, String testPointName, String expected, String actual, boolean passed) { - this(source, script, accessor, testPointName, expected, actual, passed, true); - } - - /** - * Converts element to XML formating. - * - * @return Element XML formated element. - */ - @Override - public Element toXml(Document doc) { - Element tpElement = doc.createElement("TestPoint"); - tpElement.appendChild(Jaxp.createElement(doc, "Number", String.valueOf(number))); - if (testPoint.isPass()) { - tpElement.appendChild(Jaxp.createElement(doc, "Result", "PASSED")); - } else { - tpElement.appendChild(Jaxp.createElement(doc, "Result", "FAILED")); - } - tpElement.appendChild(this.getLocation(doc)); - tpElement.appendChild(testPoint.toXml(doc)); - - return tpElement; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("TestPoint"); - XMLStreamWriterUtil.writeElement(writer, "Number", String.valueOf(number)); - if (testPoint.isPass()) { - XMLStreamWriterUtil.writeElement(writer, "Result", "PASSED"); - } else { - XMLStreamWriterUtil.writeElement(writer, "Result", "FAILED"); - } - writeLocation(writer); - testPoint.toXml(writer); - writer.writeEndElement(); - } - - @JsonProperty - public ITestPoint getTestPoint() { - return testPoint; - } - - @JsonProperty - public int getNumber() { - return number; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestRecord.java deleted file mode 100644 index 07eef5d9fb4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TestRecord.java +++ /dev/null @@ -1,341 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.LogRecord; -import java.util.regex.Pattern; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.annotate.JsonSubTypes; -import org.codehaus.jackson.annotate.JsonTypeInfo; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.log.record.MessageJarConfigrecord; -import org.eclipse.osee.ote.properties.OtePropertiesCore; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Michael A. Winston - */ -public abstract class TestRecord extends LogRecord implements Xmlizable, XmlizableStream { - private static final long serialVersionUID = 2663140700880844240L; - private static final ArrayList<Pattern> stacktraceExcludes = new ArrayList<>(32); - private static final ArrayList<Pattern> stacktraceIncludes = new ArrayList<>(32); - private static boolean filterTheStacktrace = true; - private static boolean locationLogginOn = true; - private List<LogRecord> children = new ArrayList<>(); - - public static void setLocationLoggingOn(boolean on) { - locationLogginOn = on; - } - - public static boolean getLocationLoggingOn() { - return locationLogginOn; - } - - static { - filterTheStacktrace = OtePropertiesCore.noStacktraceFilter.getValue() == null; - stacktraceExcludes.add(Pattern.compile("org\\.eclipse\\.osee\\..*")); - } - - private final ITestEnvironmentAccessor source; - private long timeStamp; - private final boolean printTimeStamp; - private Throwable throwable; - - /** - * TestRecord Constructor. This is an abstract class so this constructor is - * called via the super() call from the extended class. This sets the - * source, the logging level, the log message and whether a timestamp should - * be included. - * - * @param source - * The object requesting the logging. - * @param level - * The logging level. - * @param msg - * The log message. - * @param timeStamp - * <b>True </b> to include timestamp, <b>False </b> if not. - */ - public TestRecord(ITestEnvironmentAccessor source, Level level, String msg, boolean timeStamp) { - super(level, msg); - this.throwable = new Throwable(); - this.printTimeStamp = timeStamp; - this.source = source; - if (this.printTimeStamp) { - if (source != null) { - this.timeStamp = source.getEnvTime(); - } else { - this.timeStamp = System.currentTimeMillis(); - try { - throw new Exception("source was null"); - } catch (Exception e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e.getMessage(), e); - } - } - } - } - - @JsonIgnore - public void setStackTrace(Throwable throwable) { - this.throwable = throwable; - } - - private Element calc(Document doc) { - StackTraceElement[] stackElements = this.throwable.getStackTrace(); - Element locationElement = doc.createElement("Location"); - locationElement.setAttribute("id", Integer.toString(locationElement.hashCode())); - for (StackTraceElement stackElement : stackElements) { - addElement(doc, stackElement, locationElement); - } - return locationElement; - } - - private void calc(XMLStreamWriter writer) throws XMLStreamException { - StackTraceElement[] stackElements = this.throwable.getStackTrace(); - writer.writeStartElement("Location"); - writer.writeAttribute("id", Integer.toString(stackElements.hashCode())); - for (StackTraceElement stackElement : stackElements) { - addElement(writer, stackElement); - } - } - - private void addElement(XMLStreamWriter writer, StackTraceElement stackElement) throws XMLStreamException { - if (filterTheStacktrace) { - final String className = stackElement.getClassName(); - for (Pattern includes : stacktraceIncludes) { - if (includes.matcher(className).matches()) { - writer.writeEmptyElement("Stacktrace"); - writer.writeAttribute("source", stackElement.getClassName()); - writer.writeAttribute("line", Integer.toString(stackElement.getLineNumber())); - // writer.writeEndElement(); - return; - } - } - for (Pattern excludes : stacktraceExcludes) { - if (excludes.matcher(className).matches()) { - return; - } - } - } - writer.writeEmptyElement("Stacktrace"); - writer.writeAttribute("source", stackElement.getClassName()); - writer.writeAttribute("line", Integer.toString(stackElement.getLineNumber())); - // writer.writeEndElement(); - } - - private void addElement(Document doc, StackTraceElement stackElement, Element locationElement) { - if (filterTheStacktrace) { - final String className = stackElement.getClassName(); - for (Pattern includes : stacktraceIncludes) { - if (includes.matcher(className).matches()) { - Element stackTrace = doc.createElement("Stacktrace"); - stackTrace.setAttribute("source", stackElement.getClassName()); - stackTrace.setAttribute("line", Integer.toString(stackElement.getLineNumber())); - locationElement.appendChild(stackTrace); - return; - } - } - for (Pattern excludes : stacktraceExcludes) { - if (excludes.matcher(className).matches()) { - return; - } - } - } - Element stackTrace = doc.createElement("Stacktrace"); - stackTrace.setAttribute("source", stackElement.getClassName()); - stackTrace.setAttribute("line", Integer.toString(stackElement.getLineNumber())); - locationElement.appendChild(stackTrace); - } - - /** - * Converts log element to XML format. - * - * @return xml formated element. - */ - @Override - public Element toXml(Document doc) { - Element recordElement = doc.createElement(getLevel().getName()); - if (TestRecord.getLocationLoggingOn()) { - recordElement.appendChild(getLocation(doc)); - } - recordElement.appendChild(Jaxp.createElement(doc, "Message", getMessage())); - return recordElement; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("OteLog"); - writer.writeAttribute("Level", getLevel().getName()); - writeMessage(writer); - writeLocationCheckLocationLoggingOn(writer); - writer.writeEndElement(); - } - - public Object getSource() { - return source; - } - - /** - * @return Elements location. - */ - protected Element getLocation(Document doc) { - Element locationElement = calc(doc); - if (this.printTimeStamp) { - locationElement.appendChild(Jaxp.createElement(doc, "Time", Long.toString(timeStamp))); - } - return locationElement; - } - - protected void writeLocation(XMLStreamWriter writer) throws XMLStreamException { - calc(writer); - writeTime(writer); - writer.writeEndElement(); - } - - protected void writeLocationCheckLocationLoggingOn(XMLStreamWriter writer) throws XMLStreamException { - if (TestRecord.getLocationLoggingOn()) { - writeLocation(writer); - } - } - - protected void writeTime(XMLStreamWriter writer) throws XMLStreamException { - if (this.printTimeStamp) { - writer.writeStartElement("Time"); - writer.writeCharacters(Long.toString(timeStamp)); - writer.writeEndElement(); - } - } - - protected void writeMessage(XMLStreamWriter writer) throws XMLStreamException { - writeElement(writer, "Message", getMessage()); - } - - protected void writeElement(XMLStreamWriter writer, String elementName, String characterData) throws XMLStreamException { - XMLStreamWriterUtil.writeElement(writer, elementName, characterData); - } - - @JsonProperty - public List<String> getLocation() { - List<String> result = new ArrayList<>(); - if (TestRecord.getLocationLoggingOn()) { - StackTraceElement[] stackTrace = this.throwable.getStackTrace(); - result.addAll(filterStackTrace(stackTrace)); - } - if (result.isEmpty()) { - return null; - } else { - return result; - } - } - - private List<String> filterStackTrace(StackTraceElement[] stackTrace) { - // include everything if not filtered, otherwise ... - // default is to include unless explicitly excluded, but only if not - // explicitly included ... yuck - List<String> result = new ArrayList<>(); - for (StackTraceElement stackElement : stackTrace) { - final String className = stackElement.getClassName(); - if (!filterTheStacktrace || included(className) || !excluded(className)) { - result.add(stackElement.getClassName() + ":" + stackElement.getLineNumber()); - } - } - return result; - } - - private boolean excluded(String className) { - for (Pattern exclude : stacktraceExcludes) { - if (exclude.matcher(className).matches()) { - return true; - } - } - return false; - } - - private boolean included(String className) { - for (Pattern include : stacktraceIncludes) { - if (include.matcher(className).matches()) { - return true; - } - } - return false; - } - - @JsonProperty - public Long getTimeStamp() { - if (this.printTimeStamp) { - return timeStamp; - } else { - return null; - } - } - - @Override - @JsonProperty - public String getMessage() { - return nonEmptyString(super.getMessage()); - } - - protected String nonEmptyString(final String subject) { - if (subject != null && subject.trim().length() > 0) { - return subject; - } else { - return null; - } - } - - - protected <T> List<T> nonEmptyList(final List<T> subject) { - return (List<T>) nonEmptyCollection(subject); - } - - protected <T> Collection<T> nonEmptyCollection(final Collection<T> subject) { - if (subject.isEmpty()) { - return null; - } else { - return subject; - } - } - - // we want LogRecord to record its level in the JSON, but not derivatives, but we must - // preserve default behavior for other things, like the log handler - @JsonIgnore - @Override - public Level getLevel() { - return super.getLevel(); - } - - public void addChildRecord(final LogRecord record) { - children.add(record); - } - - @JsonProperty - public List<LogRecord> getChildRecords() { - return nonEmptyList(children); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TraceRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TraceRecord.java deleted file mode 100644 index 191bac898be..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TraceRecord.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.LogRecord; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.annotate.JsonTypeInfo; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.log.TestLevel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Ryan D. Brooks - */ -public class TraceRecord extends TestRecord implements Xmlizable { - private static final long serialVersionUID = 8567378567805515775L; - private final String objectName; - private final String methodName; - private final MethodFormatter methodArguments; - private final ArrayList<Xmlizable> additionalElements; - private final ArrayList<XmlizableStream> additionalStreamElements; - - private static final String additionalString = "AdditionalInfo"; - - /** - * TraceRecord Constructor. Sets up a Trace log message. - * - * @param source The object requesting the logging. - * @param timeStamp <b>True </b> if a timestamp should be recorded, <b>False </b> if not. - */ - public TraceRecord(ITestEnvironmentAccessor source, String objectName, String methodName, MethodFormatter methodArguments, boolean timeStamp, boolean startFlag) { - this(source, objectName, methodName, methodArguments, timeStamp); - } - - public TraceRecord(ITestEnvironmentAccessor source, String objectName, String methodName, MethodFormatter methodArguments, boolean timeStamp) { - super(source, TestLevel.TRACE, "", timeStamp); - this.objectName = objectName; - this.methodName = methodName; - this.methodArguments = methodArguments; - this.additionalElements = new ArrayList<>(); - this.additionalStreamElements = new ArrayList<>(); - } - - public TraceRecord(ITestEnvironmentAccessor source, String objectName2, String methodName2, MethodFormatter methodArguments2) { - this(source, objectName2, methodName2, methodArguments2, true); - } - - public void addAdditionalElement(Xmlizable object) { - if (object != null) { - additionalElements.add(object); - } - } - - public void addAdditionalElement(XmlizableStream object) { - if (object != null) { - additionalStreamElements.add(object); - } - } - - /** - * Converts element to XML formating. - * - * @return Element XML formated element. - */ - @Override - public Element toXml(Document doc) { - Element trElement = doc.createElement("Trace"); - trElement.appendChild(Jaxp.createElement(doc, "ObjectName", objectName)); - trElement.appendChild(Jaxp.createElement(doc, "MethodName", methodName)); - trElement.appendChild(methodArguments.toXml(doc)); - if (!additionalElements.isEmpty()) { - Element additional = doc.createElement(additionalString); - trElement.appendChild(additional); - for (Xmlizable object : additionalElements) { - additional.appendChild(object.toXml(doc)); - } - } - if (TestRecord.getLocationLoggingOn()) { - trElement.appendChild(getLocation(doc)); - } - return trElement; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("Trace"); - XMLStreamWriterUtil.writeElement(writer, "ObjectName", objectName); - XMLStreamWriterUtil.writeElement(writer, "MethodName", methodName); - methodArguments.toXml(writer); - if (!additionalElements.isEmpty()) { - writer.writeStartElement(additionalString); - for (XmlizableStream object : additionalStreamElements) { - object.toXml(writer); - } - writer.writeEndElement(); - } - writeLocationCheckLocationLoggingOn(writer); - } - - @JsonProperty - public String getArguments() { - return nonEmptyString(methodArguments.toString()); - } - - @JsonProperty - public List<?> getAdditionalInfo() { - return nonEmptyList(additionalStreamElements); - } - - @JsonProperty - public String getObjectName() { - return nonEmptyString(objectName); - } - - @JsonProperty - public String getMethodName() { - return nonEmptyString(methodName); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TraceRecordEnd.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TraceRecordEnd.java deleted file mode 100644 index 24b8a4aef2a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/TraceRecordEnd.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.ote.core.ReturnFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.log.TestLevel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class TraceRecordEnd extends TestRecord implements Xmlizable { - - private static final long serialVersionUID = 8567378567805515775L; - private final ReturnFormatter returnFormatter; - private final ArrayList<Xmlizable> additionalElements; - private final ArrayList<XmlizableStream> additionalStreamElements; - - private static final String additionalString = "AdditionalInfo"; - - public TraceRecordEnd(ITestEnvironmentAccessor source, ReturnFormatter returnFormatter) { - super(source, TestLevel.TRACE, "", true); - this.returnFormatter = returnFormatter; - this.additionalElements = new ArrayList<>(); - this.additionalStreamElements = new ArrayList<>(); - } - - public void addAdditionalElement(Xmlizable object) { - if (object != null) { - additionalElements.add(object); - } - } - - public void addAdditionalElement(XmlizableStream object) { - if (object != null) { - additionalStreamElements.add(object); - } - } - - /** - * Converts element to XML formating. - * - * @return Element XML formated element. - */ - @Override - public Element toXml(Document doc) { - Element trElement = doc.createElement("TraceEnd"); - trElement.appendChild(returnFormatter.toXml(doc)); - if (!additionalElements.isEmpty()) { - Element additional = doc.createElement(additionalString); - trElement.appendChild(additional); - for (Xmlizable object : additionalElements) { - additional.appendChild(object.toXml(doc)); - } - } - return trElement; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("TraceEnd"); - returnFormatter.toXml(writer); - if (!additionalElements.isEmpty()) { - writer.writeStartElement(additionalString); - for (XmlizableStream object : additionalStreamElements) { - object.toXml(writer); - } - } - writer.writeEndElement(); - } - - @JsonProperty - public ReturnFormatter getReturnValue() { - return returnFormatter; -} - -@Override -@JsonIgnore - public List<String> getLocation() { - return null; - } - - @JsonProperty - public List<?> getAdditionalInfo() { - return nonEmptyList(additionalStreamElements); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/WarningRecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/WarningRecord.java deleted file mode 100644 index 8267d7f5ac0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/WarningRecord.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.log.record; - -import java.util.logging.Level; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; - -/** - * @author Ryan D. Brooks - */ -public class WarningRecord extends TestRecord { - - private static final long serialVersionUID = -3124953320400273382L; - - /** - * WarningRecord Constructor. Sets up a Warning log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - * @param timeStamp <b>True </b> if a timestamp should be recorded, <b>False </b> if not. - */ - public WarningRecord(ITestEnvironmentAccessor source, String msg, boolean timeStamp) { - super(source, Level.WARNING, msg, timeStamp); - } - - /** - * WarningRecord Constructor. Sets up a Warning log message. - * - * @param source The object requesting the logging. - * @param msg The log message. - */ - public WarningRecord(ITestEnvironmentAccessor source, String msg) { - this(source, msg, true); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/json/LogRecordModule.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/json/LogRecordModule.java deleted file mode 100644 index 70fa79a5d8f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/log/record/json/LogRecordModule.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.eclipse.osee.ote.core.log.record.json; - -import java.util.logging.Level; -import java.util.logging.LogRecord; - -import org.codehaus.jackson.Version; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.annotate.JsonSubTypes; -import org.codehaus.jackson.annotate.JsonTypeInfo; -import org.codehaus.jackson.map.module.SimpleModule; -import org.eclipse.osee.ote.core.log.record.TestRecord; - -public class LogRecordModule extends SimpleModule { - - public LogRecordModule() { - super("LogRecordModule", new Version(0, 0, 1, null)); - } - - @Override - public void setupModule(SetupContext context) { - context.setMixInAnnotations(LogRecord.class, MixIn.class); - } - - abstract class MixIn { - MixIn(@JsonProperty("Level") Level level, @JsonProperty("Message") String message) { - }; - - @JsonProperty - abstract public Level getLevel(); - - @JsonProperty - abstract public String getMessage(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModel.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModel.java deleted file mode 100644 index 1265d6c4477..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModel.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.model; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import org.eclipse.osee.ote.core.environment.EnvironmentTask; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IModel extends Remote { - void turnModelOn() throws RemoteException; - - void turnModelOff() throws RemoteException; - - void init(TestEnvironment testEnvironment, ModelKey key) throws RemoteException; - - ModelState getState() throws RemoteException; - - <CLASSTYPE extends IModel> ModelKey getKey() throws RemoteException; - - void dispose() throws RemoteException; - - EnvironmentTask getEnvironmentTask() throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelKeyFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelKeyFactory.java deleted file mode 100644 index 151e08e366d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelKeyFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.model; - -import java.util.Collection; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IModelKeyFactory { - Collection<ModelKey> getModelKeys(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelListener.java deleted file mode 100644 index 9dd542a96f3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelListener.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.model; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IModelListener extends Remote { - - void onModelPreCreate(ModelKey key) throws RemoteException; - - void onModelPostCreate(ModelKey key) throws RemoteException; - - void onModelDispose(ModelKey key) throws RemoteException; - - void onModelStateChange(ModelKey key, ModelState state) throws RemoteException; - - int getHashCode() throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelManager.java deleted file mode 100644 index 3218c94b9dd..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelManager.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.model; - -import java.rmi.RemoteException; -import java.util.List; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IModelManager { - <CLASSTYPE extends IModel> CLASSTYPE getModel(ModelKey<CLASSTYPE> key); - - <CLASSTYPE extends IModel> void disposeModel(ModelKey<?> key); - - <CLASSTYPE extends IModel> void registerModel(ModelKey<?> key); - - void changeModelState(ModelKey<?> key, ModelState state); - - void notifyModelStateListener(ModelKey<?> key, ModelState state) throws RemoteException; - - @Deprecated - void notifyModeStateListener(ModelKey key, ModelState state) throws RemoteException; - - List<ModelKey> getRegisteredModels(); - - void releaseReference(IModel model); - - void releaseAllReferences(ModelKey<?> key); - - void addModelActivityListener(IModelListener listener); - - void removeModelActivityListener(IModelListener listener); - - void addModelActivityListener(IModelListener listener, ModelKey<?> key); - - void removeModelActivityListener(IModelListener listener, ModelKey<?> key); - - ModelState getModelState(ModelKey<?> key) throws RemoteException; - - /** - * Releases a single reference of the model given by the class. - * - * @param key - */ - void releaseReference(ModelKey<?> key); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelManagerRemote.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelManagerRemote.java deleted file mode 100644 index c2f7f2b6e00..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IModelManagerRemote.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.model; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.List; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IModelManagerRemote extends Remote { - List<ModelKey> getRegisteredModels() throws RemoteException; - - Remote getRemoteModel(ModelKey<?> key) throws RemoteException; - - ModelState getModelState(ModelKey<?> key) throws RemoteException; - - void releaseReference(ModelKey<?> key) throws RemoteException; - - void addModelActivityListener(IModelListener listener) throws RemoteException; - - void removeModelActivityListener(IModelListener listener) throws RemoteException; - - void addModelActivityListener(IModelListener listener, ModelKey<?> key) throws RemoteException; - - void removeModelActivityListener(IModelListener listener, ModelKey<?> key) throws RemoteException; - - void changeModelState(ModelKey<?> key, ModelState state) throws RemoteException; - - void releaseAllReferences(ModelKey<?> key) throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IRemoteModel.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IRemoteModel.java deleted file mode 100644 index 182b95c88aa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/IRemoteModel.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.model; - -import java.rmi.Remote; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IRemoteModel extends Remote { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/ModelKey.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/ModelKey.java deleted file mode 100644 index aa114f061da..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/ModelKey.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.model; - -import java.io.Serializable; - -/** - * This key is used by the model manager to search for a model already instanciated for this environment. Each of the - * getter functions MUST return a unique identifier for the specific model they represent ( or null if that particular - * type isn't available). - * - * @author Andrew M. Finkbeiner - */ -public class ModelKey<M extends IModel> implements Serializable, Comparable { - private static final long serialVersionUID = 4735332847721441142L; - private String className; - private String name; - private Class<M> modelClass; - - public ModelKey(String className) { - this(className, null, null); - } - - public ModelKey(ModelKey key) { - this(key.className, key.name, null); - } - - public ModelKey(Class<M> clazz) { - this(clazz.getCanonicalName(), null, clazz); - } - - public ModelKey(Class<M> clazz, String name) { - this(clazz.getCanonicalName(), name, clazz); - } - - public ModelKey(String className, String name, Class<M> modelClass) { - this.className = className; - this.name = name; - this.modelClass = modelClass; - } - - /** - * return the instance class for the model specified by this key. This class MUST match for all keys specifying this - * particular model. - * - * @return The class for the model described by this key. This may be null if no class name is available but in this - * case {@link #getClassName()} must NOT return null. - */ - public Class<M> getModelClass() { - return this.modelClass; - } - - public void setModelClass(Class<M> modelClass) { - this.modelClass = modelClass; - } - - /** - * return the name of the model specified by this key. - * - * @return The name for the model described by this key - */ - public String getName() { - if (this.name == null) { - this.name = this.getClassName().substring(this.getClassName().lastIndexOf(".") + 1); - } - return this.name; - } - - /** - * return the fully qualified class name for the model specified by this key. This class name MUST match for all keys - * specifying this particular model. - * - * @return The class name for the model described by this key. This may be null if no class name is available but in - * this case {@link #getModelClass()} must NOT return null. - */ - public String getClassName() { - if (className != null) { - return this.className; - } else if (modelClass != null) { - return modelClass.getCanonicalName(); - } else { - return null; - } - } - - @Override - public boolean equals(Object obj) { - return getClassName().equals(((ModelKey) obj).getClassName()); - } - - @Override - public int hashCode() { - return getClassName().hashCode(); - } - - @Override - public int compareTo(Object o) { - if (!(o instanceof ModelKey)) { - return -1; - } - - ModelKey otherKey = (ModelKey) o; - return this.getName().compareTo(otherKey.getName()); - } - - @Override - public String toString() { - return getClassName(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/ModelState.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/ModelState.java deleted file mode 100644 index b2079e30e0b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/model/ModelState.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.model; - -import java.io.Serializable; - -/** - * @author Michael P. Masterson - */ -public enum ModelState implements Serializable { - DISPOSED, - PAUSED, - RUNNING; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/osgi/IServiceOperation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/osgi/IServiceOperation.java deleted file mode 100644 index dc373eacbfc..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/osgi/IServiceOperation.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.osgi; - -/** - * An operation that interacts with an OSGI service in an atomic manner - * - * @author Ken J. Aguilar - */ -public interface IServiceOperation { - - /** - * the operation to perform against the service. The service instance will be valid during the execution of the - * operation. Subclasses should handle the case when the operation is asynchronously interrupted. - */ - void doOperation(Object service) throws InterruptedException; - - /** - * called when the service is about to be removed. - */ - void interrupt(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/osgi/ServiceOperationExecutor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/osgi/ServiceOperationExecutor.java deleted file mode 100644 index ce0b89bc70f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/osgi/ServiceOperationExecutor.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.osgi; - -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.ReentrantLock; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.util.tracker.ServiceTracker; - -/** - * A special service tracker that allows the atomic execution of an operation against a service. This provides a way for - * a complex operation to interact with an OSGI service without fear of the service being removed in the middle of the - * operation - * - * @author Ken J. Aguilar - */ -public class ServiceOperationExecutor extends ServiceTracker { - - private IServiceOperation operationInProgress = null; - private final ReentrantLock operationLock = new ReentrantLock(); - private final Condition operationComplete = operationLock.newCondition(); - - public ServiceOperationExecutor(BundleContext context, String serviceName) { - super(context, serviceName, null); - } - - @Override - public void close() { - waitForOperationComplete(); - super.close(); - } - - @Override - public void removedService(ServiceReference reference, Object service) { - waitForOperationComplete(); - super.removedService(reference, service); - } - - protected void waitForOperationComplete() { - operationLock.lock(); - try { - if (operationInProgress != null) { - operationInProgress.interrupt(); - while (operationInProgress != null) { - operationComplete.await(); - } - } - } catch (InterruptedException e) { - /* - * we got interrupted ourselves!! Standard practice is to call the current threads interrupt() if we can't - * re-throw the interrupted exception - */ - Thread.currentThread().interrupt(); - } finally { - operationLock.unlock(); - } - } - - /** - * executes the operation. - * - * @return true if the operation completed or false if the dependent service was not acquired - * @throws InterruptedException if the service operation was interrupted - */ - public boolean executeOperation(IServiceOperation operation) throws InterruptedException { - - final Object service; - // lock so we can safely get the service and set the operation in progress - operationLock.lock(); - service = getService(); - if (service == null) { - // the tracked service has not been acquired yet - return false; - } - operationInProgress = operation; - /* - * unlock since we do not want to be holding the lock while the operation is in progress. - */ - operationLock.unlock(); - - try { - operationInProgress.doOperation(service); - } finally { - /* - * if we get interrupted or something else happens make sure we signal operation complete so that we can - * prevent deadlocks if something was waiting on the operation - */ - operationLock.lock(); - operationInProgress = null; - operationComplete.signal(); - operationLock.unlock(); - - } - return true; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/shells/BashShell.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/shells/BashShell.java deleted file mode 100644 index a4f4714a9ed..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/shells/BashShell.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.test.shells; - -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintStream; -import java.net.SocketException; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.jdk.core.util.io.InputBufferThread; - -public class BashShell { - private static final int MAX_RESPONSE_TIME = 20000; - - private static final int ITERATION_TIME = 2000; - - private final InputStream in; - - private final PrintStream out; - - private final InputBufferThread inputBuffer; - - // private String prompt = "$ "; - - /** - * Connects telnet to the specified ipAddress and port - */ - public BashShell() throws SocketException, IOException { - String shell; - if (Lib.isWindows()) { - shell = "cmd.exe"; - } else { - shell = "/bin/bash"; - } - Process process; - - process = Runtime.getRuntime().exec(new String[] {shell}); - - in = process.getInputStream(); - out = new PrintStream(process.getOutputStream()); - - inputBuffer = new InputBufferThread(in); - inputBuffer.start(); - - } - - /** - * writes the command given to the output stream ( telnet ) - * - * @param string The command to give - */ - public void write(String string) { - out.println(string); - out.flush(); - } - - /** - * Sits on the line, reading in characters, and waits for the expected output from telnet - * - * @param string The String this function will stop on and return - * @return The entire string seen up to finding the string provided - */ - public synchronized String waitFor(String string) throws InterruptedException { - - int elapsedTime = 0; - while (elapsedTime <= MAX_RESPONSE_TIME) { - if (inputBuffer.contains(string, true) >= 0) { - break; - } - this.wait(ITERATION_TIME); - elapsedTime += ITERATION_TIME; - } - if (elapsedTime > MAX_RESPONSE_TIME) { - throw new InterruptedException( - "Waiting for '" + string + "' took longer then " + MAX_RESPONSE_TIME + " miliseconds."); - } - return inputBuffer.getBuffer(); - } - - /** - * Writes the command to telnet and waits for the normal command prompt - * - * @param string The command to issue - * @return Returns the whole buffer up to the prompt - */ - public String sendCommand(String string, long wait) throws InterruptedException { - - write(string); - return waitFor(wait); - } - - private String waitFor(long time) throws InterruptedException { - while (System.currentTimeMillis() - inputBuffer.getLastRead() < time) { - synchronized (this) { - this.wait(100); - } - } - return inputBuffer.getBuffer(); - } - - /** - * disconnects from telnet - */ - public void disconnect() { - write("ls"); - inputBuffer.stopOnNextRun(true); - write("exit"); - } - - // private String getBuffer() { - // return inputBuffer.getBuffer(); - // } - - public static void main(String[] args) { - BashShell shell; - try { - shell = new BashShell(); - String env = shell.sendCommand("env", 4000L); - System.out.println(env); - shell.disconnect(); - } catch (SocketException e) { - - } catch (IOException e) { - - } catch (InterruptedException e) { - - } - - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/shells/TelnetShell.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/shells/TelnetShell.java deleted file mode 100644 index ed00228382b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/shells/TelnetShell.java +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2009 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.test.shells; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.net.SocketException; -import java.nio.ByteBuffer; -import java.nio.channels.Channels; -import java.nio.channels.ReadableByteChannel; -import java.nio.channels.WritableByteChannel; -import java.util.logging.Level; -import java.util.regex.MatchResult; -import java.util.regex.Pattern; -import org.apache.commons.net.telnet.EchoOptionHandler; -import org.apache.commons.net.telnet.InvalidTelnetOptionException; -import org.apache.commons.net.telnet.SuppressGAOptionHandler; -import org.apache.commons.net.telnet.TelnetClient; -import org.apache.commons.net.telnet.TelnetNotificationHandler; -import org.apache.commons.net.telnet.TelnetOption; -import org.apache.commons.net.telnet.TerminalTypeOptionHandler; -import org.eclipse.osee.framework.jdk.core.util.io.InputBufferThread; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.TestEnvironment; - -/** - * Created on Aug 15, 2005 - */ -public class TelnetShell implements TelnetNotificationHandler { - - private static final int MAX_RESPONSE_TIME = 10000; - public final static class Piper extends Thread { - private final InputStream inStream; - private final OutputStream outStream; - - public final ByteBuffer buffer = ByteBuffer.allocateDirect(1024); - - public Piper(InputStream in, OutputStream out) { - super("Stream Piper"); - this.inStream = in; - this.outStream = out; - } - - @Override - public void run() { - final ReadableByteChannel in = Channels.newChannel(inStream); - final WritableByteChannel out = Channels.newChannel(outStream); - try { - buffer.clear(); - while (true) { - in.read(buffer); - buffer.flip(); - out.write(buffer); - buffer.compact(); - } - } catch (IOException e) { - e.printStackTrace(System.err); - } - } - } - - private final TelnetClient telnet; - private final InputStream in; - private final OutputStream out; - private InputBufferThread inputBuffer; - private String prompt = "$ "; - private int currentOutput = 0; - - /** - * Connects telnet to the specified ipAddress and port - */ - public TelnetShell(String ipAddress, int port) throws SocketException, IOException { - this(ipAddress, port, true); - } - - public TelnetShell(String ipAddress, int port, boolean start) throws SocketException, IOException { - telnet = new TelnetClient(); - telnet.registerNotifHandler(this); - SuppressGAOptionHandler sgaOpt = new SuppressGAOptionHandler(true, true, true, true); - TerminalTypeOptionHandler ttOpt = new TerminalTypeOptionHandler("VT100", false, false, true, false); - EchoOptionHandler eOPt = new EchoOptionHandler(true, false, true, false); - try { - telnet.addOptionHandler(ttOpt); - telnet.addOptionHandler(sgaOpt); - telnet.addOptionHandler(eOPt); - } catch (InvalidTelnetOptionException e) { - throw new IllegalStateException("invalid telnet options", e); - } - telnet.connect(ipAddress, port); - try { - Thread.sleep(1500); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - - /* - * try { if (!telnet.sendAYT(5000)) { throw new SocketException("server appears to be in use"); } } catch - * (IllegalArgumentException ex) { ex.printStackTrace(); } catch (InterruptedException ex) { ex.printStackTrace(); - * } - */ - //printOptionStates(); - in = telnet.getInputStream(); - out = telnet.getOutputStream(); - if (start) { - inputBuffer = new InputBufferThread(in); - inputBuffer.start(); - - } - } - - /** - * writes the command given to the output stream ( telnet ) - * - * @param string The command to give - */ - public void write(String string) { - // currentOutput = inputBuffer.getLength() + string.length() + 1; - try { - for (byte b : string.getBytes("us-ascii")) { - out.write(b); - out.flush(); - - try { - Thread.sleep(10); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - - } - out.write(getNewline()); - out.flush(); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - public String writeAndGetPrompt(String string, int timeout) throws Exception { - inputBuffer.clear(); - // currentOutput = inputBuffer.getLength() + string.length() + 1; - for (byte b : string.getBytes("us-ascii")) { - out.write(b); - out.flush(); - - try { - Thread.sleep(10); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - - } - out.write(getNewline()); - out.flush(); - Thread.sleep(timeout); - return inputBuffer.getBuffer(); - - } - - /** - * Sits on the line, reading in characters, and waits for the expected output from telnet - * - * @param string The String this function will stop on and return - */ - public synchronized void waitFor(String string) throws InterruptedException { - if (inputBuffer.waitFor(string, true, MAX_RESPONSE_TIME) < 0) { - throw new InterruptedException( - "Waiting for '" + string + "' took longer then " + MAX_RESPONSE_TIME + " miliseconds."); - } - } - - public synchronized MatchResult waitForPattern(Pattern pattern, int millis) throws InterruptedException { - MatchResult index = inputBuffer.waitFor(pattern, false, millis); - if (index == null) { - throw new InterruptedException( - "Waiting for '" + pattern.pattern() + "' took longer then " + millis + " miliseconds."); - } - return index; - } - - public synchronized void waitForTransmission(int millis) throws InterruptedException { - if (!inputBuffer.waitFor(millis)) { - throw new InterruptedException("Waiting for transmission took longer then " + millis + " miliseconds."); - } - } - - public synchronized String getBuffer(int start, int end) { - return inputBuffer.subString(start, end); - } - - public synchronized String captureTo(String string) throws InterruptedException { - int index = inputBuffer.waitFor(string, false, MAX_RESPONSE_TIME); - if (index < 0) { - throw new InterruptedException( - "Waiting for '" + string + "' took longer then " + MAX_RESPONSE_TIME + " miliseconds."); - } - return inputBuffer.subString(0, index); - } - - /** - * Writes the command to telnet and waits for the normal command prompt - * - * @param string The command to issue - */ - public void sendCommand(String string) throws InterruptedException { - currentOutput = inputBuffer.getLength() + string.length() + 1; - write(string); - waitFor(prompt); - } - - /** - * disconnects from telnet - */ - public void disconnect() { - try { - try { - inputBuffer.stopNow(); - } finally { - telnet.disconnect(); - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - public static void main(String[] args) { - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); - System.out.println("Enter host name or ip address (#.#.#.#))"); - String host = reader.readLine(); - System.out.println("Enter port"); - String string = reader.readLine(); - if (string == null) { - return; - } - int port = Integer.parseInt(string); - TelnetShell shell = new TelnetShell(host, port, false); - Piper piper = new Piper(shell.in, System.out); - piper.start(); - try { - boolean done = false; - while (!done) { - String in = reader.readLine(); - if (in.equals("quit")) { - done = true; - } else { - shell.write(in); - } - } - shell.disconnect(); - } finally { - piper.interrupt(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void setPrompt(String prompt) { - this.prompt = prompt; - } - - public String getBuffer() { - return inputBuffer.getBuffer(); - } - - public String getCurrentBuffer() { - try { - inputBuffer.waitFor(MAX_RESPONSE_TIME); - } catch (InterruptedException e) { - OseeLog.log(TestEnvironment.class, Level.SEVERE, e.getMessage(), e); - } - return inputBuffer.subString(currentOutput); - } - - public InputStream getInputStream() { - return in; - } - - public TelnetClient getTelnet() { - return telnet; - } - - public void clearBuffer() { - inputBuffer.clear(); - } - - @Override - public void receivedNegotiation(int negotiationCode, int option) { - final String negotiationCodeStr; - switch (negotiationCode) { - case TelnetNotificationHandler.RECEIVED_DO: - negotiationCodeStr = "DO"; - break; - case TelnetNotificationHandler.RECEIVED_DONT: - negotiationCodeStr = "DONT"; - break; - case TelnetNotificationHandler.RECEIVED_WILL: - negotiationCodeStr = "WILL"; - break; - case TelnetNotificationHandler.RECEIVED_WONT: - negotiationCodeStr = "WONT"; - break; - default: - throw new Error("unhandled negotiation code of " + negotiationCode); - } - System.out.printf("Negotiation recieved: %s for option %s\n", negotiationCodeStr, TelnetOption.getOption(option)); - } - - public void printOptionStates() { - for (int i = 0; i < TelnetOption.MAX_OPTION_VALUE; i++) { - String str = TelnetOption.getOption(i); - if (!str.equals("UNASSIGNED")) { - boolean local = telnet.getLocalOptionState(i); - boolean remote = telnet.getRemoteOptionState(i); - if (local || remote) { - System.out.printf("%s (%02d): local %b, remote %b\n", TelnetOption.getOption(i), i, local, remote); - } - } - } - } - - private byte[] getNewline() throws UnsupportedEncodingException { - return "\n".getBytes("US-ASCII"); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/tags/BaseTestTags.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/tags/BaseTestTags.java deleted file mode 100644 index 00467c335d9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/tags/BaseTestTags.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.test.tags; - -/** - * @author Roberto E. Escobar - */ -public abstract interface BaseTestTags { - public static final String TEST_SCRIPT = "TestScript"; - - public static final String NAME_FIELD = "Name"; - public static final String NUMBER_FIELD = "Number"; - public static final String LOCATION_FIELD = "Location"; - public static final String SCRIPT_SOURCE_FIELD = "ScriptSource"; - public static final String SCRIPT_LINE_FIELD = "ScriptLine"; - public static final String FAILURE_TYPE = "FailureType"; - - public static final String DESCRIPTION_FIELD = "Description"; - public static final String MESSAGE_FIELD = "Message"; - public static final String DETAILS_FIELD = "Details"; - public static final String ITEMS_FIELD = "Item"; - public static final String TIME_FIELD = "Time"; - - public static final String PURPOSE_FIELD = "Purpose"; - public static final String PRECONDITION_FIELD = "PreCondition"; - public static final String POSTCONDITION_FIELD = "PostCondition"; - - public static final String CONFIG_ENTRY = "Config"; - public static final String SCRIPT_NAME = "ScriptName"; - public static final String SCRIPT_VERSION = "ScriptVersion"; - public static final String EXECUTED_BY = "ExecutedBy"; - public static final String EXECUTION_DATE = "ExecutionDate"; - public static final String ENVIRONMENT_FIELD = "Environment"; - public static final String CLEAR_TOOL_VIEW = "ClearToolView"; - - public static final String NATIVE_ENVIRONMENT = "NativeEnvironment"; - public static final String ENVIRONMENT_VARIABLE = "EnvironmentVariable"; - public static final String OSEE_ENVIRONMENT_PREFIX = "OSEEKEY_"; - public static final String PATH_FIELD = "Path"; - - public static final String SCRIPT_TIME_FIELD = "ScriptResult"; - public static final String ELAPSED_TIME_FIELD = "ElapsedTime"; - - public static final String EXECUTION_STATUS = "ExecutionStatus"; - public static final String EXECUTION_RESULT = "ExecutionResult"; - public static final String EXECUTION_SUCCESS = "SUCCESS"; - public static final String EXECUTION_ABORTED = "ABORTED"; - public static final String EXECUTION_DETAILS = "ExecutionDetails"; - public static final String TARGET_ENVIRONMENT = "TargetEnvironment"; - - public static final String SECTION_BREAK = "----------------------------------------------------------------"; - - public static final String BEMS_FIELD = "BEMS"; - public static final String EMAIL_FIELD = "Email"; - - public static final String REPOSITORY_TYPE = "repositoryType"; - - public static final String MODIFIED_FIELD = "modifiedFlag"; - public static final String REVISION_FIELD = "revision"; - public static final String LAST_AUTHOR_FIELD = "lastAuthor"; - public static final String LAST_MODIFIED = "lastModified"; - public static final String URL = "url"; - - public static final String UNDEFINED_ENVIRONMENT = "Undefined"; - - public static final String Traceability = "Traceability"; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/tags/FunctionalTestTags.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/tags/FunctionalTestTags.java deleted file mode 100644 index f5c8e911454..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/test/tags/FunctionalTestTags.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.test.tags; - -/** - * @author Roberto E. Escobar - */ -public abstract interface FunctionalTestTags extends BaseTestTags { - public static final String FUNCTIONAL_TEST_SCRIPT = "FunctionalTestScript"; - public static final String FUNCTIONAL_TEST_CASE = "FunctionalTestCase"; - public static final String FUNCTIONAL_TEST_POINT = "FunctionalTestPoint"; - public static final String FUNCTIONAL_UNIT_EXECUTION = "FunctionalUnitExecution"; - public static final String FUNCTIONAL_UNIT_HEADER = "FunctionalUnitHeader"; - - public static final String EXECUTABLE_FIELD = "Executable"; - public static final String OPTIONS_FIELD = "Options"; - public static final String GUID_FIELD = "Guid"; - - public static final String FUNCTIONAL_TEST_POINT_RESULT = "Result"; - public static final String RESULT_PASSED = "PASSED"; - public static final String RESULT_FAILED = "FAILED"; - public static final String RESULT_NOT_RUN = "NOT RUN"; - public static final String RESULT_MANUAL = "MANUAL"; - - public static final String MESSAGE_CHECK = "MessageCheck"; - public static final String VALUE_FIELD = "Value"; - public static final String ACTION_CMD = "ActionCmd"; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/CheckGroup.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/CheckGroup.java deleted file mode 100644 index dee71128eb9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/CheckGroup.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.testPoint; - -import java.util.ArrayList; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.eclipse.osee.ote.core.environment.interfaces.ITestGroup; -import org.eclipse.osee.ote.core.environment.interfaces.ITestPoint; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Robert A. Fisher - * @author Charles Shaw - */ -public class CheckGroup implements ITestGroup { - private final String groupName; - private final ArrayList<ITestPoint> testPoints; - private final Operation operation; - - /** - * CheckGroup objects are used to setup complex TestPoint structures where the pass/fail behavior can be an <b>And - * </b>'ing or an <b>Or </b>'ing of the <b>getPass() </b> values of all the immediate children. - * <p> - * More complex TestPoint syntax can be obtained using the CheckGroup as a parent of other CheckGroup objects, of - * which the <b>And </b> or <b>Or </b> setting can be set differently. - * - * @param operation The logical operation used for combining items within this CheckGroup. - */ - public CheckGroup(Operation operation, String groupName) { - super(); - testPoints = new ArrayList<>(); - // this.allTrue = allTrue; - this.operation = operation; - this.groupName = groupName; - } - - public CheckGroup add(ITestPoint testPoint) { - this.testPoints.add(testPoint); - - return this; - } - - @JsonProperty - @Override - public ArrayList<ITestPoint> getTestPoints() { - return testPoints; - } - - @JsonProperty - public Operation getOperation() { - return operation; - } - - @JsonProperty - public String getGroupName() { - return groupName; - } - - /** - * @return The number of test points added to this check group so far - */ - @Override - public int size() { - return this.testPoints.size(); - } - - @Override - public boolean isPass() { - boolean passFail; - - // Ensure that some points have been added - if (testPoints.size() > 0) { - // If this group is using AND logic then assume pass until find a - // fail - // if (allTrue) { - if (operation == Operation.AND) { - passFail = true; - // Else the group is using OR logic, so assume fail until find a - // pass - } else { - passFail = false; - } - - for (ITestPoint testPoint : testPoints) { - if (operation == Operation.AND) { - passFail &= testPoint.isPass(); - } else { - passFail |= testPoint.isPass(); - } - } - } else { - passFail = false; - } - return passFail; - } - - @Override - public Element toXml(Document doc) { - return buildXml(doc, "CheckGroup"); - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - buildXml(writer, "CheckGroup"); - writer.writeEndElement(); - } - - protected Element buildXml(Document doc, String name) { - Element checkGroupElement = doc.createElement(name); - - checkGroupElement.setAttribute("Mode", operation.toString()); - checkGroupElement.appendChild(Jaxp.createElement(doc, "GroupName", groupName)); - - if (this.isPass()) { - checkGroupElement.appendChild(Jaxp.createElement(doc, "Result", "PASSED")); - } else { - checkGroupElement.appendChild(Jaxp.createElement(doc, "Result", "FAILED")); - } - - for (ITestPoint testPoint : testPoints) { - checkGroupElement.appendChild(testPoint.toXml(doc)); - } - - return checkGroupElement; - } - - protected void buildXml(XMLStreamWriter writer, String name) throws XMLStreamException { - writer.writeStartElement(name); - writer.writeAttribute("Mode", operation.toString()); - XMLStreamWriterUtil.writeElement(writer, "GroupName", groupName); - if (this.isPass()) { - XMLStreamWriterUtil.writeElement(writer, "Result", "PASSED"); - } else { - XMLStreamWriterUtil.writeElement(writer, "Result", "FAILED"); - } - - for (ITestPoint testPoint : testPoints) { - testPoint.toXml(writer); - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/CheckPoint.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/CheckPoint.java deleted file mode 100644 index 4ca63cbea67..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/CheckPoint.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.testPoint; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.eclipse.osee.ote.core.XmlSupport; -import org.eclipse.osee.ote.core.environment.interfaces.ITestPoint; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Robert A. Fisher - */ -public class CheckPoint implements ITestPoint { - private final String testPointName; - private String expected; - private final String actual; - private final boolean pass; - private final long elpasedTime; - private final int numTransmissions; - - /** - * CheckPoint objects are used for describing the result of a check and can - * be logged directly to a the logger as a testPoint or can be added to a - * CheckGroup if it is just a part of a larger series of checks being - * performed that all constitute one overall check. - * - * @param testPointName - * The item being tested. (i.e. TSD Button). - * @param expected - * The expected condition for a pass point. - * @param actual - * The actual condition during the check. - * @param pass - * The result of the check. - * @param elapsedTime - * The amount of time elapsed in milliseconds - */ - public CheckPoint(String testPointName, String expected, String actual, boolean pass, long elapsedTime) { - this(testPointName, expected, actual, pass, 0, elapsedTime); - } - - public CheckPoint(String testPointName, String expected, String actual, boolean pass, int numTransmissions, long elapsedTime) { - this.testPointName = testPointName; - this.expected = expected.equals("") ? " " : XmlSupport.convertNonPrintableCharacers(expected); - this.actual = actual.equals("") ? " " : XmlSupport.convertNonPrintableCharacers(actual); - this.pass = pass; - this.elpasedTime = elapsedTime; - this.numTransmissions = numTransmissions; - } - - public CheckPoint(String testPointName, Object expected, Object actual, boolean pass, long elapsedTime) { - this(testPointName, expected.toString(), actual.toString(), pass, elapsedTime); - } - - public CheckPoint(String testPointName, Object expected, Object actual, boolean pass) { - this(testPointName, expected.toString(), actual.toString(), pass, 0); - } - - public CheckPoint(String testPointName, String expected, String actual, boolean pass) { - this(testPointName, expected, actual, pass, 0); - } - - public CheckPoint(String testPointName, boolean expected, boolean actual) { - this(testPointName, expected, actual, expected == actual, 0); - } - - /** - * @return Returns the actual. - */ - @JsonProperty - public String getActual() { - return actual; - } - - /** - * @return Returns the expected. - */ - @JsonProperty - public String getExpected() { - return expected; - } - - /** - * @return Returns the pass. - */ - @Override - public boolean isPass() { - return pass; - } - - public void setExpected(String expected) { - this.expected = XmlSupport.convertNonPrintableCharacers(expected); - } - - @Override - public Element toXml(Document doc) { - Element checkPointElement = doc.createElement("CheckPoint"); - - checkPointElement.appendChild(Jaxp.createElement(doc, "TestPointName", testPointName)); - checkPointElement.appendChild(Jaxp.createElement(doc, "Expected", expected)); - checkPointElement.appendChild(Jaxp.createElement(doc, "Actual", actual)); - checkPointElement.appendChild(Jaxp.createElement(doc, "Result", pass ? "PASSED" : "FAILED")); - checkPointElement.appendChild(Jaxp.createElement(doc, "ElapsedTime", Long.toString(this.elpasedTime))); - checkPointElement.appendChild(Jaxp.createElement(doc, "NumberOfTransmissions", Integer.toString(this.numTransmissions))); - - return checkPointElement; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("CheckPoint"); - XMLStreamWriterUtil.writeElement(writer, "TestPointName", testPointName); - XMLStreamWriterUtil.writeElement(writer, "Expected", expected); - XMLStreamWriterUtil.writeElement(writer, "Actual", actual); - XMLStreamWriterUtil.writeElement(writer, "Result", pass ? "PASSED" : "FAILED"); - XMLStreamWriterUtil.writeElement(writer, "ElapsedTime", Long.toString(this.elpasedTime)); - XMLStreamWriterUtil.writeElement(writer, "NumberOfTransmissions", Integer.toString(this.numTransmissions)); - writer.writeEndElement(); - } - - @JsonProperty - public String getTestPointName() { - return testPointName; - } - - /** - * @return the elpasedTime - */ - @JsonProperty - public long getElpasedTime() { - return elpasedTime; - } - - /** - * @return the numTransmissions - */ - @JsonProperty - public int getNumTransmissions() { - return numTransmissions; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/Operation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/Operation.java deleted file mode 100644 index 50e21fff9c2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/Operation.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.testPoint; - -import javax.print.attribute.EnumSyntax; -import org.codehaus.jackson.annotate.JsonCreator; -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.util.EnumBase; - -public class Operation extends EnumBase { - - private static final long serialVersionUID = -3132727420541603024L; - public static final Operation OR = new Operation(0); - public static final Operation AND = new Operation(1); - - private static final String[] stringTable = new String[] {"OR", "AND"}; - private static final Operation[] enumValueTable = new Operation[] {OR, AND}; - - private Operation(int value) { - super(value); - } - - @JsonCreator - public static Operation toEnum(String str) { - return (Operation) getEnum(str, stringTable, enumValueTable); - } - - protected static Operation toEnum(int value) { - return (Operation) getEnum(value, enumValueTable); - } - - @Override - protected String[] getStringTable() { - return stringTable; - } - - @Override - protected EnumSyntax[] getEnumValueTable() { - return enumValueTable; - } - - @Override - @JsonProperty - public String getName() { - return super.getName(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/RetryGroup.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/RetryGroup.java deleted file mode 100644 index afba89e8a02..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/testPoint/RetryGroup.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.core.testPoint; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Robert A. Fisher - */ -public class RetryGroup extends CheckGroup { - ArrayList<Xmlizable> childElements; - @JsonProperty("ChildRecords") - ArrayList<XmlizableStream> childStreamElements; - - public RetryGroup(String groupName) { - super(Operation.OR, groupName); - childElements = new ArrayList<>(); - childStreamElements = new ArrayList<>(); - } - - @Override - public Element toXml(Document doc) { - Element retVal = buildXml(doc, "RetryGroup"); - - for (Xmlizable object : childElements) { - retVal.appendChild(object.toXml(doc)); - } - return retVal; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - buildXml(writer, "RetryGroup"); - for (XmlizableStream object : childStreamElements) { - object.toXml(writer); - } - writer.writeEndElement(); - } - - public void addChildElement(XmlizableStream child) { - childStreamElements.add(child); - } - - public void addChildren(List<XmlizableStream> children) { - childStreamElements.addAll(children); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/AddressBuffer.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/AddressBuffer.java deleted file mode 100644 index 7ea00ea2206..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/AddressBuffer.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.net.InetSocketAddress; -import java.nio.ByteBuffer; - -public class AddressBuffer { - - private final ByteBuffer buffer; - private InetSocketAddress address; - - public AddressBuffer(){ - buffer = ByteBuffer.allocate(131072); - } - - public ByteBuffer getBuffer(){ - return buffer; - } - - public InetSocketAddress getAddress(){ - return address; - } - - public void setAddress(InetSocketAddress address){ - this.address = address; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/EndpointDataProcessor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/EndpointDataProcessor.java deleted file mode 100644 index a0b8ed3b562..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/EndpointDataProcessor.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.nio.ByteBuffer; - -public interface EndpointDataProcessor { - - int getTypeId(); - - void processBuffer(ByteBuffer buffer); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointReceiveRunnable.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointReceiveRunnable.java deleted file mode 100644 index e99568e0b25..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointReceiveRunnable.java +++ /dev/null @@ -1,149 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.io.IOException; -import java.io.InterruptedIOException; -import java.net.BindException; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.nio.ByteBuffer; -import java.nio.channels.ClosedByInterruptException; -import java.nio.channels.DatagramChannel; -import java.util.Date; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.OTEException; -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageHeader; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; - -public class OteEndpointReceiveRunnable implements Runnable { - - private static final int DATA_SIZE = 65536; - private static final int UDP_TIMEOUT = 240000; // 4 MINUTES - private static final int ONE_MEG = 1024 * 1024; - - private volatile boolean run = true; - private volatile boolean debugOutput = false; - private Class<OteEndpointReceiveRunnable> logger = OteEndpointReceiveRunnable.class; - private final InetSocketAddress address; - - private CopyOnWriteArrayList<EndpointDataProcessor> dataProcessors = new CopyOnWriteArrayList<>(); - - public OteEndpointReceiveRunnable(InetSocketAddress address) { - this.address = address; - } - - public void stop() { - run = false; - } - - @Override - public void run() { - ByteBuffer buffer = ByteBuffer.allocate(DATA_SIZE); - DatagramChannel channel = null; - try { - while (run) { - try { - channel = DatagramChannel.open(); - channel.socket().setReuseAddress(true); - channel.socket().bind(address); - channel.socket().setSoTimeout(UDP_TIMEOUT); - channel.socket().setReceiveBufferSize(ONE_MEG); - channel.configureBlocking(true); - - while (run) { - try { - buffer.clear(); - channel.receive(buffer); - buffer.flip(); - processBuffer(buffer); - } catch (ClosedByInterruptException ex) { - stop(); - } catch (Throwable th) { - th.printStackTrace(); - } - } - } catch (BindException ex) { - if (debugOutput) { - OseeLog.log(logger, Level.FINEST, ex); - } - if (channel != null) { - channel.close(); - } - - Thread.sleep(1000); - } - } - } catch (InterruptedIOException ex) { - Thread.interrupted(); - if (run && debugOutput) { - OseeLog.log(logger, Level.WARNING, "Unexpected interruption", ex); - } - } catch (ClosedByInterruptException ie) { - Thread.interrupted(); - if (run && debugOutput) { - OseeLog.log(logger, Level.WARNING, "Unexpected interruption", ie); - } - } catch (Throwable t) { - throw new OTEException(t); - } finally { - try { - if (channel != null) { - channel.close(); - } - } catch (IOException ex) { - if (debugOutput) { - ex.printStackTrace(); - } - } - } - } - - private void processBuffer(ByteBuffer buffer) { - int typeId = buffer.getShort(0) & 0xFFFF; - if (typeId == OteEventMessageHeader.MARKER_VALUE) { - byte[] data = new byte[buffer.remaining()]; - buffer.get(data); - OteEventMessage msg = new OteEventMessage((byte[]) data); - msg.getHeader().TTL.setNoLog(1); - if (debugOutput) { - try { - System.out.printf("[%s] received: [%s][%d] from [%s:%d]\n", new Date(), msg.getHeader().TOPIC.getValue(), - msg.getData().length, msg.getHeader().ADDRESS.getAddress().getHostAddress(), - msg.getHeader().ADDRESS.getPort()); - } catch (UnknownHostException e) { - e.printStackTrace(); - } - } - OteEventMessageUtil.postEvent(msg); - } else { - for (EndpointDataProcessor processor : dataProcessors) { - if (processor.getTypeId() == typeId) { - try { - processor.processBuffer(buffer); - } catch (Throwable th) { - th.printStackTrace(); - } - } - } - } - } - - public void setDebugOutput(boolean enable) { - debugOutput = enable; - } - - public InetSocketAddress getAddress() { - return address; - } - - public void addDataProcessor(EndpointDataProcessor processor) { - dataProcessors.add(processor); - } - - public void removeDataProcessor(EndpointDataProcessor processor) { - dataProcessors.remove(processor); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointSendRunnable.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointSendRunnable.java deleted file mode 100644 index e3a9260c40c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointSendRunnable.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.io.IOException; -import java.nio.channels.AsynchronousCloseException; -import java.nio.channels.ClosedByInterruptException; -import java.nio.channels.ClosedChannelException; -import java.nio.channels.DatagramChannel; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.collections.ObjectPool; - -final class OteEndpointSendRunnable implements Runnable { - - private static final int SEND_BUFFER_SIZE = 1024 * 512; - - private final ArrayBlockingQueue<AddressBuffer> toSend; - private final ObjectPool<AddressBuffer> buffers; - - private boolean debug = false; - - OteEndpointSendRunnable(ArrayBlockingQueue<AddressBuffer> toSend, ObjectPool<AddressBuffer> buffers, boolean debug) { - this.toSend = toSend; - this.buffers = buffers; - this.debug = debug; - } - - @Override - public void run() { - DatagramChannel threadChannel = null; - try { - threadChannel = openAndInitializeDatagramChannel(); - boolean keepRunning = true; - final List<AddressBuffer> dataToSend = new ArrayList<>(32); - System.setSecurityManager(null); - while(keepRunning){ - try{ - dataToSend.clear(); - if (toSend.drainTo(dataToSend) < 1) { - try { - // block until something is available - AddressBuffer addrBuf = toSend.poll(15, TimeUnit.SECONDS); - if (addrBuf == null) { - // no activity for a while so lets clean ourselves up. Our master will restart - // a new thread if another event comes along after we self terminate - keepRunning = false; - } else { - dataToSend.add(addrBuf); - } - } catch (InterruptedException e) { - keepRunning = false; - continue; - } - } - int size = dataToSend.size(); - for (int i = 0; i < size; i++) { - AddressBuffer data = dataToSend.get(i); - if (data == OteUdpEndpointSender.POISON_PILL) { - keepRunning = false; - break; - } - threadChannel.send(data.getBuffer(), data.getAddress()); - } - } catch (ClosedByInterruptException ex){ - if(debug){ - OseeLog.log(getClass(), Level.SEVERE, "Error trying to send data", ex); - } - threadChannel = openAndInitializeDatagramChannel(); - } catch (AsynchronousCloseException ex){ - if(debug){ - OseeLog.log(getClass(), Level.SEVERE, "Error trying to send data", ex); - } - closeChannel(threadChannel); - threadChannel = openAndInitializeDatagramChannel(); - } catch (ClosedChannelException ex){ - if(debug){ - OseeLog.log(getClass(), Level.SEVERE, "Error trying to send data", ex); - } - closeChannel(threadChannel); - threadChannel = openAndInitializeDatagramChannel(); - } catch (IOException ex){ - if(debug){ - OseeLog.log(getClass(), Level.SEVERE, "Error trying to send data", ex); - } - } finally { - int size = dataToSend.size(); - for (int i = 0; i < size; i++) { - buffers.returnObj(dataToSend.get(i)); - } - } - } - } catch (IOException ex){ - if(debug){ - OseeLog.log(getClass(), Level.SEVERE, "Error opening DatagramChannel. Ending OteEndpointSendRunnable unexpectedly.", ex); - } - } finally{ - closeChannel(threadChannel); - } - - } - - private void closeChannel(DatagramChannel channel){ - try { - if (channel != null) { - channel.close(); - } - } catch (IOException e) { - if(debug){ - OseeLog.log(getClass(), Level.SEVERE, "Error trying to close channel", e); - } - } - } - - private DatagramChannel openAndInitializeDatagramChannel() throws IOException { - DatagramChannel channel = DatagramChannel.open(); - if (channel.socket().getSendBufferSize() < SEND_BUFFER_SIZE) { - channel.socket().setSendBufferSize(SEND_BUFFER_SIZE); - } - channel.socket().setReuseAddress(true); - channel.configureBlocking(true); - return channel; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointSender.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointSender.java deleted file mode 100644 index 4a1a9e76e23..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointSender.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.net.InetSocketAddress; - -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public interface OteEndpointSender { - - void send(OteEventMessage sendMessage); - - InetSocketAddress getAddress(); - - void stop() throws InterruptedException; - - boolean isClosed(); - - void setDebug(boolean debug); - - void start(); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointUtil.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointUtil.java deleted file mode 100644 index 761a4054820..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteEndpointUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; - -import org.eclipse.osee.ote.OTEException; - -public class OteEndpointUtil { - - /** - * Get the socket address for the OTEUdpEndpoint from an encoded URI. You should catch OTEException and - * handle the case when the sting is not as expected. - * - * @param uriAddress - * @return - */ - public static InetSocketAddress getAddress(final String uriAddress) throws OTEException { - String[] addPort = null; - if(uriAddress.startsWith("tcp://")){ - String add = uriAddress.replaceFirst("tcp://", ""); - addPort = add.split(":"); - } else { - addPort = uriAddress.split(":"); - } - if(addPort != null && addPort.length == 2){ - try { - InetAddress byName = InetAddress.getByName(addPort[0]); - int port = Integer.parseInt(addPort[1]); - return new InetSocketAddress(byName, port); - } catch (UnknownHostException ex){ - throw new OTEException(String.format("Invalid address[%s]", uriAddress), ex); - } catch (NumberFormatException ex){ - throw new OTEException(String.format("Invalid address format[%s], can't determine port", uriAddress), ex); - } - } else { - throw new OTEException(String.format("Invalid address format[%s]", uriAddress)); - } - } - - public static InetSocketAddress getAddress(final String address, final int port) { - try { - InetAddress byName = InetAddress.getByName(address); - return new InetSocketAddress(byName, port); - } catch (UnknownHostException ex){ - throw new OTEException(String.format("Invalid address[%s]", address), ex); - } - } - - public static String getAddressURI(final InetSocketAddress address){ - return String.format("tcp://%s:%d", address.getAddress().getHostAddress(), address.getPort()); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpoint.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpoint.java deleted file mode 100644 index 52e2c3e30fa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpoint.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.net.InetSocketAddress; -import org.eclipse.osee.ote.core.CopyOnWriteNoIteratorList; - -public interface OteUdpEndpoint { - - public void setDebugOutput(boolean enable); - - public InetSocketAddress getLocalEndpoint(); - - public OteUdpEndpointSender getOteEndpointSender(InetSocketAddress address); - - OteUdpEndpointInlineSender getOteEndpointInlineSender(InetSocketAddress address); - - public void addBroadcast(OteUdpEndpointSender sender); - - public void removeBroadcast(OteUdpEndpointSender sender); - - public CopyOnWriteNoIteratorList<OteUdpEndpointSender> getBroadcastSenders(); - - public void addDataProcessor(EndpointDataProcessor processor); - - public void removeDataProcessor(EndpointDataProcessor processor); - - OteUdpEndpointSender getOteEndpointThreadedSender(InetSocketAddress address); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpointInlineSender.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpointInlineSender.java deleted file mode 100644 index aace55267af..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpointInlineSender.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.nio.ByteBuffer; -import java.nio.channels.DatagramChannel; -import org.eclipse.osee.ote.OTEException; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -/** - * Launches a Thread that monitors a queue for data to send to specified UDP endpoints. - * - * @author b1528444 - */ -public class OteUdpEndpointInlineSender implements OteEndpointSender { - private static final int SEND_BUFFER_SIZE = 1024 * 512; - - private final InetSocketAddress address; - - public OteUdpEndpointInlineSender(InetSocketAddress address) { - this.address = address; - } - - @Override - public InetSocketAddress getAddress() { - return address; - } - - @Override - public void send(OteEventMessage message) { - - try { - DatagramChannel channel = DatagramChannel.open(); - if (channel.socket().getSendBufferSize() < SEND_BUFFER_SIZE) { - channel.socket().setSendBufferSize(SEND_BUFFER_SIZE); - } - channel.socket().setReuseAddress(true); - channel.configureBlocking(true); - - ByteBuffer buffer = ByteBuffer.allocate(SEND_BUFFER_SIZE); - - buffer.put(message.getData()); - buffer.flip(); - channel.send(buffer, address); - } catch (IOException e) { - throw new OTEException(e); - } - } - - @Override - public void stop() { - //not needed - } - - @Override - public boolean isClosed() { - return false; - } - - @Override - public void setDebug(boolean debug) { - //not needed - } - - @Override - public void start() { - //not needed - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpointReceiverImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpointReceiverImpl.java deleted file mode 100644 index 69748576257..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpointReceiverImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.net.InetSocketAddress; - -public class OteUdpEndpointReceiverImpl { - - private OteEndpointReceiveRunnable oteEndpointReceiveRunnable; - private Thread th; - - public OteUdpEndpointReceiverImpl(InetSocketAddress address){ - oteEndpointReceiveRunnable = new OteEndpointReceiveRunnable(address); - } - - public void start(){ - th = new Thread(oteEndpointReceiveRunnable); - th.setName("OTE UDP Endpoint Receiver"); - th.setDaemon(true); - th.start(); - } - - public void stop(){ - oteEndpointReceiveRunnable.stop(); - th.interrupt(); - } - - public void setDebugOutput(boolean enable){ - oteEndpointReceiveRunnable.setDebugOutput(enable); - } - - public InetSocketAddress getEndpoint(){ - return oteEndpointReceiveRunnable.getAddress(); - } - - public void addDataProcessor(EndpointDataProcessor processor) { - oteEndpointReceiveRunnable.addDataProcessor(processor); - } - - public void removeDataProcessor(EndpointDataProcessor processor) { - oteEndpointReceiveRunnable.removeDataProcessor(processor); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpointSender.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpointSender.java deleted file mode 100644 index 3ae2f4e789d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/endpoint/OteUdpEndpointSender.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.eclipse.osee.ote.endpoint; - -import java.net.InetSocketAddress; -import java.util.Date; -import java.util.concurrent.ArrayBlockingQueue; - -import org.eclipse.osee.ote.OTEException; -import org.eclipse.osee.ote.collections.ObjectPool; -import org.eclipse.osee.ote.collections.ObjectPoolConfiguration; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -/** - * Launches a Thread that monitors a queue for data to send to specified UDP endpoints. - * - * @author b1528444 - * - */ -public class OteUdpEndpointSender implements OteEndpointSender { - - static final AddressBuffer POISON_PILL = new AddressBuffer(); - - private final ObjectPool<AddressBuffer> buffers; - private final ArrayBlockingQueue<AddressBuffer> toSend; - - private final InetSocketAddress address; - - private boolean debug = false; - - private volatile boolean isClosed = false; - - private volatile Thread thread; - - public OteUdpEndpointSender(InetSocketAddress address){ - toSend = new ArrayBlockingQueue<>(5000); - buffers = new ObjectPool<AddressBuffer>(new ObjectPoolConfiguration<AddressBuffer>(50,true) { - @Override - public AddressBuffer make() { - return new AddressBuffer(); - } - }); - this.address = address; - } - - @Override - public void start(){ - thread = new Thread(new OteEndpointSendRunnable(toSend, buffers, debug)); - thread.setName(String.format("OTE Endpoint Sender[%s]", address.toString())); - thread.setDaemon(true); - thread.start(); - } - - @Override - public void stop() throws InterruptedException{ - toSend.put(POISON_PILL); - isClosed = true; - } - - @Override - public InetSocketAddress getAddress(){ - return address; - } - - @Override - public void send(OteEventMessage message) { - if(debug){ - System.out.printf("[%s] sending: [%s] to [%s] [%d]\n", new Date(), message.getHeader().TOPIC.getValue(), address.toString(), message.getData().length); - } - AddressBuffer obj = buffers.getObject(); - obj.getBuffer().clear(); - obj.getBuffer().put(message.getData()); - obj.getBuffer().flip(); - obj.setAddress(address); - try { - toSend.put(obj); - } catch (InterruptedException e) { - throw new OTEException(e); - } - - if (!thread.isAlive()) { - // our thread has sat idle for too long and self terminated go ahead and start a new one - start(); - } - } - - @Override - public boolean isClosed() { - return isClosed; - } - - @Override - public void setDebug(boolean debug){ - this.debug = debug; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/filetransfer/TcpFileTransfer.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/filetransfer/TcpFileTransfer.java deleted file mode 100644 index deb6a41bf8e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/filetransfer/TcpFileTransfer.java +++ /dev/null @@ -1,282 +0,0 @@ -package org.eclipse.osee.ote.filetransfer; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.SocketTimeoutException; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; - -public class TcpFileTransfer { - - - - private static final int SECRET_CODE = 0xF17E; - private static final int BLOCK_SIZE = 64*1024; - - public static TcpFileTransferHandle sendFile(ExecutorService service, final File file, final InetSocketAddress address) throws IOException{ - if (!file.exists()) { - throw new IllegalArgumentException("Invalid file specified: " + file.getAbsolutePath()); - } - final TransferProgressMonitor monitor = new TransferProgressMonitor(); - monitor.updateTransferStartTime(System.currentTimeMillis()); - final SocketChannel sendChannel = SocketChannel.open(address); - - final TcpFileTransfer fileTransfer = new TcpFileTransfer(Direction.FILE_TO_CHANNEL, file); - Callable<Boolean> c = new Callable<Boolean>() { - - @Override - public Boolean call() throws Exception { - fileTransfer.openSender(monitor, sendChannel); - monitor.updateTransferCompleteTime(System.currentTimeMillis()); - return true; - } - }; - InetSocketAddress localAddress = (InetSocketAddress) sendChannel.socket().getLocalSocketAddress(); - return new TcpFileTransferHandle(monitor, localAddress, service.submit(c)); - } - - - /** - * - * @param service - * @param file - * @param port - * @return the transfer handle or null if the file to be written to is in use by another process - * @throws IOException - */ - public static TcpFileTransferHandle receiveFile(ExecutorService service, final File file, int port) throws IOException{ - if (service == null) { - throw new NullPointerException("Service cannot be null"); - } - - final TcpFileTransfer fileTransfer; - try { - fileTransfer = new TcpFileTransfer(Direction.CHANNEL_TO_FILE, file); - } catch (FileNotFoundException e) { - // most likely due to file being used by another process - return null; - } - final TransferProgressMonitor monitor = new TransferProgressMonitor(); - monitor.updateTransferStartTime(System.currentTimeMillis()); - - final ServerSocketChannel channel = ServerSocketChannel.open(); - channel.configureBlocking(false); - channel.socket().bind(new InetSocketAddress(InetAddress.getLocalHost(), port)); - InetSocketAddress localAddress = (InetSocketAddress) channel.socket().getLocalSocketAddress(); - - Callable<Boolean> c = new Callable<Boolean>() { - - @Override - public Boolean call() throws Exception { - fileTransfer.openReceiver(monitor, channel); - monitor.updateTransferCompleteTime(System.currentTimeMillis()); - - return true; - - } - }; - return new TcpFileTransferHandle(monitor, localAddress, service.submit(c)); - } - - private static enum Direction { - FILE_TO_CHANNEL { - - @Override - long transfer(FileChannel fileChannel, SocketChannel byteChannel, long position, long count) throws IOException{ - return fileChannel.transferTo(position, count, byteChannel); - } - - @Override - FileChannel createChannel(File file) throws IOException{ - return new FileInputStream(file).getChannel(); - } - - }, - CHANNEL_TO_FILE { - - @Override - long transfer(FileChannel fileChannel, SocketChannel byteChannel, long position, long count) throws IOException{ - return fileChannel.transferFrom(byteChannel, position, count); - } - - @Override - FileChannel createChannel(File file) throws IOException { - FileChannel channel = new FileOutputStream(file).getChannel(); - channel.lock(); - return channel; - } - - - }; - - abstract long transfer(FileChannel fileChannel, SocketChannel byteChannel, long position, long count) throws IOException; - abstract FileChannel createChannel(File file) throws IOException; - } - - private final Direction direction; - private final File file; - - private TcpFileTransfer(Direction direction, File file) throws FileNotFoundException, IOException{ - this.direction = direction; - this.file = file; - } - - - private void openSender(TransferProgressMonitor monitor, SocketChannel sendChannel) throws IOException{ - try { - Selector selector = Selector.open(); - try { - sendChannel.configureBlocking(false); - sendChannel.register(selector, SelectionKey.OP_WRITE); - final File[] files; - if (file.isDirectory()) { - files = file.listFiles(); - } else { - files = new File[]{file}; - } - int fileCounter = 1; - ByteBuffer buffer = ByteBuffer.allocate(1024); - for (File targetFile : files) { - long size = targetFile.length(); - monitor.updateTotalTransferAmount(size); - buffer.clear(); - buffer.putInt(SECRET_CODE); - buffer.putInt(files.length); - buffer.putInt(fileCounter++); - String name = targetFile.getName(); - buffer.putInt(name.length()); - buffer.put(name.getBytes()); - buffer.putLong(size); - buffer.flip(); - sendChannel.write(buffer); - transfer(monitor, sendChannel, selector, size, targetFile); - buffer.clear(); - sendChannel.keyFor(selector).interestOps(SelectionKey.OP_READ); - waitForData(selector, sendChannel, buffer); - sendChannel.keyFor(selector).interestOps(SelectionKey.OP_WRITE); - } - } finally { - selector.close(); - } - } finally { - sendChannel.close(); - } - } - - private void openReceiver(TransferProgressMonitor monitor, ServerSocketChannel serverChannel) throws IOException{ - try { - Selector selector = Selector.open(); - try { - serverChannel.register(selector, SelectionKey.OP_ACCEPT); - // only way to timeout on accept with channels is to use a selector. - // ServerSocketChannel does not honor the socket.setSoTimeout() value - if (selector.select(10000) < 1) { - throw new SocketTimeoutException(); - } - selector.selectedKeys().clear(); - serverChannel.keyFor(selector).cancel(); - - SocketChannel receiveChannel = serverChannel.accept(); - receiveChannel.configureBlocking(false); - receiveChannel.register(selector, SelectionKey.OP_READ); - - // now we need to handle timeouts for the data channel - try { - boolean done = false; - ByteBuffer buffer = ByteBuffer.allocate(1024); - byte[] fileNameBytes = new byte[2048]; - while (!done) { - buffer.clear(); - // we only want to read the next 12 bytes, anything more than 12 is the file data - // and we want that left in the channel to be consumed later - buffer.limit(16); - - waitForData(selector, receiveChannel, buffer); - - buffer.flip(); - int code = buffer.getInt(); - if (code != SECRET_CODE) { - throw new IOException("Unexpected data during transfer negotiation"); - } - int fileCount = buffer.getInt(); - int currentFile = buffer.getInt(); - monitor.updateNumberOfFiles(fileCount); - int fileNameLength = buffer.getInt(); - buffer.clear(); - buffer.limit(fileNameLength + 8); - waitForData(selector, receiveChannel, buffer); - buffer.flip(); - buffer.get(fileNameBytes, 0, fileNameLength); - long fileSize = buffer.getLong(); - monitor.updateTotalTransferAmount(fileSize); - File targetFile = file.isDirectory() ? new File(file, new String(fileNameBytes, 0, fileNameLength)) : file; - transfer(monitor, receiveChannel, selector, fileSize, targetFile); - buffer.clear(); - buffer.putInt(0xF0F0); - buffer.flip(); - receiveChannel.write(buffer); - done = currentFile == fileCount; - - } - } finally { - receiveChannel.close(); - } - } finally { - selector.close(); - } - } finally { - serverChannel.close(); - } - } - - private static void waitForData(Selector selector, SocketChannel channel, ByteBuffer buffer) throws SocketTimeoutException, IOException{ - if (selector.select(10000) < 1) { - throw new SocketTimeoutException(); - } - selector.selectedKeys().clear(); - channel.read(buffer); - } - - - private static void waitForChannel(Selector selector) throws SocketTimeoutException, IOException{ - selector.select(10000); - Set<SelectionKey> set = selector.selectedKeys(); - if (set.size() == 0) { - throw new SocketTimeoutException(); - } - set.clear(); - } - - private void transfer(TransferProgressMonitor monitor, SocketChannel channel, Selector selector, long totalTransferAmount, File targetFile) throws IOException { - // we need a selector to deal with time outs - FileChannel fileChannel = direction.createChannel(targetFile); - try { - long position = 0; - while (position < totalTransferAmount) { - waitForChannel(selector); - long count = direction.transfer(fileChannel, channel, position, Math.min(BLOCK_SIZE, totalTransferAmount - position)); - if (count < 0) { - channel.keyFor(selector).cancel(); - continue; - } - position += count; - monitor.updateAmountTransferred(position); - } - } finally { - fileChannel.close(); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/filetransfer/TcpFileTransferHandle.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/filetransfer/TcpFileTransferHandle.java deleted file mode 100644 index 3175631aa5e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/filetransfer/TcpFileTransferHandle.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.osee.ote.filetransfer; - -import java.net.InetSocketAddress; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -public class TcpFileTransferHandle { - - private final Future<Boolean> future; - private final TransferProgressMonitor progressMonitor; - - private final InetSocketAddress localAddress; - - TcpFileTransferHandle(TransferProgressMonitor progressMonitor, InetSocketAddress localAddress, - Future<Boolean> future) { - super(); - this.progressMonitor = progressMonitor; - this.future = future; - this.localAddress = localAddress; - } - - public void cancelTransfer() { - future.cancel(true); - } - - public TransferProgressMonitor getProgressMonitor() { - return progressMonitor; - } - - - - /** - * blocks until transfer is complete. - * @return true if transfer was a success or false otherwise - * @throws ExecutionException - * @throws InterruptedException - */ - public boolean awaitCompletion() throws ExecutionException, InterruptedException { - return future.get(); - } - - /** - * returns whether or not the transfer has completed. A transfer is considered complete - * once all bytes have been sent/received or if transfer was aborted due to an error - * @return - */ - public boolean isComplete() { - return future.isDone(); - } - - public InetSocketAddress getLocalAddress() { - return localAddress; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/filetransfer/TransferProgressMonitor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/filetransfer/TransferProgressMonitor.java deleted file mode 100644 index b72102c4fda..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/filetransfer/TransferProgressMonitor.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.eclipse.osee.ote.filetransfer; - -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; - -public class TransferProgressMonitor { - - private final AtomicInteger numberOfFiles = new AtomicInteger(-1); - private final AtomicLong total = new AtomicLong(-1L); - private final AtomicLong current = new AtomicLong(0L); - private final AtomicLong transferStartTime = new AtomicLong(-1L); - private final AtomicLong transferCompleteTime = new AtomicLong(-1L); - - public long getAmountTransferred() { - return current.get(); - } - - public long getTotalTransferAmount() { - return total.get(); - } - - public long getPercentTransferred() { - return (current.get() * 100) / total.get(); - } - - void updateAmountTransferred(long amount) { - current.set(amount); - } - - void updateTotalTransferAmount(long totalAmount) { - total.set(totalAmount); - } - - void updateNumberOfFiles(int files) { - numberOfFiles.set(files); - } - - public int getNumberOfFiles() { - return numberOfFiles.get(); - } - - public long getTransferStartTime() { - return transferStartTime.get(); - } - - public long getTransferCompleteTime() { - return transferCompleteTime.get(); - } - - void updateTransferStartTime(long time) { - transferStartTime.set(time); - } - - void updateTransferCompleteTime(long time) { - transferCompleteTime.set(time); - } - - public long getTotalTransferTime() { - return getTransferCompleteTime() - getTransferStartTime(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/AddressResponseListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/AddressResponseListener.java deleted file mode 100644 index ed9e17d280c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/AddressResponseListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.net.InetSocketAddress; - -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; -import org.eclipse.osee.ote.remote.messages.GET_INET_ADDRESS_REQ; -import org.eclipse.osee.ote.remote.messages.GET_INET_ADDRESS_RESP; -import org.eclipse.osee.ote.remote.messages.SOCKET_ID; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class AddressResponseListener implements EventHandler { - - private final EventAdmin eventAdmin; - private final IRemoteMessageService messageService; - private final GET_INET_ADDRESS_RESP resp; - private final GET_INET_ADDRESS_REQ req; - - public AddressResponseListener(EventAdmin eventAdmin, IRemoteMessageService messageService) { - this.eventAdmin = eventAdmin; - this.messageService = messageService; - resp = new GET_INET_ADDRESS_RESP(); - req = new GET_INET_ADDRESS_REQ(); - } - - @Override - public void handleEvent(Event event) { - OteEventMessageUtil.putBytes(event, req); - InetSocketAddress address; - resp.getHeader().RESPONSE_ID.setValue(req.getHeader().MESSAGE_SEQUENCE_NUMBER.getValue()); - if(req.SOCKET_ID.getValue() == SOCKET_ID.MSG_UPDATES){ - address = messageService.getMsgUpdateSocketAddress(); - } else { - address = messageService.getRecorderSocketAddress(); - } - resp.SOCKET_ID.setValue(req.SOCKET_ID.getValue()); - resp.ADDRESS.setAddress(address.getAddress()); - resp.ADDRESS.setPort(address.getPort()); - OteEventMessageUtil.postEvent(resp, eventAdmin); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/Configure.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/Configure.java deleted file mode 100644 index e3e716ee2ec..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/Configure.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.util.concurrent.Callable; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.Configuration; -import org.eclipse.osee.ote.ConfigurationStatus; -import org.eclipse.osee.ote.OTEStatusCallback; -import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager; - -public class Configure implements Callable<ConfigurationStatus> { - - private final IRuntimeLibraryManager bundleLoader; - private final Configuration configuration; - private final OTEStatusCallback<ConfigurationStatus> callable; - - public Configure(IRuntimeLibraryManager bundleLoader2, Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) { - this.bundleLoader = bundleLoader2; - this.configuration = configuration; - this.callable = callable; - } - - @Override - public ConfigurationStatus call() throws Exception { - long startTime = System.currentTimeMillis(); - ConfigurationStatus status = new ConfigurationStatus(configuration, true, ""); - try{ - boolean completedUninstall = true; - callable.setTotalUnitsOfWork(determineUnitsOfWork()); - if(bundleLoader.installed()){ - completedUninstall = bundleLoader.uninstall(callable); - callable.incrememtUnitsWorked(1); - } - if(completedUninstall){ - if(bundleLoader.install(configuration, callable)){ - if(!bundleLoader.start(callable)){ - status.setFail("Bundle start failed."); - } - } else { - status.setFail("Bundle install failed."); - } - } else { - status.setFail("Failed to uninstall bundles."); - } - } finally { - callable.complete(status); - } - long elapsedTime = System.currentTimeMillis() - startTime; - OseeLog.log(getClass(), Level.INFO, String.format("Took %d ms to load and start the test environment.", elapsedTime)); - return status; - } - - private int determineUnitsOfWork() { - return (bundleLoader.installed() ? 1 : 0) + configuration.getItems().size()*2; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ConfigureAndResponseListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ConfigureAndResponseListener.java deleted file mode 100644 index 552356b0585..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ConfigureAndResponseListener.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.util.concurrent.ExecutionException; -import java.util.logging.Level; - -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.ConfigurationStatus; -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.OTEStatusCallback; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.endpoint.OteUdpEndpointSender; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.ConfigurationAndResponse; -import org.eclipse.osee.ote.remote.messages.JobStatus; -import org.eclipse.osee.ote.remote.messages.SerializedConfigurationAndResponse; -import org.eclipse.osee.ote.remote.messages.SerializedOTEJobStatus; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class ConfigureAndResponseListener implements EventHandler { - - private final OTEApi oteApi; - private final OteUdpEndpoint endpoint; - - public ConfigureAndResponseListener(EventAdmin eventAdmin, OteUdpEndpoint endpoint, OTEApi oteApi) { - this.oteApi = oteApi; - this.endpoint = endpoint; - } - - @Override - public void handleEvent(Event arg0) { - SerializedConfigurationAndResponse serialized = new SerializedConfigurationAndResponse(OteEventMessageUtil.getBytes(arg0)); - try { - ConfigurationAndResponse config = serialized.getObject(); - - OteUdpEndpointSender oteEndpointSender = endpoint.getOteEndpointSender(serialized.getHeader().getSourceInetSocketAddress()); - endpoint.addBroadcast(oteEndpointSender); - try{ - String id = (String) oteApi.getIHostTestEnvironment().getProperties().getProperty("id"); - /* - * Ensure that the id matches so that we are talking with the server we intended to talk to - */ - if(id != null && config.getId().equals(id)){ - if(config.install()){ - oteApi.loadConfiguration(config.getConfiguration(), new Status(oteEndpointSender)); - } else { - oteApi.downloadConfigurationJars(config.getConfiguration(), new Status(oteEndpointSender)); - } - } else { - handleException(new Exception("Bad server id."), oteEndpointSender); - } - } catch (ExecutionException e) { - handleException(e, oteEndpointSender); - } - }catch (Throwable e) { - handleException(e); - } - } - - private void handleException(Throwable e, OteUdpEndpointSender oteEndpointSender) { - SerializedOTEJobStatus message = new SerializedOTEJobStatus(); - JobStatus jobStatus = new JobStatus(); - StringBuilder sb = new StringBuilder(); - sb.append("error: ").append(message).append("\n").append(Lib.exceptionToString(e)).append("\n"); - jobStatus.setErrorLog(sb.toString()); - jobStatus.setSuccess(false); - jobStatus.setJobComplete(true); - try { - message.setObject(jobStatus); - oteEndpointSender.send(message); - } catch (IOException e1) { - e1.printStackTrace(); - } - } - - private void handleException(Throwable e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } - - private static class Status implements OTEStatusCallback<ConfigurationStatus> { - - private OteUdpEndpointSender oteEndpointSender; - private SerializedOTEJobStatus message; - private JobStatus jobStatus; - private StringBuilder sb; - - public Status(OteUdpEndpointSender oteEndpointSender) { - this.oteEndpointSender = oteEndpointSender; - this.message = new SerializedOTEJobStatus(); - this.jobStatus = new JobStatus(); - sb = new StringBuilder(); - } - - private void setAndSend(){ - try { - message.setObject(jobStatus); - oteEndpointSender.send(message); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Override - public void complete(ConfigurationStatus done) { - this.jobStatus.setSuccess(done.isSuccess()); - this.jobStatus.setJobComplete(true); - this.jobStatus.setErrorLog(done.getMessage()); - setAndSend(); - } - - @Override - public void setTotalUnitsOfWork(int totalUnitsOfWork) { - jobStatus.setTotalUnitsOfWork(totalUnitsOfWork); - setAndSend(); - } - - @Override - public void incrememtUnitsWorked(int count) { - jobStatus.setUnitsWorked(jobStatus.getUnitsWorked() + count); - setAndSend(); - } - - @Override - public void log(String message) { - sb.append("log: ").append(message).append("\n"); - } - - @Override - public void error(String message, Throwable th) { - sb.append("error: ").append(message).append("\n").append(Lib.exceptionToString(th)).append("\n"); - } - - @Override - public void error(String message) { - sb.append("error: ").append(message).append("\n"); - } - - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ConnectionListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ConnectionListener.java deleted file mode 100644 index b0e31bdf937..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ConnectionListener.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.rmi.RemoteException; - -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.core.ConnectionRequestResult; -import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.endpoint.OteUdpEndpointSender; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.RequestRemoteTestEnvironment; -import org.eclipse.osee.ote.remote.messages.SerializedConnectionRequestResult; -import org.eclipse.osee.ote.remote.messages.SerializedRequestRemoteTestEnvironment; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class ConnectionListener implements EventHandler { - - private OteUdpEndpoint oteEndpoint; - private OTEApi oteApi; - - public ConnectionListener(EventAdmin eventAdmin, OteUdpEndpoint oteEndpoint, OTEApi oteApi) { - this.oteEndpoint = oteEndpoint; - this.oteApi = oteApi; - } - - - @Override - public void handleEvent(Event arg0) { - SerializedRequestRemoteTestEnvironment serialized = new SerializedRequestRemoteTestEnvironment(OteEventMessageUtil.getBytes(arg0)); - RequestRemoteTestEnvironment request; - try { - request = serialized.getObject(); - IHostTestEnvironment hostTestEnvironment = oteApi.getIHostTestEnvironment(); - if(hostTestEnvironment != null){ - try { - InetSocketAddress address = serialized.getHeader().getSourceInetSocketAddress(); - ConnectionRequestResult requestEnvironment = hostTestEnvironment.requestEnvironment(request.getSession(), request.getId(), request.getConfig()); - OteUdpEndpointSender oteEndpointSender = oteEndpoint.getOteEndpointSender(address); - SerializedConnectionRequestResult serializedConnectionRequestResult = new SerializedConnectionRequestResult(requestEnvironment); - serializedConnectionRequestResult.setResponse(serialized); - oteEndpointSender.send(serializedConnectionRequestResult); - oteEndpoint.addBroadcast(oteEndpointSender); - } catch (RemoteException e) { - e.printStackTrace(); - } - } - } catch (IOException e1) { - e1.printStackTrace(); - } catch (ClassNotFoundException e1) { - e1.printStackTrace(); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DisconnectListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DisconnectListener.java deleted file mode 100644 index a184a0df13c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DisconnectListener.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; - -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.DisconnectRemoteTestEnvironment; -import org.eclipse.osee.ote.remote.messages.SerializedDisconnectRemoteTestEnvironment; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class DisconnectListener implements EventHandler { - - private OTEApi oteApi; - private OteUdpEndpoint oteEndpoint; - - public DisconnectListener(EventAdmin eventAdmin, OteUdpEndpoint oteEndpoint, OTEApi oteApi) { - this.oteApi = oteApi; - this.oteEndpoint = oteEndpoint; - } - - @Override - public void handleEvent(Event arg0) { - SerializedDisconnectRemoteTestEnvironment serializedDisconnectRemoteTestEnvironment = new SerializedDisconnectRemoteTestEnvironment(OteEventMessageUtil.getBytes(arg0)); - DisconnectRemoteTestEnvironment disconnect; - try { - disconnect = serializedDisconnectRemoteTestEnvironment.getObject(); - oteApi.getIHostTestEnvironment().disconnect(disconnect.getId()); - oteEndpoint.removeBroadcast(oteEndpoint.getOteEndpointSender(serializedDisconnectRemoteTestEnvironment.getHeader().getSourceInetSocketAddress())); - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DownloadConfiguration.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DownloadConfiguration.java deleted file mode 100644 index 5667ef90034..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/DownloadConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.util.concurrent.Callable; - -import org.eclipse.osee.ote.Configuration; -import org.eclipse.osee.ote.ConfigurationStatus; -import org.eclipse.osee.ote.OTEStatusCallback; -import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager; - -public class DownloadConfiguration implements Callable<ConfigurationStatus> { - - private final IRuntimeLibraryManager bundleLoader; - private final Configuration configuration; - private final OTEStatusCallback<ConfigurationStatus> callable; - - public DownloadConfiguration(IRuntimeLibraryManager bundleLoader2, Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) { - this.bundleLoader = bundleLoader2; - this.configuration = configuration; - this.callable = callable; - } - - @Override - public ConfigurationStatus call() throws Exception { - ConfigurationStatus status = new ConfigurationStatus(configuration, true, ""); - try{ - callable.setTotalUnitsOfWork(determineUnitsOfWork()); - if(!bundleLoader.acquireBundles(configuration, callable)){ - status.setFail("Failed to download all bundles."); - } - } finally { - callable.complete(status); - } - return status; - } - - private int determineUnitsOfWork() { - return configuration.getItems().size(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/GetPropertiesListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/GetPropertiesListener.java deleted file mode 100644 index 64aee764b8c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/GetPropertiesListener.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.rmi.RemoteException; - -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.endpoint.OteUdpEndpointInlineSender; -import org.eclipse.osee.ote.endpoint.OteUdpEndpointSender; -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.SerializedEnhancedProperties; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class GetPropertiesListener implements EventHandler { - - private final OTEApi oteApi; - private final OteUdpEndpoint endpoint; - - public GetPropertiesListener(EventAdmin eventAdmin, OteUdpEndpoint endpoint, OTEApi oteApi) { - this.oteApi = oteApi; - this.endpoint = endpoint; - } - - @Override - public void handleEvent(Event arg0) { - OteEventMessage oteEventMessage = OteEventMessageUtil.getOteEventMessage(arg0); - SerializedEnhancedProperties properties = new SerializedEnhancedProperties(); - IHostTestEnvironment host = oteApi.getIHostTestEnvironment(); - if(host != null){ - try { - properties.setResponse(oteEventMessage); - OteUdpEndpointInlineSender oteEndpointSender =endpoint.getOteEndpointInlineSender(oteEventMessage.getHeader().getSourceInetSocketAddress()); - properties.setObject(host.getProperties()); - oteEndpointSender.send(properties); - } catch (RemoteException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEApiImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEApiImpl.java deleted file mode 100644 index d38a15898f2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEApiImpl.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.util.Collections; -import java.util.Comparator; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.osee.ote.Configuration; -import org.eclipse.osee.ote.ConfigurationItem; -import org.eclipse.osee.ote.ConfigurationStatus; -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.OTEServerRuntimeCache; -import org.eclipse.osee.ote.OTEStatusCallback; -import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface; -import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager; -import org.eclipse.osee.ote.core.model.IModelManager; -import org.eclipse.osee.ote.io.OTEServerFolder; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; - -public final class OTEApiImpl implements OTEApi { - - private final Configuration emptyConfiguration; - private final ReentrantLock configurationLock; - - private Future<ConfigurationStatus> currentConfigurationFuture; - private ExecutorService executor; - private IRuntimeLibraryManager runtimeLibraryManager; - private OTEServerFolder serverFolder; - private OTEServerRuntimeCache serverRuntimeCache; - private TestEnvironmentInterface env; - private IModelManager modelManager; - private IRemoteMessageService remoteMessageService; - private IHostTestEnvironment host; - - /** - * ds component method - */ - public void start(){ - } - - /** - * ds component method - */ - public void stop(){ - } - - /** - * ds component method - */ - public void bindRuntimeLibraryManager(IRuntimeLibraryManager runtimeLibraryManager){ - this.runtimeLibraryManager = runtimeLibraryManager; - } - - /** - * ds component method - */ - public void unbindRuntimeLibraryManager(IRuntimeLibraryManager runtimeLibraryManager){ - this.runtimeLibraryManager = null; - } - - /** - * ds component method - */ - public void bindOTEServerFolder(OTEServerFolder serverFolder){ - this.serverFolder = serverFolder; - } - - /** - * ds component method - */ - public void unbindOTEServerFolder(OTEServerFolder serverFolder){ - this.serverFolder = null; - } - - /** - * ds component method - */ - public void bindOTEServerRuntimeCache(OTEServerRuntimeCache serverRuntimeCache){ - this.serverRuntimeCache = serverRuntimeCache; - } - - /** - * ds component method - */ - public void unbindOTEServerRuntimeCache(OTEServerRuntimeCache serverRuntimeCache){ - this.serverRuntimeCache = null; - } - - /** - * ds component method - */ - public void bindTestEnvironmentInterface(TestEnvironmentInterface env){ - this.env = env; - } - - /** - * ds component method - */ - public void unbindTestEnvironmentInterface(TestEnvironmentInterface env){ - this.env = null; - } - - /** - * ds component method - */ - public void bindIModelManager(IModelManager modelManager){ - this.modelManager = modelManager; - } - - /** - * ds component method - */ - public void unbindIModelManager(IModelManager modelManager){ - this.modelManager = null; - } - - /** - * ds component method - */ - public void bindIRemoteMessageService(IRemoteMessageService remoteMessageService){ - this.remoteMessageService = remoteMessageService; - } - - /** - * ds component method - */ - public void unbindIRemoteMessageService(IRemoteMessageService remoteMessageService){ - this.remoteMessageService = null; - } - - /** - * ds component method - */ - public void bindIHostTestEnvironment(IHostTestEnvironment host){ - this.host = host; - } - - /** - * ds component method - */ - public void unbindIHostTestEnvironment(IHostTestEnvironment host){ - this.host = null; - } - - public OTEApiImpl(){ - this.configurationLock = new ReentrantLock(); - this.emptyConfiguration = new Configuration(); - this.currentConfigurationFuture = new OTEFutureImpl(new ConfigurationStatus(emptyConfiguration, true, "")); - this.executor = Executors.newSingleThreadExecutor(new ThreadFactory(){ - @Override - public Thread newThread(Runnable arg0) { - Thread th = new Thread(arg0); - th.setName("OteConfiguration"); - return th; - } - }); - } - - @Override - public Future<ConfigurationStatus> loadConfiguration(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException { - Future<ConfigurationStatus> status; - configurationLock.lock(); - try{ - if(currentConfigurationFuture != null && !currentConfigurationFuture.isDone()){ - status = new OTEFutureImpl(new ConfigurationStatus(configuration, false, "In the process of loading a configuration.")); - callable.complete(status.get()); - } else if(currentConfigurationFuture.get().getConfiguration() == emptyConfiguration || configuration == emptyConfiguration || !currentConfigurationFuture.get().isSuccess()){ - status = new OTEFutureImpl(executor.submit(new Configure(runtimeLibraryManager, configuration, callable))); - currentConfigurationFuture = status; - } else { - status = new OTEFutureImpl(new ConfigurationStatus(configuration, false, generateConfigDiff(configuration, currentConfigurationFuture.get().getConfiguration()))); - callable.complete(status.get()); - } - } finally { - configurationLock.unlock(); - } - return status; - } - - private String generateConfigDiff(Configuration configuration, Configuration configuration2) { - Collections.sort(configuration.getItems(), new ConfigurationItemComparator()); - Collections.sort(configuration2.getItems(), new ConfigurationItemComparator()); - StringBuilder missingBundles = new StringBuilder(); - StringBuilder extraBundles = new StringBuilder(); - StringBuilder differentVersion = new StringBuilder(); - for(ConfigurationItem item:configuration.getItems()){ - int i = Collections.binarySearch(configuration2.getItems(), item, new ConfigurationItemComparator()); - if(i >= 0 ){ - ConfigurationItem item2 = configuration2.getItems().get(i); - if(!item2.getVersion().equals(item.getVersion())){ - differentVersion.append(String.format("%s [%s] != [%s]\n", item.getSymbolicName(), item.getVersion(), item2.getVersion())); - } else if(!item2.getMd5Digest().equals(item.getMd5Digest())){ - differentVersion.append(String.format("%s binary contents do not match\n", item.getSymbolicName())); - } - } else { - missingBundles.append(String.format("%s missing\n", item.getSymbolicName())); - } - } - for(ConfigurationItem item:configuration2.getItems()){ - int i = Collections.binarySearch(configuration.getItems(), item, new ConfigurationItemComparator()); - if(i < 0 ){ - extraBundles.append(String.format("%s extra bundle\n", item.getSymbolicName())); - } - } - return differentVersion.toString() + missingBundles.toString() + extraBundles.toString(); - } - - private static class ConfigurationItemComparator implements Comparator<ConfigurationItem> { - - @Override - public int compare(ConfigurationItem arg0, ConfigurationItem arg1) { - return arg0.getSymbolicName().compareTo(arg1.getSymbolicName()); - } - - } - - - - @Override - public Future<ConfigurationStatus> resetConfiguration(OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException { - return loadConfiguration(emptyConfiguration, callable); - } - - @Override - public Future<ConfigurationStatus> getConfiguration() { - return currentConfigurationFuture; - } - - @Override - public Future<ConfigurationStatus> downloadConfigurationJars(Configuration configuration, OTEStatusCallback<ConfigurationStatus> callable) throws InterruptedException, ExecutionException { - return new OTEFutureImpl(executor.submit(new DownloadConfiguration(runtimeLibraryManager, configuration, callable))); - } - - @Override - public IModelManager getModelManager() { - return modelManager; - } - - @Override - public TestEnvironmentInterface getTestEnvironment() { - return env; - } - - @Override - public OTEServerFolder getServerFolder() { - return serverFolder; - } - - @Override - public OTEServerRuntimeCache getRuntimeCache() { - return serverRuntimeCache; - } - - @Override - public Class<?> loadFromScriptClassLoader(String clazz) throws ClassNotFoundException { - return runtimeLibraryManager.loadFromRuntimeLibraryLoader(clazz); - } - - @Override - public Class<?> loadFromRuntimeLibraryLoader(String clazz) throws ClassNotFoundException { - return runtimeLibraryManager.loadFromScriptClassLoader(clazz); - } - - @Override - public IRemoteMessageService getRemoteMessageService() { - return remoteMessageService; - } - - @Override - public IHostTestEnvironment getIHostTestEnvironment() { - return host; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java deleted file mode 100644 index 93f10b3c8e9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEBundleLoader.java +++ /dev/null @@ -1,322 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.internal; - -import java.io.File; -import java.io.InputStream; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.core.runtime.Platform; -import org.eclipse.osee.framework.jdk.core.util.Lib; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader; -import org.eclipse.osee.ote.Configuration; -import org.eclipse.osee.ote.ConfigurationItem; -import org.eclipse.osee.ote.ConfigurationStatus; -import org.eclipse.osee.ote.OTEServerRuntimeCache; -import org.eclipse.osee.ote.OTEStatusCallback; -import org.eclipse.osee.ote.core.OseeURLClassLoader; -import org.eclipse.osee.ote.core.ServiceUtility; -import org.eclipse.osee.ote.core.environment.interfaces.IRuntimeLibraryManager; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.FrameworkUtil; - -/** - * When starting bundles users can specify an OTE-StartLevel: <int value> in the manifest of a bundle, if there are issues - * with the order in which bundles need to be started. The list of bundles to start will simply be sorted by that value, - * the default value is 0. This was implemented to work around a deadlock issue that can happen when you call Bundle.start() - * and there is a conflict with 'component resolving thread'. By waiting till the end to load the bundles that can cause the issue - * we avoid the deadlock issue which has a default 5 second time limit. - * - * @author Andrew M. Finkbeiner - * - */ -public class OTEBundleLoader implements IRuntimeLibraryManager{ - - public static final String MANIFEST_ENTRY_OTE_STARTLEVEL = "OTE-StartLevel"; - - private final List<Bundle> installedBundles; - private final Collection<Bundle> runningBundles; - private final Map<String, String> bundleNameToMd5Map; - private final BundleContext context; - - private URLClassLoader scriptClassLoader; - private OTEServerRuntimeCache serverRuntimeCache; - - public void bindOTEServerRuntimeCache(OTEServerRuntimeCache serverRuntimeCache){ - this.serverRuntimeCache = serverRuntimeCache; - } - - public void unbindOTEServerRuntimeCache(OTEServerRuntimeCache serverRuntimeCache){ - this.serverRuntimeCache = serverRuntimeCache; - } - - public OTEBundleLoader() { - this.context = FrameworkUtil.getBundle(getClass()).getBundleContext(); - this.installedBundles = new LinkedList<>(); - this.runningBundles = new LinkedList<>(); - this.bundleNameToMd5Map = new HashMap<>(); - } - - @Override - public boolean install(Configuration oteConfiguration, OTEStatusCallback<ConfigurationStatus> statusCallback) { - boolean pass = true; - for (ConfigurationItem bundleDescription : oteConfiguration.getItems()) { - String bundleName = bundleDescription.getSymbolicName(); - try { - boolean exists = false; - for (Bundle bundle : runningBundles) { - if (bundle.getSymbolicName().equals(bundleName)) { - exists = true; - break; - } - } - if (!exists) { - Bundle bundle = Platform.getBundle(bundleDescription.getSymbolicName()); - if (bundle == null) { - Bundle installedBundle; - File bundleData = acquireSystemLibraryStream(bundleDescription); - installedBundle = context.installBundle("reference:" + bundleData.toURI().toURL().toExternalForm()); - bundleNameToMd5Map.put(bundleName, bundleDescription.getMd5Digest()); - installedBundles.add(installedBundle); - } - } - statusCallback.log("installed " + bundleName); - } catch (BundleException ex){ - if(ex.getType() == BundleException.DUPLICATE_BUNDLE_ERROR){ - statusCallback.log(String.format("Duplicate bundle [%s].", bundleName)); - } else { - statusCallback.error(String.format("Unable to load [%s].", bundleName), ex); - pass = false; - } - } catch (Throwable th) { - statusCallback.error(String.format("Unable to load [%s].", bundleName), th); - pass = false; - } finally { - statusCallback.incrememtUnitsWorked(1); - } - } - return pass; - } - - @Override - public boolean acquireBundles(Configuration oteConfiguration, OTEStatusCallback<ConfigurationStatus> statusCallback) { - boolean pass = true; - for (ConfigurationItem bundleDescription : oteConfiguration.getItems()) { - String bundleName = bundleDescription.getSymbolicName(); - File bundleData = null; - try{ - bundleData = acquireSystemLibraryStream(bundleDescription); - } catch (Exception e) { - pass = false; - statusCallback.error("Failed to aquire bundle from client.", e); - } - finally { - if(bundleData == null){ - pass = false; - statusCallback.error("Failed to downloaded bundle " + bundleName); - } - statusCallback.incrememtUnitsWorked(1); - } - statusCallback.log("downloaded " + bundleName); - } - return pass; - } - - @Override - public boolean start(OTEStatusCallback<ConfigurationStatus> statusCallback) { - boolean pass = true; - sortBundles(installedBundles); - Iterator<Bundle> iter = installedBundles.iterator(); - while (iter.hasNext()) { - Bundle bundle = iter.next(); - try { - String entry = bundle.getHeaders().get("Fragment-Host"); - if (entry == null) { - int bundleState = bundle.getState(); - if(bundleState != Bundle.ACTIVE) { - bundle.start(); - } - } - // We got here because bundle.start did not exception - runningBundles.add(bundle); - iter.remove(); - statusCallback.log("started " + bundle.getSymbolicName()); - } catch (BundleException ex) { - pass = false; - statusCallback.error("Failed to start " + bundle.getSymbolicName(), ex); - } finally { - statusCallback.incrememtUnitsWorked(1); - } - } - return pass; - } - - private void sortBundles(List<Bundle> installedBundles2) { - Collections.sort(installedBundles, new Comparator<Bundle>() { - @Override - public int compare(Bundle arg0, Bundle arg1) { - int startLevel0 = getStartLevel(arg0); - int startLevel1 = getStartLevel(arg1); - if(startLevel0 != 0 || startLevel1 != 0){ - return startLevel0 - startLevel1; - } else { - return arg0.getSymbolicName().compareTo(arg1.getSymbolicName()); - } - } - - private int getStartLevel(Bundle arg0) { - String level = arg0.getHeaders().get(MANIFEST_ENTRY_OTE_STARTLEVEL); - if(level == null){ - return 0; - } else { - try { - return Integer.parseInt(level); - } catch (NumberFormatException ex) { - return 0; - } - } - } - }); - } - - @Override - public boolean uninstall(OTEStatusCallback<ConfigurationStatus> statusCallback) { - boolean result = true; - for (Bundle bundle : installedBundles) { - try { - bundle.uninstall(); - } catch (BundleException ex) { - result = false; - statusCallback.error("Failed to uninstall " + bundle.getSymbolicName(), ex); - } - } - installedBundles.clear(); - - for (Bundle bundle : runningBundles) { - try { - String entry = bundle.getHeaders().get("Fragment-Host"); - if (entry == null) { - bundle.stop(); - } - bundle.uninstall(); - } catch (BundleException ex) { - result = false; - statusCallback.error("Failed to stop and uninstall " + bundle.getSymbolicName(), ex); - } - } - runningBundles.clear(); - - return result; - } - - private File acquireSystemLibraryStream(ConfigurationItem bundleDescription) throws Exception { - File file = serverRuntimeCache.get(bundleDescription.getSymbolicName(), bundleDescription.getMd5Digest()); - if (file == null) { - InputStream servedBundleIn = new URL(bundleDescription.getLocationUrl()).openConnection().getInputStream(); - file = serverRuntimeCache.save(bundleDescription.getSymbolicName(), bundleDescription.getMd5Digest(), servedBundleIn); - servedBundleIn.close(); - } - return file; - } - - public void dispose() { - bundleNameToMd5Map.clear(); - installedBundles.clear(); - runningBundles.clear(); - } - - @Override - public boolean installed() { - return installedBundles.size() > 0 || runningBundles.size() > 0; - } - - @Override - public void clearJarCache() { - serverRuntimeCache.clearJarCache(); - } - - @Override - public void resetScriptLoader(Configuration oteConfiguration, String[] classPaths) throws Exception { - List<URL> urls = new ArrayList<>(); - if(oteConfiguration != null){ - for(ConfigurationItem item:oteConfiguration.getItems()){ - File file = serverRuntimeCache.get(item.getSymbolicName(), item.getMd5Digest()); - if(file != null){ - urls.add(file.toURI().toURL()); - } - } - } - URL[] urlArray = urls.toArray(new URL[urls.size()+classPaths.length]); - URL[] urlClassPaths = Lib.getUrlFromString(classPaths); - System.arraycopy(urlClassPaths, 0, urlArray, urls.size(), urlClassPaths.length); - scriptClassLoader = new OseeURLClassLoader("Script ClassLoader", urlArray, ExportClassLoader.getInstance()); - } - - @Override - public Class<?> loadFromScriptClassLoader(String path) throws ClassNotFoundException { - if (scriptClassLoader == null) { - return loadFromRuntimeLibraryLoader(path); - } - Class<?> scriptClass = scriptClassLoader.loadClass(path); - return scriptClass; - } - - @Override - public Class<?> loadFromRuntimeLibraryLoader(String clazz) throws ClassNotFoundException { - return ExportClassLoader.getInstance().loadClass(clazz); - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("RuntimeVersions"); - for (String bundleVersion : getBundleVersions()) { - XMLStreamWriterUtil.writeElement(writer, "Version", bundleVersion); - } - writer.writeEndElement(); - } - - @JsonProperty - public List<String> getBundleVersions() { - Bundle[] bundles = ServiceUtility.getContext().getBundles(); - List<String> versions = new ArrayList<>(); - for(Bundle bundle: bundles ){ - String version = bundle.getHeaders().get("Bundle-Version"); - String implVersion = bundle.getHeaders().get("Implementation-Version"); - if (version != null && implVersion != null) { - versions.add(String.format("%s_%s_%s", bundle.getSymbolicName(), version, implVersion)); - } else if (version != null){ - versions.add(String.format("%s_%s", bundle.getSymbolicName(), version)); - } else { - versions.add(String.format("%s", bundle.getSymbolicName())); - } - } - Collections.sort(versions); - return versions; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFutureImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFutureImpl.java deleted file mode 100644 index cf2ad43ebcb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEFutureImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import org.eclipse.osee.ote.ConfigurationStatus; - -public class OTEFutureImpl implements Future<ConfigurationStatus> { - - private final Future<ConfigurationStatus> submit; - private ConfigurationStatus oteConfigurationStatus; - - public OTEFutureImpl(Future<ConfigurationStatus> submit) { - this.submit = submit; - } - - public OTEFutureImpl(ConfigurationStatus oteConfigurationStatus) { - this.submit = null; - this.oteConfigurationStatus = oteConfigurationStatus; - } - - @Override - public boolean cancel(boolean mayInterruptIfRunning) { - if(submit == null){ - return false; - } - return submit.cancel(mayInterruptIfRunning); - } - - @Override - public ConfigurationStatus get() throws InterruptedException, ExecutionException { - if(submit == null){ - return oteConfigurationStatus; - } - return submit.get(); - } - - @Override - public ConfigurationStatus get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { - if(submit == null){ - return oteConfigurationStatus; - } - return submit.get(timeout, unit); - } - - @Override - public boolean isCancelled() { - if(submit == null){ - return false; - } - return submit.isCancelled(); - } - - @Override - public boolean isDone() { - if(submit == null){ - return true; - } - return submit.isDone(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEServerRuntimeCacheImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEServerRuntimeCacheImpl.java deleted file mode 100644 index 99eace740e9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTEServerRuntimeCacheImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.logging.Level; - -import org.eclipse.osee.framework.jdk.core.util.io.streams.StreamPumper; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.OTEServerRuntimeCache; -import org.eclipse.osee.ote.io.OTEServerFolder; - -public class OTEServerRuntimeCacheImpl implements OTEServerRuntimeCache { - - private static final SimpleDateFormat formatter = new SimpleDateFormat("yyyy_MM_dd___kk_mm_ss"); - - private File folder; - private OTEServerFolder oteServerFolder; - - public OTEServerRuntimeCacheImpl(){ - } - - /** - * ds component method - */ - public void start(){ - folder = oteServerFolder.getCacheFolder(); - if (!folder.exists()) { - if (!folder.mkdirs()) { - OseeLog.log(getClass(), Level.SEVERE, "Could not create JAR cache at " + folder.getAbsolutePath()); - } - } - if (!folder.isDirectory()) { - OseeLog.log(getClass(), Level.SEVERE, "The JAR cache is not a directory! Path=" + folder.getAbsolutePath()); - } - clean(); - } - - /** - * ds component method - */ - public void stop(){ - } - - /** - * ds component method - */ - public void bindOTEServerFolder(OTEServerFolder oteServerFolder){ - this.oteServerFolder = oteServerFolder; - } - - /** - * ds component method - */ - public void unbindOTEServerFolder(OTEServerFolder oteServerFolder){ - this.oteServerFolder = oteServerFolder; - } - - @Override - public void clearJarCache() { - File[] bundleFolders = folder.listFiles(); - for(File bundleFolder: bundleFolders){ - if(bundleFolder.isDirectory()){ - File[] jars = bundleFolder.listFiles(new FileFilter() { - @Override - public boolean accept(File file) { - return file.getAbsolutePath().endsWith(".jar"); - } - }); - for(File jar:jars){ - jar.delete(); - } - } else { - bundleFolder.delete(); - } - } - } - - @Override - public File save(String symbolicName, String md5Digest, InputStream servedBundleIn) throws IOException { - File namedFolder = new File(folder, symbolicName); - if(namedFolder.exists() && !namedFolder.isDirectory()){ - namedFolder.delete(); - } - namedFolder.mkdirs(); - - File newCachedFile = new File(namedFolder, md5Digest + ".jar"); - OutputStream cachedFileOut = new FileOutputStream(newCachedFile); - StreamPumper.pumpData(servedBundleIn, cachedFileOut); - cachedFileOut.close(); - servedBundleIn.close(); - writeDateFile(newCachedFile); - return newCachedFile; - } - - @Override - public File get(String symbolicName, String md5Digest) throws FileNotFoundException { - File foundFile = new File(new File(folder, symbolicName), md5Digest + ".jar"); - if(foundFile.exists()){ - writeDateFile(foundFile); - return foundFile; - } - return null; - } - - /** - * Write out a file that has the date a cached file was last accessed. This file will be used to determine when it is ok to remove a file. - * - * @param foundFile - */ - private void writeDateFile(File foundFile) { - File dateFile = new File(foundFile.getParentFile(), foundFile.getName()+ ".date"); - FileOutputStream fos = null; - try{ - fos = new FileOutputStream(dateFile); - fos.write(formatter.format(new Date()).getBytes()); - fos.flush(); - } catch(IOException ex) { - OseeLog.log(getClass(), Level.SEVERE, ex); - } finally { - if(fos != null){ - try { - fos.close(); - } catch (IOException e) { - } - } - } - } - - private void clean(){ - if(folder.exists()){ - File[] bundleFolders = folder.listFiles(); - if(bundleFolders != null){ - for(File bundleFolder: bundleFolders){ - if(bundleFolder.isDirectory()){ - File[] jars = bundleFolder.listFiles(new FileFilter() { - @Override - public boolean accept(File file) { - return file.getAbsolutePath().endsWith(".jar"); - } - }); - if(jars.length == 0){ - if(bundleFolder.listFiles().length == 0){ - bundleFolder.delete(); - } - } else { - for(File jar:jars){ - File dateFile = new File(jar.getAbsolutePath() + ".date"); - if(dateFile.exists()){ - if(isDateFileOld(dateFile)){//delete files that haven't been recently used - if(jar.exists()){ - jar.delete(); - } - dateFile.delete(); - } - } else { //delete a jar without a ".date" file - jar.delete(); - } - } - } - } else { //delete legacy style cache items - bundleFolder.delete(); - } - } - } - } - } - - private boolean isDateFileOld(File dateFile) { - String dateStr = getDateFromFile(dateFile); - Date date; - try { - date = formatter.parse(dateStr); - } catch (ParseException e) { - return true; - } - Date oldDate = getOldDate(); - if(date.before(oldDate)){ - return true; - } else { - return false; - } - } - - private String getDateFromFile(File dateFile){ - FileInputStream fis = null; - String dateStr = null; - try{ - byte[] buffer = new byte[1024]; - fis = new FileInputStream(dateFile); - fis.read(buffer); - dateStr = new String(buffer); - } catch(IOException ex) { - OseeLog.log(getClass(), Level.SEVERE, ex); - } finally { - if(fis != null){ - try { - fis.close(); - } catch (IOException e) { - } - } - } - return dateStr; - } - - private Date getOldDate(){ - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date()); - cal.add(Calendar.DAY_OF_MONTH, -7); - return cal.getTime(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTESystemOutConnection.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTESystemOutConnection.java deleted file mode 100644 index 38a799c0ded..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTESystemOutConnection.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; - -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.io.SystemOutput; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.ConsoleInputMessage; -import org.osgi.framework.ServiceRegistration; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventHandler; - -public class OTESystemOutConnection { - - private OteUdpEndpoint endpoint; - private SystemOutput output; - private OTESystemOutputHandler outputHandler; - private ServiceRegistration<EventHandler> subscribe; - - /** - * osgi - */ - public void start(){ - outputHandler = new OTESystemOutputHandler(endpoint); - output.addListener(outputHandler); - subscribe = OteEventMessageUtil.subscribe(ConsoleInputMessage.TOPIC, new ConsoleInputHandler(output)); - } - - /** - * osgi - */ - public void stop(){ - output.removeListener(outputHandler); - if(subscribe != null){ - subscribe.unregister(); - subscribe = null; - } - } - - /** - * osgi - */ - public void bindOteUdpEndpoint(OteUdpEndpoint endpoint){ - this.endpoint = endpoint; - } - - /** - * osgi - */ - public void unbindOteUdpEndpoint(OteUdpEndpoint endpoint){ - this.endpoint = null; - } - - /** - * osgi - */ - public void bindSystemOutput(SystemOutput output){ - this.output = output; - } - - /** - * osgi - */ - public void unbindSystemOutput(SystemOutput output){ - this.output = null; - } - - private static class ConsoleInputHandler implements EventHandler { - - private SystemOutput output; - private ConsoleInputMessage message; - - public ConsoleInputHandler(SystemOutput output) { - this.output = output; - message = new ConsoleInputMessage(); - } - - @Override - public void handleEvent(Event arg0) { - message.setBackingBuffer(OteEventMessageUtil.getBytes(arg0)); - try { - output.write(message.getString()); - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTESystemOutputHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTESystemOutputHandler.java deleted file mode 100644 index 3b825279d59..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/OTESystemOutputHandler.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; - -import org.eclipse.osee.ote.core.CopyOnWriteNoIteratorList; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.endpoint.OteUdpEndpointSender; -import org.eclipse.osee.ote.io.SystemOutputListener; -import org.eclipse.osee.ote.remote.messages.ConsoleOutputMessage; - -public class OTESystemOutputHandler implements SystemOutputListener { - - private ByteBuffer buffer = ByteBuffer.allocate(4096); - private OteUdpEndpoint endpoint; - private ConsoleOutputMessage outputMessage; - private ScheduledExecutorService newSingleThreadScheduledExecutor; - - public OTESystemOutputHandler(OteUdpEndpoint endpoint) { - this.endpoint = endpoint; - outputMessage = new ConsoleOutputMessage(); - newSingleThreadScheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { - @Override - public Thread newThread(Runnable arg0) { - Thread th = new Thread(arg0); - th.setDaemon(true); - th.setName("OTEConsole Send"); - return th; - } - }); - newSingleThreadScheduledExecutor.scheduleAtFixedRate(new Runnable(){ - @Override - public void run() { - send(); - } - }, 1000, 1000, TimeUnit.MILLISECONDS); - } - - @Override - public void close() throws IOException { - flush(); - } - - @Override - public synchronized void flush() throws IOException { - send(); - } - - public synchronized void send(){ - if(buffer.position() > 0){ - try{ - buffer.flip(); - outputMessage.setStringData(buffer); - buffer.clear(); - CopyOnWriteNoIteratorList<OteUdpEndpointSender> broadcastSenders = endpoint.getBroadcastSenders(); - OteUdpEndpointSender[] oteUdpEndpointSenders = broadcastSenders.get(); - for(int i = 0; i < oteUdpEndpointSenders.length; i++){ - oteUdpEndpointSenders[i].send(outputMessage); - } - } catch (Throwable th){ - } - } - } - - @Override - public synchronized void write(byte[] b, int off, int len) throws IOException { - while(len > 0){ - if(buffer.position() > 0 && buffer.remaining() <= len){ - flush(); - } - int length = (buffer.remaining() < len) ? buffer.remaining() : len; - len = len - length; - buffer.put(b, off, length); - off += length; - } - } - - @Override - public synchronized void write(byte[] b) throws IOException { - write(b, 0, b.length); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/PhysicalTypesResponceListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/PhysicalTypesResponceListener.java deleted file mode 100644 index d9edf52827f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/PhysicalTypesResponceListener.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.io.Serializable; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; -import org.eclipse.osee.ote.remote.messages.AVAILABLE_PHYSICAL_TYPES_REQ; -import org.eclipse.osee.ote.remote.messages.SerializedAvailablePhysicalTypesMessage; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class PhysicalTypesResponceListener implements EventHandler { - - private final EventAdmin eventAdmin; - private final IRemoteMessageService messageService; - private final SerializedAvailablePhysicalTypesMessage resp; - private final AVAILABLE_PHYSICAL_TYPES_REQ req; - - public PhysicalTypesResponceListener(EventAdmin eventAdmin, IRemoteMessageService messageService) { - this.eventAdmin = eventAdmin; - this.messageService = messageService; - resp = new SerializedAvailablePhysicalTypesMessage(); - req = new AVAILABLE_PHYSICAL_TYPES_REQ(); - } - - @Override - public void handleEvent(Event event) { - OteEventMessageUtil.putBytes(event, req); - resp.getHeader().RESPONSE_ID.setValue(req.getHeader().MESSAGE_SEQUENCE_NUMBER.getValue()); - try { - resp.setObject((Serializable)messageService.getAvailablePhysicalTypes()); - OteEventMessageUtil.postEvent(resp, eventAdmin); - } catch (IOException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RecordCommandListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RecordCommandListener.java deleted file mode 100644 index a7746af57d6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RecordCommandListener.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.commands.RecordCommand; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; -import org.eclipse.osee.ote.remote.messages.SerializedRecordCommandMessage; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class RecordCommandListener implements EventHandler { - - private final IRemoteMessageService messageService; - - public RecordCommandListener(EventAdmin eventAdmin, IRemoteMessageService messageService) { - this.messageService = messageService; - } - - @Override - public void handleEvent(Event arg0) { - RecordCommand cmd; - try { - SerializedRecordCommandMessage msg = new SerializedRecordCommandMessage(OteEventMessageUtil.getBytes(arg0)); - cmd = msg.getObject(); - messageService.startRecording(cmd); - } catch (IOException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } catch (ClassNotFoundException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RemoteMessageServiceHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RemoteMessageServiceHandler.java deleted file mode 100644 index ed426464f8b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RemoteMessageServiceHandler.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; -import org.eclipse.osee.ote.remote.messages.AVAILABLE_PHYSICAL_TYPES_REQ; -import org.eclipse.osee.ote.remote.messages.GET_INET_ADDRESS_REQ; -import org.eclipse.osee.ote.remote.messages.STOP_RECORDING_CMD; -import org.eclipse.osee.ote.remote.messages.SerializedRecordCommandMessage; -import org.eclipse.osee.ote.remote.messages.SerializedSetElementMessage; -import org.eclipse.osee.ote.remote.messages.SerializedSubscribeToMessage; -import org.eclipse.osee.ote.remote.messages.SerializedUnSubscribeMessage; -import org.eclipse.osee.ote.remote.messages.SerializedZeroizeElementMessage; -import org.osgi.framework.ServiceRegistration; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class RemoteMessageServiceHandler { - - private EventAdmin eventAdmin; - private IRemoteMessageService messageService; - private ServiceRegistration<EventHandler> addressResponseReg; - private ServiceRegistration<EventHandler> availablePhysicalTypesReg; - private ServiceRegistration<EventHandler> subscribeToMessageReg; - private ServiceRegistration<EventHandler> unsubscribeToMessageReg; - private ServiceRegistration<EventHandler> recordReg; - private ServiceRegistration<EventHandler> setElementReg; - private ServiceRegistration<EventHandler> zeroizeElementReg; - private ServiceRegistration<EventHandler> stopRecordReg; - - /** - * osgi - */ - public void bindEventAdmin(EventAdmin eventAdmin){ - this.eventAdmin = eventAdmin; - } - - /** - * osgi - */ - public void unbindEventAdmin(EventAdmin eventAdmin){ - this.eventAdmin = null; - } - - /** - * osgi - */ - public void bindIRemoteMessageService(IRemoteMessageService messageService){ - this.messageService = messageService; - } - - /** - * osgi - */ - public void unbindIRemoteMessageService(IRemoteMessageService messageService){ - this.messageService = null; - } - - /** - * osgi - */ - public void start(){ - addressResponseReg = OteEventMessageUtil.subscribe(GET_INET_ADDRESS_REQ.TOPIC, new AddressResponseListener(eventAdmin, messageService)); - availablePhysicalTypesReg = OteEventMessageUtil.subscribe(AVAILABLE_PHYSICAL_TYPES_REQ.TOPIC, new PhysicalTypesResponceListener(eventAdmin, messageService)); - subscribeToMessageReg = OteEventMessageUtil.subscribe(SerializedSubscribeToMessage.EVENT, new SubscriptionCommandListener(eventAdmin, messageService)); - unsubscribeToMessageReg = OteEventMessageUtil.subscribe(SerializedUnSubscribeMessage.EVENT, new UnSubscribeCommandListener(eventAdmin, messageService)); - recordReg = OteEventMessageUtil.subscribe(SerializedRecordCommandMessage.EVENT, new RecordCommandListener(eventAdmin, messageService)); - setElementReg = OteEventMessageUtil.subscribe(SerializedSetElementMessage.EVENT, new SetElementCommandListener(eventAdmin, messageService)); - zeroizeElementReg = OteEventMessageUtil.subscribe(SerializedZeroizeElementMessage.EVENT, new ZeroizeElementCommandListener(eventAdmin, messageService)); - stopRecordReg = OteEventMessageUtil.subscribe(STOP_RECORDING_CMD.TOPIC, new StopRecordCommandListener(eventAdmin, messageService)); - } - - /** - * osgi - */ - public void stop(){ - addressResponseReg.unregister(); - availablePhysicalTypesReg.unregister(); - subscribeToMessageReg.unregister(); - unsubscribeToMessageReg.unregister(); - recordReg.unregister(); - setElementReg.unregister(); - zeroizeElementReg.unregister(); - stopRecordReg.unregister(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RemoteOteApiHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RemoteOteApiHandler.java deleted file mode 100644 index 12e976bfcd3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RemoteOteApiHandler.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.RequestHostEnvironmentProperties; -import org.eclipse.osee.ote.remote.messages.RunTestsSerialized; -import org.eclipse.osee.ote.remote.messages.SerializedConfigurationAndResponse; -import org.eclipse.osee.ote.remote.messages.SerializedDisconnectRemoteTestEnvironment; -import org.eclipse.osee.ote.remote.messages.SerializedRequestRemoteTestEnvironment; -import org.eclipse.osee.ote.remote.messages.TestEnvironmentServerShutdown; -import org.eclipse.osee.ote.remote.messages.TestEnvironmentSetBatchMode; -import org.eclipse.osee.ote.remote.messages.TestEnvironmentTransferFile; -import org.osgi.framework.ServiceRegistration; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class RemoteOteApiHandler { - - private EventAdmin eventAdmin; - private OTEApi oteApi; - private OteUdpEndpoint oteEndpoint; - private ServiceRegistration<EventHandler> configureAndResponse; - private ServiceRegistration<EventHandler> getProperties; - private ServiceRegistration<EventHandler> getConnection; - private ServiceRegistration<EventHandler> disconnect; - private ServiceRegistration<EventHandler> runTests; - private ServiceRegistration<EventHandler> setBatchMode; - private ServiceRegistration<EventHandler> transferFile; - private ServiceRegistration<EventHandler> serverShutdown; - - /** - * osgi - */ - public void bindEventAdmin(EventAdmin eventAdmin){ - this.eventAdmin = eventAdmin; - } - - /** - * osgi - */ - public void unbindEventAdmin(EventAdmin eventAdmin){ - this.eventAdmin = null; - } - - /** - * osgi - */ - public void bindOTEApi(OTEApi oteApi){ - this.oteApi = oteApi; - } - - /** - * osgi - */ - public void unbindOTEApi(OTEApi oteApi){ - this.oteApi = null; - } - - /** - * osgi - */ - public void bindOteUdpEndpoint(OteUdpEndpoint oteEndpoint){ - this.oteEndpoint = oteEndpoint; - } - - /** - * osgi - */ - public void unbindOteUdpEndpoint(OteUdpEndpoint oteEndpoint){ - this.oteEndpoint = null; - } - - - /** - * osgi - */ - public void start(){ - configureAndResponse = OteEventMessageUtil.subscribe(SerializedConfigurationAndResponse.EVENT, new ConfigureAndResponseListener(eventAdmin, oteEndpoint, oteApi)); - getProperties = OteEventMessageUtil.subscribe(RequestHostEnvironmentProperties.TOPIC, new GetPropertiesListener(eventAdmin, oteEndpoint, oteApi)); - getConnection = OteEventMessageUtil.subscribe(SerializedRequestRemoteTestEnvironment.TOPIC, new ConnectionListener(eventAdmin, oteEndpoint, oteApi)); - disconnect = OteEventMessageUtil.subscribe(SerializedDisconnectRemoteTestEnvironment.TOPIC, new DisconnectListener(eventAdmin, oteEndpoint, oteApi)); - runTests = OteEventMessageUtil.subscribe(RunTestsSerialized.RUNTESTS_NAMESPACE + "*", new RunTestListener(eventAdmin, oteEndpoint, oteApi)); - setBatchMode = OteEventMessageUtil.subscribe(TestEnvironmentSetBatchMode.TOPIC, new SetBatchModeListener(eventAdmin, oteEndpoint, oteApi)); - transferFile = OteEventMessageUtil.subscribe(TestEnvironmentTransferFile.TOPIC, new TransferFileToClientListener(eventAdmin, oteEndpoint, oteApi)); - serverShutdown = OteEventMessageUtil.subscribe(TestEnvironmentServerShutdown.TOPIC, new ServerShutdownListener(eventAdmin, oteEndpoint, oteApi)); - } - - /** - * osgi - */ - public void stop(){ - configureAndResponse.unregister(); - getProperties.unregister(); - getConnection.unregister(); - disconnect.unregister(); - runTests.unregister(); - setBatchMode.unregister(); - transferFile.unregister(); - serverShutdown.unregister(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RunTestListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RunTestListener.java deleted file mode 100644 index 639962df7a6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/RunTestListener.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.rmi.server.ExportException; -import java.util.concurrent.ConcurrentHashMap; - -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.core.framework.command.ICommandHandle; -import org.eclipse.osee.ote.core.framework.command.ITestCommandResult; -import org.eclipse.osee.ote.core.framework.command.RunTests; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.BooleanResponse; -import org.eclipse.osee.ote.remote.messages.RunTestsCancel; -import org.eclipse.osee.ote.remote.messages.RunTestsGetCommandResultReq; -import org.eclipse.osee.ote.remote.messages.RunTestsGetCommandResultResp; -import org.eclipse.osee.ote.remote.messages.RunTestsIsCancelled; -import org.eclipse.osee.ote.remote.messages.RunTestsIsDone; -import org.eclipse.osee.ote.remote.messages.RunTestsSerialized; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class RunTestListener implements EventHandler { - - private OTEApi oteApi; - - private ConcurrentHashMap<String, ICommandHandle> handles; - - public RunTestListener(EventAdmin eventAdmin, OteUdpEndpoint oteEndpoint, OTEApi oteApi) { - this.oteApi = oteApi; - handles = new ConcurrentHashMap<>(); - } - - @Override - public void handleEvent(Event event) { - if(oteApi.getTestEnvironment() == null){ - return; - } - OteEventMessage generic = OteEventMessageUtil.getOteEventMessage(event); - if(RunTestsSerialized.TOPIC.equals(generic.getHeader().TOPIC.getValue())){ - RunTestsSerialized serialized = new RunTestsSerialized(OteEventMessageUtil.getBytes(event)); - try { - RunTests runTests = serialized.getObject(); - String guid = runTests.getGUID(); - ICommandHandle addCommand = oteApi.getTestEnvironment().addCommand(runTests); - handles.put(guid, addCommand); - } catch (ExportException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } else if (RunTestsCancel.TOPIC.equals(generic.getHeader().TOPIC.getValue())){ - BooleanResponse booleanResponse = new BooleanResponse(); - RunTestsCancel cancel = new RunTestsCancel(OteEventMessageUtil.getBytes(event)); - ICommandHandle iCommandHandle = handles.get(cancel.GUID.getValue()); - boolean status = false; - if(iCommandHandle != null){ - if(cancel.CANCEL_ALL.getValue()){ - status = iCommandHandle.cancelAll(true); - } else { - status = iCommandHandle.cancelSingle(true); - } - } - booleanResponse.VALUE.setValue(status); - booleanResponse.setResponse(cancel); - OteEventMessageUtil.postEvent(booleanResponse); - } else if (RunTestsGetCommandResultReq.TOPIC.equals(generic.getHeader().TOPIC.getValue())){ - RunTestsGetCommandResultReq req = new RunTestsGetCommandResultReq(OteEventMessageUtil.getBytes(event)); - ICommandHandle iCommandHandle = handles.get(req.GUID.getValue()); - RunTestsGetCommandResultResp resp = new RunTestsGetCommandResultResp(); - if(iCommandHandle != null){ - ITestCommandResult iTestCommandResult = iCommandHandle.get(); - try { - resp.setObject(iTestCommandResult); - } catch (IOException e) { - e.printStackTrace(); - } - } - resp.setResponse(req); - OteEventMessageUtil.postEvent(resp); - } else if (RunTestsIsCancelled.TOPIC.equals(generic.getHeader().TOPIC.getValue())){ - BooleanResponse booleanResponse = new BooleanResponse(); - RunTestsIsCancelled isCanceled = new RunTestsIsCancelled(OteEventMessageUtil.getBytes(event)); - ICommandHandle iCommandHandle = handles.get(isCanceled.GUID.getValue()); - boolean status = false; - if(iCommandHandle != null){ - status = iCommandHandle.isCancelled(); - } - booleanResponse.VALUE.setValue(status); - booleanResponse.setResponse(isCanceled); - OteEventMessageUtil.postEvent(booleanResponse); - } else if (RunTestsIsDone.TOPIC.equals(generic.getHeader().TOPIC.getValue())){ - BooleanResponse booleanResponse = new BooleanResponse(); - RunTestsIsDone isDone = new RunTestsIsDone(OteEventMessageUtil.getBytes(event)); - ICommandHandle iCommandHandle = handles.get(isDone.GUID.getValue()); - boolean status = false; - if(iCommandHandle != null){ - status = iCommandHandle.isDone(); - } - booleanResponse.VALUE.setValue(status); - booleanResponse.setResponse(isDone); - OteEventMessageUtil.postEvent(booleanResponse); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ServerShutdownListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ServerShutdownListener.java deleted file mode 100644 index a70b0f9f3f0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ServerShutdownListener.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.rmi.RemoteException; - -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.TestEnvironmentServerShutdown; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.FrameworkUtil; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class ServerShutdownListener implements EventHandler { - - private OTEApi oteApi; - - public ServerShutdownListener(EventAdmin eventAdmin, OteUdpEndpoint oteEndpoint, OTEApi oteApi) { - this.oteApi = oteApi; - } - - @Override - public void handleEvent(Event arg0) { - if(oteApi.getIHostTestEnvironment() == null){ - return; - } - TestEnvironmentServerShutdown serverShutdown = new TestEnvironmentServerShutdown(OteEventMessageUtil.getBytes(arg0)); - String id; - try { - id = (String)oteApi.getIHostTestEnvironment().getProperties().getProperty("id", "dontknow"); - if(serverShutdown.SERVER_ID.getValue().equals(id)){ - shutdown(); - } - } catch (RemoteException e) { - e.printStackTrace(); - } - } - - private void shutdown(){ - BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext(); - Bundle systemBundle = context.getBundle(0); - try { - systemBundle.stop(); - boolean canExit = false; - while(!canExit){ - try{ - Thread.sleep(20); - } catch (Throwable th){ - } - canExit = true; - try{ - for(Bundle b:context.getBundles()){ - if(b.getState() != Bundle.ACTIVE){ - canExit = false; - } - } - } catch (Throwable th){ - canExit = true; - } - } - } catch (BundleException e) { - } - System.exit(0); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/SetBatchModeListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/SetBatchModeListener.java deleted file mode 100644 index 1c179c51414..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/SetBatchModeListener.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.TestEnvironmentSetBatchMode; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class SetBatchModeListener implements EventHandler { - - private OTEApi oteApi; - - public SetBatchModeListener(EventAdmin eventAdmin, OteUdpEndpoint oteEndpoint, OTEApi oteApi) { - this.oteApi = oteApi; - } - - @Override - public void handleEvent(Event arg0) { - if(oteApi.getTestEnvironment() == null){ - return; - } - TestEnvironmentSetBatchMode testEnvironmentSetBatchMode = new TestEnvironmentSetBatchMode(OteEventMessageUtil.getBytes(arg0)); - oteApi.getTestEnvironment().setBatchMode(testEnvironmentSetBatchMode.SET_BATCH_MODE.getValue()); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/SetElementCommandListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/SetElementCommandListener.java deleted file mode 100644 index d6abffa3418..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/SetElementCommandListener.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.commands.SetElementValue; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; -import org.eclipse.osee.ote.remote.messages.SerializedSetElementMessage; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class SetElementCommandListener implements EventHandler { - - private final IRemoteMessageService messageService; - - public SetElementCommandListener(EventAdmin eventAdmin, IRemoteMessageService messageService) { - this.messageService = messageService; - } - - @Override - public void handleEvent(Event arg0) { - SetElementValue cmd; - try { - SerializedSetElementMessage msg = new SerializedSetElementMessage(OteEventMessageUtil.getBytes(arg0)); - cmd = msg.getObject(); - messageService.setElementValue(cmd); - } catch (IOException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } catch (ClassNotFoundException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/StopRecordCommandListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/StopRecordCommandListener.java deleted file mode 100644 index 3c042de26bb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/StopRecordCommandListener.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class StopRecordCommandListener implements EventHandler { - - private final IRemoteMessageService messageService; - - public StopRecordCommandListener(EventAdmin eventAdmin, IRemoteMessageService messageService) { - this.messageService = messageService; - } - - @Override - public void handleEvent(Event arg0) { - messageService.stopRecording(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/SubscriptionCommandListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/SubscriptionCommandListener.java deleted file mode 100644 index 6b8182a3e0f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/SubscriptionCommandListener.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.net.UnknownHostException; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.commands.SubscribeToMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; -import org.eclipse.osee.ote.message.tool.SubscriptionDetails; -import org.eclipse.osee.ote.remote.messages.SerializedSubscribeToMessage; -import org.eclipse.osee.ote.remote.messages.SerializedSubscriptionDetailsMessage; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class SubscriptionCommandListener implements EventHandler { - - private final IRemoteMessageService messageService; - private final SerializedSubscribeToMessage cmd; - - public SubscriptionCommandListener(EventAdmin eventAdmin, IRemoteMessageService messageService) { - this.messageService = messageService; - cmd = new SerializedSubscribeToMessage(); - } - - @Override - public void handleEvent(Event event) { - OteEventMessageUtil.putBytes(event, cmd); - SubscribeToMessage subscribe; - try { - subscribe = cmd.getObject(); - SubscriptionDetails resp = messageService.subscribeToMessage(subscribe); - SerializedSubscriptionDetailsMessage stat = new SerializedSubscriptionDetailsMessage(); - stat.getHeader().RESPONSE_ID.setValue(cmd.getHeader().MESSAGE_SEQUENCE_NUMBER.getValue()); - stat.setObject(resp); - OteEventMessageUtil.postEvent(stat); - } catch (UnknownHostException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } catch (IOException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } catch (ClassNotFoundException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/TransferFileToClientListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/TransferFileToClientListener.java deleted file mode 100644 index c376e323bc5..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/TransferFileToClientListener.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.File; -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; - -import org.eclipse.osee.ote.OTEApi; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.filetransfer.TcpFileTransfer; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.remote.messages.TestEnvironmentTransferFile; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class TransferFileToClientListener implements EventHandler { - - private ExecutorService pool; - private OTEApi oteApi; - - public TransferFileToClientListener(EventAdmin eventAdmin, OteUdpEndpoint oteEndpoint, OTEApi oteApi) { - this.oteApi = oteApi; - pool = Executors.newCachedThreadPool(new ThreadFactory() { - @Override - public Thread newThread(Runnable arg0) { - Thread th = new Thread(arg0); - th.setName("OTE File Transfer"); - return th; - } - }); - } - - @Override - public void handleEvent(Event arg0) { - if(oteApi.getTestEnvironment() == null){ - return; - } - TestEnvironmentTransferFile testEnvironmentTransferFile = new TestEnvironmentTransferFile(OteEventMessageUtil.getBytes(arg0)); - InetSocketAddress inetSocketAddress; - try { - inetSocketAddress = new InetSocketAddress(testEnvironmentTransferFile.ADDRESS.getAddress(), testEnvironmentTransferFile.ADDRESS.getPort()); - TcpFileTransfer.sendFile(pool, new File(testEnvironmentTransferFile.FILE_PATH.getValue()), inetSocketAddress); - } catch (UnknownHostException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/UnSubscribeCommandListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/UnSubscribeCommandListener.java deleted file mode 100644 index 11d9d55cb0f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/UnSubscribeCommandListener.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.net.UnknownHostException; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.commands.UnSubscribeToMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; -import org.eclipse.osee.ote.remote.messages.SerializedUnSubscribeMessage; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class UnSubscribeCommandListener implements EventHandler { - - private final IRemoteMessageService messageService; - private final SerializedUnSubscribeMessage cmd; - - public UnSubscribeCommandListener(EventAdmin eventAdmin, IRemoteMessageService messageService) { - this.messageService = messageService; - cmd = new SerializedUnSubscribeMessage(); - } - - @Override - public void handleEvent(Event event) { - OteEventMessageUtil.putBytes(event, cmd); - UnSubscribeToMessage unsubscribe; - try { - unsubscribe = cmd.getObject(); - messageService.unsubscribeToMessage(unsubscribe); - } catch (UnknownHostException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } catch (IOException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } catch (ClassNotFoundException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ZeroizeElementCommandListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ZeroizeElementCommandListener.java deleted file mode 100644 index 8bf3f9bafb3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/ZeroizeElementCommandListener.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.eclipse.osee.ote.internal; - -import java.io.IOException; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.commands.ZeroizeElement; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService; -import org.eclipse.osee.ote.remote.messages.SerializedZeroizeElementMessage; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class ZeroizeElementCommandListener implements EventHandler { - - private final IRemoteMessageService messageService; - - public ZeroizeElementCommandListener(EventAdmin eventAdmin, IRemoteMessageService messageService) { - this.messageService = messageService; - } - - @Override - public void handleEvent(Event arg0) { - ZeroizeElement cmd; - try { - SerializedZeroizeElementMessage msg = new SerializedZeroizeElementMessage(OteEventMessageUtil.getBytes(arg0)); - cmd = msg.getObject(); - messageService.zeroizeElement(cmd); - } catch (IOException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } catch (ClassNotFoundException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/endpoint/EndpointComponent.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/endpoint/EndpointComponent.java deleted file mode 100644 index 05bb97ae9b9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/endpoint/EndpointComponent.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.eclipse.osee.ote.internal.endpoint; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.util.HashMap; -import org.eclipse.osee.framework.jdk.core.util.network.PortUtil; -import org.eclipse.osee.ote.core.CopyOnWriteNoIteratorList; -import org.eclipse.osee.ote.endpoint.EndpointDataProcessor; -import org.eclipse.osee.ote.endpoint.OteEndpointSender; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.endpoint.OteUdpEndpointInlineSender; -import org.eclipse.osee.ote.endpoint.OteUdpEndpointReceiverImpl; -import org.eclipse.osee.ote.endpoint.OteUdpEndpointSender; -import org.eclipse.osee.ote.properties.OtePropertiesCore; - -public class EndpointComponent implements OteUdpEndpoint { - - private OteUdpEndpointReceiverImpl receiver; - private HashMap<InetSocketAddress, OteUdpEndpointSender> senders = new HashMap<>(); - private CopyOnWriteNoIteratorList<OteUdpEndpointSender> broadcastThreaded = - new CopyOnWriteNoIteratorList<>(OteUdpEndpointSender.class);//for backwards compatibility - private boolean debug = false; - - public EndpointComponent() { - int port; - try { - String strPort = - OtePropertiesCore.endpointPort.getValue(Integer.toString(PortUtil.getInstance().getValidPort())); - try { - port = Integer.parseInt(strPort); - } catch (Throwable th) { - port = PortUtil.getInstance().getValidPort(); - } - receiver = new OteUdpEndpointReceiverImpl(new InetSocketAddress(InetAddress.getLocalHost(), port)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void start() { - receiver.start(); - setDebugOutput(false); - } - - public synchronized void stop() { - receiver.stop(); - for (OteEndpointSender sender : senders.values()) { - try { - sender.stop(); - } catch (Throwable e) { - e.printStackTrace(); - } - } - } - - @Override - public void setDebugOutput(boolean debug) { - String ioRedirect = OtePropertiesCore.ioRedirect.getValue(); - if (ioRedirect != null) { - if (Boolean.parseBoolean(ioRedirect)) { - this.debug = false; - System.out.println("Unable to enable Endpoint debug because -Dote.io.redirect is enabled."); - return; - } - } - this.debug = debug; - receiver.setDebugOutput(debug); - for (OteUdpEndpointSender sender : senders.values()) { - sender.setDebug(debug); - } - } - - @Override - public InetSocketAddress getLocalEndpoint() { - return receiver.getEndpoint(); - } - - @Override - public synchronized OteUdpEndpointSender getOteEndpointThreadedSender(InetSocketAddress address) { - OteUdpEndpointSender sender = senders.get(address); - if (sender == null || sender.isClosed()) { - sender = new OteUdpEndpointSender(address); - sender.setDebug(debug); - sender.start(); - senders.put(address, sender); - } - return sender; - } - - @Override - public OteUdpEndpointInlineSender getOteEndpointInlineSender(InetSocketAddress address) { - return new OteUdpEndpointInlineSender(address); - } - - @Override - public synchronized OteUdpEndpointSender getOteEndpointSender(InetSocketAddress address) { - return getOteEndpointThreadedSender(address); - } - - @Override - public void addBroadcast(OteUdpEndpointSender sender) { - if (!isAlreadyInBroadcastThreadedList(sender) && sender instanceof OteUdpEndpointSender) { - broadcastThreaded.add((OteUdpEndpointSender) sender); - } - } - - private boolean isAlreadyInBroadcastThreadedList(OteEndpointSender sender) { - OteEndpointSender[] oteUdpEndpointSenders = broadcastThreaded.get(); - for (int i = 0; i < oteUdpEndpointSenders.length; i++) { - if (oteUdpEndpointSenders[i].getAddress().getPort() == sender.getAddress().getPort()) { - if (oteUdpEndpointSenders[i].getAddress().getAddress().equals(sender.getAddress().getAddress())) { - return true; - } - } - } - return false; - } - - @Override - public CopyOnWriteNoIteratorList<OteUdpEndpointSender> getBroadcastSenders() { - return broadcastThreaded; - } - - @Override - public void addDataProcessor(EndpointDataProcessor processor) { - receiver.addDataProcessor(processor); - } - - @Override - public void removeDataProcessor(EndpointDataProcessor processor) { - receiver.removeDataProcessor(processor); - } - - @Override - public void removeBroadcast(OteUdpEndpointSender sender) { - broadcastThreaded.remove(sender); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/NotifyOnResponse.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/NotifyOnResponse.java deleted file mode 100644 index ec37344e5e1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/NotifyOnResponse.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.internal.message.event.send; - -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.Lock; - -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.osgi.framework.ServiceRegistration; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventHandler; - - -public class NotifyOnResponse<T extends OteEventMessage> implements EventHandler { - - private final int responseId; - private final Condition responseReceived; - private final Lock lock; - private final Class<T> clazz; - private T recievedMessage; - private volatile boolean responded = false; - private final ServiceRegistration<EventHandler> reg; - private T responseMessage; - - public NotifyOnResponse(Class<T> clazz, String responseTopic, int responseId, Lock lock, Condition responseReceived) { - this.responseId = responseId; - this.clazz = clazz; - this.responseReceived = responseReceived; - this.lock = lock; - reg = OteEventMessageUtil.subscribe(responseTopic, this); - } - - @SuppressWarnings("unchecked") - public NotifyOnResponse(T responseMessage, int responseId2, Lock lock2, Condition responseReceived2) { - this((Class<T>)responseMessage.getClass(), responseMessage.getHeader().TOPIC.getValue(), responseId2, lock2, responseReceived2); - this.responseMessage = responseMessage; - } - - @Override - public void handleEvent(Event event) { - try { - if(responseMessage == null){ - recievedMessage = clazz.newInstance(); - } else { - recievedMessage = responseMessage; - } - OteEventMessageUtil.putBytes(event, recievedMessage); - if(recievedMessage.getHeader().RESPONSE_ID.getValue() == responseId){ - lock.lock(); - try{ - responded = true; - responseReceived.signal(); - }finally{ - lock.unlock(); - } - } else { - recievedMessage = null; - } - } catch (InstantiationException e) { - recievedMessage = null; - e.printStackTrace(); - } catch (IllegalAccessException e) { - recievedMessage = null; - e.printStackTrace(); - } - } - - public boolean hasResponse(){ - return responded; - } - - public T getMessage(){ - return recievedMessage; - } - - public void dispose(){ - reg.unregister(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/OteEventMessageFutureImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/OteEventMessageFutureImpl.java deleted file mode 100644 index 4d5a906d48d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/OteEventMessageFutureImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.internal.message.event.send; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.ReentrantLock; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.event.send.OteEventMessageCallable; -import org.eclipse.osee.ote.message.event.send.OteEventMessageFuture; -import org.osgi.framework.ServiceRegistration; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventHandler; - - -public class OteEventMessageFutureImpl<T extends OteEventMessage, R extends OteEventMessage> implements OteEventMessageFuture<T, R>, EventHandler{ - - private final ServiceRegistration<EventHandler> reg; - protected final OteEventMessageCallable<T, R> callable; - protected final Class<R> recieveClasstype; - protected final int responseId; - protected final T sentMessage; - private final ScheduledExecutorService ex; - private final ReentrantLock lock; - private final Condition condition; - private final ScheduledFuture<?> wakeup; - private TimeoutRunnable<T, R> timeoutRunnable; - protected volatile boolean gotResponse = false; - protected volatile boolean isDone = false; - - public OteEventMessageFutureImpl(Class<R> recieveClasstype, OteEventMessageCallable<T, R> callable, T sentMessage, String responseTopic, int responseId, long timeout) { - this.callable = callable; - this.responseId = responseId; - this.sentMessage = sentMessage; - this.recieveClasstype = recieveClasstype; - reg = OteEventMessageUtil.subscribe(responseTopic, this); - lock = new ReentrantLock(); - condition = lock.newCondition(); - ex = Executors.newSingleThreadScheduledExecutor(new ThreadFactory(){ - @Override - public Thread newThread(Runnable arg0) { - Thread th = new Thread(arg0); - th.setDaemon(true); - th.setName("OteEventMessage Timeout"); - return th; - } - }); - timeoutRunnable = new TimeoutRunnable<>(lock, condition, sentMessage, callable, this); - wakeup = ex.schedule(timeoutRunnable, timeout, TimeUnit.MILLISECONDS); - } - - @Override - public void handleEvent(Event event) { - try { - R msg = recieveClasstype.newInstance(); - OteEventMessageUtil.putBytes(event, msg); - if(msg.getHeader().RESPONSE_ID.getValue() == responseId){ - cancel(); - gotResponse = true; - callable.call(sentMessage, msg, this); - executeCondition(); - } - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - } - - protected final void executeCondition(){ - lock.lock(); - try{ - condition.signal(); - } finally { - lock.unlock(); - } - } - - @Override - public void cancel(){ - dispose(); - } - - @Override - public void waitForCompletion(){ - lock.lock(); - try{ - while(!timeoutRunnable.isTimedOut() && !this.wakeup.isDone()){ - try { - condition.await(); - } catch (InterruptedException e) { - OseeLog.log(getClass(), Level.SEVERE, e); - } - } - } finally { - lock.unlock(); - } - } - - @Override - public boolean isTimedOut(){ - return timeoutRunnable.isTimedOut(); - } - - @Override - public boolean gotResponse(){ - return gotResponse ; - } - - @Override - public void complete(){ - cancel(); - executeCondition(); - } - - private void dispose(){ - reg.unregister(); - wakeup.cancel(false); - this.ex.shutdown(); - isDone = true; - } - - @Override - public boolean isDone() { - return isDone; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/OteEventMessageFutureMultipleResponseImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/OteEventMessageFutureMultipleResponseImpl.java deleted file mode 100644 index fafd13ba4be..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/OteEventMessageFutureMultipleResponseImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.internal.message.event.send; - -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.event.send.OteEventMessageCallable; -import org.osgi.service.event.Event; - - -public class OteEventMessageFutureMultipleResponseImpl<T extends OteEventMessage, R extends OteEventMessage> extends OteEventMessageFutureImpl<T, R> { - - - public OteEventMessageFutureMultipleResponseImpl(Class<R> recieveClasstype, OteEventMessageCallable<T, R> callable, T sentMessage, String responseTopic, int responseId, long timeout) { - super(recieveClasstype, callable, sentMessage, responseTopic, responseId, timeout); - } - - @Override - public void handleEvent(Event event) { - try { - R msg = recieveClasstype.newInstance(); - OteEventMessageUtil.putBytes(event, msg); - callable.call(sentMessage, msg, this); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/OteEventMessageResponseFutureImpl.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/OteEventMessageResponseFutureImpl.java deleted file mode 100644 index 128ce15a8e7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/OteEventMessageResponseFutureImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.internal.message.event.send; - -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.eclipse.osee.ote.message.event.send.OteEventMessageResponseCallable; -import org.eclipse.osee.ote.message.event.send.OteEventMessageResponseFuture; -import org.osgi.framework.ServiceRegistration; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventHandler; - - -public class OteEventMessageResponseFutureImpl<R extends OteEventMessage> implements OteEventMessageResponseFuture<R>, EventHandler { - private final ServiceRegistration<EventHandler> reg; - private final OteEventMessageResponseCallable<R> callable; - private final Class<R> recieveClasstype; - - public OteEventMessageResponseFutureImpl(Class<R> recieveClasstype, OteEventMessageResponseCallable<R> callable, String responseTopic) { - this.callable = callable; - this.recieveClasstype = recieveClasstype; - reg = OteEventMessageUtil.subscribe(responseTopic, this); - } - - @Override - public void handleEvent(Event event) { - try { - R msg = recieveClasstype.newInstance(); - OteEventMessageUtil.putBytes(event, msg); - callable.call(msg); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - } - - @Override - public void cancel(){ - dispose(); - } - - private void dispose(){ - reg.unregister(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/TimeoutRunnable.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/TimeoutRunnable.java deleted file mode 100644 index 3681e2cea1f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/internal/message/event/send/TimeoutRunnable.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.internal.message.event.send; - -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.send.OteEventMessageCallable; - - -public class TimeoutRunnable<T extends OteEventMessage, R extends OteEventMessage> implements Runnable { - - private final ReentrantLock lock; - private final Condition condition; - private final T sentMessage; - private boolean timedOut = false; - private final OteEventMessageCallable<T, R> callable; - private final OteEventMessageFutureImpl<T, R> oteByteMessageFuture; - - public TimeoutRunnable(ReentrantLock lock, Condition condition, T sentMessage, OteEventMessageCallable<T, R> callable, OteEventMessageFutureImpl<T, R> oteByteMessageFuture) { - this.lock = lock; - this.condition = condition; - this.sentMessage = sentMessage; - this.callable = callable; - this.oteByteMessageFuture = oteByteMessageFuture; - } - - @Override - public void run() { - lock.lock(); - try{ - timedOut = true; - try{ - oteByteMessageFuture.cancel(); - callable.timeout(sentMessage); - } finally { - condition.signal(); - } - } finally { - lock.unlock(); - } - } - - public boolean isTimedOut(){ - return timedOut; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/ElementPath.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/ElementPath.java deleted file mode 100644 index a6247f96d58..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/ElementPath.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -/** - * @author Ken J. Aguilar - */ -public class ElementPath implements Serializable { - - private static final long serialVersionUID = 4928814252711879251L; - - private final List<Object> elementPath; - private String elementPathAsString = null; - private final boolean isHeaderElement; - - public static ElementPath decode(String encodedPath) { - List<Object> path = new LinkedList<>(); - String[] components = encodedPath.split("\\+"); - - for (String component : components) { - try { - Integer i = Integer.parseInt(component); - path.add(i); - } catch (NumberFormatException e) { - path.add(component); - } - } - - return new ElementPath(path); - } - - public String getMessageClass() { - return elementPath.get(0).toString(); - } - - public boolean isHeaderElement() { - return isHeaderElement; - } - - public String getElementName() { - return elementPath.get(elementPath.size() - 1).toString(); - } - - public ElementPath(List<Object> path) { - elementPath = path; - String string = (String) path.get(1); - isHeaderElement = string.startsWith("HEADER("); - - } - - public List<Object> getList() { - return elementPath; - } - - @Override - public String toString() { - if (elementPathAsString == null) { - StringBuilder sb = new StringBuilder(64); - if (isHeaderElement) { - String string = (String) elementPath.get(1); - String headerName = string.substring(string.indexOf('(') + 1, string.indexOf(')')); - sb.append(headerName).append("-HEADER").append('.').append(elementPath.get(2).toString()); - } else { - for (int i = 1; i < elementPath.size(); i++) { - Object obj = elementPath.get(i); - if (obj instanceof Integer) { - sb.delete(sb.length() - 1, sb.length()); - sb.append('['); - sb.append(((Integer) obj).intValue()); - sb.append(']'); - } else { - - sb.append(obj.toString()); - } - sb.append('.'); - } - sb.deleteCharAt(sb.length() - 1); - } - elementPathAsString = sb.toString(); - } - return elementPathAsString; - } - - public String encode() { - - StringBuilder buffer = new StringBuilder(256); - for (Object component : elementPath) { - buffer.append(component.toString()); - buffer.append('+'); - } - buffer.deleteCharAt(buffer.length() - 1); - return buffer.toString(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IInstrumentationRegistrationListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IInstrumentationRegistrationListener.java deleted file mode 100644 index 4da5002cf3a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IInstrumentationRegistrationListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import org.eclipse.osee.ote.message.instrumentation.IOInstrumentation; - -/** - * @author Ken J. Aguilar - */ -public interface IInstrumentationRegistrationListener extends Remote { - void onRegistered(String name, IOInstrumentation instrumentation) throws RemoteException; - - void onDeregistered(String name) throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMemSourceChangeListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMemSourceChangeListener.java deleted file mode 100644 index b1201bb221a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMemSourceChangeListener.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IMemSourceChangeListener { - void onChange(DataType oldtype, DataType newType, Message<?, ?, ?> message); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageDisposeListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageDisposeListener.java deleted file mode 100644 index 2f4a38183bf..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageDisposeListener.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IMessageDisposeListener { - void onPreDispose(Message<?, ?, ?> message); - - void onPostDispose(Message<?, ?, ?> message); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageHeader.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageHeader.java deleted file mode 100644 index c0988c17324..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageHeader.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import org.eclipse.osee.ote.message.elements.Element; - -/** - * Defines operations for setting and getting the raw bytes that comprise a message header as well as getting the name - * of the message that the header is attached to - * - * @author Ken J. Aguilar - */ -public interface IMessageHeader { - public String getMessageName(); - - public int getHeaderSize(); - - /** - * Sets the data that backs this header. - */ - // public void copyData(byte[] data); - public byte[] getData(); - - public Element[] getElements(); - - public void setNewBackingBuffer(byte[] data); - - public String toXml(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageSendListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageSendListener.java deleted file mode 100644 index 729ec990efc..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageSendListener.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import org.eclipse.osee.ote.message.data.MessageData; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IMessageSendListener { - void onPreSend(MessageData messageData); - - void onPostSend(MessageData messageData); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java deleted file mode 100644 index e4fe4218693..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IMessageTestContext.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import org.eclipse.osee.ote.Configuration; -import org.eclipse.osee.ote.core.framework.command.ITestContext; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IMessageTestContext extends ITestContext { - void resetScriptLoader(Configuration configuration, String[] strings) throws Exception; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IOInstrumentationDB.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IOInstrumentationDB.java deleted file mode 100644 index 5ea7b84f05f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IOInstrumentationDB.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArraySet; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.instrumentation.IOInstrumentation; - -/** - * @author Andrew M. Finkbeiner - */ -public class IOInstrumentationDB { - - private final Map<String, IOInstrumentation> ioInstrumentation = new ConcurrentHashMap<>();; - private final CopyOnWriteArraySet<IInstrumentationRegistrationListener> listeners = - new CopyOnWriteArraySet<IInstrumentationRegistrationListener>(); - - IOInstrumentationDB() { - } - - public IOInstrumentation getIOInstrumentation(String name) {//, IOInstrumentation io){ - return ioInstrumentation.get(name); - } - - public IOInstrumentation registerIOInstrumentation(String name, IOInstrumentation io) { - IOInstrumentation old = ioInstrumentation.put(name, io); - if (old != io) { - notifyRegistration(name, io); - } - return old; - } - - public void unregisterIOInstrumentation(String name) { - IOInstrumentation io = ioInstrumentation.remove(name); - if (io != null) { - notifyDeregistration(name); - } - } - - public void addRegistrationListener(IInstrumentationRegistrationListener listener) { - listeners.add(listener); - for (Map.Entry<String, IOInstrumentation> entry : ioInstrumentation.entrySet()) { - try { - listener.onRegistered(entry.getKey(), entry.getValue()); - } catch (Exception e) { - OseeLog.log(IOInstrumentation.class, Level.SEVERE, - "exception notifying listener of IO instrumentation registration", e); - } - } - } - - public void removeRegistrationListener(IInstrumentationRegistrationListener listener) { - listeners.remove(listener); - } - - private void notifyRegistration(String name, IOInstrumentation io) { - for (IInstrumentationRegistrationListener listener : listeners) { - try { - listener.onRegistered(name, io); - } catch (Exception e) { - OseeLog.log(IOInstrumentation.class, Level.SEVERE, - "exception notifying listener of IO instrumentation registration", e); - } - } - } - - private void notifyDeregistration(String name) { - for (IInstrumentationRegistrationListener listener : listeners) { - try { - listener.onDeregistered(name); - } catch (Exception e) { - OseeLog.log(IOInstrumentation.class, Level.SEVERE, - "exception notifying listener of IO instrumentation de-registration", e); - } - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IOteIO.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IOteIO.java deleted file mode 100644 index 7d6ee9d6cb4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IOteIO.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IOteIO { - void send(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IPreScriptInstantiation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IPreScriptInstantiation.java deleted file mode 100644 index 11888ad4da8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/IPreScriptInstantiation.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IPreScriptInstantiation { - void run(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/Message.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/Message.java deleted file mode 100644 index 4f1c163a6dc..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/Message.java +++ /dev/null @@ -1,1335 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicLong; -import java.util.logging.Level; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import org.codehaus.jackson.annotate.JsonProperty; -import org.eclipse.osee.framework.jdk.core.persistence.Xmlizable; -import org.eclipse.osee.framework.jdk.core.persistence.XmlizableStream; -import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; -import org.eclipse.osee.framework.jdk.core.util.xml.XMLStreamWriterUtil; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.GCHelper; -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckPoint; -import org.eclipse.osee.ote.message.condition.ICondition; -import org.eclipse.osee.ote.message.condition.TransmissionCountCondition; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.Element; -import org.eclipse.osee.ote.message.elements.MsgWaitResult; -import org.eclipse.osee.ote.message.elements.RecordElement; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.interfaces.IMessageManager; -import org.eclipse.osee.ote.message.interfaces.IMessageRequestor; -import org.eclipse.osee.ote.message.interfaces.IMessageScheduleChangeListener; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; -import org.eclipse.osee.ote.message.interfaces.ITestEnvironmentMessageSystemAccessor; -import org.eclipse.osee.ote.message.listener.IOSEEMessageListener; -import org.eclipse.osee.ote.message.listener.MessageSystemListener; -import org.eclipse.osee.ote.message.tool.MessageMode; -import org.w3c.dom.Document; - -/** - * @author Andrew M. Finkbeiner - */ -public abstract class Message<S extends ITestEnvironmentMessageSystemAccessor, T extends MessageData, U extends Message<S, T, U>> implements Xmlizable, XmlizableStream { - private static volatile AtomicLong constructed = new AtomicLong(0); - private static volatile AtomicLong finalized = new AtomicLong(0); - private final LinkedHashMap<String, Element> elementMap; - @JsonProperty - private final String name; - private final MessageSystemListener listenerHandler; - protected final ArrayList<IMessageScheduleChangeListener> schedulingChangeListeners = - new ArrayList<IMessageScheduleChangeListener>(10); - private boolean destroyed = false; - - private DataType currentMemType; - private final Map<DataType, ArrayList<U>> memTypeToMessageMap = new HashMap<>(); - private final Map<DataType, ArrayList<T>> memToDataMap = new HashMap<>(); - private final int phase; - protected double rate; - protected final double defaultRate; - private final boolean isScheduledFromStart; - private boolean regularUnscheduleCalled = false; - private boolean isTurnedOff = false; - - @SuppressWarnings("rawtypes") - private IMessageRequestor messageRequestor = null; - private static final double doubleTolerance = 0.000001; - private final Set<DataType> memTypeActive = new HashSet<>(); - - private T defaultMessageData; - - private final List<IMemSourceChangeListener> preMemSourceChangeListeners = new CopyOnWriteArrayList<>(); - private final List<IMemSourceChangeListener> postMemSourceChangeListeners = - new CopyOnWriteArrayList<IMemSourceChangeListener>(); - private final List<IMessageDisposeListener> preMessageDisposeListeners = new CopyOnWriteArrayList<>(); - private final List<IMessageDisposeListener> postMessageDisposeListeners = new CopyOnWriteArrayList<>(); - - private final int defaultByteSize; - private final int defaultOffset; - - protected final MessageSystemListener removableListenerHandler; - - public Message(String name, int defaultByteSize, int defaultOffset, boolean isScheduled, int phase, double rate) { - constructed.incrementAndGet(); - listenerHandler = new MessageSystemListener(this); - this.name = name; - this.defaultByteSize = defaultByteSize; - this.defaultOffset = defaultOffset; - elementMap = new LinkedHashMap<>(20); - this.phase = phase; - this.rate = rate; - this.defaultRate = rate; - this.isScheduledFromStart = isScheduled; - GCHelper.getGCHelper().addRefWatch(this); - this.removableListenerHandler = new MessageSystemListener(this); - } - - /** - * Attemps to remove the specified listener from the list of REMOVABLE listeners. This will NOT remove any listener - * added using the addListener() call, only those added using the addRemovableListener() call will be removed. - * - * @param listener The removable listener to remove - */ - public void removeRemovableListener(IOSEEMessageListener listener) { - removableListenerHandler.removeListener(listener); - } - - /** - * Adds listener to the list of listeners removed at the end of every script. - * - * @param listener the removable listern to add. - */ - public void addRemovableListener(IOSEEMessageListener listener) { - removableListenerHandler.addListener(listener); - } - - /** - * Removes all the listeners from the RemovableListenerHandler. This method is meant to be called upon script - * completion but can be used by anyone. Other listeners can be removed using the traditional removeListener call. - */ - public void clearRemovableListeners() { - this.removableListenerHandler.clearListeners(); - - } - - public void destroy() { - - notifyPreDestroyListeners(); - destroyed = true; - defaultMessageData.dispose(); - - memToDataMap.clear(); - memTypeToMessageMap.clear(); - listenerHandler.dispose(); - - notifyPostDestroyListeners(); - schedulingChangeListeners.clear(); - postMessageDisposeListeners.clear(); - preMessageDisposeListeners.clear(); - postMemSourceChangeListeners.clear(); - preMemSourceChangeListeners.clear(); - elementMap.clear(); - - if (messageRequestor != null) { - messageRequestor.dispose(); - } - removableListenerHandler.dispose(); - } - - private void notifyPostDestroyListeners() { - for (IMessageDisposeListener listener : postMessageDisposeListeners) { - listener.onPostDispose(this); - } - } - - private void notifyPreDestroyListeners() { - for (IMessageDisposeListener listener : preMessageDisposeListeners) { - try { - listener.onPreDispose(this); - } catch (Exception e) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, "exception during listener notification", e); - } - } - } - - public void setData(byte[] data) { - checkState(); - if (data == null) { - throw new IllegalArgumentException("data array cannot be null"); - } - for (MessageData msgdata : memToDataMap.get(currentMemType)) { - msgdata.setFromByteArray(data); - } - } - - public void setData(ByteBuffer data, int length) { - checkState(); - if (data == null) { - throw new IllegalArgumentException("data array cannot be null"); - } - for (MessageData msgdata : memToDataMap.get(currentMemType)) { - msgdata.setFromByteArray(data, length); - } - } - - public void setData(byte[] data, int length) { - checkState(); - if (data == null) { - throw new IllegalArgumentException("data array cannot be null"); - } - for (MessageData msgdata : memToDataMap.get(currentMemType)) { - msgdata.setFromByteArray(data, length); - } - } - - public void setBackingBuffer(byte[] data) { - checkState(); - if (data == null) { - throw new IllegalArgumentException("data array cannot be null"); - } - for (MessageData msgdata : memToDataMap.get(currentMemType)) { - msgdata.setNewBackingBuffer(data); - } - } - - public byte[] getData() { - checkState(); - return getActiveDataSource().toByteArray(); - } - - public T getMemoryResource() { - checkState(); - return memToDataMap.get(currentMemType).get(0); - } - - /** - * Returns the number of byte words in the payload of this message. - * - * @return number of bytes in the message payload - */ - public int getPayloadSize() { - checkState(); - return memToDataMap.get(currentMemType).get(0).getPayloadSize(); - } - - public int getPayloadSize(DataType type) { - checkState(); - return memToDataMap.get(type).get(0).getPayloadSize(); - } - - /** - * Returns the number of byte words in the header of this message. - * - * @return the number of bytes in the header - */ - public int getHeaderSize() { - checkState(); - final IMessageHeader hdr = memToDataMap.get(currentMemType).get(0).getMsgHeader(); - if (hdr != null) { - return hdr.getHeaderSize(); - } - return 0; - } - - public int getHeaderSize(DataType type) { - checkState(); - return memToDataMap.get(type).get(0).getMsgHeader().getHeaderSize(); - } - - /* - * protected static final ThreadLocal current = new ThreadLocal() { protected Object initialValue() { return new - * MemMessageHolder(); } }; - */ - public void send() throws MessageSystemException { - checkState(); - if (!isTurnedOff) { - ArrayList<T> dataList = memToDataMap.get(currentMemType); - if (dataList != null) { - int listSize = dataList.size(); - for (int i = 0; i < listSize; i++) { - dataList.get(i).send(); - } - } else { - throw new MessageSystemException( - "Message: " + name + " does not have the physical type " + currentMemType + " available for this environment!!!!!", - Level.SEVERE); - } - } - } - - public void addSendListener(IMessageSendListener listener) { - getActiveDataSource().addSendListener(listener); - } - - public void removeSendListener(IMessageSendListener listener) { - getActiveDataSource().removeSendListener(listener); - } - - public boolean containsSendListener(IMessageSendListener listener) { - return getActiveDataSource().containsSendListener(listener); - } - - public void send(DataType type) throws MessageSystemException { - checkState(); - if (!isTurnedOff) { - Collection<T> dataList = memToDataMap.get(type); - if (dataList != null) { - - for (T data : dataList) { - data.send(); - } - - } else { - throw new MessageSystemException( - "Message: " + name + " does not have a physical type available for this environment!!!!!", Level.SEVERE); - } - } else { - OseeLog.log(MessageSystemTestEnvironment.class, Level.WARNING, - this.getMessageName() + " has attempted a send(), but is currently turned off."); - } - } - - // we may not really need this guy, in fact I think we don't - // protected void takeNextSample() { - // for (T item : memToDataMap.get(currentMemType)) { - // item.takeNextSample(); - // } - // } - - public boolean setMemSource(S accessor, DataType type) { - return setMemSource(type); - } - - /** - * Associates Messages to MemTypes based on the memType's physical availability - */ - // public abstract void associateMessages(S accessor); - /** - * Changes the element references for this message to a corresponding message with the given MemType. The messages - * defined for this memType must have been provided by the associateMessages function to be seen. - * - * @param memType the possibly new physical mem type. - */ - public void switchElementAssociation(DataType memType) { - checkState(); - switchElementAssociation(getMessageTypeAssociation(memType)); - } - - // public abstract void switchElementAssociation(Collection<U> messages); - - public void addMessageTypeAssociation(DataType memType, U messageToBeAdded) { - checkState(); - ArrayList<U> list; - if (!memTypeToMessageMap.containsKey(memType)) { - list = new ArrayList<>(4); - memTypeToMessageMap.put(memType, list); - } else { - list = memTypeToMessageMap.get(memType); - } - list.add(messageToBeAdded); - - // addMessageDataSource(messageToBeAdded.defaultMessageData); - } - - protected Collection<U> getMessageTypeAssociation(DataType type) { - final ArrayList<U> list = memTypeToMessageMap.get(type); - if (list != null) { - return Collections.unmodifiableCollection(list); - } else { - return new ArrayList<U>(); - } - } - - public void addMessageDataSource(T... dataList) { - checkState(); - for (T data : dataList) { - addMessageDataSource(data); - } - } - - public void addMessageDataSource(Collection<T> dataList) { - for (T data : dataList) { - addMessageDataSource(data); - } - } - - protected void addMessageDataSource(T data) { - final DataType type = data.getType(); - final ArrayList<T> list; - if (!memToDataMap.containsKey(type)) { - list = new ArrayList<>(); - memToDataMap.put(type, list); - } else { - list = memToDataMap.get(type); - } - list.add(data); - data.addMessage(this); - } - - public Collection<T> getMemSource(DataType type) { - checkState(); - final ArrayList<T> list = memToDataMap.get(type); - if (list != null) { - return Collections.unmodifiableCollection(list); - } else { - return new ArrayList<T>(); - } - } - - public boolean getMemSource(DataType type, Collection<T> listToAddto) { - checkState(); - final ArrayList<T> list = memToDataMap.get(type); - if (list != null) { - return listToAddto.addAll(list); - } - return false; - } - - public DataType getMemType() { - return currentMemType; - } - - public void addElement(Element element) { - checkState(); - elementMap.put(element.getName(), element); - } - - /** - * Gets a list of all the message's data elements. <br> - * This returns ALL the elements, which may not be mapped to the active data type and/or may be non-mapping elements. - * Use {@link #getElements(DataType)} to get mapped elements - * - * @return a collection of {@link Element}s - */ - public Collection<Element> getElements() { - checkState(); - return elementMap.values(); - } - - public void getAllElements(Collection<Element> elements) { - checkState(); - IMessageHeader header = getActiveDataSource().getMsgHeader(); - if (header != null) { - Collections.addAll(elements, header.getElements()); - } - elements.addAll(elementMap.values()); - - } - - /** - * @return a collection of mapped {@link Element}s for the specified DataType - */ - public Collection<Element> getElements(DataType type) { - checkState(); - LinkedList<Element> list = new LinkedList<>(); - for (Element element : elementMap.values()) { - Element e = element.switchMessages(getMessageTypeAssociation(type)); - if (!e.isNonMappingElement()) { - list.add(e); - } - } - return list; - } - - /** - * @return true if the Message contains an element with the given name, false otherwise - */ - public boolean hasElement(String elementName) { - checkState(); - return elementMap.containsKey(elementName); - } - - /** - * @return HashMap<String, Element> - */ - public HashMap<String, Element> getElementMap() { - checkState(); - return elementMap; - } - - /** - * @param elementName the name of the element as defined in the message ( All caps ). - * @return the element associated with the given name - * @throws IllegalArgumentException if an element doesn't exist with given name. Use {@link #hasElement(String)} with - * any use of this function. - */ - public Element getElement(String elementName) { - return getElement(elementName, currentMemType); - } - - public <E extends Element> E getElement(String elementName, Class<E> clazz) { - checkState(); - return clazz.cast(getElement(elementName, currentMemType)); - } - - public boolean hasElement(List<Object> elementPath) { - return getElement(elementPath) != null; - } - - public Element getElement(List<Object> elementPath) { - checkState(); - Element el = null; - RecordElement rel = null; - if (elementPath.size() == 1) { - el = elementMap.get(elementPath.get(0)); - } else { - String string = (String) elementPath.get(1); - if (string.startsWith("HEADER(")) { - Element[] elements = getActiveDataSource(currentMemType).getMsgHeader().getElements(); - for (Element element : elements) { - if (element.getName().equals(elementPath.get(2))) { - return element; - } - } - return null; - } else { - el = this.elementMap.get(string); - if (el instanceof RecordElement) { - rel = (RecordElement) el; - } - } - for (int i = 2; i < elementPath.size(); i++) { - if (elementPath.get(i) instanceof String) { - String name = (String) elementPath.get(i); - if (rel != null) { - el = rel.getElementMap().get(name); - } - if (el instanceof RecordElement) { - rel = (RecordElement) el; - } - } else if (elementPath.get(i) instanceof Integer) { - Integer index = (Integer) elementPath.get(i); - if (rel != null) { - rel = rel.get(index); - } - el = rel; - } - } - } - return el; - } - - public Element getElement(List<Object> elementPath, DataType type) { - Element element = getElement(elementPath); - if (element == null) { - return null; - } - return element.switchMessages(this.getMessageTypeAssociation(type)); - } - - /** - * @return the element associated with the given name - * @throws IllegalArgumentException if an element doesn't exist with given name. Use {@link #hasElement(String)} with - * any use of this function. - */ - public Element getElement(String elementName, DataType type) { - checkState(); - Element retVal = elementMap.get(elementName); - if (retVal != null) { - return retVal.switchMessages(this.getMessageTypeAssociation(type)); - } - return null; - - } - - public Element getBodyOrHeaderElement(String elementName) { - return getBodyOrHeaderElement(elementName, currentMemType); - } - - public Element getBodyOrHeaderElement(String elementName, DataType type) { - checkState(); - Element e = elementMap.get(elementName); - if (e == null) { - Element[] elements = getActiveDataSource(type).getMsgHeader().getElements(); - for (Element element : elements) { - if (element.getName().equals(elementName)) { - return element; - } - } - } else { - e = e.switchMessages(this.getMessageTypeAssociation(type)); - } - return e; - } - - /** - * Turning off a message causes sends to be short-circuited and the message to be unscheduled. - */ - public void turnOff() { - checkState(); - isTurnedOff = true; - unschedule(); - } - - /** - * Turning on message allows sends to work again & reschedules message if that is the default state defined by the - * message constructor call. - */ - public void turnOn() { - checkState(); - isTurnedOff = false; - if (isScheduledFromStart()) { - schedule(); - } - } - - /** - * This is the turnOn being called from the method register in MessageCollection. Messages shouldn't be scheduled at - * this point b/c the control message hasn't gone out yet. Messages can't go out until the control message goes out - * the first time so that collisions in the box are avoided. - */ - public void whenBeingRegisteredTurnOn() { - isTurnedOff = false; - } - - /** - * Returns if the message is turned off. - */ - public boolean isTurnedOff() { - return isTurnedOff; - } - - private void setSchedule(boolean newValue) { - ArrayList<T> dataList = memToDataMap.get(currentMemType); - for (T d : dataList) { - d.setScheduled(newValue); - } - } - - /** - * This method schedules the message. There is also some code that allows the scheduled state to be updated in - * Message Watch. - */ - public void schedule() { - checkState(); - if (!isTurnedOff) { - setSchedule(true); - regularUnscheduleCalled = false; - for (IMessageScheduleChangeListener listener : schedulingChangeListeners) { - listener.isScheduledChanged(true); - } - } - } - - /** - * This method unschedules the message. The variable regularUnscheduledCalled is used to preserve unschedules that - * are called in constructors, which is before the control message goes out for the first time. - */ - public void unschedule() { - checkState(); - setSchedule(false); - regularUnscheduleCalled = true; - for (IMessageScheduleChangeListener listener : schedulingChangeListeners) { - listener.isScheduledChanged(false); - } - } - - /** - * Returns if the message is scheduled or not. - */ - @Deprecated - public boolean isScheduled() { - ArrayList<T> dataList = memToDataMap.get(currentMemType); - for (T d : dataList) { - if (!d.isScheduled()) { - return false; - } - } - return true; - } - - /** - * This is called at the end of a script run to reset the "hard" unschedule variable that is used to preserve - * unschedules called in constructors. - */ - public void resetScheduling() { - regularUnscheduleCalled = false; - - } - - /** - * @return - double - rate of message - */ - public double getRate() { - return rate; - } - - /** - * @return - int - phase of message - */ - public int getPhase() { - return phase; - } - - public MessageSystemListener getListener() { - return listenerHandler; - } - - public MessageSystemListener getRemoveableListener() { - return removableListenerHandler; - } - - public void addListener(IOSEEMessageListener listener) { - listenerHandler.addListener(listener); - } - - public boolean removeListener(IOSEEMessageListener listener) { - return listenerHandler.removeListener(listener); - } - - /** - * Notifies all registered listeners of an update. - * <P> - * <B>NOTE: </B>Should only be called from sub classes of {@link MessageData} - * - * @param data the Message Data object that has been updated - * @param type the memtype of the message data object - */ - public void notifyListeners(final MessageData data, final DataType type) { - checkState(); - this.listenerHandler.onDataAvailable(data, type); - this.removableListenerHandler.onDataAvailable(data, type); - } - - /* - * public HashMap getTypeToMessageData(){ return typeToMessageData; } - */ - /** - * @return Returns the name. - */ - public String getName() { - return name; - } - - private static final int TransmissionTimeoutDefault = 15000; - - @Override - public String toString() { - return name; - } - - /** - * @return Returns the messageName. - */ - public String getMessageName() { - return name; - } - - @Override - public org.w3c.dom.Element toXml(Document doc) { - org.w3c.dom.Element rootElement = doc.createElement("Message"); - rootElement.appendChild(Jaxp.createElement(doc, "Name", name)); - rootElement.appendChild(Jaxp.createElement(doc, "Type", getMemType().name())); - return rootElement; - } - - @Override - public void toXml(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("Message"); - XMLStreamWriterUtil.writeElement(writer, "Name", name); - XMLStreamWriterUtil.writeElement(writer, "Type", getMemType().name()); - writer.writeEndElement(); - } - - @JsonProperty - public String getType() { - return getMemType().name(); - } - - public void zeroize() { - checkState(); - for (DataType memType : memToDataMap.keySet()) { - for (Element el : getElements(memType)) { - el.zeroize(); - } - } - } - - /** - * Verifies that the message is sent at least once using the default message timeout. DO NOT override this method in - * production code. - * - * @return if the check passed - */ - public boolean checkForTransmission(ITestAccessor accessor) throws InterruptedException { - return checkForTransmission(accessor, TransmissionTimeoutDefault); - } - - /** - * Verifies that the message is sent at least once within the time specified. DO NOT override this method in - * production code. - * - * @param milliseconds the amount to time (in milliseconds) to allow - * @return if the check passed - */ - public boolean checkForTransmission(ITestAccessor accessor, int milliseconds) throws InterruptedException { - return checkForTransmissions(accessor, 1, milliseconds); - } - - /** - * Verifies that the message is sent at least "numTransmission" times within the default message timeout. DO NOT - * override this method in production code. - * - * @param numTransmissions the number of transmissions to look for - * @return if the check passed - */ - public boolean checkForTransmissions(ITestAccessor accessor, int numTransmissions) throws InterruptedException { - return checkForTransmissions(accessor, numTransmissions, TransmissionTimeoutDefault); - } - - /** - * Verifies that the message is sent at least "numTransmission" times within the time specified. - * - * @param numTransmissions the number of transmission to look for - * @param milliseconds the amount to time (in milliseconds) to allow - * @return if the check passed - */ - public boolean checkForTransmissions(ITestAccessor accessor, int numTransmissions, int milliseconds) throws InterruptedException { - checkState(); - accessor.getLogger().methodCalledOnObject(accessor, getMessageName(), - new MethodFormatter().add(numTransmissions).add(milliseconds)); - TransmissionCountCondition c = new TransmissionCountCondition(numTransmissions); - MsgWaitResult result = waitForCondition(accessor, c, false, milliseconds); - CheckPoint passFail = new CheckPoint(this.name, Integer.toString(numTransmissions), - Integer.toString(result.getXmitCount()), result.isPassed(), result.getXmitCount(), result.getElapsedTime()); - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - accessor.getLogger().methodEnded(accessor); - return passFail.isPass(); - } - - /** - * Verifies that the message is not sent within the time specified. - * - * @param milliseconds the amount to time (in milliseconds) to check - * @return if the check passed - */ - public boolean checkForNoTransmissions(ITestEnvironmentMessageSystemAccessor accessor, int milliseconds) throws InterruptedException { - checkState(); - if (accessor == null) { - throw new IllegalArgumentException("accessor cannot be null"); - } - accessor.getLogger().methodCalledOnObject(accessor, getMessageName(), new MethodFormatter().add(milliseconds), - this); - long time = accessor.getEnvTime(); - org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer cancelTimer = - accessor.setTimerFor(listenerHandler, milliseconds); - - boolean result; - listenerHandler.waitForData(); // will also return if the timer (set above) - // expires - - result = listenerHandler.isTimedOut(); - - cancelTimer.cancelTimer(); - time = accessor.getEnvTime() - time; - - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestScript().getTestCase(), - new CheckPoint(this.getMessageName(), "No Transmissions", - result ? "No Transmissions" : "Transmissions Occurred", result, time)); - - accessor.getLogger().methodEnded(accessor); - return result; - } - - /** - * Waits until message is sent at least once within the default message timeout. - * - * @return if the check passed - */ - public boolean waitForTransmission(ITestEnvironmentMessageSystemAccessor accessor) throws InterruptedException { - return waitForTransmission(accessor, TransmissionTimeoutDefault); - } - - /** - * Waits until message is sent at least once within the time specified. - * - * @param milliseconds the amount to time (in milliseconds) to allow - * @return if the check passed - */ - public boolean waitForTransmission(ITestEnvironmentMessageSystemAccessor accessor, int milliseconds) throws InterruptedException { - return waitForTransmissions(accessor, 1, milliseconds); - } - - /** - * Waits until message is sent at least "numTransmission" times within the default message timeout. - * - * @param numTransmissions the number of transmissions to look for - * @return if the check passed - */ - public boolean waitForTransmissions(ITestEnvironmentMessageSystemAccessor accessor, int numTransmissions) throws InterruptedException { - return waitForTransmissions(accessor, numTransmissions, TransmissionTimeoutDefault); - } - - /** - * Waits until message is sent at least "numTransmission" times within the time specified. - * - * @param milliseconds the amount to time (in milliseconds) to allow - * @return if the check passed - */ - public boolean waitForTransmissions(ITestEnvironmentMessageSystemAccessor accessor, int numTransmissions, int milliseconds) throws InterruptedException { - checkState(); - accessor.getLogger().methodCalledOnObject(accessor, getMessageName(), - new MethodFormatter().add(numTransmissions).add(milliseconds), this); - boolean pass = waitForTransmissionsNoLog(accessor, numTransmissions, milliseconds); - accessor.getLogger().methodEnded(accessor); - return pass; - } - - public boolean waitForTransmissionsNoLog(ITestEnvironmentMessageSystemAccessor accessor, int numTransmissions, int milliseconds) throws InterruptedException { - checkState(); - if (accessor == null) { - throw new IllegalArgumentException("environment accessor parameter cannot be null"); - } - TransmissionCountCondition c = new TransmissionCountCondition(numTransmissions); - MsgWaitResult result = waitForCondition(accessor, c, false, milliseconds); - return result.isPassed(); - } - - public MsgWaitResult waitForCondition(ITestEnvironmentAccessor accessor, ICondition condition, boolean maintain, int milliseconds) throws InterruptedException { - checkState(); - return listenerHandler.waitForCondition(accessor, condition, maintain, milliseconds); - } - - /** - * @return Returns size value. - */ - public int getMaxDataSize() { - checkState(); - return getMaxDataSize(currentMemType); - } - - public int getMaxDataSize(DataType type) { - checkState(); - int size = 0; - for (MessageData msgData : memToDataMap.get(type)) { - if (msgData != null && msgData.getPayloadSize() > size) { - size = msgData.getPayloadSize(); - } - } - return size; - } - - /* - * @Override public boolean equals(Object obj) { return this.getClass().equals(obj.getClass()); } - */ - - /* - * @Override public int hashCode() { return getClass().hashCode(); } - */ - - /** - * returns a {@link MessageState} object that represents this message's state. The state is intended to be used in - * synchronizing a remote instance of this message - * - * @return Returns MessageState object reference. - */ - public MessageState getMessageState() { - checkState(); - MessageMode mode = isWriter() ? MessageMode.WRITER : MessageMode.READER; - return new MessageState(currentMemType, getData(), memToDataMap.keySet(), mode); - } - - /** - * restores the state of this message. The state is intended to come from a remote instance of this message. - */ - public void setMessageState(final MessageState state) { - checkState(); - setMemSource(state.getCurrentMemType()); - setData(state.getData()); - } - - public void addSchedulingChangeListener(IMessageScheduleChangeListener listener) { - checkState(); - schedulingChangeListeners.add(listener); - } - - public void removeSchedulingChangeListener(IMessageScheduleChangeListener listener) { - checkState(); - schedulingChangeListeners.remove(listener); - } - - public T getActiveDataSource() { - checkState(); - ArrayList<T> dataList = memToDataMap.get(currentMemType); - if (dataList == null) { - throw new IllegalStateException("no datas for " + currentMemType); - } - return dataList.get(0); - } - - public T getActiveDataSource(DataType type) { - checkState(); - ArrayList<T> dataList = memToDataMap.get(type); - return dataList != null ? dataList.get(0) : null; - } - - public void addElements(Element... elements) { - checkState(); - for (Element element : elements) { - elementMap.put(element.getElementName(), element); - element.addPath(this.getClass().getName()); - } - } - - public int getBitOffset() { - return 0; - } - - /** - * @param currentMemType the currentMemType to set - */ - protected void setCurrentMemType(DataType currentMemType) { - checkState(); - this.currentMemType = currentMemType; - } - - public boolean setMemSource(DataType type) { - checkState(); - DataType oldMemType = getMemType(); - notifyPreMemSourceChangeListeners(oldMemType, type, this); - this.switchElementAssociation(type); - setCurrentMemType(type); - notifyPostMemSourceChangeListeners(oldMemType, type, this); - return true; - } - - public boolean activateMemSource(DataType type) { - checkState(); - DataType oldMemType = getMemType(); - notifyPreMemSourceChangeListeners(oldMemType, type, this); - // this.switchElementAssociation(type); - // setCurrentMemType(type); - notifyPostMemSourceChangeListeners(oldMemType, type, this); - return true; - } - - private void notifyPostMemSourceChangeListeners(DataType old, DataType newtype, Message<?, ?, ?> message) { - checkState(); - for (IMemSourceChangeListener listener : postMemSourceChangeListeners) { - try { - listener.onChange(old, newtype, message); - } catch (Exception e) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, e); - } - } - } - - private void notifyPreMemSourceChangeListeners(DataType old, DataType newtype, Message<?, ?, ?> message) { - checkState(); - for (IMemSourceChangeListener listener : preMemSourceChangeListeners) { - listener.onChange(old, newtype, message); - } - } - - public void addPreMemSourceChangeListener(IMemSourceChangeListener listener) { - checkState(); - preMemSourceChangeListeners.add(listener); - } - - public void addPostMemSourceChangeListener(IMemSourceChangeListener listener) { - checkState(); - postMemSourceChangeListeners.add(listener); - } - - public void removePreMemSourceChangeListener(IMemSourceChangeListener listener) { - checkState(); - preMemSourceChangeListeners.remove(listener); - } - - public void removePostMemSourceChangeListener(IMemSourceChangeListener listener) { - checkState(); - postMemSourceChangeListeners.remove(listener); - } - - public void addPreMessageDisposeListener(IMessageDisposeListener listener) { - checkState(); - preMessageDisposeListeners.add(listener); - } - - public void removePreMessageDisposeListener(IMessageDisposeListener listener) { - checkState(); - preMessageDisposeListeners.remove(listener); - } - - public void addPostMessageDisposeListener(IMessageDisposeListener listener) { - checkState(); - postMessageDisposeListeners.add(listener); - } - - /** - * @return the memToDataMap - */ - public Collection<ArrayList<T>> getAllData() { - checkState(); - return memToDataMap.values(); - } - - public Set<DataType> getAvailableMemTypes() { - checkState(); - return memToDataMap.keySet(); - } - - public Collection<T> getMessageData(DataType type) { - checkState(); - return memToDataMap.get(type); - } - - public String getTypeName() { - return getName(); - } - - /** - * This variable reflects whether a message is defined to start out being scheduled. - * - * @return Returns the isScheduledFromStart. - */ - public boolean isScheduledFromStart() { - return isScheduledFromStart; - } - - /** - * This variable reflects whether unsubscribe has been called on the message. The main purpose of this is to preserve - * if an unschedule is called on a message from a constructor. - * - * @return Returns the regularUnscheduleCalled. - */ - public boolean isRegularUnscheduleCalled() { - return regularUnscheduleCalled; - } - - /** - * @return the defaultMessageData - */ - public T getDefaultMessageData() { - checkState(); - return defaultMessageData; - } - - /** - * @param defaultMessageData the defaultMessageData to set - */ - @SuppressWarnings("unchecked") - protected void setDefaultMessageData(T defaultMessageData) { - checkState(); - this.defaultMessageData = defaultMessageData; - addMessageDataSource(defaultMessageData); - addMessageTypeAssociation(defaultMessageData.getType(), (U) this); - } - - public boolean isWriter() { - checkState(); - return defaultMessageData.isWriter(); - } - - public void setMemTypeActive(DataType type) { - checkState(); - memTypeActive.add(type); - notifyPostMemSourceChangeListeners(currentMemType, currentMemType, this); - } - - public void setMemTypeInactive(DataType type) { - checkState(); - memTypeActive.add(type); - notifyPostMemSourceChangeListeners(currentMemType, currentMemType, this); - } - - public boolean isMemTypeActive(DataType type) { - checkState(); - return memTypeActive.contains(type); - } - - protected void checkState() throws IllegalStateException { - if (isDestroyed()) { - throw new IllegalStateException(getName() + " is destroyed"); - } - } - - public boolean isDestroyed() { - return destroyed; - } - - @Override - protected void finalize() throws Throwable { - finalized.incrementAndGet(); - super.finalize(); - } - - public static long getConstructed() { - return constructed.get(); - } - - public static long getFinalized() { - return finalized.get(); - } - - public boolean isValidElement(Element currentElement, Element proposedElement) { - return true; - } - - public IMessageHeader[] getHeaders() { - final Collection<T> dataSources = getMemSource(getMemType()); - if (dataSources.size() > 0) { - final IMessageHeader[] headers = new IMessageHeader[dataSources.size()]; - int i = 0; - for (T dataSrc : dataSources) { - headers[i] = dataSrc.getMsgHeader(); - i++; - } - return headers; - } else { - return new IMessageHeader[0]; - } - } - - public long getActivityCount() { - return getActiveDataSource().getActivityCount(); - } - - public long getSentCount() { - return getActiveDataSource().getSentCount(); - } - - public void setActivityCount(long activityCount) { - getActiveDataSource().setActivityCount(activityCount); - } - - public void switchElementAssociation(Collection<U> messages) { - } - - @SuppressWarnings("rawtypes") - public Map<? extends DataType, Class<? extends Message>[]> getAssociatedMessages() { - return new HashMap<DataType, Class<? extends Message>[]>(); - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - public void postCreateMessageSetup(IMessageManager messageManager, MessageData data) throws Exception { - Map<? extends DataType, Class<? extends Message>[]> o = getAssociatedMessages(); - messageRequestor = messageManager.createMessageRequestor(getName()); - for (Entry<? extends DataType, Class<? extends Message>[]> entry : o.entrySet()) { - if (messageManager.isPhysicalTypeAvailable(entry.getKey())) { - for (Class<? extends Message> clazz : entry.getValue()) { - final Message message; - if (data.isWriter()) { - message = messageRequestor.getMessageWriter(clazz); - } else { - message = messageRequestor.getMessageReader(clazz); - } - this.addMessageDataSource((T) message.getDefaultMessageData()); - this.addMessageTypeAssociation(entry.getKey(), (U) message); - setMemSource(entry.getKey()); - } - } - } - } - - /** - * Changes the rate a message is being published at. NOTE: This is only going to be allowed to be used on periodic - * message & users are not allowed to set rate to zero. - * - * @param newRate - hz - */ - public void changeRate(double newRate) { - if (Math.abs(newRate - 0.0) < doubleTolerance) { //newRate == 0.0 - throw new IllegalArgumentException( - "Cannot change message rate to zero (" + getName() + ")!\n\tUse unschedule() to do that!"); - } - if (Math.abs(newRate - rate) > doubleTolerance) { //newRate != rate - // accessor.getMsgManager().changeMessageRate(this, newRate, rate); - double oldRate = rate; - rate = newRate; - for (IMessageScheduleChangeListener listener : schedulingChangeListeners) { - listener.onRateChanged(this, oldRate, newRate); - } - } - } - - /** - * Changes the rate back to the default rate. - */ - public void changeRateToDefault(ITestEnvironmentMessageSystemAccessor accessor) { - // accessor.getMsgManager().changeMessageRate(this, defaultRate, rate); - double oldRate = getRate(); - rate = defaultRate; - for (IMessageScheduleChangeListener listener : schedulingChangeListeners) { - listener.onRateChanged(this, oldRate, defaultRate); - } - } - - public void sendWithLog(ITestAccessor accessor) { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, getMessageName(), new MethodFormatter(), this); - } - send(); - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - } - - public int getDefaultByteSize() { - return defaultByteSize; - } - - public int getDefaultOffset() { - return defaultOffset; - } - - public Element getElementByPath(ElementPath path) { - return getElementByPath(path, currentMemType); - } - - public Element getElementByPath(ElementPath path, DataType type) { - if (path.isHeaderElement()) { - Element[] elements = getActiveDataSource(type).getMsgHeader().getElements(); - for (Element element : elements) { - if (element.getName().equals(path.getElementName())) { - return element; - } - } - return null; - } - return getElement(path.getList(), type); - } - - public ListIterator<Element> getElementIterator() { - ArrayList<Element> list = new ArrayList<>(elementMap.values()); - return list.listIterator(); - } - - public ListIterator<Element> getElementIterator(Element elemnt) { - ArrayList<Element> list = new ArrayList<>(elementMap.values()); - int index = list.indexOf(elemnt); - if (index >= 0) { - return list.listIterator(index); - } - return null; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageDefinitionProvider.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageDefinitionProvider.java deleted file mode 100644 index 088b6cf7772..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageDefinitionProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - - -/** - * @author Andrew M. Finkbeiner - */ -public interface MessageDefinitionProvider { - - /** - * This function returns an ID that is intended to be unique to the running system. The system should not allow more - * than one active instance of a service with the same singletonId. - */ - String singletonId(); - - String majorVersion(); - - String minorVersion(); - - void generateMessageIndex(MessageSink sink) throws Exception; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageEventLogger.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageEventLogger.java deleted file mode 100644 index 0f2b7a06b5d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageEventLogger.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Ken J. Aguilar - */ -public class MessageEventLogger implements UniversalMessageListener { - private static final class StackTrace extends RuntimeException { - private static final long serialVersionUID = 6805422596135323489L; - - public StackTrace() { - super("Event stack trace"); - } - } - - private final Message<?, ?, ?> message; - private final String modeStatus; - - private volatile boolean showStackTrace = false; - - public MessageEventLogger(Message<?, ?, ?> message) { - this(message, false); - } - - /** - * @return the message - */ - public Message<?, ?, ?> getMessage() { - return message; - } - - /** - * Creates a message event logger that also prints a stack trace when the event is fired - */ - public MessageEventLogger(Message<?, ?, ?> message, boolean showStackTrace) { - this.message = message; - modeStatus = message.isWriter() ? "wirter " : "reader"; - message.addPostMemSourceChangeListener(this); - message.addPostMessageDisposeListener(this); - message.addPreMessageDisposeListener(this); - message.addSchedulingChangeListener(this); - this.showStackTrace = showStackTrace; - } - - @Override - public void onChange(DataType oldtype, DataType newType, Message<?, ?, ?> message) { - log(Level.INFO, String.format("MemType for %s %s has changed from %s to %s", message.getName(), modeStatus, - oldtype.name(), newType.name()), showStackTrace ? new StackTrace() : null); - } - - @Override - public void onPostDispose(Message<?, ?, ?> message) { - log(Level.INFO, String.format("%s %s has been disposed", message.getName(), modeStatus), - showStackTrace ? new StackTrace() : null); - } - - @Override - public void onPreDispose(Message<?, ?, ?> message) { - log(Level.INFO, String.format("%s %s is about to be disposed", message.getName(), modeStatus), - showStackTrace ? new StackTrace() : null); - } - - @Override - public void isScheduledChanged(boolean isScheduled) { - log(Level.INFO, String.format("schedule status for %s has changed to %s. Env time is %d", message.getName(), - modeStatus, isScheduled ? "scheduled" : "not scheduled"), showStackTrace ? new StackTrace() : null); - } - - @Override - public void onRateChanged(Message<?, ?, ?> message, double oldRate, double newRate) { - log(Level.INFO, - String.format("rate for %s %s change from %f to %f", message.getName(), modeStatus, oldRate, newRate), - showStackTrace ? new StackTrace() : null); - } - - protected void log(Level level, String message) { - OseeLog.log(MessageSystemTestEnvironment.class, level, message); - } - - protected void log(Level level, String message, StackTrace stackTrace) { - OseeLog.log(MessageSystemTestEnvironment.class, level, message, stackTrace); - } - - protected StackTraceElement[] getStackTrace() { - return new Exception().getStackTrace(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageProviderVersion.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageProviderVersion.java deleted file mode 100644 index e1880226596..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageProviderVersion.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.util.Set; -import java.util.concurrent.ConcurrentSkipListSet; - -public class MessageProviderVersion { - Set<String> versions = new ConcurrentSkipListSet<>(); - - public synchronized void add(MessageDefinitionProvider provider){ - versions.add(generateVersion(provider)); - } - - public synchronized void remove(MessageDefinitionProvider provider){ - versions.remove(generateVersion(provider)); - } - - public synchronized String getVersion(){ - if(versions.size() == 0){ - return "no library detected"; - } - StringBuilder sb = new StringBuilder(); - for(String ver:versions){ - sb.append(ver); - sb.append("\n"); - } - sb.deleteCharAt(sb.length()-1); - return sb.toString(); - } - - private String generateVersion(MessageDefinitionProvider provider){ - return String.format("%s[%s.%s]", provider.singletonId(), provider.majorVersion(), provider.minorVersion()); - } - - public synchronized boolean isAnyAvailable(){ - return versions.size() > 0; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSink.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSink.java deleted file mode 100644 index 4556d642aac..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSink.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -/** - * @author Ryan D. Brooks - */ -public interface MessageSink { - - /** - * called once by each provider before it calls absorbMessage or absorbElement - * @param providerName The name of the provider - */ - public void absorbProvider(String providerName); - - /** - * called once for each message in the message list - * @param messageName The name of the message - */ - public void absorbMessage(String messageName); - - /** - * called once for each element in a message after absorbMessage is called for that message - * @param elementName The name of the element - */ - public void absorbElement(String elementName); -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageState.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageState.java deleted file mode 100644 index 2b42104dcad..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageState.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.tool.MessageMode; - -/** - * Holds a state of a message intended to be transferred from the message manager server to an interest client. In other - * words, helps synchronize two remote instances of a message object - * - * @author Ken J. Aguilar - * @see org.eclipse.osee.ote.message.Message - */ -public final class MessageState implements Serializable { - - private static final long serialVersionUID = -8977593021184452337L; - - private final DataType currentMemType; - private final byte[] data; - private final Set<DataType> availableMemTypes; - private final MessageMode mode; - - public MessageState(final DataType currentMemType, final byte[] data, final Set<DataType> availableMemTypes, final MessageMode mode) { - this.currentMemType = currentMemType; - this.data = data; - - this.availableMemTypes = new HashSet<>(availableMemTypes); - this.mode = mode; - } - - public DataType getCurrentMemType() { - return currentMemType; - } - - public byte[] getData() { - return data; - } - - public Set<DataType> getAvailableMemTypes() { - return availableMemTypes; - } - - public MessageMode getMode() { - return mode; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemException.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemException.java deleted file mode 100644 index 208653be7c2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemException.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.util.logging.Level; -import org.eclipse.osee.ote.core.TestException; - -public class MessageSystemException extends TestException { - - private static final long serialVersionUID = -8476610648021756216L; - - public MessageSystemException(String message, Level level) { - this(message, level, null); - } - - public MessageSystemException(String message, Level level, Throwable cause) { - super(message, level, cause); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestCase.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestCase.java deleted file mode 100644 index a2311c9923a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestCase.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.util.Set; -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.interfaces.IMessageManager; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; -import org.eclipse.osee.ote.message.interfaces.ITestEnvironmentMessageSystemAccessor; - -/** - * @author Andy Jury - */ -public abstract class MessageSystemTestCase extends TestCase implements ITestAccessor { - - private final ITestEnvironmentMessageSystemAccessor msgSysTestEnvironment; - - protected MessageSystemTestCase(TestScript testScript, boolean standAlone, boolean addToRunList) { - super(testScript, standAlone, addToRunList); - msgSysTestEnvironment = (MessageSystemTestScript) testScript; - } - - /** - * TestCase Constructor. - */ - public MessageSystemTestCase(TestScript testScript, boolean standAlone) { - this(testScript, standAlone, true); - } - - /** - * TestCase Constructor. - */ - public MessageSystemTestCase(TestScript testScript) { - this(testScript, false); - } - - @Override - public IMessageManager<?, ?> getMsgManager() { - return msgSysTestEnvironment.getMsgManager(); - } - - @Override - public boolean isPhysicalTypeAvailable(DataType mux) { - return msgSysTestEnvironment.isPhysicalTypeAvailable(mux); - } - - @Override - public void associateObject(Class<?> c, Object obj) { - msgSysTestEnvironment.associateObject(c, obj); - } - - @Override - public Set<? extends DataType> getDataTypes() { - return msgSysTestEnvironment.getDataTypes(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestEnvironment.java deleted file mode 100644 index 67326b83b08..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestEnvironment.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import java.lang.reflect.InvocationTargetException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.osee.ote.Configuration; -import org.eclipse.osee.ote.core.IUserSession; -import org.eclipse.osee.ote.core.ServiceUtility; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.BasicTimeout; -import org.eclipse.osee.ote.core.environment.interfaces.IEnvironmentFactory; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.core.model.IModelManager; -import org.eclipse.osee.ote.message.instrumentation.IOInstrumentation; -import org.eclipse.osee.ote.message.interfaces.IMessageManager; -import org.eclipse.osee.ote.message.interfaces.ITestEnvironmentMessageSystemAccessor; - -/** - * @author Ryan D. Brooks - * @author Robert A. Fisher - * @author Andrew M. Finkbeiner - */ -public abstract class MessageSystemTestEnvironment extends TestEnvironment implements ITestEnvironmentMessageSystemAccessor, IMessageTestContext { - protected URL[] clientClasses; - private final List<IPreScriptInstantiation> preInstantiation = new ArrayList<>(); - protected boolean promptResponse = false; - private IOInstrumentationDB ioInstrumentation; - - protected MessageSystemTestEnvironment(IEnvironmentFactory factory) { - super(factory); - getScriptCtrl().setScriptReady(false); - } - - private void setupIOInstrumentation() { - if (ioInstrumentation == null) { - ioInstrumentation = new IOInstrumentationDB(); - } - } - - public void envWait(int milliseconds) throws InterruptedException { - envWait(new BasicTimeout(), milliseconds); - } - - public void envWait(ITimeout obj, int milliseconds) throws InterruptedException { - setTimerFor(obj, milliseconds); - synchronized (obj) { - obj.wait(); - } - } - - @SuppressWarnings("rawtypes") - @Override - public IMessageManager getMsgManager() { - return ServiceUtility.getService(IMessageManager.class, false); - } - - public IModelManager getModelManager() { - return ServiceUtility.getService(IModelManager.class, 5000); - } - - /** - * provides a way for sub classes to instantiate test scripts in their own way. - */ - protected abstract TestScript instantiateScriptClass(Class<?> scriptClass, IUserSession connection) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException; - - public abstract void singleStepEnv(); - - @Override - public void resetScriptLoader(Configuration configuration, String[] strings) throws Exception { - getRuntimeManager().resetScriptLoader(configuration, strings); - } - - public void addPreInstantiationListener(IPreScriptInstantiation listener) { - preInstantiation.add(listener); - } - - public void removePreInstantiationListener(IPreScriptInstantiation listener) { - preInstantiation.remove(listener); - } - - public void notifyPreInstantiationListeners() { - for (IPreScriptInstantiation pre : preInstantiation) { - pre.run(); - } - } - - public IOInstrumentation getIOInstrumentation(String name) { - setupIOInstrumentation(); - return ioInstrumentation.getIOInstrumentation(name); - } - - public IOInstrumentation registerIOInstrumentation(String name, IOInstrumentation io) { - setupIOInstrumentation(); - return ioInstrumentation.registerIOInstrumentation(name, io); - } - - public void deregisterIOInstrumentation(String name) { - setupIOInstrumentation(); - ioInstrumentation.unregisterIOInstrumentation(name); - } - - public void addInstrumentationRegistrationListener(IInstrumentationRegistrationListener listener) { - setupIOInstrumentation(); - ioInstrumentation.addRegistrationListener(listener); - } - - public void removeInstrumentationRegistrationListener(IInstrumentationRegistrationListener listener) { - setupIOInstrumentation(); - ioInstrumentation.removeRegistrationListener(listener); - } - - public Class<?> loadClassFromMessageLoader(String path) throws ClassNotFoundException { - return getRuntimeManager().loadFromRuntimeLibraryLoader(path); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestScript.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestScript.java deleted file mode 100644 index 8d22982f9d6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/MessageSystemTestScript.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import org.eclipse.osee.ote.core.IUserSession; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.enums.ScriptTypeEnum; -import org.eclipse.osee.ote.core.environment.EnvironmentTask; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.IExecutionUnitManagement; -import org.eclipse.osee.ote.core.environment.interfaces.IScriptControl; -import org.eclipse.osee.ote.core.environment.interfaces.ITestLogger; -import org.eclipse.osee.ote.core.environment.interfaces.ITestStation; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.core.environment.interfaces.ITimerControl; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.interfaces.IMessageManager; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; -import org.eclipse.osee.ote.message.interfaces.ITestEnvironmentMessageSystemAccessor; - -/** - * @author Andrew M. Finkbeiner - */ -public abstract class MessageSystemTestScript extends TestScript implements ITestAccessor { - - private final ITestEnvironmentMessageSystemAccessor msgSysEnvironment; - - public MessageSystemTestScript(TestEnvironment environment, IUserSession callback, ScriptTypeEnum scriptType, boolean isBatchable) { - super(environment, callback, scriptType, isBatchable); - msgSysEnvironment = (ITestEnvironmentMessageSystemAccessor) environment; - } - - @Override - public IMessageManager<?, ?> getMsgManager() { - return msgSysEnvironment.getMsgManager(); - } - - @Override - public boolean isPhysicalTypeAvailable(DataType mux) { - return msgSysEnvironment.isPhysicalTypeAvailable(mux); - } - - @Override - public void associateObject(Class<?> c, Object obj) { - msgSysEnvironment.associateObject(c, obj); - } - - @Override - public Object getAssociatedObject(Class<?> c) { - return msgSysEnvironment.getAssociatedObject(c); - } - - public Object getAssociatedObject() { - return msgSysEnvironment.getAssociatedObjects(); - } - - @Override - public IExecutionUnitManagement getExecutionUnitManagement() { - return msgSysEnvironment.getExecutionUnitManagement(); - } - - @Override - public ITestStation getTestStation() { - return msgSysEnvironment.getTestStation(); - } - - @Override - public ITestLogger getLogger() { - return msgSysEnvironment.getLogger(); - } - - @Override - public ITimerControl getTimerCtrl() { - return msgSysEnvironment.getTimerCtrl(); - } - - @Override - public IScriptControl getScriptCtrl() { - return msgSysEnvironment.getScriptCtrl(); - } - - @Override - public ICancelTimer setTimerFor(ITimeout listener, int time) { - return msgSysEnvironment.setTimerFor(listener, time); - } - - @Override - public final void onScriptSetup() { - msgSysEnvironment.onScriptSetup(); - } - - @Override - public final void onScriptComplete() throws InterruptedException { - msgSysEnvironment.onScriptComplete(); - } - - @Override - public long getEnvTime() { - return msgSysEnvironment.getEnvTime(); - } - - // public ITestPointTally getAttachedTestPointTally(TestScript script) { - // return msgSysEnvironment.getAttachedTestPointTally(script); - // } - - // public EnvironmentType getEnvironmentType() { - // return msgSysEnvironment.getEnvironmentType(); - // } - @Override - public void abortTestScript() { - msgSysEnvironment.abortTestScript(); - } - - @Override - public boolean addTask(EnvironmentTask task) { - return msgSysEnvironment.addTask(task); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/UniversalMessageListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/UniversalMessageListener.java deleted file mode 100644 index 4255980f378..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/UniversalMessageListener.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message; - -import org.eclipse.osee.ote.message.interfaces.IMessageScheduleChangeListener; - -/** - * @author Ken J. Aguilar - */ -public interface UniversalMessageListener extends IMemSourceChangeListener, IMessageDisposeListener, IMessageScheduleChangeListener { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/ChangeSubscription.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/ChangeSubscription.java deleted file mode 100644 index af8591b1624..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/ChangeSubscription.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.commands; - -import java.io.Serializable; -import java.net.InetSocketAddress; -import org.eclipse.osee.ote.message.tool.MessageMode; - -public final class ChangeSubscription implements Serializable { - private static final long serialVersionUID = 2863442398798431500L; - private final String msgName; - private final MessageMode mode; - private final int newMemTypeOrdinal; - private final int oldMemTypeOrdinal; - private final InetSocketAddress oldAddress; - private final InetSocketAddress newAddress; - - public ChangeSubscription(final String msgName, final MessageMode mode, final int oldMemTypeOrdinal, final int newMemTypeOrdinal, final InetSocketAddress oldAddress, final InetSocketAddress newAddress) { - this.msgName = msgName; - this.mode = mode; - this.newMemTypeOrdinal = newMemTypeOrdinal; - this.oldMemTypeOrdinal = oldMemTypeOrdinal; - this.oldAddress = oldAddress; - this.newAddress = newAddress; - } - - public String getMsgName() { - return msgName; - } - - /** - * @return Returns the mode. - */ - public MessageMode getMode() { - return mode; - } - - public int getNewMemTypeOrdinal() { - return newMemTypeOrdinal; - } - - public int getOldMemTypeOrdinal() { - return oldMemTypeOrdinal; - } - - public InetSocketAddress getOldAddress() { - return oldAddress; - } - - public InetSocketAddress getNewAddress() { - return newAddress; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/RecordCommand.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/RecordCommand.java deleted file mode 100644 index d643c9106a7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/RecordCommand.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.commands; - -import java.io.Serializable; -import java.net.InetSocketAddress; -import java.util.Collection; -import java.util.List; -import java.util.UUID; - -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Ken J. Aguilar - */ -public class RecordCommand implements Serializable { - - public static final class MessageRecordDetails implements Serializable { - - private static final long serialVersionUID = 2954398510075588584L; - private final String name; - private final DataType type; - private final List<List<Object>> headerElementNames; - private final List<List<Object>> bodyElementNames; - private final boolean headerDump; - private final boolean bodyDump; - - public MessageRecordDetails(final String name, final DataType type, boolean headerDump, final List<List<Object>> headerElementNames, boolean bodyDump, final List<List<Object>> bodyElementNames) { - super(); - this.name = name; - this.type = type; - this.headerDump = headerDump; - this.bodyDump = bodyDump; - this.headerElementNames = headerElementNames; - this.bodyElementNames = bodyElementNames; - } - - public static long getSerialVersionUID() { - return serialVersionUID; - } - - public List<List<Object>> getBodyElementNames() { - return bodyElementNames; - } - - public List<List<Object>> getHeaderElementNames() { - return headerElementNames; - } - - public boolean getHeaderDump() { - return this.headerDump; - } - - public boolean getBodyDump() { - return this.bodyDump; - } - - public String getName() { - return name; - } - - public DataType getType() { - return type; - } - - } - private static final long serialVersionUID = -1000973301709084337L; - - private final List<MessageRecordDetails> list; - private final InetSocketAddress destAddress; - private final UUID key; - - public RecordCommand(UUID key, InetSocketAddress destAddress, List<MessageRecordDetails> list) { - this.list = list; - this.destAddress = destAddress; - this.key = key; - } - - /** - * @return the destAddress - */ - public InetSocketAddress getDestAddress() { - return destAddress; - } - - public Collection<MessageRecordDetails> getMsgsToRecord() { - return list; - } - - public UUID getKey(){ - return key; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/SetElementValue.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/SetElementValue.java deleted file mode 100644 index bf974128695..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/SetElementValue.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.commands; - -import java.io.Serializable; -import java.util.List; - -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - * @author Ken J. Aguilar - */ -public final class SetElementValue implements Serializable { - - private static final long serialVersionUID = -6696340729803635664L; - private final String message; - private final List<Object> element; - private final String value; - private final DataType type; - private final boolean shouldSend; - - public SetElementValue(String message, DataType type, List<Object> elementPath, String value, boolean shouldSend) { - super(); - this.message = message; - this.type = type; - this.element = elementPath; - this.value = value; - this.shouldSend = shouldSend; - } - - /** - * @return Returns the message. - */ - public String getMessage() { - return message; - } - - /** - * @return Returns the data. - */ - public List<Object> getElement() { - return element; - } - - public String getValue() { - return value; - } - - public DataType getMemType() { - return type; - } - - public boolean shouldSend() { - return shouldSend; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/SetMessageModeCmd.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/SetMessageModeCmd.java deleted file mode 100644 index adc8afa73bb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/SetMessageModeCmd.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.commands; - -import java.io.Serializable; -import java.net.InetSocketAddress; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.tool.MessageMode; - -/** - * @author Ken J. Aguilar - */ -public class SetMessageModeCmd implements Serializable { - - private static final long serialVersionUID = 4294009014724352978L; - - private final String name; - private final DataType type; - private final MessageMode oldMode; - private final MessageMode newMode; - private final InetSocketAddress address; - - public SetMessageModeCmd(String name, DataType type, MessageMode oldMode, MessageMode newMode, InetSocketAddress address) { - this.name = name; - this.type = type; - this.oldMode = oldMode; - this.newMode = newMode; - this.address = address; - } - - /** - * @return Returns the serialVersionUID. - */ - public static long getSerialVersionUID() { - return serialVersionUID; - } - - /** - * @return Returns the name. - */ - public String getName() { - return name; - } - - /** - * @return Returns the newMode. - */ - public MessageMode getNewMode() { - return newMode; - } - - /** - * @return Returns the oldMode. - */ - public MessageMode getOldMode() { - return oldMode; - } - - /** - * @return Returns the client. - */ - public InetSocketAddress getAddress() { - return address; - } - - /** - * @return Returns the type. - */ - public DataType getType() { - return type; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/SubscribeToMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/SubscribeToMessage.java deleted file mode 100644 index 43707ac3f3a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/SubscribeToMessage.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.commands; - -import java.io.Serializable; -import java.net.InetSocketAddress; -import java.util.UUID; - -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.tool.MessageMode; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class SubscribeToMessage implements Serializable { - - private static final long serialVersionUID = -8639822314152666969L; - private final String message; - private final DataType type; - private final MessageMode mode; - private final InetSocketAddress address; - private final UUID key; - - public SubscribeToMessage(String message, DataType type, MessageMode mode, InetSocketAddress address, UUID key) { - super(); - this.message = message; - this.type = type; - this.mode = mode; - this.address = address; - this.key = key; - } - - /** - * @param message The message to set. - */ - public String getMessage() { - return message; - } - - public DataType getType() { - return type; - } - - public MessageMode getMode() { - return mode; - } - - public InetSocketAddress getAddress(){ - return address; - } - - public UUID getKey(){ - return key; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/UnSubscribeToMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/UnSubscribeToMessage.java deleted file mode 100644 index 595fcf80aa9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/UnSubscribeToMessage.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.commands; - -import java.io.Serializable; -import java.net.InetSocketAddress; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.tool.MessageMode; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class UnSubscribeToMessage implements Serializable { - - private static final long serialVersionUID = -1140091630056507142L; - private final String messageName; - private final MessageMode mode; - private final InetSocketAddress address; - private final DataType memTypeOrdinal; - - /** - * Creates a new unsubscribe command. - * - * @param messageName the name of the message that the message manager service will no longer sent updates to for the - * specified client address - * @param address the address of the client. - */ - public UnSubscribeToMessage(final String messageName, final MessageMode mode, final DataType memTypeOrdinal, InetSocketAddress address) { - this.messageName = messageName; - this.mode = mode; - this.address = address; - this.memTypeOrdinal = memTypeOrdinal; - } - - public String getMessage() { - return messageName; - } - - public InetSocketAddress getAddress() { - return address; - } - - public DataType getMemTypeOrdinal() { - return memTypeOrdinal; - } - - /** - * @return Returns the mode. - */ - public MessageMode getMode() { - return mode; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/ZeroizeElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/ZeroizeElement.java deleted file mode 100644 index b553e8ac0cb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/commands/ZeroizeElement.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.commands; - -import java.io.Serializable; -import java.util.List; -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - * @author Ken J. Aguilar - */ -public class ZeroizeElement implements Serializable { - - private static final long serialVersionUID = 2245725475520729629L; - private final String message; - private final List<Object> element; - private final DataType type; - - public ZeroizeElement(String message, DataType type, List<Object> elementPath) { - super(); - this.message = message; - this.type = type; - this.element = elementPath; - } - - /** - * @return Returns the message. - */ - public String getMessage() { - return message; - } - - /** - * @return Returns the data. - */ - public List<Object> getElement() { - return element; - } - - public DataType getMemType() { - return type; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/AbstractCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/AbstractCondition.java deleted file mode 100644 index 7558292b427..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/AbstractCondition.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -/** - * @author Ken J. Aguilar - */ -public abstract class AbstractCondition implements ICondition { - - @Override - public boolean checkAndIncrement() { - incrementCheckCount(); - return check(); - } - - private int checkCount = 0; - - protected void incrementCheckCount() { - checkCount++; - } - - @Override - public int getCheckCount() { - return checkCount; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/AndCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/AndCondition.java deleted file mode 100644 index 4382a67c11b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/AndCondition.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import java.util.Collection; - -/** - * Checks that atleast one condition of a series of conditions is true - * - * @author Ken J. Aguilar - */ -public class AndCondition extends AbstractCondition { - - private final ICondition[] conditions; - - public AndCondition(ICondition... conditions) { - this.conditions = conditions; - } - - public AndCondition(Collection<ICondition> conditions) { - this.conditions = conditions.toArray(new ICondition[conditions.size()]); - } - - @Override - public boolean check() { - for (ICondition condition : conditions) { - if (condition.check()) { - return true; - } - } - return false; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ChangesCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ChangesCondition.java deleted file mode 100644 index 9fafabd28dd..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ChangesCondition.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.DiscreteElement; - -/** - * @author Ken J. Aguilar - */ - -public class ChangesCondition<T extends Comparable<T>> extends AbstractCondition implements IDiscreteElementCondition<T> { - - private final DiscreteElement<T> element; - private T lastValue = null; - - public ChangesCondition(DiscreteElement<T> element) { - this.element = element; - } - - @Override - public T getLastCheckValue() { - return lastValue; - } - - @Override - public boolean check() { - T currentValue = element.getValue(); - if (lastValue == null) { - lastValue = currentValue; - return false; - } - boolean result = !currentValue.equals(lastValue); - lastValue = currentValue; - return result; - } - - public DiscreteElement<T> getElement() { - return element; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ComparisonCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ComparisonCondition.java deleted file mode 100644 index 89b7b0cd55e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ComparisonCondition.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.DiscreteElement; - -/** - * @author Ken J. Aguilar - */ - -public class ComparisonCondition<T extends Comparable<T>> extends AbstractCondition implements IDiscreteElementCondition<T> { - - private final DiscreteElement<T> element; - private final T value; - private final EqualityOperation operation; - private T lastValue = null; - - public ComparisonCondition(DiscreteElement<T> element, EqualityOperation operation, T value) { - this.element = element; - this.operation = operation; - this.value = value; - } - - @Override - public T getLastCheckValue() { - return lastValue; - } - - @Override - public boolean check() { - lastValue = element.getValue(); - return operation.evaluate(lastValue, value); - } - - public DiscreteElement<T> getElement() { - return element; - } - - public T getValue() { - return value; - } - - public EqualityOperation getOperation() { - return operation; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/DifferenceCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/DifferenceCondition.java deleted file mode 100644 index 0077844f201..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/DifferenceCondition.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.NumericElement; - -/** - * @author Ken J. Aguilar - */ - -public class DifferenceCondition<T extends Number & Comparable<T>> extends AbstractCondition implements IDiscreteElementCondition<T> { - - private final NumericElement<T> element; - private final T differenceThreshold; - private T lastValue; - private final NumericEvaluator<T> evaluator; - - public DifferenceCondition(NumericElement<T> element, T differenceThreshold) { - this.element = element; - this.differenceThreshold = differenceThreshold; - Class<?> targetClass = differenceThreshold.getClass(); - if (targetClass.equals(Integer.class)) { - evaluator = (NumericEvaluator<T>) NumericEvaluator.IntegerEvaluator; - } else if (targetClass.equals(Double.class)) { - evaluator = (NumericEvaluator<T>) NumericEvaluator.DoubleEvaluator; - } else if (targetClass.equals(Long.class)) { - evaluator = (NumericEvaluator<T>) NumericEvaluator.LongEvaluator; - } else if (targetClass.equals(Float.class)) { - evaluator = (NumericEvaluator<T>) NumericEvaluator.FloatEvaluator; - } else { - throw new IllegalArgumentException(""); - } - } - - public NumericElement<T> getElement() { - return element; - } - - public T getDifferenceThreshold() { - return differenceThreshold; - } - - @Override - public T getLastCheckValue() { - return lastValue; - } - - @Override - public boolean check() { - T value = element.getValue(); - if (lastValue == null) { - lastValue = value; - return false; - } - - boolean result = evaluator.subtractAndCheckGreater(value, lastValue, differenceThreshold); - lastValue = value; - return result; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/EmptyStringCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/EmptyStringCondition.java deleted file mode 100644 index 02b8c2e4045..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/EmptyStringCondition.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.StringElement; - -/** - * this condition checks to see if a {@link StringElement} is empty. Empty is defined as having the first byte/character - * of the element equal to zero. - * - * @author Ken J. Aguilar - */ -public class EmptyStringCondition extends AbstractCondition implements IDiscreteElementCondition<Character> { - - public final StringElement element; - private char lastValue; - private final int offset; - - public EmptyStringCondition(StringElement element) { - this.element = element; - offset = element.getMsgData().getMem().getOffset() + element.getByteOffset(); - } - - @Override - public Character getLastCheckValue() { - return lastValue; - } - - @Override - public boolean check() { - lastValue = (char) element.getMsgData().getMem().getData()[offset]; - return lastValue == (char) 0; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/EqualityOperation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/EqualityOperation.java deleted file mode 100644 index 202eea8587a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/EqualityOperation.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -/** - * @author Ken J. Aguilar - */ -public enum EqualityOperation { - LESS_THAN("<") { - - @Override - public <T extends Comparable<T>> boolean evaluate(T currentValue, T targetValue) { - return currentValue.compareTo(targetValue) < 0; - } - }, - LESS_THAN_OR_EQUAL("<=") { - - @Override - public <T extends Comparable<T>> boolean evaluate(T currentValue, T targetValue) { - return currentValue.compareTo(targetValue) <= 0; - } - }, - EQUAL("==") { - - @Override - public <T extends Comparable<T>> boolean evaluate(T currentValue, T targetValue) { - return currentValue.compareTo(targetValue) == 0; - } - }, - NOT_EQUAL("!=") { - - @Override - public <T extends Comparable<T>> boolean evaluate(T currentValue, T targetValue) { - return currentValue.compareTo(targetValue) != 0; - } - }, - GREATER_THAN_OR_EQUAL(">=") { - - @Override - public <T extends Comparable<T>> boolean evaluate(T currentValue, T targetValue) { - return currentValue.compareTo(targetValue) >= 0; - } - }, - GREATER_THAN(">") { - - @Override - public <T extends Comparable<T>> boolean evaluate(T currentValue, T targetValue) { - return currentValue.compareTo(targetValue) > 0; - } - }; - - private final String toString; - - EqualityOperation(String toString) { - this.toString = toString; - } - - @Override - public String toString() { - return toString; - } - - public abstract <T extends Comparable<T>> boolean evaluate(T currentValue, T targetValue); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/EqualsCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/EqualsCondition.java deleted file mode 100644 index 8e11f60c87b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/EqualsCondition.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.DiscreteElement; - -public class EqualsCondition<T extends Comparable<T>> extends AbstractCondition implements IDiscreteElementCondition<T> { - - private final DiscreteElement<T> element; - private final T value; - private final boolean notEquals; - private T actualValue; - - public EqualsCondition(DiscreteElement<T> element, T value) { - this(element, false, value); - } - - /** - * sets up a condition that only passes when the notEquals flag is set to false and actual value equals the expected - * value or when the notEquals flag is true and the actual value does not equal the expected. - */ - public EqualsCondition(DiscreteElement<T> element, boolean notEquals, T value) { - this.element = element; - this.value = element.elementMask(value); - this.notEquals = notEquals; - } - - @Override - public boolean check() { - actualValue = element.getValue(); - return actualValue.equals(value) ^ notEquals; - } - - @Override - public T getLastCheckValue() { - return actualValue; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ICondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ICondition.java deleted file mode 100644 index 33c55c16f0a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ICondition.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -public interface ICondition { - boolean check(); - - boolean checkAndIncrement(); - - int getCheckCount(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/IDiscreteElementCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/IDiscreteElementCondition.java deleted file mode 100644 index 3439308dd3f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/IDiscreteElementCondition.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -public interface IDiscreteElementCondition<T extends Comparable<T>> extends ICondition { - - T getLastCheckValue(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/InRangeCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/InRangeCondition.java deleted file mode 100644 index dfca34a2144..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/InRangeCondition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.DiscreteElement; - -public class InRangeCondition<T extends Comparable<T>> extends AbstractCondition implements IDiscreteElementCondition<T> { - - private final DiscreteElement<T> element; - private final T minValue; - private final T maxValue; - private final boolean minInclusive; - private final boolean maxInclusive; - private T actualValue; - - public InRangeCondition(DiscreteElement<T> element, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive) { - this.element = element; - this.minValue = element.elementMask(minValue); - this.maxValue = element.elementMask(maxValue); - this.maxInclusive = maxInclusive; - this.minInclusive = minInclusive; - } - - @Override - public boolean check() { - actualValue = element.getValue(); - boolean result = minInclusive ? actualValue.compareTo(minValue) >= 0 : actualValue.compareTo(minValue) > 0; - return result && (maxInclusive ? actualValue.compareTo(maxValue) <= 0 : actualValue.compareTo(maxValue) < 0); - } - - @Override - public T getLastCheckValue() { - return actualValue; - } - - public DiscreteElement<T> getElement() { - return element; - } - - public T getMinValue() { - return minValue; - } - - public T getMaxValue() { - return maxValue; - } - - public boolean isMinInclusive() { - return minInclusive; - } - - public boolean isMaxInclusive() { - return maxInclusive; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ListCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ListCondition.java deleted file mode 100644 index 9d9788946f0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/ListCondition.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import org.eclipse.osee.ote.message.elements.DiscreteElement; - -public class ListCondition<T extends Comparable<T>> extends AbstractCondition implements IDiscreteElementCondition<T> { - private final DiscreteElement<T> element; - private final HashSet<T> set; - private final boolean inList; - private T lastValue; - - public ListCondition(DiscreteElement<T> element, boolean inList, T... list) { - this.element = element; - this.inList = inList; - for (int i = 0; i < list.length; i++) { - list[i] = element.elementMask(list[i]); - } - this.set = new HashSet<>(Arrays.asList(list)); - - } - - public ListCondition(DiscreteElement<T> element, boolean inList, Collection<T> list) { - this.element = element; - this.inList = inList; - this.set = new HashSet<>(); - for (T item : list) { - set.add(element.elementMask(item)); - } - - } - - @Override - public T getLastCheckValue() { - return lastValue; - } - - @Override - public boolean check() { - lastValue = element.getValue(); - return !(inList ^ set.contains(lastValue)); - } - - public DiscreteElement<T> getElement() { - return element; - } - - public Collection<T> getSet() { - return set; - } - - public boolean isInList() { - return inList; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/MultiMessageCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/MultiMessageCondition.java deleted file mode 100644 index 6e9f1a2f37d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/MultiMessageCondition.java +++ /dev/null @@ -1,271 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.core.testPoint.CheckPoint; -import org.eclipse.osee.ote.core.testPoint.Operation; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.MessageSystemException; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.MsgWaitResult; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; -import org.eclipse.osee.ote.message.listener.IOSEEMessageListener; - -public class MultiMessageCondition { - - private static final class MessageCounter { - private final Message message; - private int count; - - public MessageCounter(Message message, int initialCount) { - this.count = initialCount; - this.message = message; - } - - public void incrementCount() { - count++; - } - - public int getCount() { - return count; - } - - } - private static final class Listener implements IOSEEMessageListener, ITimeout { - private volatile boolean isTimedOut = false; - private final Message[] messages; - private final HashSet<MessageData> messagesNotSeen = new HashSet<>(); - private final HashMap<MessageData, MessageCounter> hitCount = new HashMap<>(); - - private Listener(Message... messages) { - this.messages = messages; - for (Message message : messages) { - MessageData data = message.getActiveDataSource(); - messagesNotSeen.add(data); - hitCount.put(data, new MessageCounter(message, 0)); - } - - } - - synchronized void begin() { - for (Message message : messages) { - message.addListener(this); - } - } - - void end() { - for (Message message : messages) { - message.removeListener(this); - } - } - - @Override - public synchronized void onDataAvailable(MessageData data, DataType type) throws MessageSystemException { - MessageCounter count = hitCount.get(data); - if (count != null) { - if (count.getCount() == 0) { - // remove this message from the list of messages not seen - messagesNotSeen.remove(data); - } - count.incrementCount(); - } - notify(); - } - - @Override - public void onInitListener() throws MessageSystemException { - // TODO Auto-generated method stub - - } - - @Override - public boolean isTimedOut() { - return isTimedOut; - } - - @Override - public void setTimeout(boolean timeout) { - isTimedOut = timeout; - } - - public synchronized boolean waitForTransmission() throws InterruptedException { - wait(); - return !isTimedOut; - - } - - public void fillInMessagesReceived(Collection<MessageCounter> list) { - for (Message msg : messages) { - // items are removed from the hit list when they are found so if they are not - // in the hit list then that means we received it - - MessageCounter counter = hitCount.get(msg.getActiveDataSource()); - if (counter != null) { - list.add(counter); - } - } - } - - public int getHitCount(Message msg) { - MessageCounter count = hitCount.get(msg.getActiveDataSource()); - return count != null ? count.getCount() : 0; - } - - public void fillInMessagesNotReceived(Collection<Message> list) { - - for (Message msg : messages) { - // if we found it in the hit list then that means we didn't see it - if (messagesNotSeen.contains(msg.getActiveDataSource())) { - list.add(msg); - } - } - } - } - - public MultiMessageCondition() { - } - - public MsgWaitResult waitForAllTransmissions(ITestEnvironmentAccessor accessor, int timeout, Collection<MessageCounter> msgsNotSeen, Message... messages) throws InterruptedException { - long time = accessor.getEnvTime(); - boolean seenAllMessages = false; - int count = 0; - if (timeout > 0) { - boolean done = false; - Listener listener = new Listener(messages); - listener.begin(); - try { - final ICancelTimer cancelTimer = accessor.setTimerFor(listener, timeout); - while (!done) { - if (listener.waitForTransmission()) { - seenAllMessages = listener.messagesNotSeen.isEmpty(); - count++; - } - done = seenAllMessages | listener.isTimedOut(); - } - cancelTimer.cancelTimer(); - } finally { - listener.end(); - if (msgsNotSeen != null) { - listener.fillInMessagesReceived(msgsNotSeen); - } - } - } - time = accessor.getEnvTime() - time; - return new MsgWaitResult(time, count, seenAllMessages); - } - - public MsgWaitResult waitForAnyTransmission(ITestEnvironmentAccessor accessor, int timeout, Collection<MessageCounter> msgsSeen, Message... messages) throws InterruptedException { - long time = accessor.getEnvTime(); - boolean anyTransmissions = false; - int count = 0; - if (timeout > 0) { - boolean done = false; - Listener listener = new Listener(messages); - listener.begin(); - try { - final ICancelTimer cancelTimer = accessor.setTimerFor(listener, timeout); - while (!done) { - if (listener.waitForTransmission()) { - count++; - anyTransmissions = true; - } - done = anyTransmissions | listener.isTimedOut(); - } - cancelTimer.cancelTimer(); - } finally { - listener.end(); - if (msgsSeen != null) { - listener.fillInMessagesReceived(msgsSeen); - } - } - } - time = accessor.getEnvTime() - time; - return new MsgWaitResult(time, count, anyTransmissions); - } - - public void checkNoTransmissions(ITestAccessor accessor, int timeout, Message... messages) throws InterruptedException { - MethodFormatter mf = new MethodFormatter(); - mf.add(timeout); - for (Message msg : messages) { - mf.add(msg.getName()); - } - accessor.getLogger().methodCalledOnObject(accessor, "MultMessage", mf); - LinkedList<MessageCounter> msgsReceived = new LinkedList<>(); - MsgWaitResult result = waitForAnyTransmission(accessor, timeout, msgsReceived, messages); - if (!result.isPassed()) { - CheckPoint cp = - new CheckPoint("MESSAGE_TRANSMISSION.NONE", "NONE", result.isPassed() ? "AT LEAST ONE" : "NONE", - !result.isPassed(), result.getXmitCount(), result.getElapsedTime()); - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), cp); - } else { - CheckGroup group = new CheckGroup(Operation.AND, "MESSAGE_TRANSMISSION.NONE"); - for (MessageCounter counter : msgsReceived) { - group.add(new CheckPoint("TRANSMISSIONS OF " + counter.message.getName(), "0", - Integer.toString(counter.count), counter.count == 0, counter.count, result.getElapsedTime())); - } - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), group); - } - accessor.getLogger().methodEnded(accessor); - } - - public void checkAnyTransmissions(ITestAccessor accessor, int timeout, Message... messages) throws InterruptedException { - MethodFormatter mf = new MethodFormatter(); - mf.add(timeout); - for (Message msg : messages) { - mf.add(msg.getName()); - } - accessor.getLogger().methodCalledOnObject(accessor, "MultMessage", mf); - LinkedList<MessageCounter> msgsReceived = new LinkedList<>(); - MsgWaitResult result = waitForAnyTransmission(accessor, timeout, msgsReceived, messages); - CheckPoint cp = - new CheckPoint("MESSAGE_TRANSMISSION.ANY", "AT LEAST ONE", result.isPassed() ? "AT LEAST ONE" : "NONE", - result.isPassed(), result.getXmitCount(), result.getElapsedTime()); - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), cp); - accessor.getLogger().methodEnded(accessor); - } - - public void checkAllTransmissions(ITestAccessor accessor, int timeout, Message... messages) throws InterruptedException { - MethodFormatter mf = new MethodFormatter(); - mf.add(timeout); - for (Message msg : messages) { - mf.add(msg.getName()); - } - accessor.getLogger().methodCalledOnObject(accessor, "MultMessage", mf); - LinkedList<MessageCounter> msgsReceived = new LinkedList<>(); - MsgWaitResult result = waitForAllTransmissions(accessor, timeout, msgsReceived, messages); - if (result.isPassed()) { - CheckPoint cp = - new CheckPoint("MESSAGE_TRANSMISSION.ALL", "ALL", result.isPassed() ? "ALL" : "NOT ALL", result.isPassed(), - result.getXmitCount(), result.getElapsedTime()); - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), cp); - } else { - CheckGroup group = new CheckGroup(Operation.AND, "MESSAGE_TRANSMISSION.ALL"); - for (MessageCounter counter : msgsReceived) { - group.add(new CheckPoint("TRANSMISSIONS OF " + counter.message.getName(), "GREATER THAN 0", - Integer.toString(counter.count), counter.count > 0, counter.count, result.getElapsedTime())); - } - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), group); - } - - accessor.getLogger().methodEnded(accessor); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/NotInRangeCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/NotInRangeCondition.java deleted file mode 100644 index c27c422bb31..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/NotInRangeCondition.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.DiscreteElement; - -public class NotInRangeCondition<T extends Comparable<T>> extends AbstractCondition implements IDiscreteElementCondition<T> { - - private final DiscreteElement<T> element; - private final T minValue; - private final T maxValue; - private final boolean minInclusive; - private final boolean maxInclusive; - private T actualValue; - - public NotInRangeCondition(DiscreteElement<T> element, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive) { - this.element = element; - this.minValue = element.elementMask(minValue); - this.maxValue = element.elementMask(maxValue); - this.maxInclusive = maxInclusive; - this.minInclusive = minInclusive; - } - - @Override - public boolean check() { - actualValue = element.getValue(); - boolean result = minInclusive ? actualValue.compareTo(minValue) < 0 : actualValue.compareTo(minValue) <= 0; - return result | (maxInclusive ? actualValue.compareTo(maxValue) > 0 : actualValue.compareTo(maxValue) >= 0); - } - - @Override - public T getLastCheckValue() { - return actualValue; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/NumericEvaluator.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/NumericEvaluator.java deleted file mode 100644 index 6394d4a21db..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/NumericEvaluator.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -/** - * @author Ken J. Aguilar - */ -public interface NumericEvaluator<T extends Number & Comparable<T>> { - - public static final NumericEvaluator<Integer> IntegerEvaluator = new NumericEvaluator<Integer>() { - @Override - public boolean subtractAndCheckGreater(Integer left, Integer right, Integer expected) { - return left - right > expected; - } - }; - - public static final NumericEvaluator<Double> DoubleEvaluator = new NumericEvaluator<Double>() { - @Override - public boolean subtractAndCheckGreater(Double left, Double right, Double expected) { - return left - right > expected; - } - }; - - public static final NumericEvaluator<Long> LongEvaluator = new NumericEvaluator<Long>() { - @Override - public boolean subtractAndCheckGreater(Long left, Long right, Long expected) { - return left - right > expected; - } - }; - - public static final NumericEvaluator<Float> FloatEvaluator = new NumericEvaluator<Float>() { - @Override - public boolean subtractAndCheckGreater(Float left, Float right, Float expected) { - return left - right > expected; - } - }; - - boolean subtractAndCheckGreater(T left, T right, T expected); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/OrCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/OrCondition.java deleted file mode 100644 index b40426e2980..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/OrCondition.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import java.util.Collection; - -/** - * Checks that a series of conditions are all true - * - * @author Ken J. Aguilar - */ -public class OrCondition extends AbstractCondition { - - private final ICondition[] conditions; - - public OrCondition(ICondition... conditions) { - this.conditions = conditions; - } - - public OrCondition(Collection<ICondition> conditions) { - this.conditions = conditions.toArray(new ICondition[conditions.size()]); - } - - @Override - public boolean check() { - for (ICondition condition : conditions) { - if (!condition.check()) { - return false; - } - } - return true; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/PulseCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/PulseCondition.java deleted file mode 100644 index b9a0b6aa295..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/PulseCondition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.DiscreteElement; - -public class PulseCondition<T extends Comparable<T>> extends AbstractCondition implements IDiscreteElementCondition<T> { - - private final int maxPulses; - private final DiscreteElement<T> element; - private final T pulsedValue; - private final T nonPulsedValue; - private int pulses = 0; - private T lastValue; - - public PulseCondition(DiscreteElement<T> element, T pulsedValue, T nonPulsedValue, int numPulses) { - this.element = element; - this.pulsedValue = element.elementMask(pulsedValue); - this.nonPulsedValue = element.elementMask(nonPulsedValue); - this.maxPulses = numPulses; - } - - public PulseCondition(DiscreteElement<T> element, T pulsedValue, T nonPulsedValue) { - this(element, pulsedValue, nonPulsedValue, 2); - } - - @Override - public T getLastCheckValue() { - return lastValue; - } - - @Override - public boolean check() { - lastValue = element.getValue(); - if (lastValue.equals(pulsedValue)) { - pulses++; - } else if (lastValue.equals(nonPulsedValue)) { - if( pulses >= maxPulses ) { - return true; - } else { - pulses = 0; - } - } - return false; - } - - public int getPulses() { - return pulses; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/StringComparisonCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/StringComparisonCondition.java deleted file mode 100644 index 229959f6ddf..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/StringComparisonCondition.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.StringElement; - -/** - * @author Ken J. Aguilar - */ - -public class StringComparisonCondition extends AbstractCondition implements IDiscreteElementCondition<String> { - - private final StringElement element; - private final String value; - private final StringOperation operation; - private String lastValue = null; - - public StringComparisonCondition(StringElement element, StringOperation operation, String value) { - this.element = element; - this.operation = operation; - this.value = value; - } - - @Override - public String getLastCheckValue() { - return lastValue; - } - - @Override - public boolean check() { - lastValue = element.getValue(); - return operation.evaluate(lastValue, value); - } - - public StringElement getElement() { - return element; - } - - public String getValue() { - return value; - } - - public StringOperation getOperation() { - return operation; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/StringOperation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/StringOperation.java deleted file mode 100644 index c4d6da227cf..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/StringOperation.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -/** - * @author Ken J. Aguilar - */ -public enum StringOperation { - LESS_THAN("<") { - - @Override - public boolean evaluate(String currentValue, String targetValue) { - return currentValue.compareTo(targetValue) < 0; - } - }, - LESS_THAN_OR_EQUAL("<=") { - - @Override - public boolean evaluate(String currentValue, String targetValue) { - return currentValue.compareTo(targetValue) <= 0; - } - }, - EQUAL("==") { - - @Override - public boolean evaluate(String currentValue, String targetValue) { - return currentValue.compareTo(targetValue) == 0; - } - }, - NOT_EQUAL("!=") { - - @Override - public boolean evaluate(String currentValue, String targetValue) { - return currentValue.compareTo(targetValue) != 0; - } - }, - GREATER_THAN_OR_EQUAL(">=") { - - @Override - public boolean evaluate(String currentValue, String targetValue) { - return currentValue.compareTo(targetValue) >= 0; - } - }, - GREATER_THAN(">") { - - @Override - public boolean evaluate(String currentValue, String targetValue) { - return currentValue.compareTo(targetValue) > 0; - } - }, - - SUBSTRING("SUB-STRING OF") { - - @Override - public boolean evaluate(String currentValue, String targetValue) { - return targetValue.contains(currentValue); - } - }, - - CONTAINS("CONTAINS") { - - @Override - public boolean evaluate(String currentValue, String targetValue) { - return currentValue.contains(targetValue); - } - }; - - private final String toString; - - StringOperation(String toString) { - this.toString = toString; - } - - @Override - public String toString() { - return toString; - } - - public abstract boolean evaluate(String currentValue, String targetValue); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/StringTrimCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/StringTrimCondition.java deleted file mode 100644 index 6816365a3a7..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/StringTrimCondition.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.DiscreteElement; - -public class StringTrimCondition extends AbstractCondition implements IDiscreteElementCondition<String> { - - private final DiscreteElement<String> element; - private final String value; - private String actualValue; - - public StringTrimCondition(DiscreteElement<String> element, String value) { - this.element = element; - this.value = value; - } - - @Override - public boolean check() { - actualValue = element.getValue().trim(); - return actualValue.equals(value); - } - - @Override - public String getLastCheckValue() { - return actualValue; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/TransitionCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/TransitionCondition.java deleted file mode 100644 index 2c66b46efa1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/TransitionCondition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -import org.eclipse.osee.ote.message.elements.DiscreteElement; - -/** - * @author Ken J. Aguilar - */ - -public class TransitionCondition<T extends Comparable<T>> extends AbstractCondition implements IDiscreteElementCondition<T> { - - private final DiscreteElement<T> element; - private final T transitionFromValue; - private final T transitionToValue; - private T lastValue = null; - - public TransitionCondition(DiscreteElement<T> element, T transitionFromValue, T transitionToValue) { - this.element = element; - this.transitionToValue = transitionToValue; - this.transitionFromValue = transitionFromValue; - } - - @Override - public T getLastCheckValue() { - return lastValue; - } - - @Override - public boolean check() { - T currentValue = element.getValue(); - if (lastValue == null) { - lastValue = currentValue; - return false; - } - boolean result = transitionFromValue.equals(lastValue) && transitionToValue.equals(currentValue); - lastValue = currentValue; - return result; - } - - public DiscreteElement<T> getElement() { - return element; - } - - public T getTransitionFromValue() { - return transitionFromValue; - } - - public T getTransitionToValue() { - return transitionToValue; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/TransmissionCountCondition.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/TransmissionCountCondition.java deleted file mode 100644 index 9860239a11c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/condition/TransmissionCountCondition.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.condition; - -public class TransmissionCountCondition extends AbstractCondition { - - private final int max; - - public TransmissionCountCondition(int max) { - this.max = max; - } - - @Override - public boolean check() { - return getCheckCount() >= max; - } - - public int getMaxTransmitCount() { - return max; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/ByteArrayHolder.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/ByteArrayHolder.java deleted file mode 100644 index a497cd96539..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/ByteArrayHolder.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.data; - -import java.nio.ByteBuffer; - -/** - * @author Andrew M. Finkbeiner - */ -public class ByteArrayHolder { - private byte[] buffer; - private ByteBuffer byteBuffer; - - public ByteArrayHolder() { - - } - - public ByteArrayHolder(byte[] buffer) { - this.buffer = buffer; - byteBuffer = ByteBuffer.wrap(buffer); - } - - public void set(byte[] buffer) { - this.buffer = buffer; - byteBuffer = ByteBuffer.wrap(buffer); - } - - public byte[] get() { - return this.buffer; - } - - public ByteBuffer getByteBuffer() { - return byteBuffer; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/DDSTypeSupport.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/DDSTypeSupport.java deleted file mode 100644 index 61a427c0417..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/DDSTypeSupport.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.data; - -import org.eclipse.osee.ote.messaging.dds.service.Key; -import org.eclipse.osee.ote.messaging.dds.service.TypeSupport; - -/** - * @author Andrew M. Finkbeiner - */ -public class DDSTypeSupport extends TypeSupport { - - private final Key key; - private final String readerName; - private final String writerName; - private final int size; - - public DDSTypeSupport(Key key, String readerName, String writerName, int size) { - this.key = key; - this.readerName = readerName; - this.writerName = writerName; - this.size = size; - } - - @Override - protected Key getKey() { - return key; - } - - @Override - protected String getReaderName() { - return this.readerName; - } - - @Override - protected int getTypeDataSize() { - return this.size; - } - - @Override - protected String getWriterName() { - return this.writerName; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/HeaderData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/HeaderData.java deleted file mode 100644 index 588c7d527f1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/HeaderData.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.data; - -import org.eclipse.osee.ote.message.IMessageHeader; - -public class HeaderData extends MessageData { - - public HeaderData(String name, MemoryResource memoryResource) { - super(name, memoryResource); - } - - public HeaderData(MemoryResource memoryResource) { - this("", memoryResource); - } - - @Override - public IMessageHeader getMsgHeader() { - return null; - } - - @Override - public void initializeDefaultHeaderValues() { - } - - @Override - public void visit(IMessageDataVisitor visitor) { - } - - @Override - public void zeroize() { - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/IMessageDataVisitor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/IMessageDataVisitor.java deleted file mode 100644 index 195bc7addad..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/IMessageDataVisitor.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.data; - -/** - * @author Ken J. Aguilar - */ -public interface IMessageDataVisitor { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/MemoryResource.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/MemoryResource.java deleted file mode 100644 index 3c58096560e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/MemoryResource.java +++ /dev/null @@ -1,511 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.data; - -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.util.Arrays; -import java.util.logging.Level; - -import org.eclipse.osee.ote.message.MessageSystemException; - -/** - * @author Andrew M. Finkbeiner - */ -public class MemoryResource { - private static final Charset US_ASCII_CHARSET = Charset.forName("US-ASCII"); - - private final ByteArrayHolder byteArray; - // private byte _data[]; - private int _offset; - private final int _length; - private volatile boolean _dataHasChanged; - - // private final ByteBuffer buffer; - - public MemoryResource(byte data[], int offset, int length) { - byteArray = new ByteArrayHolder(data); - _length = length; - _offset = offset; - _dataHasChanged = false; - } - - protected MemoryResource(ByteArrayHolder byteArray, int offset, int length) { - this.byteArray = byteArray; - _length = length; - _offset = offset; - _dataHasChanged = false; - } - - public final String getUnfilteredASCIIString(int offset, int msb, int lsb) { - offset += _offset; - int size = (lsb - msb + 1) / 8; - - StringBuilder str = new StringBuilder(size); - int limit = Math.min(size, byteArray.get().length-offset); - for (int i = 0; i < limit; i++) { - str.append(getASCIICharFromOffset(offset + i)); - } - return str.toString(); - } - public void setData(byte data[]) { - byteArray.set(data); - _dataHasChanged = true; - } - - public byte[] getData() { - return byteArray.get(); - } - - public byte getByte(int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 7) { - return byteArray.get()[offset]; - } else { - int b = byteArray.get()[offset]; - int mask = (1 << 8 - msb) - 1; - mask = mask & 0xFFFFFF80 >>> lsb; - return (byte) ((b & mask) >> 7 - lsb); - } - } - - private byte getByteFromOffset(int offset) { - return byteArray.get()[offset]; - } - - private final char getASCIICharFromOffset(int offset) { - return (char) byteArray.get()[offset]; - } - - public final int getInt(int offset, int msb, int lsb) { - offset += _offset; - final byte[] data = byteArray.get(); - final int length = data.length; - final int beginByte = offset + msb / 8; - int endByte = offset + lsb / 8; - endByte = endByte < length ? endByte : length; - int v = data[beginByte] & 0xFF >>> msb % 8 & 0xFF; - if (endByte != beginByte) { - for (int i = beginByte + 1; i <= endByte - 1; i++) { - v <<= 8; - v |= data[i] & 0xFF; - } - v <<= 8; - v |= data[endByte] & 0xFF; - } - return v >>> 7 - lsb % 8; - } - - public final short getSignedInt16(int offset, int msb, int lsb) { - if (lsb - msb != 15) { - throw new IllegalArgumentException("element must be 16 bits wide"); - } - offset += _offset; - final byte[] data = byteArray.get(); - final int length = data.length; - final int beginByte = offset + msb / 8; - int endByte = offset + lsb / 8; - endByte = endByte < length ? endByte : length; - int v = data[beginByte] & 0xFF >>> msb % 8 & 0xFF; - if (endByte != beginByte) { - for (int i = beginByte + 1; i <= endByte - 1; i++) { - v <<= 8; - v |= data[i] & 0xFF; - } - v <<= 8; - v |= data[endByte] & 0xFF; - } - return (short) (v >>> 7 - lsb % 8); - } - - public final int getSignedInt32(int offset, int msb, int lsb) { - if (lsb - msb != 31) { - throw new IllegalArgumentException("element must be 32 bits wide"); - } - offset += _offset; - final byte[] data = byteArray.get(); - final int length = data.length; - final int beginByte = offset + msb / 8; - int endByte = offset + lsb / 8; - endByte = endByte < length ? endByte : length; - int v = data[beginByte] & 0xFF >>> msb % 8 & 0xFF; - if (endByte != beginByte) { - for (int i = beginByte + 1; i <= endByte - 1; i++) { - v <<= 8; - v |= data[i] & 0xFF; - } - v <<= 8; - v |= data[endByte] & 0xFF; - } - return v >>> 7 - lsb % 8; - } - - public final long getLong(int offset, int msb, int lsb) { - offset += _offset; - if (lsb - msb <= 63) { - final byte[] data = byteArray.get(); - final int length = data.length; - final int beginByte = offset + msb / 8; - int endByte = offset + lsb / 8; - endByte = endByte < length ? endByte : length; - long v = data[beginByte] & 0xFF >>> msb % 8 & 0xFF; - if (endByte != beginByte) { - for (int i = beginByte + 1; i <= endByte - 1; i++) { - v <<= 8; - v |= data[i] & 0xFF; - } - v <<= 8; - v |= data[endByte] & 0xFF; - } - return v >>> 7 - lsb % 8; - } else { - throw new IllegalArgumentException("gettting long with bits not supported"); - } - } - - public final String getASCIIString(int offset, int length) { - offset += _offset; - // int size = ((lsb - msb) + 1) / 8; - - StringBuilder str = new StringBuilder(length); - for (int i = 0; i < length; i++) { - char ch = getASCIICharFromOffset(offset + i); - if (ch != 0) {// NOTE this was done to be compatible with java - // Strings that don't null char termination - str.append(getASCIICharFromOffset(offset + i)); - } - } - return str.toString(); - } - - public final String getASCIIString(int offset, int msb, int lsb) { - offset += _offset; - int size = (lsb - msb + 1) / 8; - - StringBuilder str = new StringBuilder(size); - for (int i = 0; i < size; i++) { - if (offset + i >= byteArray.get().length) { - break; - } - char ch = getASCIICharFromOffset(offset + i); - if (ch == 0) { - break; //Terminate on null characters. - } - str.append(getASCIICharFromOffset(offset + i)); - } - return str.toString(); - } - - public final int getASCIIChars(int offset, int msb, int lsb, char[] destination) { - offset += _offset; - int size = (lsb - msb + 1) / 8; - int destIndex = 0; - - for (int i = 0; i < size; i++) { - if (offset + i >= byteArray.get().length) { - break; - } - char ch = getASCIICharFromOffset(offset + i); - destination[destIndex] = ch; - destIndex++; - } - return destIndex; - } - - public boolean asciiEquals(int offset, int msb, int lsb, String other) { - offset += _offset; - int size = (lsb - msb + 1) / 8; - if (other.length() > size) { - return false; - } - boolean isEqual = true; - for (int i = 0; i < size && isEqual; i++) { - char ch = getASCIICharFromOffset(offset + i); - if (ch != 0) {// NOTE this was done to be compatible with java - // Strings that don't null char termination - isEqual = ch == other.charAt(i); - } - } - return isEqual; - } - - public void setBoolean(boolean v, int offset, int msb, int lsb) { - int i = v ? 1 : 0; - if (lsb < 32) { - setInt(i, offset, msb, lsb); - } else { - throw new RuntimeException("Not supported lsb = " + lsb); - } - } - - public final void setByte(int v, int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 7) { - setByteFromOffset(v, offset); - } else { - if ((v & 1 >>> 7 - (lsb - msb)) != 0) { - throw new IllegalArgumentException("Tried to set signal to value that is too large"); - } - int mask = createMask(msb, lsb, 7); - v = v << 7 - lsb; - v &= ~mask; - setByteFromOffset(v | getByteFromOffset(offset) & mask, offset); - } - } - - public final void setBytesInHeader(int v, int offset, int msb, int lsb) { - if (offset > _offset) { - throw new IllegalArgumentException("Data beyond header attempting to be set!!!"); - } - if (msb == 0 && lsb == 7) { - setByteFromOffset(v, offset); - } else { - if ((v & 1 >>> 7 - (lsb - msb)) != 0) { - throw new IllegalArgumentException("Tried to set signal to value that is too large"); - } - int mask = (1 << 7 - lsb) - 1; - mask = mask | 0xFFFFFF00 >>> msb; - v = v << 7 - lsb; - setByteFromOffset(v | getByteFromOffset(offset) & mask, offset); - } - } - - private final void setByteFromOffset(int v, int offset) { - byteArray.get()[offset] = (byte) v; - _dataHasChanged = true; - } - - public void setOffset(int offset) { - this._offset = offset; - } - - public final void setInt(int v, int offset, int msb, int lsb) { - offset += _offset; - final byte[] data = byteArray.get(); - final int length = data.length; - final int beginByte = offset + msb / 8; - int endByte = offset + lsb / 8; - endByte = endByte < length ? endByte : length - 1; - final int lsbMod = lsb % 8; - if (endByte != beginByte) { - byte mask = (byte) (0xFF >>> lsbMod + 1); // mask used to mask off bits we shouldn't touch - data[endByte] &= mask; // zero out bits that will be set by v - v <<= 7 - lsbMod; // shift v so that it lines up - data[endByte] |= v; - v >>>= 8; // shift to the next byte - for (int i = endByte - 1; i >= beginByte + 1; i--) { - data[i] = (byte) v; - v >>>= 8; // shift to the next byte - } - mask = (byte) (0xFF >>> msb % 8); - v &= mask; - data[beginByte] &= ~mask; - data[beginByte] |= v; - } else { - byte mask = (byte) (-1 << lsb - msb + 1); // create mask for everything left of msb - v &= ~mask; // mask off everything to the left of the msb in the value - int shift = 7 - lsbMod; - mask <<= shift; // shift mask to align with the lsb - v <<= shift; // shift value so that it aligns with the lsb - mask |= (byte) (0xFF >>> lsbMod + 1); // union the mask so that it mask everything to the right of the lsb - data[beginByte] &= mask; // zero out the bits about to be written to - data[beginByte] |= v; // logical 'OR' in the value - } - _dataHasChanged = true; - } - - private int createMask(int msb, int lsb, int maxBitPosition) { - int maximumElementValue = (int) Math.pow(2, lsb - msb + 1) - 1; - int maxValueInPosition = maximumElementValue << maxBitPosition - lsb; - //the mask is all ones except at the bit positions we are setting - int mask = ~maxValueInPosition; - return mask; - } - - public final void setLong(long v, int offset, int msb, int lsb) { - if (lsb - msb < 64) { - offset += _offset; - final byte[] data = byteArray.get(); - final int length = data.length; - final int beginByte = offset + msb / 8; - int endByte = offset + lsb / 8; - endByte = endByte < length ? endByte : length - 1; - final int lsbMod = lsb % 8; - if (endByte != beginByte) { - byte mask = (byte) (0xFF >>> lsbMod + 1); // mask used to mask off bits we shouldn't touch - data[endByte] &= mask; // zero out bits that will be set by v - v <<= 7 - lsbMod; // shift v so that it lines ups - data[endByte] |= v; - v >>>= 8; - for (int i = endByte - 1; i >= beginByte + 1; i--) { - data[i] = (byte) v; - v >>>= 8; - } - mask = (byte) (0xFF >>> msb % 8); - v &= mask; - data[beginByte] &= ~mask; - data[beginByte] |= v; - } else { - byte mask = (byte) (-1 << lsb - msb + 1); - v &= ~mask; - int shift = 7 - lsbMod; - mask <<= shift; - v <<= shift; - mask |= (byte) (0xFF >>> lsbMod + 1); - data[beginByte] &= mask; - data[beginByte] |= v; - } - _dataHasChanged = true; - } else { - throw new IllegalArgumentException("not supported bit width of " + (lsb - msb + 1)); - } - } - - public final void setASCIIString(String s, int offset, int msb, int lsb) { - int size = (lsb - msb + 1) / 8; - int limit = Math.min(s.length(), size); - System.arraycopy(s.getBytes(US_ASCII_CHARSET), 0, byteArray.get(), _offset + offset, limit); - zeroizeFromOffset(limit + offset, size - limit); - _dataHasChanged = true; - } - - public final void setASCIIString(String s, int offset) { - System.arraycopy(s.getBytes(US_ASCII_CHARSET), 0, byteArray.get(), _offset + offset, s.length()); - _dataHasChanged = true; - } - - public void zeroizeFromOffset(int offset, int size) { - offset += _offset; - Arrays.fill(byteArray.get(), offset, offset + size, (byte) 0); - _dataHasChanged = true; - } - - public boolean getBoolean(int offset, int msb, int lsb) { - return getInt(offset, msb, lsb) != 0; - } - - public void copyData(int offset, byte[] src, int srcOffset, int length) { - // assert(byteArray.get().length >= length ); - if (length + offset > byteArray.get().length) { - throw new MessageSystemException("backing byte[] is too small for copy operation", Level.SEVERE); - } - System.arraycopy(src, srcOffset, byteArray.get(), offset, length); - Arrays.fill(byteArray.get(), offset + length, byteArray.get().length, (byte) 0); - _dataHasChanged = true; - } - - public void copyData(ByteBuffer src) { - copyData(0, src, src.remaining()); - } - - /** - * @param destOffset offset in this memory resource in which the copy will begin - */ - public void copyData(int destOffset, ByteBuffer src, int length) throws MessageSystemException { - if (length + destOffset > byteArray.get().length) { - throw new MessageSystemException("backing byte[] is too small for copy operation", Level.INFO); - } - if (src.hasArray()) { - System.arraycopy(src.array(), src.arrayOffset() + src.position(), byteArray.get(), destOffset, length); - } else { - synchronized (src) { - src.mark(); - src.get(byteArray.get(), destOffset, length); - src.reset(); - } - } - Arrays.fill(byteArray.get(), destOffset + length, byteArray.get().length, (byte) 0); - _dataHasChanged = true; - } - - public ByteBuffer getAsBuffer() { - return ByteBuffer.wrap(byteArray.get()); - } - - public ByteBuffer getBuffer() { - return byteArray.getByteBuffer(); - } - - // public void set(ByteBuffer other) { - // buffer.put(other); - // } - public ByteBuffer getAsBuffer(int offset, int length) { - if (offset > byteArray.get().length) { - throw new IllegalArgumentException( - "offset of " + offset + " cannot be bigger than data length of " + byteArray.get().length); - } - if (offset + length > byteArray.get().length) { - throw new IllegalArgumentException( - "offset (" + offset + ") plus length (" + length + ") is greater than data length of " + byteArray.get().length); - } - return ByteBuffer.wrap(byteArray.get(), offset, length); - } - - public int getOffset() { - return _offset; - } - - public int getLength() { - return _length; - } - - public MemoryResource slice(int offset, int length) { - return new MemoryResource(byteArray, offset, length); - } - - /** - * @return the _dataHasChanged - */ - public boolean isDataChanged() { - return _dataHasChanged; - } - - /** - * @param hasChanged the _dataHasChanged to set - */ - public void setDataHasChanged(boolean hasChanged) { - _dataHasChanged = hasChanged; - } - - public static void main(String[] args) { - - MemoryResource mem = new MemoryResource(new byte[24], 4, 24); - mem.setLong(0x1234567890abcdefL, 12, 0, 63); - for (int i = 0; i < 24; i++) { - System.out.printf("%02x ", mem.getData()[i]); - } - System.out.printf("\nget=%016x\n", mem.getLong(12, 0, 63)); - - mem.setLong(0xff22cc00aa11L, 12, 0, 43); - for (int i = 0; i < 24; i++) { - System.out.printf("%02x ", mem.getData()[i]); - } - System.out.printf("\nget=%016x\n", mem.getLong(12, 0, 43)); - - mem.setLong(0xffdd555522L, 12, 2, 41); - for (int i = 0; i < 24; i++) { - System.out.printf("%02x ", mem.getData()[i]); - } - System.out.printf("\nget=%016x\n", mem.getLong(12, 2, 41)); - - mem.setLong(0x00L, 12, 2, 41); - for (int i = 0; i < 24; i++) { - System.out.printf("%02x ", mem.getData()[i]); - } - System.out.printf("\nget=%016x\n", mem.getLong(12, 2, 41)); - - mem.setLong(0x035544332211L, 12, 2, 43); - for (int i = 0; i < 24; i++) { - System.out.printf("%02x ", mem.getData()[i]); - } - System.out.printf("\nget=%016x\n", mem.getLong(12, 2, 43)); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/MemoryResourceByteBuffer.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/MemoryResourceByteBuffer.java deleted file mode 100644 index e99fcec228c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/MemoryResourceByteBuffer.java +++ /dev/null @@ -1,515 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.data; - -import java.nio.ByteBuffer; -import java.util.logging.Level; -import org.eclipse.osee.ote.message.MessageSystemException; - -/** - * @author Andrew M. Finkbeiner - */ -public class MemoryResourceByteBuffer { - private byte _data[]; - private final int _offset; - public boolean _dataHasChanged; - - private final ByteBuffer buffer; - - public MemoryResourceByteBuffer(byte data[], int offset, int length) { - _data = data; - _offset = offset; - _dataHasChanged = false; - buffer = ByteBuffer.wrap(_data); - } - - public void setData(byte data[]) { - _data = data; - _dataHasChanged = true; - } - - public byte[] getData() { - return _data; - } - - public long getRawDataLong(int offset, int msb, int lsb) { - - if (lsb < 8) { - return getByte(offset, msb, lsb); - } else if (lsb < 16) { - return getShort(offset, msb, lsb); - } else if (lsb < 32) { - offset += _offset; - if (msb == 0 && lsb == 31) { - return getIntFromOffset(offset); - } else { - int i = getIntFromOffset(offset); - int mask = (1 << 32 - msb) - 1; - mask = mask & 0x80000000 >>> lsb; - return (i & mask) >> 31 - lsb; - } - } else if (lsb == 63) { - return getLong(offset, msb, lsb); - } else { - throw new IllegalArgumentException("lsb greater than 63"); - } - } - - public int getRawDataInt(int offset, int msb, int lsb) { - - if (lsb < 8) { - return getByte(offset, msb, lsb); - } else if (lsb < 16) { - return getShort(offset, msb, lsb); - } else if (lsb < 32) { - offset += _offset; - if (msb == 0 && lsb == 31) { - return getIntFromOffset(offset); - } else { - int i = getIntFromOffset(offset); - int mask = (1 << 32 - msb) - 1; - mask = mask & 0x80000000 >>> lsb; - return (i & mask) >> 31 - lsb; - } - } else { - throw new IllegalArgumentException("lsb greater than 31"); - } - } - - public void setRawData(long v, int offset, int msb, int lsb) { - if (lsb < 8) { - setByte((int) v, offset, msb, lsb); - } else if (lsb < 16) { - setShort((int) v, offset, msb, lsb); - } else if (lsb < 32) { - setInt((int) v, offset, msb, lsb); - } else { - setLong(v, offset, msb, lsb); - } - } - - public byte getByte(int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 7) { - return getByteFromOffset(offset); - } else { - int b = getByteFromOffset(offset); - int mask = (1 << 8 - msb) - 1; - mask = mask & 0xFFFFFF80 >>> lsb; - return (byte) ((b & mask) >> 7 - lsb); - } - } - - private byte getByteFromOffset(int offset) { - return _data[offset]; - } - - public short getShort(int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 15) { - return getShortFromOffset(offset); - } else { - int s = getShortFromOffset(offset); - int mask = (1 << 16 - msb) - 1; - mask = mask & 0xFFFF8000 >>> lsb; - return (short) ((s & mask) >> 15 - lsb); - } - } - - private short getShortFromOffset(int offset) { - int ch1 = _data[offset] & 0xFF; - int ch2 = _data[offset + 1] & 0xFF; - return (short) ((ch1 << 8) + (ch2 << 0)); - } - - public char getASCIIChar(int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 7) { - return getASCIICharFromOffset(offset); - } else if (msb == 8 && lsb == 15) { - return getASCIICharFromOffset(offset + 1); - } else if (msb == 16 && lsb == 23) { - return getASCIICharFromOffset(offset + 2); - } else if (msb == 24 && lsb == 31) { - return getASCIICharFromOffset(offset + 3); - } else { - throw new IllegalArgumentException("not supported"); - } - } - - private final char getASCIICharFromOffset(int offset) { - return (char) _data[offset]; - } - - public int getInt(int offset, int msb, int lsb) { - - int nextFourBytes = getIntFromOffset(offset + _offset); - - int bitsToShift = 32 - msb; - int maskLeft = msb == 0 ? -1 : (1 << bitsToShift) - 1;//(int)Math.pow(2, 32 - msb ) -1; - - int retVal = (nextFourBytes & maskLeft) >>> 31 - lsb; - return retVal; - - // if (lsb < 8) { - // return getByte(offset, msb, lsb); - // } - // else if (lsb < 16) { - // return getShort(offset, msb, lsb); - // } - // else if (lsb < 32) { - // offset += _offset; - // if (msb == 0 && lsb == 31) { - // return getIntFromOffset(offset); - // } - // else { - // int i = getIntFromOffset(offset); - // int mask = (1 << (32 - msb)) - 1; - // mask = mask & (0x80000000 >>> lsb); - // return (i & mask) >> (31 - lsb); - // } - // } - // else { - // throw new IllegalArgumentException("lsb greater than 31"); - // } - } - - private int getIntFromOffset(int offset) { - int ch1 = 0, ch2 = 0, ch3 = 0, ch4 = 0; - - if (_data.length > offset) { - ch1 = _data[offset] & 0xFF; - } - if (_data.length > offset + 1) { - ch2 = _data[offset + 1] & 0xFF; - } - if (_data.length > offset + 2) { - ch3 = _data[offset + 2] & 0xFF; - } - if (_data.length > offset + 3) { - ch4 = _data[offset + 3] & 0xFF; - } - return (ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0); - } - - public final long getLong(int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 63) { - return getLongFromOffset(offset); - } else { - throw new IllegalArgumentException("gettting long with bits not supported"); - } - } - - private final long getLongFromOffset(int offset) { - long byte1 = 0, byte2 = 0, byte3 = 0, byte4 = 0, byte5 = 0, byte6 = 0, byte7 = 0, byte8 = 0; - - if (_data.length > offset) { - byte1 = _data[offset]; - } - if (_data.length > offset + 1) { - byte2 = _data[offset + 1]; - } - if (_data.length > offset + 2) { - byte3 = _data[offset + 2]; - } - if (_data.length > offset + 3) { - byte4 = _data[offset + 3]; - } - if (_data.length > offset + 4) { - byte5 = _data[offset + 4]; - } - if (_data.length > offset + 5) { - byte6 = _data[offset + 5]; - } - if (_data.length > offset + 6) { - byte7 = _data[offset + 6]; - } - if (_data.length > offset + 7) { - byte8 = _data[offset + 7]; - } - - long retVal = - (byte1 << 56) + ((byte2 & 0xFF) << 48) + ((byte3 & 0xFF) << 40) + ((byte4 & 0xFF) << 32) + ((byte5 & 0xFF) << 24) + ((byte6 & 0xFF) << 16) + ((byte7 & 0xFF) << 8) + (byte8 & 0xFF); - - return retVal; - // return (((long) _data[offset] << 56) + ((long) (_data[offset + 1] & 255) << 48) - // + ((long) (_data[offset + 2] & 255) << 40) + ((long) (_data[offset + 3] & 255) << 32) - // + ((long) (_data[offset + 4] & 255) << 24) + ((_data[offset + 5] & 255) << 16) - // + ((_data[offset + 6] & 255) << 8) + ((_data[offset + 7] & 255) << 0)); - } - - public final String getASCIIString(int offset, int length) { - offset += _offset; - // int size = ((lsb - msb) + 1) / 8; - - StringBuffer str = new StringBuffer(length); - for (int i = 0; i < length; i++) { - char ch = getASCIICharFromOffset(offset + i); - if (ch != 0) {// NOTE this was done to be compatible with java - // Strings that don't null char termination - str.append(getASCIICharFromOffset(offset + i)); - } - } - return str.toString(); - } - - public final String getASCIIString(int offset, int msb, int lsb) { - offset += _offset; - int size = (lsb - msb + 1) / 8; - - StringBuffer str = new StringBuffer(size); - for (int i = 0; i < size; i++) { - char ch = getASCIICharFromOffset(offset + i); - if (ch != 0) {// NOTE this was done to be compatible with java - // Strings that don't null char termination - str.append(getASCIICharFromOffset(offset + i)); - } - } - return str.toString(); - } - - public void setBoolean(boolean v, int offset, int msb, int lsb) { - int i = v ? 1 : 0; - if (lsb < 8) { - setByte(i, offset, msb, lsb); - } else if (lsb < 16) { - setShort(i, offset, msb, lsb); - } else if (lsb < 32) { - setInt(i, offset, msb, lsb); - } else { - throw new RuntimeException("Not supported lsb = " + lsb); - } - } - - public final void setByte(int v, int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 7) { - setByteFromOffset(v, offset); - } else { - if ((v & 1 >>> 7 - (lsb - msb)) != 0) { - throw new IllegalArgumentException("Tried to set signal to value that is too large"); - } - int mask = createMask(msb, lsb, 7); - v = v << 7 - lsb; - setByteFromOffset(v | getByteFromOffset(offset) & mask, offset); - } - } - - public final void setBytesInHeader(int v, int offset, int msb, int lsb) { - if (offset > _offset) { - throw new IllegalArgumentException("Data beyond header attempting to be set!!!"); - } - if (msb == 0 && lsb == 7) { - setByteFromOffset(v, offset); - } else { - if ((v & 1 >>> 7 - (lsb - msb)) != 0) { - throw new IllegalArgumentException("Tried to set signal to value that is too large"); - } - int mask = (1 << 7 - lsb) - 1; - mask = mask | 0xFFFFFF00 >>> msb; - v = v << 7 - lsb; - setByteFromOffset(v | getByteFromOffset(offset) & mask, offset); - } - } - - private final void setByteFromOffset(int v, int offset) { - _data[offset] = (byte) v; - _dataHasChanged = true; - } - - private final void setShort(int v, int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 15) { - setShortFromOffset(v, offset); - } else { - if ((v & 1 >>> 15 - (lsb - msb)) != 0) { - throw new IllegalArgumentException("Tried to set signal to value that is too large"); - } - int mask = createMask(msb, lsb, 15); - - // shift the value into the correct position within the whole int - v = v << 15 - lsb; - // zero out the element we are setting before oring in the new value - setShortFromOffset(v | getShortFromOffset(offset) & mask, offset); - } - } - - private final void setShortFromOffset(int v, int offset) { - _data[offset] = (byte) (v >>> 8 & 0xFF); - _data[offset + 1] = (byte) (v >>> 0 & 0xFF); - _dataHasChanged = true; - } - - public final void setASCIIChar(char v, int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 7) { - setASCIICharFromOffset(v, offset); - } else if (msb == 8 && lsb == 15) { - setASCIICharFromOffset(v, offset + 1); - } else if (msb == 16 && lsb == 23) { - setASCIICharFromOffset(v, offset + 2); - } else if (msb == 24 && lsb == 31) { - setASCIICharFromOffset(v, offset + 3); - } else { - throw new IllegalArgumentException("only 8 bit char supported"); - } - } - - private final void setASCIICharFromOffset(char v, int offset) { - _data[offset] = (byte) (v & 0xFF); - _dataHasChanged = true; - } - - public final void setInt(int v, int offset, int msb, int lsb) { - if (lsb < 8) { - setByte(v, offset, msb, lsb); - } else if (lsb < 16) { - setShort(v, offset, msb, lsb); - } else { - offset += _offset; - if (msb == 0 && lsb == 31) { - setIntFromOffset(v, offset); - } else { - if ((v & 1 >>> 31 - (lsb - msb)) != 0) { - throw new IllegalArgumentException("Tried to set signal to value that is too large"); - } - int mask = createMask(msb, lsb, 31); - // shift the value into the correct position within the whole int - v = v << 31 - lsb; - // zero out the element we are setting before oring in the new value - setIntFromOffset(v | getIntFromOffset(offset) & mask, offset); - } - } - } - - private int createMask(int msb, int lsb, int maxBitPosition) { - int maximumElementValue = (int) Math.pow(2, lsb - msb + 1) - 1; - int maxValueInPosition = maximumElementValue << maxBitPosition - lsb; - //the mask is all ones except at the bit positions we are setting - int mask = ~maxValueInPosition; - return mask; - } - - private final void setIntFromOffset(int v, int offset) { - if (_data.length > offset) { - _data[offset] = (byte) (v >>> 24 & 0xFF); - } - if (_data.length > offset + 1) { - _data[offset + 1] = (byte) (v >>> 16 & 0xFF); - } - if (_data.length > offset + 2) { - _data[offset + 2] = (byte) (v >>> 8 & 0xFF); - } - if (_data.length > offset + 3) { - _data[offset + 3] = (byte) (v >>> 0 & 0xFF); - } - _dataHasChanged = true; - } - - public final void setLong(long v, int offset, int msb, int lsb) { - offset += _offset; - if (msb == 0 && lsb == 63) { - setLongFromOffset(v, offset); - } else { - throw new IllegalArgumentException("not supported"); - } - } - - private final void setLongFromOffset(long v, int offset) { - if (_data.length > offset) { - _data[offset] = (byte) (v >>> 56); - } - if (_data.length > offset + 1) { - _data[offset + 1] = (byte) (v >>> 48); - } - if (_data.length > offset + 2) { - _data[offset + 2] = (byte) (v >>> 40); - } - if (_data.length > offset + 3) { - _data[offset + 3] = (byte) (v >>> 32); - } - if (_data.length > offset + 4) { - _data[offset + 4] = (byte) (v >>> 24); - } - if (_data.length > offset + 5) { - _data[offset + 5] = (byte) (v >>> 16); - } - if (_data.length > offset + 6) { - _data[offset + 6] = (byte) (v >>> 8); - } - if (_data.length > offset + 7) { - _data[offset + 7] = (byte) (v >>> 0); - } - _dataHasChanged = true; - } - - public final void setASCIIString(String s, int offset, int msb, int lsb) { - offset += _offset; - int size = (lsb - msb + 1) / 8; - - int len = s.length(); - for (int i = 0; i < len && i < size; i++) { - setASCIICharFromOffset(s.charAt(i), offset + i); - } - } - - public final void setASCIIString(String s, int offset) { - offset += _offset; - int len = s.length(); - for (int i = 0; i < len; i++) { - setASCIICharFromOffset(s.charAt(i), offset + i); - } - } - - public boolean getBoolean(int offset, int msb, int lsb) { - int i; - if (lsb < 8) { - i = getByte(offset, msb, lsb); - } else if (lsb < 16) { - i = getShort(offset, msb, lsb); - } else { - i = getInt(offset, msb, lsb); - } - return i != 0; - } - - public void copyData(int offset, byte[] src, int srcOffset, int length) { - // assert(_data.length >= length ); - if (_data.length < src.length) { - throw new MessageSystemException("backing byte[] is too small for copy operation", Level.SEVERE); - } - System.arraycopy(src, srcOffset, _data, offset, length); - _dataHasChanged = true; - } - - public void copyData(ByteBuffer src) { - src.get(_data); - _dataHasChanged = true; - } - - public void copyData(int offset, ByteBuffer src, int length) { - src.get(_data, offset, length); - _dataHasChanged = true; - } - - public ByteBuffer getAsBuffer() { - return ByteBuffer.wrap(_data); - } - - public void set(ByteBuffer other) { - buffer.put(other); - } - - public ByteBuffer getAsBuffer(int offset, int length) { - return ByteBuffer.wrap(_data, offset, length); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/MessageData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/MessageData.java deleted file mode 100644 index fc4afbde7bb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/data/MessageData.java +++ /dev/null @@ -1,690 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.data; - -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Locale; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.CopyOnWriteNoIteratorList; -import org.eclipse.osee.ote.core.GCHelper; -import org.eclipse.osee.ote.core.log.Env; -import org.eclipse.osee.ote.message.IMessageDisposeListener; -import org.eclipse.osee.ote.message.IMessageHeader; -import org.eclipse.osee.ote.message.IMessageSendListener; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.MessageSystemException; -import org.eclipse.osee.ote.message.MessageSystemTestEnvironment; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.interfaces.Namespace; -import org.eclipse.osee.ote.messaging.dds.Data; -import org.eclipse.osee.ote.messaging.dds.DataSample; -import org.eclipse.osee.ote.messaging.dds.IDestination; -import org.eclipse.osee.ote.messaging.dds.ISource; -import org.eclipse.osee.ote.messaging.dds.ReturnCode; -import org.eclipse.osee.ote.messaging.dds.entity.DataReader; -import org.eclipse.osee.ote.messaging.dds.entity.DataWriter; -import org.eclipse.osee.ote.messaging.dds.listener.DataReaderListener; -import org.eclipse.osee.ote.messaging.dds.listener.DataWriterListener; -import org.eclipse.osee.ote.messaging.dds.service.Key; -import org.eclipse.osee.ote.messaging.dds.service.TypeSupport; -import org.eclipse.osee.ote.messaging.dds.status.LivelinessChangedStatus; -import org.eclipse.osee.ote.messaging.dds.status.LivelinessLostStatus; -import org.eclipse.osee.ote.messaging.dds.status.OfferedDeadlineMissedStatus; -import org.eclipse.osee.ote.messaging.dds.status.OfferedIncompatibleQosStatus; -import org.eclipse.osee.ote.messaging.dds.status.PublicationMatchStatus; -import org.eclipse.osee.ote.messaging.dds.status.RequestedDeadlineMissedStatus; -import org.eclipse.osee.ote.messaging.dds.status.RequestedIncompatibleQosStatus; -import org.eclipse.osee.ote.messaging.dds.status.SampleLostStatus; -import org.eclipse.osee.ote.messaging.dds.status.SampleRejectedStatus; -import org.eclipse.osee.ote.messaging.dds.status.SubscriptionMatchStatus; -import org.eclipse.osee.ote.properties.OtePropertiesCore; - -/** - * @author Andrew M. Finkbeiner - */ -public abstract class MessageData implements DataReaderListener, DataWriterListener, Data, Key { - - private static long debugTimeout = OtePropertiesCore.timeDebugTimeout.getLongValue(); - private static boolean debugTime = OtePropertiesCore.timeDebug.getBooleanValue(); - - private DataWriter writer; - private DataReader reader; - private DataSample myDataSample; - - private final MemoryResource mem; - private final String typeName; - private final String name; - private final CopyOnWriteNoIteratorList<Message> messages = new CopyOnWriteNoIteratorList<>(Message.class); - private final CopyOnWriteNoIteratorList<IMessageSendListener> messageSendListeners = new CopyOnWriteNoIteratorList<>(IMessageSendListener.class); - private final int defaultDataByteSize; - private final DataType memType; - private final boolean isEnabled = true; - private long activityCount = 0; - private long sentCount; - private int currentLength; - private boolean isScheduled = false; - private long time = -1; - - public MessageData(String typeName, String name, int dataByteSize, int offset, DataType memType) { - mem = new MemoryResource(new byte[dataByteSize], offset, dataByteSize - offset); - myDataSample = new DataSample(this); - this.typeName = typeName; - this.name = name; - this.defaultDataByteSize = dataByteSize; - this.currentLength = dataByteSize; - this.memType = memType; - } - - public MessageData(String typeName, String name, MemoryResource mem, DataType memType) { - this.mem = mem; - myDataSample = new DataSample(this); - this.typeName = typeName; - this.name = name; - this.defaultDataByteSize = mem.getLength(); - this.currentLength = mem.getLength(); - this.memType = memType; - GCHelper.getGCHelper().addRefWatch(this); - } - - public MessageData(String name, int dataByteSize, int offset, DataType memType) { - this(name, name, dataByteSize, offset, memType); - } - - public MessageData(byte[] data, int dataByteSize, int offset) { - this.mem = new MemoryResource(data, offset, dataByteSize - offset); - this.typeName = ""; - this.name = ""; - this.defaultDataByteSize = dataByteSize; - this.currentLength = dataByteSize; - this.memType = null; - GCHelper.getGCHelper().addRefWatch(this); - } - - public MessageData(MemoryResource memoryResource) { - this("", memoryResource); - } - - public MessageData(String name, MemoryResource memoryResource) { - this.mem = memoryResource; - this.typeName = ""; - this.name = name; - this.defaultDataByteSize = memoryResource.getLength(); - this.currentLength = memoryResource.getLength(); - this.memType = null; - GCHelper.getGCHelper().addRefWatch(this); - } - - public abstract IMessageHeader getMsgHeader(); - - public DataType getType() { - return memType; - } - - /** - * Returns the number of byte words in the payload of this message. - * - * @return the number of bytes in the message payload - */ - public int getPayloadSize() { - return currentLength; - } - - public String getName() { - return name; - } - - /** - * adds a {@link Message} who are mapped to this data object - */ - public void addMessage(Message message) { - if (!messages.contains(message)) { - messages.add(message); - message.addPreMessageDisposeListener(disposeListener); - } - } - - /** - * returns a list of the message that this data is a source for. <BR> - * - * @return a collection of messages - */ - public Collection<Message> getMessages() { - return messages.fillCollection(new ArrayList<Message>()); - // return new ArrayList<Message>(messages); - } - - /** - * @return Returns the activityCount. - */ - public long getActivityCount() { - return activityCount; - } - - /** - * @param activityCount The activityCount to set. - */ - public void setActivityCount(long activityCount) { - this.activityCount = activityCount; - } - - public void incrementActivityCount() { - activityCount++; - } - - public void incrementSentCount() { - sentCount++; - } - - public long getSentCount() { - return sentCount; - } - - public boolean isEnabled() { - return isEnabled; - } - - public abstract void visit(IMessageDataVisitor visitor); - - public void dispose() { - - try{ - Message[] msgs = messages.get(); - for (int i = 0; i < msgs.length; i++){ - Message local = msgs[i]; - if(local != null){ - local.removePreMessageDisposeListener(disposeListener); - } - } - } catch (Throwable th){ - OseeLog.log(getClass(), Level.SEVERE, "failed to remove message dispose listener.", th); - } - messages.clear(); - if (writer != null) { - writer.getPublisher().deleteDataWriter(writer); - writer.dispose(this, null); - writer = null; - } else if (reader != null && reader.getSubscriber() != null) { - reader.getSubscriber().deleteDataReader(reader); - reader.dispose(); - reader = null; - } - disposeListener = null; - } - - public void copyData(int destOffset, byte[] data, int srcOffset, int length) { - setCurrentLength(length + destOffset); - mem.copyData(destOffset, data, srcOffset, length); - } - - public void copyData(int destOffset, ByteBuffer data, int length) throws MessageSystemException { - try { - setCurrentLength(destOffset + length); - mem.copyData(destOffset, data, length); - } catch (MessageSystemException ex) { - OseeLog.logf(MessageSystemTestEnvironment.class, Level.INFO, ex, - "increasing backing store for %s to %d. prev length: %d, recv cnt: %d", getName(), destOffset + length, - mem.getData().length, this.activityCount); - setNewBackingBuffer(data, destOffset, length); - } - } - - public void copyData(ByteBuffer data) { - copyData(0, data, data.remaining()); - } - - /** - * Notifies all {@link Message}s that have this registered as a data source of the update - */ - public void notifyListeners() throws MessageSystemException { - final DataType memType = getType(); - Message[] ref = messages.get(); - for (int i = 0; i < ref.length; i++) { - Message message = ref[i]; - try { - if (!message.isDestroyed()) { - message.notifyListeners(this, memType); - } - } catch (Throwable t) { - final String msg = - String.format("Problem during listener notification for message %s. Data=%s, MemType=%s", - message.getName(), this.getName(), this.getType()); - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, msg, t); - } - } - } - - /** - * @return the currentLength - */ - public int getCurrentLength() { - return currentLength; - } - - /** - * @param currentLength the currentLength to set - */ - public void setCurrentLength(int currentLength) { - this.currentLength = currentLength; - } - - /** - * Override this method if you need to set some default data in the backing buffer. - */ - public void setNewBackingBuffer(byte[] data) { - setCurrentLength(data.length); - this.mem.setData(data); - if (this.getMsgHeader() != null) { - initializeDefaultHeaderValues(); - } else { - // System.out.println("what??-- bad HeaderData"); - } - - } - - public void setNewBackingBuffer(ByteBuffer buffer) { - byte[] data = new byte[buffer.remaining()]; - buffer.get(data); - this.mem.setData(data); - setCurrentLength(data.length); - if (this.getMsgHeader() != null) { - initializeDefaultHeaderValues(); - } else { - // System.out.println("what??-- bad HeaderData"); - } - } - - public void setNewBackingBuffer(ByteBuffer buffer, int offset, int length) { - byte[] data = new byte[offset + length]; - buffer.get(data, offset, length); - this.mem.setData(data); - setCurrentLength(data.length); - if (this.getMsgHeader() != null) { - initializeDefaultHeaderValues(); - } else { - // System.out.println("what??-- bad HeaderData"); - } - - } - - public abstract void initializeDefaultHeaderValues(); - - /** - * @return the mem - */ - public MemoryResource getMem() { - return mem; - } - - public int getDefaultDataByteSize() { - return defaultDataByteSize; - } - - @Override - public synchronized void onDataAvailable(DataReader theReader) { - // System.out.println(String.format("data available %s %s", this.getName(), - // this.getNamespace())); - if (isEnabled()) { - ReturnCode val = theReader.takeNextSample(myDataSample); - if (val == ReturnCode.OK) { - incrementActivityCount(); - notifyListeners(); - } else { - Env.getInstance().severe(val.getDescription()); - } - } - } - - @Override - public void onLivelinessChanged(DataReader theReader, LivelinessChangedStatus status) { - } - - @Override - public void onRequestedDeadlineMissed(DataReader theReader, RequestedDeadlineMissedStatus status) { - } - - @Override - public void onRequestedIncompatibleQos(DataReader theReader, RequestedIncompatibleQosStatus status) { - } - - @Override - public void onSampleLost(DataReader theReader, SampleLostStatus status) { - } - - @Override - public void onSampleRejected(DataReader theReader, SampleRejectedStatus status) { - } - - @Override - public void onSubscriptionMatch(DataReader theReader, SubscriptionMatchStatus status) { - } - - @Override - public synchronized void onDataSentToMiddleware(DataWriter theWriter) { - // header.setSequenceNumber(header.getSequenceNumber() + 1); - notifyListeners(); - } - - @Override - public void onLivelinessLost(DataWriter theWriter, LivelinessLostStatus status) { - } - - @Override - public void onOfferedDeadlineMissed(DataWriter theWriter, OfferedDeadlineMissedStatus status) { - } - - @Override - public void onOfferedIncompatibleQos(DataWriter theWriter, OfferedIncompatibleQosStatus status) { - } - - @Override - public void onPublicationMatch(DataWriter theWriter, PublicationMatchStatus status) { - } - - @Override - public Object getKeyValue() { - return null; - } - - @Override - public void setFromByteArray(byte[] input) { - try { - copyData(0, input, 0, input.length); - } catch (MessageSystemException ex) { - OseeLog.logf(MessageSystemTestEnvironment.class, Level.WARNING, - - "Copy Failed: setting new backing buffer. msg[%s], oldSize[%d] newSize[%d]", this.getName(), - this.mem.getData().length, input.length); - setNewBackingBuffer(input); - } - } - - @Override - public void setFromByteBuffer(ByteBuffer buffer) { - try { - copyData(buffer); - } catch (Exception e) { - OseeLog.logf(MessageSystemTestEnvironment.class, Level.SEVERE, - "Copy Failed: setting new backing buffer. msg[%s], oldSize[%d] newSize[%d]", this.getName(), - this.mem.getData().length, buffer.limit()); - setNewBackingBuffer(buffer); - } - } - - @Override - public ByteBuffer toByteBuffer() { - return mem.getAsBuffer(); - } - - public void setFromByteArray(byte[] input, int length) { - try { - copyData(0, input, 0, length); - } catch (MessageSystemException ex) { - OseeLog.logf(MessageSystemTestEnvironment.class, Level.SEVERE, - "Copy Failed: setting new backing buffer. msg[%s], oldSize[%d] newSize[%d]", this.getName(), - this.mem.getData().length, length); - setNewBackingBuffer(input); - } - } - - public void setFromByteArray(int destOffset, byte[] input, int srcOffset, int length) { - try { - copyData(destOffset, input, srcOffset, length); - } catch (MessageSystemException ex) { - OseeLog.logf(MessageSystemTestEnvironment.class, Level.SEVERE, - "Copy Failed: setting new backing buffer. msg[%s], oldSize[%d] newSize[%d]", this.getName(), - this.mem.getData().length, length); - setNewBackingBuffer(input); - } - } - - public void setFromByteArray(ByteBuffer input, int length) { - try { - copyData(0, input, length); - } catch (MessageSystemException ex) { - OseeLog.logf(MessageSystemTestEnvironment.class, Level.SEVERE, - "Copy Failed: setting new backing buffer. msg[%s], oldSize[%d] newSize[%d]", this.getName(), - this.mem.getData().length, length); - setNewBackingBuffer(input); - } - } - - @Override - public byte[] toByteArray() { - return mem.getData(); - } - - public void setReader(DataReader reader) { - this.reader = reader; - } - - public void setWriter(DataWriter writer) { - this.writer = writer; - } - - public void send() throws MessageSystemException { - if (writer == null) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, getName() + " - the writer is null"); - } else if (shouldSendData()) { - try { - notifyPreSendListeners(); - long start = 0, elapsed; - if(debugTime){ - start = System.nanoTime(); - } - getMem().setDataHasChanged(false); - writer.write(null, null, this, null); - incrementSentCount(); - if(debugTime){ - elapsed = System.nanoTime() - start; - if(elapsed > debugTimeout){ - Locale.setDefault(Locale.US); - System.out.printf("%s SLOW IOSEND %,d\n", getName(), elapsed); - } - } - notifyPostSendListeners(); - } catch (Throwable ex) { - throw new MessageSystemException("Could not send message data " + getName(), Level.SEVERE, ex); - } - } - } - - protected void sendTo(IDestination destination, ISource source) throws MessageSystemException { - if (writer == null) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.WARNING, getName() + " - the writer is null"); - } else if (shouldSendData()) { - try { - notifyPreSendListeners(); - // this.initializeDefaultHeaderValues(); - getMem().setDataHasChanged(false); - writer.write(destination, source, this, null); - incrementSentCount(); - notifyPostSendListeners(); - } catch (Throwable ex) { - throw new MessageSystemException("Could not send message data " + getName(), Level.SEVERE, ex); - } - } - } - - /** - * Override this method if you want to specialize the send criteria in a data source. For example, if you only want - * to send data to the MUX driver if the data has changed. - */ - protected boolean shouldSendData() { - return true; - } - - public TypeSupport getTypeSupport() { - return new DDSTypeSupport(this, getName(), getName(), getPayloadSize()); - } - - public String getTopicName() { - return getName(); - } - - public String getTypeName() { - return typeName; - } - - @Override - public boolean isSameInstance(byte[] data1, byte[] data2) { - return true; - } - - public Namespace getNamespace() { - if (isWriter()) { - return new Namespace(writer.getTopic().getNamespace()); - } else { - return new Namespace(reader.getTopicDescription().getNamespace()); - } - } - - /* - * each type that extends DDSData needs to have it's own namespace.... we need to go through each DDSData child and - * determine all of it's possible namespaces - */ - public boolean isWriter() { - if (writer != null && reader == null) { - return true; - } else if (writer == null && reader != null) { - return false; - } else { - throw new MessageSystemException( - "This is an illegal message it has neither a reader or a writer [" + this.getName() + "].", Level.SEVERE); - } - } - - private IMessageDisposeListener disposeListener = new IMessageDisposeListener() { - - @Override - public void onPreDispose(Message message) { - messages.remove(message); - } - - @Override - public void onPostDispose(Message message) { - } - - }; - - @Override - public void copyFrom(Data data) { - ByteBuffer buffer = data.toByteBuffer(); - copyData(data.getOffset(), buffer, buffer.remaining()); - } - - @Override - public String toString() { - return getClass().getName() + ": name=" + getName(); - } - - @Override - public int getOffset() { - return 0; - } - - /** - * @return the isScheduled - */ - public boolean isScheduled() { - return isScheduled; - } - - /** - * @param isScheduled the isScheduled to set - */ - public void setScheduled(boolean isScheduled) { - this.isScheduled = isScheduled; - } - - private void notifyPostSendListeners() { - try { - long start = 0, elapsed; - IMessageSendListener[] listeners = messageSendListeners.get(); - for (int i = 0; i < listeners.length; i++) { - IMessageSendListener listener = listeners[i]; - if(debugTime){ - start = System.nanoTime(); - } - listener.onPostSend(this); - if(debugTime){ - elapsed = System.nanoTime() - start; - if(elapsed > debugTimeout){ - Locale.setDefault(Locale.US); - System.out.printf("%s %s SLOW POST SEND %,d\n", getName(), listener.getClass().getName(), elapsed); - } - } - } - } catch (Exception ex) { - OseeLog.log(Message.class, Level.SEVERE, ex); - } - } - - private void notifyPreSendListeners() { - try { - long start = 0, elapsed; - IMessageSendListener[] listeners = messageSendListeners.get(); - for (int i = 0; i < listeners.length; i++) { - IMessageSendListener listener = listeners[i]; - if(debugTime){ - start = System.nanoTime(); - } - listener.onPreSend(this); - if(debugTime){ - elapsed = System.nanoTime() - start; - if(elapsed > debugTimeout){ - Locale.setDefault(Locale.US); - System.out.printf("%s %s SLOW PRE SEND %,d\n", getName(), listener.getClass().getName(), elapsed); - } - } - } - } catch (Exception ex) { - OseeLog.log(Message.class, Level.SEVERE, ex); - } - } - - public void addSendListener(IMessageSendListener listener) { - messageSendListeners.add(listener); - } - - public void removeSendListener(IMessageSendListener listener) { - messageSendListeners.remove(listener); - } - - public boolean containsSendListener(IMessageSendListener listener) { - return messageSendListeners.contains(listener); - } - - public boolean isMessageCollectionNotEmpty() { - return messages.get().length > 0; - } - - public void zeroize() { - final byte[] data = toByteArray(); - Arrays.fill(data, getMsgHeader().getHeaderSize(), data.length, (byte) 0); - } - - /** - * A time value associated with this message. - * The time value will have different meanings or may not be used depending on the context and usage. - */ - public long getTime() { - return time; - } - - public void setTime(long time) { - this.time = time; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/ArrayElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/ArrayElement.java deleted file mode 100644 index 8161a12a3c9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/ArrayElement.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.nio.ByteBuffer; -import java.util.Collection; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; - -public class ArrayElement extends Element { - - public ArrayElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalMsb, int originalLsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb, originalMsb, originalLsb); - } - - public ArrayElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(msg, elementName, messageData, bitOffset, bitLength); - } - - public ArrayElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb); - } - - @Override - protected Element getNonMappingElement() { - return null; - } - - public void setValue(int index, byte value) { - getMsgData().getMem().getData()[index + getMsgData().getMem().getOffset() + getArrayStartOffset()] = value; - } - - public ByteBuffer asByteBuffer() { - return ByteBuffer.wrap(getMsgData().getMem().getData(), - getMsgData().getMem().getOffset() + getArrayStartOffset(), getLength()); - } - - public byte getValue(int index) { - return getValue(getMsgData().getMem(), index); - } - - public byte getValue(MemoryResource mem, int index) { - return mem.getData()[index + mem.getOffset() + getArrayStartOffset()]; - - } - - @Override - public void zeroize() { - MemoryResource mem = getMsgData().getMem(); - mem.zeroizeFromOffset(getArrayStartOffset(), getLength()); - } - - public int getLength() { - int currentMsgLength = getMsgData().getCurrentLength() - getMsgData().getOffset() - getArrayStartOffset(); - int length = getArrayEndOffset() - getArrayStartOffset(); - length = currentMsgLength < length ? currentMsgLength : length; - return length; - } - - public int getArrayStartOffset() { - return byteOffset + msb / 8; - } - - public int getArrayEndOffset() { - return (lsb - msb + 1) / 8 + byteOffset; - } - - @Override - public void visit(IElementVisitor visitor) { - visitor.asArrayElement(this); - } - - @Override - public ArrayElement switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (ArrayElement) super.switchMessages(messages); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/BiSci16Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/BiSci16Element.java deleted file mode 100644 index 4af18002dad..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/BiSci16Element.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Created on Apr 30, 2015 - * - * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE - */ -package org.eclipse.osee.ote.message.elements; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingLongIntegerElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * MIL-STD-1760E standard 16 bit Binary Scientific Notation Integer format. - * <dl> - * <dt>Base<dd>2's compliment integer located in the first 12 most significant bits - * <dt>Exponent<dd>unsigned int located in the last 4 (least significant) bits - * <dt>Conversion<dd>LogicalValue = (Base) * 16<sup>Exponent</sup> - * </dl> - * - * @author Michael P. Masterson - */ -public class BiSci16Element extends LongIntegerElement { - - public BiSci16Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public BiSci16Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - public BiSci16Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - @Override - public void setValue(Long value) { - super.setValue(convertLogicalValueToBiSci(value)); - } - - @Override - public Long getValue() { - return convertBiSciToLogicalValue(super.getValue()); - } - - @Override - public Long valueOf(MemoryResource mem) { - return convertBiSciToLogicalValue(super.valueOf(mem)); - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - @Override - public boolean check(ITestAccessor accessor, long value, int milliseconds) throws InterruptedException { - return super.check(accessor, (CheckGroup) null, value, milliseconds); - } - - /** - * This function will verify that this signal is pulsed for 2 cycles. - * - * @param value The value to be checked - */ - @Override - public void checkPulse(ITestAccessor accessor, long value) throws InterruptedException { - long nonPulsedValue = 0; - if (value == 0) { - nonPulsedValue = 1; - } - - checkPulse(accessor, value, nonPulsedValue); - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - @Override - public void set(ITestEnvironmentAccessor accessor, long value) { - super.set(accessor, value); - } - - /** - * Sets the element to the "value" passed and immediately sends the message that contains it.. - * - * @param value The value to set. - */ - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, long value) { - this.set(accessor, value); - super.sendMessage(); - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - this.set(accessor, Long.parseLong(value)); - } - - @Override - protected NonMappingLongIntegerElement getNonMappingElement() { - return new NonMappingLongIntegerElement(this); - } - - @Override - public Long elementMask(Long value) { - return value; - } - - @Override - public long getNumericBitValue() { - return getRaw(); - } - - /** - * @return the raw bits of this element without conversion from the binary scientific notation format. - */ - public long getRaw() { - return getRaw(getMsgData().getMem()); - } - - /** - * @param mem - * @return the raw bits of this element without conversion from the binary scientific notation format. - */ - public long getRaw(MemoryResource mem) { - return mem.getLong(byteOffset, msb, lsb); - } - - - /** - * Sets the raw long straight into memory without conversion - * @param hex - */ - public void setHex(long hex) { - getMsgData().getMem().setLong(hex, byteOffset, msb, lsb); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - @Override - public void checkForwarding(ITestAccessor accessor, LongIntegerElement cause, long value) throws InterruptedException { - /* check for 0 to begine */ - check(accessor, 0, 0); - - /* Set the DP1 Mux Signal */ - cause.set(accessor, value); - - /* Chk Value on DP2 */ - check(accessor, value, 1000); - - /* Set DP1 to 0 */ - cause.set(accessor, 0); - - /* Init DP2 Mux to 0 */ - set(accessor, 0); - - /* Chk Value on DP2 is still set */ - check(accessor, value, 500); - - /* Chk DP2 is 0 for two-pulse signals and high for four-pulse signal */ - check(accessor, 0, 500); - - } - - - /*package*/ Long convertLogicalValueToBiSci(long logical) { - long biSci = 0; - boolean isNeg = false; - if( logical < 0 ) { - isNeg = true; - logical = -logical; - } - - long base = Math.abs(logical); - int powersOf16 = 0; - boolean round = false; - while( base > 0x0800) { - powersOf16++; - if( round ) - base--; - - round = base % 16 > 7; - base = base >>> 4; - - if( round) - base++; - } - - if( isNeg ) { - base = 0x1000 - base; - } - - final long shiftedBase = base << 4; - biSci = shiftedBase + powersOf16; - - return biSci & 0xFFFF; - } - - /*package*/ Long convertBiSciToLogicalValue(long biSci) { - long logical = 0; - long base = ((short)biSci) >> 4; // cast to short to ensure sign extension to long - long powersOf16 = biSci & 0xF; - - long shift = powersOf16 * 4; - logical = base << shift; - - return logical; - } - - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/BooleanElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/BooleanElement.java deleted file mode 100644 index 16a4b1f7760..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/BooleanElement.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; - -public class BooleanElement extends DiscreteElement<Boolean> { - - public BooleanElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalMsb, int originalLsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb, originalMsb, originalLsb); - - } - - public BooleanElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(msg, elementName, messageData, bitOffset, bitLength); - - } - - public BooleanElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb); - - } - - @Override - protected Element getNonMappingElement() { - return null; - } - - @Override - public Boolean getValue() { - return Boolean.valueOf(getMsgData().getMem().getBoolean(byteOffset, msb, lsb)); - } - - @Override - public void setValue(Boolean obj) { - getMsgData().getMem().setBoolean(obj, byteOffset, msb, lsb); - } - - @Override - public String toString(Boolean obj) { - return obj.toString(); - } - - @Override - public Boolean valueOf(MemoryResource mem) { - return Boolean.valueOf(mem.getBoolean(byteOffset, msb, lsb)); - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - set(accessor, Boolean.parseBoolean(value)); - } - - @Override - public void visit(IElementVisitor visitor) { - visitor.asBooleanElement(this); - } - - @Override - public Boolean elementMask(Boolean value) { - return value; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/CharElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/CharElement.java deleted file mode 100644 index 3016726dbad..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/CharElement.java +++ /dev/null @@ -1,616 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import java.util.ListIterator; -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.core.testPoint.CheckPoint; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingCharElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; -import org.eclipse.osee.ote.message.listener.MessageSystemListener; - -/** - * @author John Butler - * @author Robert A. Fisher - */ -public class CharElement extends DiscreteElement<Character> { - - public CharElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public CharElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public CharElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - @Override - public CharElement switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (CharElement) super.switchMessages(messages); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, CharElement cause, Character value) throws InterruptedException { - /* check for 0 to begine */ - check(accessor, (char) 0, 0); - - /* Set the DP1 Mux Signal */ - cause.set(accessor, value); - - /* Chk Value on DP2 */ - check(accessor, value, 1000); - - /* Set DP1 to 0 */ - cause.set(accessor, (char) 0); - - /* Init DP2 Mux to 0 */ - set(accessor, (char) 0); - - /* Chk Value on DP2 is still set */ - check(accessor, value, 500); - - /* Chk DP2 is 0 for two-pulse signals and high for four-oulse signal */ - check(accessor, (char) 0, 500); - - } - - /** - * Verifies that the element is Not set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, String value, int milliseconds) throws InterruptedException { - return this.checkNot(accessor, (CheckGroup) null, value, milliseconds); - } - - /** - * Verifies that the element is Not set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, String value, int milliseconds) throws InterruptedException { - if (accessor == null) { - throw new IllegalArgumentException("accessor cannot be null"); - } - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - - long time = accessor.getEnvTime(); - String currentValue; - boolean result; - if (milliseconds > 0) { - final MessageSystemListener listener = getMessage().getListener(); - org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer cancelTimer = - accessor.setTimerFor(listener, milliseconds); - - accessor.getLogger().debug(accessor, "waiting............", true); - - while (result = !(currentValue = getString(accessor, value.length())).equals(value)) { - listener.waitForData(); // will also return if the timer (set above) - // expires - /* - * NOTE: had to add isTimedOut() because we were getting data at the same time we're timing out, so the - * notifyAll() isn't guaranteed to work since we would not be in a waiting state at that time - so we're - * forced to save the fact that we timed out. - */ - if (listener.isTimedOut()) { - break; - } - } - cancelTimer.cancelTimer(); - accessor.getLogger().debug(accessor, "done waiting", true); - } else { - result = !(currentValue = getString(accessor, value.length())).equals(value); - } - time = accessor.getEnvTime() - time; - CheckPoint passFail = new CheckPoint(this.getFullName(), "Not " + value, currentValue, result, time); - - if (checkGroup == null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } else { - checkGroup.add(passFail); - } - - accessor.getLogger().methodEnded(accessor); - - return passFail.isPass(); - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, String value, int milliseconds) throws InterruptedException { - return this.check(accessor, (CheckGroup) null, value, milliseconds); - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, String value, int milliseconds) throws InterruptedException { - if (accessor == null) { - throw new IllegalArgumentException("accessor cannot be null"); - } - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(value).add(milliseconds), this.getMessage()); - long time = accessor.getEnvTime(); - String currentValue; - if (milliseconds > 0) { - MessageSystemListener listener = getMessage().getListener(); - org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer cancelTimer = - accessor.setTimerFor(listener, milliseconds); - - accessor.getLogger().debug(accessor, "waiting............", true); - - while (!compareString(currentValue = getString(accessor, value.length()), value)) { - listener.waitForData(); // will also return if the timer (set above) - // expires - /* - * NOTE: had to add isTimedOut() because we were getting data at the same time we're timing out, so the - * notifyAll() isn't guaranteed to work since we would not be in a waiting state at that time - so we're - * forced to save the fact that we timed out. - */ - if (listener.isTimedOut()) { - break; - } - } - - cancelTimer.cancelTimer(); - accessor.getLogger().debug(accessor, "done waiting", true); - } else { - currentValue = getString(accessor, value.length()); - } - time = accessor.getEnvTime() - time; - CheckPoint passFail = - new CheckPoint(this.getFullName(), value, currentValue, compareString(currentValue, value), time); - - if (checkGroup == null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } else { - checkGroup.add(passFail); - } - - accessor.getLogger().methodEnded(accessor); - - return passFail.isPass(); - } - - private boolean compareString(String string, String value) { - return string.equals(value); - } - - /** - * Verifies that the string starting at the element is not set to "value". - * - * @param value Expected value - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, String value) { - return this.checkNot(accessor, (CheckGroup) null, value); - } - - /** - * Verifies that the string starting at the element is not set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, String value) { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - this.getMessage()); - } - - String actualValue = getString(accessor, value.length()); - - CheckPoint passFail = - new CheckPoint(this.getFullName(), "Not " + value, actualValue, value.compareTo(actualValue) != 0, 0); - - if (checkGroup == null) { - if (accessor != null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } - } else { - checkGroup.add(passFail); - } - - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - return passFail.isPass(); - - } - - /** - * Verifies that the string starting at the element is set to "value". - * - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, String value) { - return this.check(accessor, (CheckGroup) null, value); - } - - /** - * Verifies that the string starting at the element is set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, String value) { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - this.getMessage()); - } - String actualValue = getString(accessor, value.length()); - - CheckPoint passFail = - new CheckPoint(this.getFullName(), value, actualValue, value.compareTo(actualValue) == 0, 0); - - if (checkGroup == null) { - if (accessor != null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } - } else { - checkGroup.add(passFail); - } - - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - return passFail.isPass(); - } - - /** - * Returns the string of length "stringLength" starting as the position of the element. - * - * @param stringLength the length of the string to return - * @return the string starting with this element - */ - public String getString(ITestEnvironmentAccessor accessor, int stringLength) { - if (getBitLength() == 8) { - return getASCIIString(stringLength); - } else { - ListIterator<Element> iter = getMessage().getElementIterator(this); - char[] chars = new char[stringLength]; - for (int i = 0; i < stringLength; i++) { - Element element = iter.next(); - if (element instanceof CharElement) { - chars[i] = ((CharElement) element).getValue(); - } else { - // we ran into a non char element we should abort string extraction - break; - } - } - return new String(chars); - } - } - - /** - * <p> - * Sets the element's value. Can be [ab]used to set subsequent, contiguous bytes but, while widespread, this use is - * discouraged and may be removed in a future release. The behavior of this method differs depending on the length of - * string passed in and whether the underlying element is eight bits. - * </p> - * <p> - * For an empty string it sets the element to the null character, '\0', using {@link #setValue(Character)}, which - * properly accounts for cases where the element is not eight bits. - * </p> - * <p> - * If the string has a length of one it calls {@link #setValue(Character)} with value.charAt(0). - * </p> - * <p> - * If the string length is greater than one it will assume this and all subsequent elements are eight bits and set - * them. <b>Note</b> that it does nothing to ensure the subsequent bytes are character elements or eight bits. It - * will throw IllegalArgumentException if setting subsequent elements would overflow. If the element is not eight - * bits in size it will set as above and log a warning and stack trace but not throw an exception. - * </p> - * - * @param accessor - * @param value the string to set the bytes to - */ - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) { - if (value.length() + this.getByteOffset() > this.getMessage().getData().length) { - throw new IllegalArgumentException("Setting a String whose length exceeds the Message bounds!"); - } - - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - this.getMessage()); - } - - switch (value.length()) { - case 0: - setValue('\0'); - break; - case 1: - setValue(value.charAt(0)); - break; - default: - setASCIIString(value); - break; - } - - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - } - - /** - * This method uses {@link #parseAndSet(ITestEnvironmentAccessor, String)} and has all the associate risks and - * limitations. - * - * @param accessor - * @param value - */ - public void set(ITestEnvironmentAccessor accessor, String value) { - parseAndSet(accessor, value); - } - - /** - * This method uses {@link #parseAndSet(ITestEnvironmentAccessor, String)} and has all the associate risks and - * limitations. - * - * @param value - */ - public void setValue(String value) { - parseAndSet(null, value); - } - - /** - * This method uses {@link #parseAndSet(ITestEnvironmentAccessor, String)} and has all the associate risks and - * limitations. After setting it sends the message. - * - * @param accessor - * @param value - */ - public void setAndSend(ITestEnvironmentAccessor accessor, String value) { - this.parseAndSet(accessor, value); - super.sendMessage(); - } - - /** - * This method uses {@link #parseAndSet(ITestEnvironmentAccessor, String)} and has all the associate risks and - * limitations. - * - * @param accessor - * @param value - */ - public void setNoLog(ITestEnvironmentAccessor accessor, String value) { - this.parseAndSet(accessor, value); - } - - /** - * Sets the element to the "value" passed and immediately sends the meessage that contains it.. - * - * @param value The value to set. - */ - public void setAndSend(ITestEnvironmentAccessor accessor, Character value) { - this.set(accessor, value); - super.sendMessage(); - } - - /** - * Waits until the element equals the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value found. Either value expected or value found at timeout. - */ - protected String waitForValue(ITestEnvironmentAccessor accessor, String value, int milliseconds) throws InterruptedException { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(value).add(milliseconds), this.getMessage()); - } - String currentValue; - if (milliseconds > 0) { - MessageSystemListener listener = getMessage().getListener(); - org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer cancelTimer = null; - if (accessor != null) { - cancelTimer = accessor.setTimerFor(listener, milliseconds); - accessor.getLogger().debug(accessor, "waiting............", true); - } - - while ((currentValue = getString(accessor, value.length())).equals(value)) { - listener.waitForData(); // will also return if the timer (set above) - // expires - /* - * NOTE: had to add isTimedOut() because we were getting data at the same time we're timing out, so the - * notifyAll() isn't guaranteed to work since we would not be in a waiting state at that time - so we're - * forced to save the fact that we timed out. - */ - if (listener.isTimedOut()) { - break; - } - } - - if (cancelTimer != null) { - cancelTimer.cancelTimer(); - } - - if (accessor != null) { - accessor.getLogger().debug(accessor, "done waiting", true); - } - - } else { - currentValue = getString(accessor, value.length()); - } - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - this.getMessage()); - } - return currentValue; - } - - /** - * Waits until the element does not equal the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value found. Either value expected or value found at timeout. - */ - protected String waitForNotValue(ITestEnvironmentAccessor accessor, String value, int milliseconds) throws InterruptedException { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(value).add(milliseconds), this.getMessage()); - } - String currentValue; - if (milliseconds > 0) { - - MessageSystemListener listener = getMessage().getListener(); - org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer cancelTimer = null; - if (accessor != null) { - cancelTimer = accessor.setTimerFor(listener, milliseconds); - accessor.getLogger().debug(accessor, "waiting............", true); - } - - while (!(currentValue = getString(accessor, value.length())).equals(value)) { - listener.waitForData(); // will also return if the timer (set above) - // expires - /* - * NOTE: had to add isTimedOut() because we were getting data at the same time we're timing out, so the - * notifyAll() isn't guaranteed to work since we would not be in a waiting state at that time - so we're - * forced to save the fact that we timed out. - */ - if (listener.isTimedOut()) { - break; - } - } - - if (cancelTimer != null) { - cancelTimer.cancelTimer(); - } - - if (accessor != null) { - accessor.getLogger().debug(accessor, "done waiting", true); - } - - } else { - currentValue = getString(accessor, value.length()); - } - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - this.getMessage()); - } - return currentValue; - } - - /** - * Sets the element value, properly accounting for the bit-size of the element. - * - * @param value - */ - @Override - public void setValue(Character value) { - getMsgData().getMem().setInt(value, byteOffset, msb, lsb); - } - - @Override - public Character getValue() { - return (char) getMsgData().getMem().getInt(byteOffset, msb, lsb); - } - - @Override - public Character valueOf(MemoryResource otherMem) { - return Character.valueOf((char) otherMem.getInt(byteOffset, msb, lsb)); - } - - @Override - public String toString(Character obj) { - return obj.toString(); - } - - private String getASCIIString(int length) { - return getMsgData().getMem().getASCIIString(byteOffset, length); - } - - private void setASCIIString(String value) { - if (getBitLength() == 8) { - getMsgData().getMem().setASCIIString(value, byteOffset); - } else { - ListIterator<Element> iter = getMessage().getElementIterator(this); - for (int i = 0; i < value.length(); i++) { - Element element = iter.next(); - if (element instanceof CharElement) { - ((CharElement) element).setValue(value.charAt(i)); - } else { - // we ran into a non char element we should abort string extraction - return; - } - } - } - } - - @Override - public void visit(IElementVisitor visitor) { - visitor.asCharElement(this); - } - - @Override - protected NonMappingCharElement getNonMappingElement() { - return new NonMappingCharElement(this); - } - - @Override - public Character elementMask(Character value) { - return value; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Dec32Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Dec32Element.java deleted file mode 100644 index 7e3a59e3afa..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Dec32Element.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Created on Nov 6, 2013 - * - * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE - */ -package org.eclipse.osee.ote.message.elements; - -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; - -/** - * @author Michael P. Masterson - */ -public class Dec32Element extends Float32Element { - - /** - * @param message - * @param elementName - * @param messageData - * @param byteOffset - * @param msb - * @param lsb - */ - public Dec32Element(Message<?, ?, ?> message, String elementName, MessageData messageData, - int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, byteOffset, msb, lsb); - } - - /** - * @param message - * @param elementName - * @param messageData - * @param byteOffset - * @param msb - * @param lsb - * @param originalLsb - * @param originalMsb - */ - public Dec32Element(Message<?, ?, ?> message, String elementName, MessageData messageData, - int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - /** - * @param message - * @param elementName - * @param messageData - * @param bitOffset - * @param bitLength - */ - public Dec32Element(Message<?, ?, ?> message, String elementName, MessageData messageData, - int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - @Override - protected double toDouble(long value) { - return super.toDouble(value * 4); - } - - @Override - protected long toLong(double value) { - return super.toLong(value * 4); - } - - @Override - public void setValue(Double value) { - super.setValue(value * 4); - } - - @Override - public Double getValue() { - return super.getValue() / 4; - } - - @Override - public Double valueOf(MemoryResource mem) { - return super.valueOf(mem) / 4; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/DiscreteElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/DiscreteElement.java deleted file mode 100644 index 86b10d9bd89..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/DiscreteElement.java +++ /dev/null @@ -1,1469 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.ReturnFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.core.testPoint.CheckPoint; -import org.eclipse.osee.ote.core.testPoint.Operation; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.condition.EqualsCondition; -import org.eclipse.osee.ote.message.condition.IDiscreteElementCondition; -import org.eclipse.osee.ote.message.condition.InRangeCondition; -import org.eclipse.osee.ote.message.condition.ListCondition; -import org.eclipse.osee.ote.message.condition.NotInRangeCondition; -import org.eclipse.osee.ote.message.condition.PulseCondition; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -public abstract class DiscreteElement<T extends Comparable<T>> extends Element implements Comparable<DiscreteElement<T>> { - - private static final String FOR_2_PULSES = " FOR 2 PULSES"; - - public DiscreteElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalMsb, int originalLsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb, originalMsb, originalLsb); - } - - public DiscreteElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb); - } - - public DiscreteElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(msg, elementName, messageData, bitOffset, bitLength); - } - - public abstract void setValue(T obj); - - public abstract T getValue(); - - public abstract String toString(T obj); - - public String valueOf() { - return getValue().toString(); - } - - public abstract void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException; - - /** - * Sets the element to the "value" passed. - * - * @param accessor Reference to the accessor. - * @param value The value to set. - */ - public void set(ITestEnvironmentAccessor accessor, T value) { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - getMessage()); - } - - setValue(value); - - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - } - - /** - * Verifies that the element is set to "value". - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, T value) { - - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - getMessage()); - } - - T actualValue = getValue(); - CheckPoint passFail = new CheckPoint(this.getFullName(), toString(value), toString(actualValue), - actualValue.equals(elementMask(value)), 0); - - if (checkGroup == null) { - if (accessor != null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } - } else { - checkGroup.add(passFail); - } - - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - return passFail.isPass(); - } - - public boolean checkNT(ITestAccessor accessor, CheckGroup checkGroup, T value) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - getMessage()); - boolean v = getValue().equals(elementMask(value)); - accessor.getLogger().methodEnded(accessor); - return v; - } - - public boolean checkNotNT(ITestAccessor accessor, CheckGroup checkGroup, T value) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - getMessage()); - boolean v = !getValue().equals(elementMask(value)); - accessor.getLogger().methodEnded(accessor); - return v; - } - - public final boolean check(ITestAccessor accessor, T value) { - return this.check(accessor, (CheckGroup) null, value); - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public final boolean check(ITestAccessor accessor, T value, int milliseconds) throws InterruptedException { - return check(accessor, (CheckGroup) null, value, milliseconds); - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive) { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive), getMessage()); - - InRangeCondition<T> c = new InRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - - boolean pass = c.check(); - CheckPoint passFail = new CheckPoint(this.getFullName(), - "In " + expectedRangeString(toString(minValue).toString(), minInclusive, toString(maxValue), maxInclusive), - toString(c.getLastCheckValue()), pass, 0); - - if (checkGroup == null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } else { - checkGroup.add(passFail); - } - accessor.getLogger().methodEnded(accessor); - return passFail.isPass(); - } - - public boolean checkRangeNT(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive) { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive), getMessage()); - InRangeCondition<T> c = new InRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - boolean pass = c.check(); - accessor.getLogger().methodEnded(accessor); - return pass; - } - - public boolean checkRangeNT(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int millis) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive), getMessage()); - InRangeCondition<T> c = new InRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - MsgWaitResult result = getMessage().waitForCondition(accessor, c, false, millis); - accessor.getLogger().methodEnded(accessor); - return result.isPassed(); - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public final boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, T maxValue) { - return checkRange(accessor, checkGroup, minValue, true, maxValue, true); - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, T value) { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - getMessage()); - } - - T actualValue = getValue(); - - CheckPoint passFail = new CheckPoint(this.getFullName(), "Not " + toString(value), toString(actualValue), - !actualValue.equals(value), 0); - - if (checkGroup == null) { - if (accessor != null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } - } else { - checkGroup.add(passFail); - } - - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - return passFail.isPass(); - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T checkMaintainRange(ITestAccessor accessor, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return checkMaintainRange(accessor, null, minValue, true, maxValue, true, milliseconds); - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T checkMaintainRange(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return checkMaintainRange(accessor, (CheckGroup) null, minValue, minInclusive, maxValue, maxInclusive, - milliseconds); - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T checkMaintainNotRange(ITestAccessor accessor, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return checkMaintainNotRange(accessor, null, minValue, true, maxValue, true, milliseconds); - } - - /** - * Verifies that the element is not set to a value within the range specified for the entire time specified. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T checkMaintainNotRange(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return checkMaintainNotRange(accessor, (CheckGroup) null, minValue, minInclusive, maxValue, maxInclusive, - milliseconds); - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return checkMaintainRange(accessor, checkGroup, minValue, true, maxValue, true, milliseconds); - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public final boolean checkNotRange(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return checkNotRange(accessor, (CheckGroup) null, minValue, minInclusive, maxValue, maxInclusive, milliseconds); - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public final boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive) throws InterruptedException { - return checkNotRange(accessor, (CheckGroup) null, minValue, minInclusive, maxValue, maxInclusive, 0); - } - - /** - * Waits until the element equals the "value" passed. Returns last value observed upon a time out. - * - * @param accessor Reference to the accessor. - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value found. Either value expected or value found at timeout. - */ - public T waitForValue(ITestEnvironmentAccessor accessor, T value, int milliseconds) throws InterruptedException { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - } - EqualsCondition<T> c = new EqualsCondition<>(this, value); - getMessage().waitForCondition(accessor, c, false, milliseconds); - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - return c.getLastCheckValue(); - } - - /** - * Waits until the element has a value other than the "value" passed. Returns last value observed upon a time out. - * - * @param accessor Reference to the accessor. - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T waitForNotValue(ITestEnvironmentAccessor accessor, T value, int milliseconds) throws InterruptedException { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - } - EqualsCondition<T> c = new EqualsCondition<>(this, true, value); - getMessage().waitForCondition(accessor, c, false, milliseconds); - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - return c.getLastCheckValue(); - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param accessor Reference to the accessor. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T waitForRange(ITestEnvironmentAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive).add(milliseconds), - getMessage()); - } - InRangeCondition<T> c = new InRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - getMessage().waitForCondition(accessor, c, false, milliseconds); - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - return c.getLastCheckValue(); - } - - /** - * Waits until the element has a value within the range specified. Assumes the range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T waitForRange(ITestEnvironmentAccessor accessor, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return waitForRange(accessor, minValue, true, maxValue, true, milliseconds); - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param accessor Reference to the accessor. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T waitForNotRange(ITestEnvironmentAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive).add(milliseconds), - getMessage()); - } - - NotInRangeCondition<T> c = new NotInRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - getMessage().waitForCondition(accessor, c, false, milliseconds); - - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - return c.getLastCheckValue(); - } - - /** - * Waits until the element has a value within the range specified. Assumes range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T waitForNotRange(ITestEnvironmentAccessor accessor, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return waitForRange(accessor, minValue, true, maxValue, true, milliseconds); - } - - /** - * Waits until the element has a value other than the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T waitNotValue(ITestEnvironmentAccessor accessor, T value, int milliseconds) throws InterruptedException { - return waitForNotValue(accessor, value, milliseconds); - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, T value, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - - EqualsCondition<T> c = new EqualsCondition<>(this, value); - - CheckPoint cp = waitWithCheckPoint(accessor, checkGroup, toString(value), c, false, milliseconds); - accessor.getLogger().methodEnded(accessor); - return cp.isPass(); - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be in the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive).add(milliseconds), - getMessage()); - - InRangeCondition<T> c = new InRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - CheckPoint cp = waitWithCheckPoint(accessor, checkGroup, - "In " + expectedRangeString(toString(minValue), minInclusive, toString(maxValue), maxInclusive), c, false, - milliseconds); - accessor.getLogger().methodEnded(accessor); - return cp.isPass(); - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minimum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public final boolean checkRange(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return checkRange(accessor, (CheckGroup) null, minValue, minInclusive, maxValue, maxInclusive, milliseconds); - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public final boolean checkRange(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive) { - return checkRange(accessor, (CheckGroup) null, minValue, minInclusive, maxValue, maxInclusive); - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public final boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return checkRange(accessor, checkGroup, minValue, true, maxValue, true, milliseconds); - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public final boolean checkRange(ITestAccessor accessor, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return this.checkRange(accessor, (CheckGroup) null, minValue, true, maxValue, true, milliseconds); - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public final boolean checkRange(ITestAccessor accessor, T minValue, T maxValue) { - return checkRange(accessor, (CheckGroup) null, minValue, true, maxValue, true); - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, T value, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - CheckPoint cp = waitWithCheckPoint(accessor, checkGroup, "Not " + toString(value), - new EqualsCondition<T>(this, true, value), false, milliseconds); - accessor.getLogger().methodEnded(accessor); - return cp.isPass(); - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param value value to test against - * @return if the check passed - */ - public final boolean checkNot(ITestAccessor accessor, T value) { - return checkNot(accessor, (CheckGroup) null, value); - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the element is set to a value other than "value". - * - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public final boolean checkNot(ITestAccessor accessor, T value, int milliseconds) throws InterruptedException { - return checkNot(accessor, (CheckGroup) null, value, milliseconds); - } - - protected CheckPoint waitWithCheckPoint(ITestAccessor accessor, CheckGroup checkGroup, String expected, IDiscreteElementCondition<T> condition, boolean maintain, int milliseconds) throws InterruptedException { - MsgWaitResult result = getMessage().waitForCondition(accessor, condition, maintain, milliseconds); - CheckPoint passFail = new CheckPoint(getFullName(), expected, toString(condition.getLastCheckValue()), - result.isPassed(), result.getXmitCount(), result.getElapsedTime()); - - if (checkGroup == null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } else { - checkGroup.add(passFail); - } - return passFail; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive).add(milliseconds), - getMessage()); - CheckPoint cp = waitWithCheckPoint(accessor, checkGroup, - "Not In " + expectedRangeString(toString(minValue), minInclusive, toString(maxValue), maxInclusive), - new NotInRangeCondition<T>(this, minValue, minInclusive, maxValue, maxInclusive), false, milliseconds); - accessor.getLogger().methodEnded(accessor); - return cp.isPass(); - } - - public boolean checkNotRangeNT(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive).add(milliseconds), - getMessage()); - MsgWaitResult cp = getMessage().waitForCondition(accessor, - new NotInRangeCondition<T>(this, minValue, minInclusive, maxValue, maxInclusive), false, milliseconds); - accessor.getLogger().methodEnded(accessor); - return cp.isPassed(); - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public final boolean checkNotRange(ITestAccessor accessor, T minValue, T maxValue) throws InterruptedException { - return checkNotRange(accessor, (CheckGroup) null, minValue, true, maxValue, true); - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public final boolean checkNotRange(ITestAccessor accessor, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return checkNotRange(accessor, (CheckGroup) null, minValue, true, maxValue, true, milliseconds); - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public final boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return checkNotRange(accessor, checkGroup, minValue, true, maxValue, true, milliseconds); - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public final boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, T maxValue) throws InterruptedException { - return checkNotRange(accessor, checkGroup, minValue, true, maxValue, true); - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public final boolean checkNotRange(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive) throws InterruptedException { - return checkNotRange(accessor, (CheckGroup) null, minValue, minInclusive, maxValue, maxInclusive); - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed. Either value expected or value found at timeout. - */ - public T checkMaintain(ITestAccessor accessor, CheckGroup checkGroup, T value, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - EqualsCondition<T> c = new EqualsCondition<>(this, value); - waitWithCheckPoint(accessor, checkGroup, toString(value), c, true, milliseconds); - accessor.getLogger().methodEnded(accessor); - return c.getLastCheckValue(); - } - - public T checkMaintainNT(ITestAccessor accessor, T value, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - EqualsCondition<T> c = new EqualsCondition<>(this, value); - getMessage().waitForCondition(accessor, c, true, milliseconds); - accessor.getLogger().methodEnded(accessor); - return c.getLastCheckValue(); - } - - public T checkMaintainNotNT(ITestAccessor accessor, T value, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - EqualsCondition<T> c = new EqualsCondition<>(this, true, value); - getMessage().waitForCondition(accessor, c, true, milliseconds); - accessor.getLogger().methodEnded(accessor); - return c.getLastCheckValue(); - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @return last value observed. Either value expected or value found at timeout. - */ - public final T checkMaintain(ITestAccessor accessor, T value, int milliseconds) throws InterruptedException { - return checkMaintain(accessor, (CheckGroup) null, value, milliseconds); - } - - /** - * Verifies that the element is set to a value other than the "value" passed for the entire time passed into - * "milliseconds". Returns value found that caused failure or last value observed if time expires. - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed - */ - public T checkMaintainNot(ITestAccessor accessor, CheckGroup checkGroup, T value, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - - EqualsCondition<T> c = new EqualsCondition<>(this, true, value); - waitWithCheckPoint(accessor, checkGroup, - - "Not " + toString(value), c, true, milliseconds); - accessor.getLogger().methodEnded(accessor); - return c.getLastCheckValue(); - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @return last value observed - */ - public final T checkMaintainNot(ITestAccessor accessor, T value, int milliseconds) throws InterruptedException { - return checkMaintainNot(accessor, (CheckGroup) null, value, milliseconds); - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive).add(milliseconds), - getMessage()); - - InRangeCondition<T> c = new InRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - waitWithCheckPoint(accessor, checkGroup, - "In" + expectedRangeString(toString(minValue), minInclusive, toString(maxValue), maxInclusive), c, true, - milliseconds); - accessor.getLogger().methodEnded(accessor); - return c.getLastCheckValue(); - } - - public T checkMaintainRangeNT(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive).add(milliseconds), - getMessage()); - InRangeCondition<T> c = new InRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - getMessage().waitForCondition(accessor, c, true, milliseconds); - accessor.getLogger().methodEnded(accessor); - return c.getLastCheckValue(); - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param accessor Reference to the accessor. - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive).add(milliseconds), - getMessage()); - - NotInRangeCondition<T> c = new NotInRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - waitWithCheckPoint(accessor, checkGroup, - "Not In" + expectedRangeString(toString(minValue), minInclusive, toString(maxValue), maxInclusive), c, true, - milliseconds); - accessor.getLogger().methodEnded(accessor); - return c.getLastCheckValue(); - } - - public T checkMaintainNotRangeNT(ITestAccessor accessor, T minValue, boolean minInclusive, T maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - checkAccessor(accessor); - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(minValue).add(minInclusive).add(maxValue).add(maxInclusive).add(milliseconds), - getMessage()); - - NotInRangeCondition<T> c = new NotInRangeCondition<>(this, minValue, minInclusive, maxValue, maxInclusive); - getMessage().waitForCondition(accessor, c, true, milliseconds); - accessor.getLogger().methodEnded(accessor); - return c.getLastCheckValue(); - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, T minValue, T maxValue, int milliseconds) throws InterruptedException { - return checkMaintainNotRange(accessor, checkGroup, minValue, true, maxValue, true, milliseconds); - } - - public boolean checkPulse(ITestAccessor accessor, CheckGroup checkGroup, T pulsedValue, T nonPulsedValue, int milliseconds, int pulses) throws InterruptedException { - if (accessor == null) { - throw new NullPointerException("The parameter accessor is null"); - } - - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(pulsedValue).add(nonPulsedValue).add(milliseconds), getMessage()); - final PulseCondition<T> c = new PulseCondition<>(this, pulsedValue, nonPulsedValue, pulses); - - MsgWaitResult result = getMessage().waitForCondition(accessor, c, false, milliseconds); - CheckPoint passFail = new CheckPoint(getFullName(), toString(pulsedValue) + " FOR " + pulses + " PULSES", - toString(c.getLastCheckValue()) + " FOR " + c.getPulses() + " PULSES", result.isPassed(), - result.getElapsedTime()); - - if (checkGroup == null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } else { - checkGroup.add(passFail); - } - accessor.getLogger().methodEnded(accessor); - return passFail.isPass(); - } - - public final boolean checkPulse(ITestAccessor accessor, T pulsedValue, T nonPulsedValue) throws InterruptedException { - return checkPulse(accessor, null, pulsedValue, nonPulsedValue); - } - - public final boolean checkPulse(ITestAccessor accessor, CheckGroup checkGroup, T pulsedValue, T nonPulsedValue) throws InterruptedException { - return checkPulse(accessor, checkGroup, pulsedValue, nonPulsedValue, 1000, 2); - } - - public final boolean checkPulse(ITestAccessor accessor, T pulsedValue, T nonPulsedValue, int milliseconds) throws InterruptedException { - return checkPulse(accessor, null, pulsedValue, nonPulsedValue, milliseconds, 2); - } - - public final boolean checkPulse(ITestAccessor accessor, T pulsedValue, T nonPulsedValue, int milliseconds, int pulses) throws InterruptedException { - return checkPulse(accessor, null, pulsedValue, nonPulsedValue, milliseconds, pulses); - } - - public boolean checkPulse(ITestAccessor accessor, CheckGroup checkGroup, T pulsedValue, T nonPulsedValue, int milliseconds) throws InterruptedException { - return checkPulse(accessor, checkGroup, pulsedValue, nonPulsedValue, milliseconds, 2); - } - - public abstract T valueOf(MemoryResource mem); - - @Override - public String toString() { - - return elementName + "=" + getValue().toString(); - } - - @Override - public int compareTo(DiscreteElement<T> o) { - return getValue().compareTo(o.getValue()); - } - - /** - * Verifies that the element is set to a value in the "list". - * - * @param list List of values to check for - * @return if check passed - */ - public final boolean checkInList(ITestAccessor accessor, T[] list) { - return checkList(accessor, null, true, list); - } - - /** - * Verifies that the element is set to a value NOT in the "list". - * - * @param list List of values to check for - * @return if check passed - */ - public final boolean checkNotInList(ITestAccessor accessor, T[] list) { - return checkList(accessor, null, false, list); - } - - /** - * Verifies that the element is set to a value IN or NOT IN the "list" passed. "isInList" determines if checking for - * IN the list or NOT. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param isInList Determines if checking for the element's value to be in or not in the "list". Passing TRUE will - * test for IN the "list". - * @param list List of values to check for - * @param milliseconds Number of milliseconds to wait - * @return if check passed - */ - public boolean checkList(ITestAccessor accessor, CheckGroup checkGroup, boolean isInList, T[] list, int milliseconds) throws InterruptedException { - ListCondition<T> c = new ListCondition<>(this, isInList, list); - - if (accessor == null) { - throw new NullPointerException("The parameter accessor is null"); - } - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(isInList).add(list).add(milliseconds), getMessage()); - - MsgWaitResult result = getMessage().waitForCondition(accessor, c, false, milliseconds); - CheckGroup passFail = inList(accessor, isInList, c.getLastCheckValue(), list, result.getElapsedTime()); - assert result.isPassed() == passFail.isPass() : "result does not match checkgroup"; - if (checkGroup == null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } else { - checkGroup.add(passFail); - } - accessor.getLogger().methodEnded(accessor); - return passFail.isPass(); - } - - /** - * Verifies that the element is set to a value NOT in the "list". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param list List of values to check for - * @return if check passed - */ - public final boolean checkNotInList(ITestAccessor accessor, CheckGroup checkGroup, T[] list) { - return this.checkList(accessor, checkGroup, false, list); - } - - /** - * Verifies that the element is set to a value NOT in the "list". - * - * @param list List of values to check for - * @param milliseconds Number of milliseconds to wait - * @return if check passed - */ - public final boolean checkNotInList(ITestAccessor accessor, T[] list, int milliseconds) throws InterruptedException { - return this.checkList(accessor, (CheckGroup) null, false, list, milliseconds); - } - - /** - * Verifies that the element is set to a value IN or NOT IN the "list" passed. "wantInList" determines if checking - * for IN the list or NOT. - * - * @param wantInList Determines if checking for the element's value to be in or not in the "list". Passing TRUE will - * test for IN the "list". - * @param list List of values to check for - * @return if check passed - */ - public final boolean checkList(ITestAccessor accessor, boolean wantInList, T[] list) { - return this.checkList(accessor, null, wantInList, list); - } - - /** - * Verifies that the element is set to a value IN or NOT IN the "list" passed. "isInList" determines if checking for - * IN the list or NOT. - * - * @param isInList Determines if checking for the element's value to be in or not in the "list". Passing TRUE will - * test for IN the "list". - * @param list List of values to check for - * @param milliseconds Number of milliseconds to wait - * @return if check passed - */ - public final boolean checkList(ITestAccessor accessor, boolean isInList, T[] list, int milliseconds) throws InterruptedException { - return checkList(accessor, (CheckGroup) null, isInList, list, milliseconds); - } - - /** - * Verifies that the element is set to a value IN or NOT IN the "list" passed. "wantInList" determines if checking - * for IN the list or NOT. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param wantInList Determines if checking for the element's value to be in or not in the "list". Passing TRUE will - * test for IN the "list". - * @param list List of values to check for - * @return if check passed - */ - public boolean checkList(ITestAccessor accessor, CheckGroup checkGroup, boolean wantInList, T[] list) { - - final T actualValue = getValue(); - - // Check if the value is in the list - CheckGroup passFail = inList(accessor, wantInList, actualValue, list, 0); - - if (checkGroup == null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } else { - checkGroup.add(passFail); - } - - return passFail.isPass(); - } - - /** - * Verifies that the element is set to a value in the "list". - * - * @param list List of values to check for - * @param milliseconds Number of milliseconds to wait - * @return if check passed - */ - public final boolean checkInList(ITestAccessor accessor, T[] list, int milliseconds) throws InterruptedException { - return this.checkList(accessor, (CheckGroup) null, true, list, milliseconds); - } - - /** - * Verifies that the element is set to a value NOT in the "list". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param list List of values to check for - * @param milliseconds Number of milliseconds to wait - * @return if check passed - */ - public final boolean checkNotInList(ITestAccessor accessor, CheckGroup checkGroup, T[] list, int milliseconds) throws InterruptedException { - return this.checkList(accessor, checkGroup, false, list, milliseconds); - } - - /** - * Verifies that the element is set to a value in the list for the entire time passed into milliseconds. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param list The list of values to check against - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T checkMaintainInList(ITestAccessor accessor, CheckGroup checkGroup, T[] list, int milliseconds) throws InterruptedException { - return this.checkMaintainList(accessor, checkGroup, list, true, milliseconds); - } - - /** - * Verifies that the element is set to a value not in the list for the entire time passed into milliseconds. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param list The list of values to check against - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public final T checkMaintainNotInList(ITestAccessor accessor, CheckGroup checkGroup, T[] list, int milliseconds) throws InterruptedException { - return this.checkMaintainList(accessor, checkGroup, list, false, milliseconds); - } - - /** - * Verifies that the element is set to a value in the "list". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param list List of values to check for - * @param milliseconds Number of milliseconds to wait - * @return if check passed - */ - public final boolean checkInList(ITestAccessor accessor, CheckGroup checkGroup, T[] list, int milliseconds) throws InterruptedException { - return this.checkList(accessor, checkGroup, true, list, milliseconds); - } - - /** - * Verifies that the element is set to a value in the "list". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param list List of values to check for - * @return if check passed - */ - public final boolean checkInList(ITestAccessor accessor, CheckGroup checkGroup, T[] list) { - return checkList(accessor, checkGroup, true, list); - } - - /** - * Waits until the element is set to a value either in or not in the "list" as determined by "isInList". - * - * @param list The list of values to check against - * @param isInList If the value is expected to be in or not in the "list" - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T waitForList(ITestAccessor accessor, T[] list, boolean isInList, int milliseconds) throws InterruptedException { - - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(list).add(isInList).add(milliseconds), this.getMessage()); - - ListCondition<T> c = new ListCondition<>(this, isInList, list); - getMessage().waitForCondition(accessor, c, false, milliseconds); - accessor.getLogger().methodEnded(accessor); - return c.getLastCheckValue(); - } - - public T checkMaintainList(ITestAccessor accessor, CheckGroup checkGroup, T[] list, boolean isInList, int milliseconds) throws InterruptedException { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(list).add(isInList).add(milliseconds), this.getMessage()); - - ListCondition<T> c = new ListCondition<>(this, isInList, list); - - MsgWaitResult result = getMessage().waitForCondition(accessor, c, true, milliseconds); - - T value = c.getLastCheckValue(); - - CheckGroup passFail = inList(accessor, isInList, value, list, result.getElapsedTime()); - if (checkGroup == null) { - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - } else { - checkGroup.add(passFail); - } - accessor.getLogger().methodEnded(accessor); - return value; - } - - /** - * This method checks a an array of EnumBase objects to determine if a given EnumBase object is or isn't in the list. - * It then returns a CheckGroup object that describes the checks and pass/fail status. - * - * @param isInList - * <ul> - * <li><b>True </b> used to get a pass iff the item is in the list.</li> - * <li><b>False </b> used to get a pass iff the item is not in the list.</li> - * </ul> - * @param value The EnumBase object to check for. - * @param list The array of EnumBase objects to look through. - * @return A CheckGroup object that describes all comparisons made and outcomes. - */ - private CheckGroup inList(ITestAccessor accessor, boolean isInList, T value, T[] list, long elapsedTime) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(isInList).add(value).add(list), this.getMessage()); - CheckGroup checkGroup; - final String not = "Not "; - - int i = 0; - // Build CheckPoint based on the type of check - if (isInList) { - checkGroup = new CheckGroup(Operation.OR, this.getFullName()); // Pass if at least one item - // matches - for (T val : list) { - // Check if current item in the list matches. - checkGroup.add( - new CheckPoint("List Item: " + i, value.toString(), val.toString(), val.equals(value), elapsedTime)); - i++; - } - } else { - checkGroup = new CheckGroup(Operation.AND, this.getFullName()); // Pass iff none of the - // items match - for (T val : list) { - checkGroup.add(new CheckPoint("List Item: " + i, not + value.toString(), val.toString(), !val.equals(value), - elapsedTime)); - i++; - } - } - accessor.getLogger().methodEnded(accessor); - return checkGroup; - } - - /** - * Sets the element to the first enumeration for the wait time and then it sets it to the second enumeration. - */ - public synchronized void toggle(ITestEnvironmentAccessor accessor, T value1, T value2, int milliseconds) throws InterruptedException { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), - new MethodFormatter().add(value1).add(value2).add(milliseconds), getMessage()); - - set(accessor, value1); - accessor.setTimerFor(this, milliseconds); - wait(); - accessor.getScriptCtrl().lock(); - set(accessor, value2); - - accessor.getLogger().methodEnded(accessor); - } - - /** - * Will be removed in MS_0.1.6. - * - * @use {@link #getValue()} instead - */ - @Deprecated - public T get() { - return getValue(); - } - - /** - * gets this element's current value. Does logging - */ - public T get(ITestEnvironmentAccessor accessor) { - // accessor.getLogger().methodCalled(accessor, new MethodFormatter()); - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter(), getMessage()); - } - - T v = getValue(); - ReturnFormatter returnFormatter = new ReturnFormatter(); - returnFormatter.add(v); - if (accessor != null) { - accessor.getLogger().methodEnded(accessor, returnFormatter); - } - return v; - } - - /** - * get this elements current value - * - * @return the value of this element - */ - public T getNoLog() { - return getValue(); - } - - @Deprecated - public void set(T value) { - setValue(value); - } - - public void setNoLog(T value) { - setValue(value); - } - - @Deprecated - public void setNoLog(ITestEnvironmentAccessor accessor, T value) { - setValue(value); - } - - private void checkAccessor(ITestEnvironmentAccessor accessor) { - if (accessor == null) { - throw new NullPointerException("The parameter accessor is null"); - } - } - - abstract public T elementMask(T value); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Element.java deleted file mode 100644 index b031c5f3710..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Element.java +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.logging.Level; - -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.MessageSystemException; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public abstract class Element implements ITimeout { -// protected final Message<?, ?, ?> msg; - private final WeakReference<Message<?, ?, ?>> msg; - protected String elementName; - private volatile boolean timedOut; - private final List<Object> elementPath; - private final String fullName; - - protected final int byteOffset; - protected int lsb; - protected final MessageData messageData; - protected int msb; - protected final int originalMsb; - protected final int originalLsb; - private String elementPathAsString; - - public Element(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalMsb, int originalLsb) { - this.msg = new WeakReference<>(msg); - this.elementName = elementName; - this.messageData = messageData; - this.byteOffset = byteOffset; - this.lsb = lsb; - this.msb = msb; - this.originalLsb = originalLsb; - this.originalMsb = originalMsb; - elementPath = new ArrayList<>(); - fullName = (msg != null ? msg.getName() : messageData.getName()) + "." + this.elementName; - } - - public Element(Message<?, ?, ?> msg, String elementName, MessageData messageData, int bitOffset, int bitLength) { - this(msg, elementName, messageData, bitOffset / 8, 0, 0, 0, 0); - this.msb = bitOffset % 8; - this.lsb = msb + bitLength - 1; - } - - public Element(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(msg, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public int getMsb() { - return msb; - } - - public int getLsb() { - return lsb; - } - - public int getByteOffset() { - return byteOffset; - } - - public MessageData getMsgData() { - return messageData; - } - - public int getBitLength() { - return Math.abs(getMsb() - getLsb()) + 1; - } - - public int getStartingBit() { - return getByteOffset() * 8 + Math.min(getMsb(), getLsb()); - } - - /* - * protected void set(TestEnvironmentAccessor accessor, long value) { if (accessor != null) { - * accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), (new MethodFormatter()).add(value)); } - * ((MemHolder) current.get()).getMem().s.setLong(value); if (accessor != null) { - * accessor.getLogger().methodEnded(accessor); } } - */ - /** - * @return Returns full name string. - */ - public String getFullName() { - return fullName; - } - - public String getName() { - return this.elementName; - } - - public String getDescriptiveName() { - return this.elementName; - } - - /** - * @return Returns the msg. - */ - public Message<?, ?, ?> getMessage() { - return msg.get(); - } - - public String getElementName() { - return elementName; - } - - @Override - public boolean isTimedOut() { - return this.timedOut; - } - - @Override - public void setTimeout(boolean timeout) { - this.timedOut = timeout; - } - - public DataType getType() { - return messageData.getType(); - } - - /** - * @return Returns the lsb. - */ - public int getOriginalLsb() { - return originalLsb; - } - - /** - * @return Returns the msb. - */ - public int getOriginalMsb() { - return originalMsb; - } - - private int calculateBitsToShift() { - int size = lsb - msb + 1; - return 32 - size; - } - - private int calculateLongBitsToShift() { - int size = lsb - msb + 1; - return 64 - size; - } - - protected int signExtend(int value) { - int bitsToShift = calculateBitsToShift(); - return value << bitsToShift >> bitsToShift; - } - - protected int removeSign(int value) { - int bitsToShift = calculateBitsToShift(); - return value << bitsToShift >>> bitsToShift; - } - - protected long removeSign(long value) { - int bitsToShift = calculateLongBitsToShift(); - return value << bitsToShift >>> bitsToShift; - } - - /** - * @return whether this message maps solely to PubSub - */ - public boolean isNonMappingElement() { - return false; - } - - /** - * Looks for the element matching this elements name inside one of the messages passed - * - * @param messages Those messages mapped to a certain physical type, one of whom contains a mapping to this element - * @return An element of one of the messages passed with the same name as this element or this element if no match is - * found. - */ - public Element switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - for (Message<?, ?, ?> currentMessage : messages) { - // System.out.println("SwitchMessages" + currentMessage.getMessageName()); - Element el = currentMessage.getElement(this.getElementPath()); - if (el != null && currentMessage.isValidElement(this, el)) { - return el; - } - } - return this.getNonMappingElement(); - } - - protected void sendMessage() { - this.getMessage().send(); - } - - /** - * This method returns a properly formatted string that describes the range and inclusive/exclusive properties of - * each end of the range. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return the string holding "[", "]", "(", or ")" - */ - protected static String expectedRangeString(Object minValue, boolean minInclusive, Object maxValue, boolean maxInclusive) { - // A means for a return value - String retVal; - - // Start with the proper symbol for the lower bound - if (minInclusive) { - retVal = "["; - } else { - retVal = "("; - } - - // Add in the minimum and maximum values - retVal += minValue + " .. " + maxValue; - - // End with the proper symbol for the upper bound - if (maxInclusive) { - retVal += "]"; - } else { - retVal += ")"; - } - - // Return the formatted string - return retVal; - } - - protected abstract Element getNonMappingElement(); - - protected void throwNoMappingElementException() { - throw new MessageSystemException( - "The element " + msg.get().getName() + "." + elementName + " does not exist for the message's current MemType!! " + "\nIt shouldn't be used for this environment type!!", - Level.SEVERE); - } - - /** - * @return the elementPath - */ - public List<Object> getElementPath() { - return elementPath; - } - - public void addPath(Object... objs) { - for (Object obj : objs) { - elementPath.add(obj); - } - elementPath.add(this.getName()); - } - - @Override - public String toString() { - - return elementName; - } - - public void zeroize() { - - getMsgData().getMem().setLong(0L, byteOffset, msb, lsb); - - } - - public void visit(IElementVisitor visitor) { - visitor.asGenericElement(this); - } - - public String getElementPathAsString() { - if (elementPathAsString == null) { - StringBuilder sb = new StringBuilder(); - for (int i = 1; i < elementPath.size(); i++) { - Object obj = elementPath.get(i); - if (obj instanceof String) { - sb.append(obj); - - } else if (obj instanceof Integer) { - sb.delete(sb.length() - 1, sb.length()); - sb.append("["); - sb.append(((Integer) obj).intValue()); - sb.append("]"); - } - if (i < elementPath.size() - 1) { - sb.append("."); - } - } - elementPathAsString = sb.toString(); - } - return elementPathAsString; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/EmptyEnum_Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/EmptyEnum_Element.java deleted file mode 100644 index 9fb4e5fabc1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/EmptyEnum_Element.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingEmptyEnumElement; -import org.eclipse.osee.ote.message.enums.EmptyEnum; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Michael P. Masterson - */ -public class EmptyEnum_Element extends DiscreteElement<EmptyEnum> { - - public EmptyEnum_Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public EmptyEnum_Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public EmptyEnum_Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, EmptyEnum_Element cause, EmptyEnum value) throws InterruptedException { - /* check for 0 to begin */ - check(accessor, EmptyEnum.toEnum(0), 0); - - /* Set the DP1 Signal */ - cause.set(accessor, value); - - /* Check Value on DP2 */ - check(accessor, value, 1000); - - /* Set DP1 to 0 */ - cause.set(accessor, EmptyEnum.toEnum(0)); - - /* Set DP2 Mux to 0 */ - set(accessor, EmptyEnum.toEnum(0)); - - /* Check Value on DP2 is still set */ - check(accessor, value, 500); - - /* Check DP2 is 0 for two-pulse signals and high for four-pulse signal */ - check(accessor, EmptyEnum.toEnum(0), 500); - - } - - @Override - public EmptyEnum_Element switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (EmptyEnum_Element) super.switchMessages(messages); - } - - /** - * Sets the element to the "value" passed and immediately sends the message that contains it. - * - * @param enumeration The value to set. - */ - public void setAndSend(ITestEnvironmentAccessor accessor, EmptyEnum enumeration) { - this.set(accessor, enumeration); - super.sendMessage(); - } - - @Override - protected Element getNonMappingElement() { - return new NonMappingEmptyEnumElement(this); - } - - @Override - public void visit(IElementVisitor visitor) { - visitor.asEmptyEnumElement(this); - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - int intValue = Integer.parseInt(value); - getMsgData().getMem().setInt(intValue, byteOffset, msb, lsb); - } - - @Override - public EmptyEnum getValue() { - return toEnum(getMsgData().getMem().getInt(byteOffset, msb, lsb)); - } - - @Override - public void setValue(EmptyEnum obj) { - getMsgData().getMem().setInt(obj.getValue(), byteOffset, msb, lsb); - } - - @Override - public String toString(EmptyEnum obj) { - return "EmptyEnum_" + obj.getValue(); - } - - @Override - public EmptyEnum valueOf(MemoryResource mem) { - return toEnum(mem.getInt(byteOffset, msb, lsb)); - } - - private EmptyEnum toEnum(int intValue) { - return EmptyEnum.toEnum(intValue); - } - - @Override - public EmptyEnum elementMask(EmptyEnum value) { - return value; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/EnumeratedElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/EnumeratedElement.java deleted file mode 100644 index ef9840c52e8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/EnumeratedElement.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingEnumeratedElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class EnumeratedElement<T extends Enum<T> & IEnumValue<T>> extends DiscreteElement<T> { - - private final Class<T> clazz; - private final T[] values; - - public EnumeratedElement(Message<?, ?, ?> msg, String elementName, Class<T> clazz, MessageData messageData, int byteOffset, int msb, int lsb, int originalMsb, int originalLsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - this.clazz = clazz; - - values = clazz.getEnumConstants(); - } - - public EnumeratedElement(Message<?, ?, ?> msg, String elementName, Class<T> clazz, MessageData messageData, int byteOffset, int msb, int lsb) { - this(msg, elementName, clazz, messageData, byteOffset, msb, lsb, msb, lsb); - } - - private T getValue(int intVal) { - T undefined = null; - for (T val : values) { - if (val.getIntValue() == intVal) { - return val; - } else if (undefined == null) { - undefined = val.getEnum(intVal); - } - } - return undefined; - } - - public EnumeratedElement(Message<?, ?, ?> message, String elementName, Class<T> clazz, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - this.clazz = clazz; - - values = clazz.getEnumConstants(); - } - - public int getIntValue() { - return getMsgData().getMem().getInt(byteOffset, msb, lsb); - } - - /** - * Sets the element to the "value" passed and immediately sends the meessage that contains it. - * - * @param enumeration The value to set. - */ - public void setAndSend(ITestEnvironmentAccessor accessor, T enumeration) { - this.set(accessor, enumeration); - super.sendMessage(); - } - - /** - * Waits until the element is set to a value not in the "list" passed - * - * @param list The list of values to check against - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T waitForNotInList(ITestAccessor accessor, T[] list, int milliseconds) throws InterruptedException { - return this.waitForList(accessor, list, false, milliseconds); - } - - /** - * Waits until the element is set to a value in the "list" passed - * - * @param list The list of values to check against - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T waitForInList(ITestAccessor accessor, T[] list, int milliseconds) throws InterruptedException { - return this.waitForList(accessor, list, true, milliseconds); - } - - /** - * This function will verify that this signal is pulsed for 2 cycles. - * - * @param value The value to be checked - */ - public void checkPulse(ITestAccessor accessor, T value) throws InterruptedException { - - T nonPulsedValue = getValue(0); - if (value == nonPulsedValue) { - nonPulsedValue = getValue(1); - } - - checkPulse(accessor, value, nonPulsedValue); - - } - - @Override - @SuppressWarnings("unchecked") - public EnumeratedElement<T> switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (EnumeratedElement<T>) super.switchMessages(messages); - } - - protected T toEnum(int intValue) { - final T val = getValue(intValue); - if (val != null) { - return val; - } - throw new IllegalArgumentException( - "No enum value associated with the integer value " + intValue + " for element " + getName()); - } - - @Override - public T getValue() { - return toEnum(getMsgData().getMem().getInt(byteOffset, msb, lsb)); - } - - @Override - public T valueOf(MemoryResource otherMem) { - return toEnum(otherMem.getInt(byteOffset, msb, lsb)); - } - - @Override - public void setValue(T obj) { - getMsgData().getMem().setInt(obj.getIntValue(), byteOffset, msb, lsb); - } - - public T[] getEnumValues() { - return clazz.getEnumConstants(); - } - - @Override - public String toString(T obj) { - return String.format("%s [%d]", obj.name(), obj.getIntValue()); - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - this.set(accessor, Enum.valueOf(clazz, value)); - } - - public void set(String value) throws IllegalArgumentException { - this.setValue(Enum.valueOf(clazz, value)); - } - - public void setbyEnumIndex(int index) throws IllegalArgumentException { - getMsgData().getMem().setInt(values[index].getIntValue(), byteOffset, msb, lsb); - } - - @Override - public void visit(IElementVisitor visitor) { - visitor.asEnumeratedElement(this); - } - - @Override - protected NonMappingEnumeratedElement<T> getNonMappingElement() { - return new NonMappingEnumeratedElement<T>(this); - } - - @Override - public String valueOf() { - return String.format("%s [%d]", getValue().name(), getIntValue()); - } - - public Class<T> getEnumClass() { - return clazz; - } - - @Override - public T elementMask(T value) { - return value; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/FixedPointElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/FixedPointElement.java deleted file mode 100644 index 1742f31dece..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/FixedPointElement.java +++ /dev/null @@ -1,342 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.MessageSystemTestEnvironment; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingFixedPointElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andrew M. Finkbeiner - * @author John Butler - */ -public class FixedPointElement extends RealElement { - - private final double resolution; - private final boolean signed; - private final double offset; - - public FixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, boolean signed, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, resolution, 0, signed, byteOffset, msb, lsb, msb, lsb); - } - - public FixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, double offset, boolean signed, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, resolution, offset, signed, byteOffset, msb, lsb, msb, lsb); - } - - public FixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, boolean signed, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - this(message, elementName, messageData, resolution, 0, signed, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public FixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, double offset, boolean signed, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - this.resolution = resolution; - this.signed = signed; - this.offset = offset; - } - - public FixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, double offset, boolean signed, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - this.resolution = resolution; - this.signed = signed; - this.offset = offset; - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - @Override - public void set(ITestEnvironmentAccessor accessor, double value) { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - this.getMessage()); - } - setValue(value); - - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - } - - /** - * Sets the element to the "value" passeda nd immediately sends the message that contains it... - * - * @param value The value to set. - */ - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, double value) { - this.set(accessor, value); - super.sendMessage(); - } - - public void setNoLog(ITestEnvironmentAccessor accessor, double value) { - setValue(value); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, FixedPointElement cause, double value) throws InterruptedException { - /* check for 0 to begine */ - check(accessor, 0d, 0); - - /* Set the DP1 Mux Signal */ - cause.set(accessor, value); - - /* Chk Value on DP2 */ - check(accessor, value, 1000); - - /* Set DP1 to 0 */ - cause.set(accessor, 0); - - /* Init DP2 Mux to 0 */ - set(accessor, 0); - - /* Chk Value on DP2 is still set */ - check(accessor, value, 500); - - /* Chk DP2 is 0 for two-pulse signals and high for four-oulse signal */ - check(accessor, 0d, 500); - } - - private double toFixed(long value, boolean signed, double resolution, double offset) { - int shift = 64 - (lsb - msb + 1); - if (signed) {// two's compliment - if (value >>> lsb - msb == 1) {// we've got a negative - value--; - value = ~value; - value = value << shift; - value = value >>> shift; - value = value * -1; - } - } else { - value = value << shift; - value = value >>> shift; - } - return value * resolution + offset; - } - - private long toFixedLong(double value, boolean signed, double resolution, double offset) { - long returnValue = Math.round((value - offset) / resolution); - - if (value > 0 && toFixed(returnValue, signed, resolution, offset) < 0) { - returnValue = Math.round((value - resolution - offset) / resolution); - if (value > 0 && toFixed(returnValue, signed, resolution, offset) < 0) { - returnValue = Math.round((value - resolution * 2 - offset) / resolution); - if (value > 0 && toFixed(returnValue, signed, resolution, offset) < 0) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.INFO, getName()); - } else { - OseeLog.log(MessageSystemTestEnvironment.class, Level.INFO, getName()); - } - } else { - OseeLog.log(MessageSystemTestEnvironment.class, Level.INFO, getName()); - } - } - - if (signed && value < 0) { - returnValue = returnValue * -1; - int shift = 64 - (lsb - msb + 1); - returnValue = returnValue << shift; - returnValue = ~returnValue; - returnValue = returnValue >>> shift; - returnValue++; - } - return returnValue; - } - - @Override - public void setValue(Double obj) { - getMsgData().getMem().setLong(toFixedLong(obj, signed, resolution, offset), byteOffset, msb, lsb); - } - - @Override - public void setHex(long hex) { - getMsgData().getMem().setLong(hex, byteOffset, msb, lsb); - } - - @Override - public Double getValue() { - return toFixed(getRaw(), signed, resolution, offset); - } - - @Override - public Double valueOf(MemoryResource mem) { - return toFixed(getRaw(mem), signed, resolution, offset); - } - - @Override - protected double toDouble(long value) { - return toFixed(value, signed, resolution, offset); - } - - @Override - protected long toLong(double value) { - return toFixedLong(value, signed, resolution, offset); - } - - /** - * @return Returns the offset. - */ - public double getMinVal() { - return offset; - } - - /** - * @return Returns the resolution. - */ - public double getResolution() { - return resolution; - } - - /** - * @return Returns the signed. - */ - public boolean isSigned() { - return signed; - } - - @Override - public void visit(IElementVisitor visitor) { - visitor.asFixedPointElement(this); - } - - @Override - protected NonMappingFixedPointElement getNonMappingElement() { - return new NonMappingFixedPointElement(this); - } - - @Override - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, Double value, int milliseconds) throws InterruptedException { - return super.check(accessor, checkGroup, adjust(value), milliseconds); - } - - @Override - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, Double value) { - return super.check(accessor, checkGroup, adjust(value)); - } - - @Override - public boolean checkList(ITestAccessor accessor, CheckGroup checkGroup, boolean isInList, Double[] list, int milliseconds) throws InterruptedException { - return super.checkList(accessor, checkGroup, isInList, adjust(list), milliseconds); - } - - @Override - public boolean checkList(ITestAccessor accessor, CheckGroup checkGroup, boolean wantInList, Double[] list) { - return super.checkList(accessor, checkGroup, wantInList, adjust(list)); - } - - @Override - public Double checkMaintain(ITestAccessor accessor, CheckGroup checkGroup, Double value, int milliseconds) throws InterruptedException { - return super.checkMaintain(accessor, checkGroup, adjust(value), milliseconds); - } - - @Override - public Double checkMaintainList(ITestAccessor accessor, CheckGroup checkGroup, Double[] list, boolean isInList, int milliseconds) throws InterruptedException { - return super.checkMaintainList(accessor, checkGroup, adjust(list), isInList, milliseconds); - } - - @Override - public Double checkMaintainNot(ITestAccessor accessor, CheckGroup checkGroup, Double value, int milliseconds) throws InterruptedException { - return super.checkMaintainNot(accessor, checkGroup, adjust(value), milliseconds); - } - - @Override - public Double checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, Double minValue, boolean minInclusive, Double maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.checkMaintainNotRange(accessor, checkGroup, minValue, minInclusive, maxValue, maxInclusive, - milliseconds); - } - - @Override - public Double checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, Double minValue, boolean minInclusive, Double maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.checkMaintainRange(accessor, checkGroup, minValue, minInclusive, maxValue, maxInclusive, - milliseconds); - } - - @Override - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, Double value, int milliseconds) throws InterruptedException { - return super.checkNot(accessor, checkGroup, adjust(value), milliseconds); - } - - @Override - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, Double value) { - return super.checkNot(accessor, checkGroup, adjust(value)); - } - - @Override - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, Double minValue, boolean minInclusive, Double maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.checkNotRange(accessor, checkGroup, minValue, minInclusive, maxValue, maxInclusive, milliseconds); - } - - @Override - public boolean checkPulse(ITestAccessor accessor, CheckGroup checkGroup, Double pulsedValue, Double nonPulsedValue, int milliseconds) throws InterruptedException { - return super.checkPulse(accessor, checkGroup, adjust(pulsedValue), adjust(nonPulsedValue), milliseconds); - } - - @Override - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, Double minValue, boolean minInclusive, Double maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.checkRange(accessor, checkGroup, minValue, minInclusive, maxValue, maxInclusive, milliseconds); - } - - @Override - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, Double minValue, boolean minInclusive, Double maxValue, boolean maxInclusive) { - return super.checkRange(accessor, checkGroup, minValue, minInclusive, maxValue, maxInclusive); - } - - @Override - public Double waitForList(ITestAccessor accessor, Double[] list, boolean isInList, int milliseconds) throws InterruptedException { - return super.waitForList(accessor, adjust(list), isInList, milliseconds); - } - - @Override - public Double waitForNotRange(ITestEnvironmentAccessor accessor, Double minValue, boolean minInclusive, Double maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.waitForNotRange(accessor, minValue, minInclusive, maxValue, maxInclusive, milliseconds); - } - - @Override - public Double waitForNotValue(ITestEnvironmentAccessor accessor, Double value, int milliseconds) throws InterruptedException { - return super.waitForNotValue(accessor, adjust(value), milliseconds); - } - - @Override - public Double waitForRange(ITestEnvironmentAccessor accessor, Double minValue, boolean minInclusive, Double maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.waitForRange(accessor, minValue, minInclusive, maxValue, maxInclusive, milliseconds); - } - - @Override - public Double waitForValue(ITestEnvironmentAccessor accessor, Double value, int milliseconds) throws InterruptedException { - return super.waitForValue(accessor, adjust(value), milliseconds); - } - - private Double adjust(Double value) { - return toDouble(toLong(value)); - } - - private Double[] adjust(Double[] list) { - Double[] newList = new Double[list.length]; - for (int i = 0; i < list.length; i++) { - newList[i] = adjust(list[i]); - } - return newList; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Float32Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Float32Element.java deleted file mode 100644 index 0a84d1092f1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Float32Element.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingFloat32Element; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andrew M. Finkbeiner - */ -public class Float32Element extends RealElement { - - public Float32Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public Float32Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public Float32Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, Float32Element cause, double value) throws InterruptedException { - /* check for 0 to begine */ - check(accessor, 0d, 0); - - /* Set the DP1 Mux Signal */ - cause.set(accessor, (float) value); - - /* Chk Value on DP2 */ - check(accessor, value, 1000); - - /* Set DP1 to 0 */ - cause.set(accessor, 0); - - /* Init DP2 Mux to 0 */ - set(accessor, 0); - - /* Chk Value on DP2 is still set */ - check(accessor, value, 500); - - /* Chk DP2 is 0 for two-pulse signals and high for four-oulse signal */ - check(accessor, 0d, 500); - - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - @Override - public void set(ITestEnvironmentAccessor accessor, double value) { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - this.getMessage()); - } - setValue(value); - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - } - - /** - * Sets the element to the "value" passed and immediately sends the message that contains it.. - * - * @param value The value to set. - */ - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, double value) { - this.set(accessor, value); - super.sendMessage(); - } - - @Override - public Double getValue() { - return new Double(Float.intBitsToFloat(getMsgData().getMem().getInt(byteOffset, msb, lsb))); - - } - - @Override - public Double valueOf(MemoryResource mem) { - return new Double(Float.intBitsToFloat(mem.getInt(byteOffset, msb, lsb))); - } - - @Override - public void setValue(Double obj) { - setValue(obj.floatValue()); - } - - @Override - public void setValue(Float obj) { - getMsgData().getMem().setInt(Float.floatToIntBits(obj), byteOffset, msb, lsb); - } - - @Override - protected double toDouble(long value) { - return Float.intBitsToFloat((int) value); - } - - @Override - protected long toLong(double value) { - return Double.doubleToLongBits(value); - } - - @Override - protected NonMappingFloat32Element getNonMappingElement() { - return new NonMappingFloat32Element(this); - } - - @Override - public void setHex(long hex) { - getMsgData().getMem().setLong(hex, byteOffset, msb, lsb); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Float64Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Float64Element.java deleted file mode 100644 index 209d2a66474..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/Float64Element.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingFloat64Element; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andrew M. Finkbeiner - */ -public class Float64Element extends RealElement { - - public Float64Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public Float64Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public Float64Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, Float64Element cause, double value) throws InterruptedException { - /* check for 0 to begine */ - check(accessor, 0d, 0); - - /* Set the DP1 Mux Signal */ - cause.set(accessor, value); - - /* Chk Value on DP2 */ - check(accessor, value, 1000); - - /* Set DP1 to 0 */ - cause.set(accessor, 0); - - /* Init DP2 Mux to 0 */ - set(accessor, 0); - - /* Chk Value on DP2 is still set */ - check(accessor, value, 500); - - /* Chk DP2 is 0 for two-pulse signals and high for four-oulse signal */ - check(accessor, 0d, 500); - - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - @Override - public void set(ITestEnvironmentAccessor accessor, double value) { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(value), - this.getMessage()); - } - setValue(value); - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - } - - /** - * Sets the element to the "value" passed and immediately sends the message that contains it.. - * - * @param value The value to set. - */ - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, double value) { - this.set(accessor, value); - super.sendMessage(); - } - - public void setNoLog(ITestEnvironmentAccessor accessor, double value) { - setValue(value); - } - - @Override - public Double getValue() { - return Double.longBitsToDouble(getMsgData().getMem().getLong(byteOffset, msb, lsb)); - } - - @Override - public Double valueOf(MemoryResource mem) { - return Double.longBitsToDouble(mem.getLong(byteOffset, msb, lsb)); - } - - @Override - public void setValue(Double obj) { - getMsgData().getMem().setLong(Double.doubleToLongBits(obj), byteOffset, msb, lsb); - } - - /** - * Sets the element to the "value" passed. - * - * @param accessor - For logging. - * @param bits - The bits to set. - */ - public void setRawBits(ITestEnvironmentAccessor accessor, long bits) { - if (accessor != null) { - accessor.getLogger().methodCalledOnObject(accessor, this.getFullName(), new MethodFormatter().add(bits), - this.getMessage()); - } - - getMsgData().getMem().setLong(bits, byteOffset, msb, lsb); - if (accessor != null) { - accessor.getLogger().methodEnded(accessor); - } - } - - /** - * Sest the element without the logging. - */ - public void setRawBits(long bits) { - getMsgData().getMem().setLong(bits, byteOffset, msb, lsb); - } - - @Override - protected double toDouble(long value) { - return Double.longBitsToDouble(value); - } - - @Override - protected long toLong(double value) { - return Double.doubleToLongBits(value); - } - - @Override - protected Element getNonMappingElement() { - return new NonMappingFloat64Element(this); - } - - @Override - public void setHex(long hex) { - getMsgData().getMem().setLong(hex, byteOffset, msb, lsb); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IElementVisitor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IElementVisitor.java deleted file mode 100644 index ba7a6097aa9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IElementVisitor.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -/** - * @author Andy Jury - */ -public interface IElementVisitor { - - void asGenericElement(Element element); - - void asBooleanElement(BooleanElement element); - - void asIntegerElement(IntegerElement element); - - void asRealElement(RealElement element); - - void asCharElement(CharElement element); - - void asEnumeratedElement(EnumeratedElement<?> element); - - void asFixedPointElement(FixedPointElement element); - - void asRecordElement(RecordElement element); - - void asFloat32(Float32Element element); - - void asFloat64(Float64Element element); - - void asStringElement(StringElement element); - - void asRecordMap(RecordMap<? extends RecordElement> element); - - void asEmptyEnumElement(EmptyEnum_Element element); - - void asLongIntegerElement(LongIntegerElement element); - - void asSignedInteger16Element(SignedInteger16Element element); - - void asArrayElement(ArrayElement element); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IEnumValue.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IEnumValue.java deleted file mode 100644 index 13b058b041b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IEnumValue.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -public interface IEnumValue<T> { - public int getIntValue(); - - T getEnum(int value); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IRecordFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IRecordFactory.java deleted file mode 100644 index 846fb951038..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IRecordFactory.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -public interface IRecordFactory { - - RecordElement create(int i); - - int getBitLength(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/InaccessibleElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/InaccessibleElement.java deleted file mode 100644 index 10e47ba0008..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/InaccessibleElement.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; - -public class InaccessibleElement extends Element { - - // TODO - this is a temporary hack for (PLT/CPG)_UFD_CMD. When cdb adds - // individual elements, delete this class!!! Make sure to remove it from - // MuxSignalType too!! Also make sure to take code out of Message Generation - // too. - public InaccessibleElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public InaccessibleElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - @Override - public InaccessibleElement switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (InaccessibleElement) super.switchMessages(messages); - } - - @Override - protected Element getNonMappingElement() { - return null; - } - - public int compareTo(InaccessibleElement o) { - return 0; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IntegerElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IntegerElement.java deleted file mode 100644 index d5de5e8c1e3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/IntegerElement.java +++ /dev/null @@ -1,228 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.HeaderData; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingIntegerElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class IntegerElement extends NumericElement<Integer> { - - @Override - public void visit(IElementVisitor visitor) { - visitor.asIntegerElement(this); - } - - public IntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public IntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - public IntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - @Override - public IntegerElement switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (IntegerElement) super.switchMessages(messages); - } - - @Override - public String toString(Integer obj) { - int value = elementMask(obj); - return value + "(0x" + Integer.toHexString(value).toUpperCase() + ")"; - } - - @Override - public void setValue(Integer value) { - getMsgData().getMem().setInt(value, byteOffset, msb, lsb); - } - - @Override - public Integer getValue() { - return Integer.valueOf(getMsgData().getMem().getInt(byteOffset, msb, lsb)); - } - - @Override - public Integer valueOf(MemoryResource mem) { - return Integer.valueOf(mem.getInt(byteOffset, msb, lsb)); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, IntegerElement cause, int value) throws InterruptedException { - value = removeSign(value); - /* check for 0 to begine */ - check(accessor, 0, 0); - - /* Set the DP1 Mux Signal */ - cause.set(accessor, value); - - /* Chk Value on DP2 */ - check(accessor, value, 1000); - - /* Set DP1 to 0 */ - cause.set(accessor, 0); - - /* Init DP2 Mux to 0 */ - set(accessor, 0); - - /* Chk Value on DP2 is still set */ - check(accessor, value, 500); - - /* Chk DP2 is 0 for two-pulse signals and high for four-pulse signal */ - check(accessor, 0, 500); - - } - - /** - * This function will verify that this signal is pulsed for 2 cycles. - * - * @param value The value to be checked - */ - public void checkPulse(ITestAccessor accessor, Integer value) throws InterruptedException { - - int nonPulsedValue = 0; - if (value == 0) { - nonPulsedValue = 1; - } - - checkPulse(accessor, value, nonPulsedValue); - - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - @Override - public void set(ITestEnvironmentAccessor accessor, Integer value) { - super.set(accessor, value); - } - - /** - * Sets the element to the "value" passed and immediately sends the message that contains it.. - * - * @param value The value to set. - */ - public void setAndSend(ITestEnvironmentAccessor accessor, int value) { - this.set(accessor, value); - super.sendMessage(); - } - - /** - * Waits until the element has a value within the range specified. Assumes the range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForRange(ITestEnvironmentAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - return this.waitForRange(accessor, minValue, true, maxValue, true, milliseconds); - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.waitForRange(accessor, Integer.valueOf(minValue), minInclusive, Integer.valueOf(maxValue), - maxInclusive, milliseconds); - } - - /** - * Waits until the element has a value within the range specified. Range is assumes to be inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - return this.waitForNotRange(accessor, minValue, true, maxValue, true, milliseconds); - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.waitForNotRange(accessor, Integer.valueOf(minValue), minInclusive, Integer.valueOf(maxValue), - maxInclusive, milliseconds); - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - this.set(accessor, Integer.parseInt(value)); - } - - @Override - protected Element getNonMappingElement() { - return new NonMappingIntegerElement(this); - } - - @Override - public Integer elementMask(Integer value) { - return removeSign(value); - } - - public static void main(String[] args) { - final HeaderData hd = new HeaderData("test_data", new MemoryResource(new byte[64], 2, 64)); - IntegerElement e1 = new IntegerElement(null, "e1", hd, 0, 0, 31); - IntegerElement e2 = new IntegerElement(null, "e2", hd, 4, 0, 31); - e1.setValue(-1); - e2.setValue(-1000); - - System.out.printf(" e1 value = %d\n", e1.getValue()); - System.out.printf(" e2 value = %d\n", e2.getValue()); - - } - - @Override - public long getNumericBitValue() { - return getValue() & 0xFFFFFFFFL; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/LongIntegerElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/LongIntegerElement.java deleted file mode 100644 index 087aeb6d2c3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/LongIntegerElement.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingLongIntegerElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class LongIntegerElement extends NumericElement<Long> { - - @Override - public void visit(IElementVisitor visitor) { - visitor.asLongIntegerElement(this); - } - - public LongIntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public LongIntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - public LongIntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - @Override - public LongIntegerElement switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (LongIntegerElement) super.switchMessages(messages); - } - - @Override - public String toString(Long obj) { - long value = elementMask(obj); - return value + "(0x" + Long.toHexString(value).toUpperCase() + ")"; - } - - @Override - public void setValue(Long value) { - getMsgData().getMem().setLong(value, byteOffset, msb, lsb); - } - - @Override - public Long getValue() { - return Long.valueOf(getMsgData().getMem().getLong(byteOffset, msb, lsb)); - } - - @Override - public Long valueOf(MemoryResource mem) { - return Long.valueOf(mem.getLong(byteOffset, msb, lsb)); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, LongIntegerElement cause, long value) throws InterruptedException { - value = removeSign(value); - /* check for 0 to begine */ - check(accessor, 0, 0); - - /* Set the DP1 Mux Signal */ - cause.set(accessor, value); - - /* Chk Value on DP2 */ - check(accessor, value, 1000); - - /* Set DP1 to 0 */ - cause.set(accessor, 0); - - /* Init DP2 Mux to 0 */ - set(accessor, 0); - - /* Chk Value on DP2 is still set */ - check(accessor, value, 500); - - /* Chk DP2 is 0 for two-pulse signals and high for four-pulse signal */ - check(accessor, 0, 500); - - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, long value, int milliseconds) throws InterruptedException { - return super.check(accessor, (CheckGroup) null, removeSign(value), milliseconds); - } - - /** - * This function will verify that this signal is pulsed for 2 cycles. - * - * @param value The value to be checked - */ - public void checkPulse(ITestAccessor accessor, long value) throws InterruptedException { - long nonPulsedValue = 0; - if (value == 0) { - nonPulsedValue = 1; - } - - checkPulse(accessor, value, nonPulsedValue); - - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - public void set(ITestEnvironmentAccessor accessor, long value) { - super.set(accessor, value); - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - @Deprecated - public void set(long value) { - setValue(value); - } - - /** - * Sets the element to the "value" passed and immediately sends the message that contains it.. - * - * @param value The value to set. - */ - public void setAndSend(ITestEnvironmentAccessor accessor, long value) { - this.set(accessor, value); - super.sendMessage(); - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - this.set(accessor, Long.parseLong(value)); - } - - @Override - protected NonMappingLongIntegerElement getNonMappingElement() { - return new NonMappingLongIntegerElement(this); - } - - @Override - public Long elementMask(Long value) { - return removeSign(value); - } - - @Override - public long getNumericBitValue() { - return getValue(); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/MsgWaitResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/MsgWaitResult.java deleted file mode 100644 index 57ca2928724..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/MsgWaitResult.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -public class MsgWaitResult { - private final long time; - private final int xmitCount; - private final boolean passed; - - public MsgWaitResult(long time, int xmitCount, boolean passed) { - this.time = time; - this.xmitCount = xmitCount; - this.passed = passed; - } - - public long getElapsedTime() { - return time; - } - - public int getXmitCount() { - return xmitCount; - } - - public boolean isPassed() { - return passed; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/NonFilteredStringElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/NonFilteredStringElement.java deleted file mode 100644 index c155e2e652d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/NonFilteredStringElement.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - - -public class NonFilteredStringElement extends StringElement{ - - public NonFilteredStringElement(StringElement element) { - super(element.getMessage(), element.getName(), element.getMsgData(), element.getByteOffset(), element.getMsb(), element.getLsb()); - } - - /* (non-Javadoc) - * @see org.eclipse.osee.ote.message.elements.StringElement#getValue() - */ - @Override - public String getValue() { - return getMsgData().getMem().getUnfilteredASCIIString(byteOffset, msb, lsb); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/NumericElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/NumericElement.java deleted file mode 100644 index 6bc34dc7467..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/NumericElement.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; - -public abstract class NumericElement<T extends Number & Comparable<T>> extends DiscreteElement<T> { - - public NumericElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalMsb, int originalLsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb, originalMsb, originalLsb); - } - - public NumericElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb); - } - - public NumericElement(Message<?, ?, ?> msg, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(msg, elementName, messageData, bitOffset, bitLength); - } - - public abstract long getNumericBitValue(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/RealElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/RealElement.java deleted file mode 100644 index 953236d6088..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/RealElement.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public abstract class RealElement extends NumericElement<Double> { - - @Override - public void visit(IElementVisitor visitor) { - visitor.asRealElement(this); - } - - public RealElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public RealElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public RealElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - @Override - public RealElement switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (RealElement) super.switchMessages(messages); - } - - public void setValue(Float value) { - setValue(value.doubleValue()); - } - - @Override - public String valueOf() { - return getValue().toString(); - } - - public long getRaw() { - return getRaw(getMsgData().getMem()); - } - - public long getRaw(MemoryResource mem) { - return mem.getLong(byteOffset, msb, lsb); - } - - public abstract void set(ITestEnvironmentAccessor accessor, double value); - - public abstract void setAndSend(ITestEnvironmentAccessor accessor, double value); - - /** - * sets the bit pattern for this element. All hex values must be in the form of: <br> - * <p> - * <code><b>0x[<I>hex characters</I>]L</b></code><br> - * <p> - * The trailing 'L' signals java to treat the value as a long integer. - * - * @param hex a bit patter to set the element to. The pattern is not limited to hexadecimal - */ - public abstract void setHex(long hex); - - protected abstract double toDouble(long value); - - protected abstract long toLong(double value); - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - this.set(accessor, Double.parseDouble(value)); - } - - @Override - public String toString(Double obj) { - return obj.toString(); - } - - @Override - public Double elementMask(Double value) { - return value; - } - - @Override - public long getNumericBitValue() { - return getRaw(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/RecordElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/RecordElement.java deleted file mode 100644 index dd42ed10a2b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/RecordElement.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingRecordElement; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public abstract class RecordElement extends Element { - - private final Map<String, Element> elementMap; - private final int recordBitSize; - - private int bitOffset; - private final int index; - private boolean isPartOfMap = true; - private final int firstRecordBitOffset; - public int BIT_OFFSET; - - /** - * @param message - - * @param elementName - - */ - public RecordElement(Message<?, ?, ?> message, String elementName, int index, MessageData messageData, int firstRecordBitOffset, int recordBitSize) { - super(message, elementName, messageData, firstRecordBitOffset + index * recordBitSize, recordBitSize); - elementMap = new LinkedHashMap<>(); - BIT_OFFSET = this.bitOffset = firstRecordBitOffset + index * recordBitSize; - this.recordBitSize = recordBitSize; - this.firstRecordBitOffset = firstRecordBitOffset; - this.index = index; - } - - public RecordElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int firstRecordBitOffset, int recordBitSize) { - this(message, elementName, 0, messageData, firstRecordBitOffset, recordBitSize); - isPartOfMap = false; - } - - public void addElements(Element... elements) { - for (Element element : elements) { - elementMap.put(element.elementName, element); - } - } - - @Override - public void addPath(Object... objs) { - for (Object obj : objs) { - getElementPath().add(obj); - } - if (isPartOfMap) { - getElementPath().add(index); - } else { - getElementPath().add(getElementName()); - } - Object[] myPath = getElementPath().toArray(); - for (Element el : elementMap.values()) { - el.addPath(myPath); - } - } - - public RecordElement(RecordElement message, String elementName, int offset, MessageData messageData, int firstRecordByteOffset, int recordByteSize) { - this(message.getMessage(), elementName, offset, messageData, firstRecordByteOffset, recordByteSize); - isPartOfMap = false; - } - - public Map<String, Element> getElementMap() { - return this.elementMap; - } - - @Override - protected NonMappingRecordElement getNonMappingElement() { - return new NonMappingRecordElement(this); - } - - @Override - public RecordElement switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (RecordElement) super.switchMessages(messages); - } - - public void put(int index, RecordElement newRecord) { - // records.put(index, (T)newRecord); - } - - public int length() { - return -1; - } - - public RecordElement get(int index) { - // T val = records.get(index); - // if(val == null){ - // val = (T)factory.create(index); - // records.put(index, val); - // } - return null; - } - - /** - * @return the firstRecordBitOffset - */ - public int getFirstRecordBitOffset() { - return firstRecordBitOffset; - } - - /** - * @return the bitOffset - */ - public int getBitOffset() { - return bitOffset; - } - - /** - * @return the recordBitSize - */ - public int getRecordBitSize() { - return recordBitSize; - } - - @Override - public void visit(IElementVisitor visitor) { - visitor.asRecordElement(this); - } - - @Override - public void zeroize() { - for (Element el : elementMap.values()) { - el.zeroize(); - } - } - - @Override - public String getDescriptiveName() { - if (isPartOfMap) { - return String.format("%s[%d]", getName(), index); - } - return getName(); - } - - public int getIndex() { - return index; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/RecordMap.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/RecordMap.java deleted file mode 100644 index a887d541122..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/RecordMap.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import java.util.HashMap; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class RecordMap<T extends RecordElement> extends RecordElement { - - private final int NUMBER_OF_RECORDS; - - private final HashMap<Integer, T> records; - private IRecordFactory factory; - - public RecordMap(Message<?, ?, ?> message, MessageData messageData, String elementName, int numberOfRecords, IRecordFactory factory) { - super(message, elementName, 1, messageData, 0, factory.getBitLength()); - NUMBER_OF_RECORDS = numberOfRecords; - records = new HashMap<>(numberOfRecords); - this.factory = factory; - } - - public RecordMap(Message<?, ?, ?> message, MessageData messageData, int firstRecordByteOffset, int recordByteSize, int numberOfRecords) { - super(message, "", 1, messageData, 0, 0); - NUMBER_OF_RECORDS = numberOfRecords; - records = new HashMap<>(numberOfRecords); - } - - @Override - public T get(int index) { - if (index >= NUMBER_OF_RECORDS) { - throw new IllegalArgumentException( - "index(zero-based):" + index + " is greater than NUMBER_OF_RECORDS:" + NUMBER_OF_RECORDS); - } - - T val = records.get(index); - if (val == null) { - val = (T) factory.create(index); - for (Object obj : getElementPath()) { - val.getElementPath().add(obj); - } - records.put(index, val); - } - return val; - } - - @Override - public void addPath(Object... objs) { - for (Object obj : objs) { - getElementPath().add(obj); - } - getElementPath().add(this.getName()); - } - - @Override - public void put(int index, RecordElement newRecord) { - records.put(index, (T) newRecord); - } - - @Override - public int length() { - return this.NUMBER_OF_RECORDS; - } - - public MessageData getMessageData() { - return messageData; - } - - public RecordMap<T> switchRecordMapMessages(Collection<? extends Message<?, ?, ?>> messages) { - for (RecordElement element : this.records.values()) { - element.switchMessages(messages); - } - - return this; - } - - // public <U extends Message<? extends ITestEnvironmentMessageSystemAccessor, ? extends MessageData, U>> RecordMap<T> switchMessages(Collection<U> messages) { - // for (RecordElement element : this.records.values()) { - // element.switchMessages(messages); - // } - // - // return this; - // } - - @Override - public RecordMap<T> switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - for (RecordElement element : this.records.values()) { - element.switchMessages(messages); - } - return this; - } - - @Override - public void visit(IElementVisitor visitor) { - visitor.asRecordMap(this); - } - - public int compareTo(RecordElement o) { - return 0; - } - - @Override - public void zeroize() { - super.zeroize(); - for (int i = 0; i < length(); i++) { - get(i).zeroize(); - } - } - - @Override - public String getDescriptiveName() { - return String.format("%s[0...%d]", getName(), length() - 1); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/SignedInteger16Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/SignedInteger16Element.java deleted file mode 100644 index 3bddf54f3fb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/SignedInteger16Element.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingSignedInteger16Element; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class SignedInteger16Element extends NumericElement<Integer> { - - @Override - public void visit(IElementVisitor visitor) { - visitor.asSignedInteger16Element(this); - } - - public SignedInteger16Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public SignedInteger16Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - public SignedInteger16Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - @Override - public SignedInteger16Element switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (SignedInteger16Element) super.switchMessages(messages); - } - - @Override - public String toString(Integer obj) { - return obj + "(0x" + Integer.toHexString(obj).toUpperCase() + ")"; - } - - @Override - public void setValue(Integer value) { - getMsgData().getMem().setInt(value, byteOffset, msb, lsb); - } - - @Override - public Integer getValue() { - return Integer.valueOf(getMsgData().getMem().getSignedInt16(byteOffset, msb, lsb)); - } - - @Override - public Integer valueOf(MemoryResource mem) { - return Integer.valueOf(mem.getSignedInt16(byteOffset, msb, lsb)); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, SignedInteger16Element cause, int value) throws InterruptedException { - /* check for 0 to begine */ - check(accessor, 0, 0); - - /* Set the DP1 Mux Signal */ - cause.set(accessor, value); - - /* Chk Value on DP2 */ - check(accessor, value, 1000); - - /* Set DP1 to 0 */ - cause.set(accessor, 0); - - /* Init DP2 Mux to 0 */ - set(accessor, 0); - - /* Chk Value on DP2 is still set */ - check(accessor, value, 500); - - /* Chk DP2 is 0 for two-pulse signals and high for four-pulse signal */ - check(accessor, 0, 500); - - } - - /** - * This function will verify that this signal is pulsed for 2 cycles. - * - * @param value The value to be checked - */ - public void checkPulse(ITestAccessor accessor, int value) throws InterruptedException { - - int nonPulsedValue = 0; - if (value == 0) { - nonPulsedValue = 1; - } - - checkPulse(accessor, value, nonPulsedValue); - - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - public void set(ITestEnvironmentAccessor accessor, int value) { - super.set(accessor, value); - } - - /** - * Sets the element to the "value" passed and immediately sends the message that contains it.. - * - * @param value The value to set. - */ - public void setAndSend(ITestEnvironmentAccessor accessor, int value) { - this.set(accessor, value); - super.sendMessage(); - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.waitForRange(accessor, Integer.valueOf(minValue), minInclusive, Integer.valueOf(maxValue), - maxInclusive, milliseconds); - } - - /** - * Waits until the element has a value within the range specified. Range is assumes to be inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - return this.waitForNotRange(accessor, minValue, true, maxValue, true, milliseconds); - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - return super.waitForNotRange(accessor, Integer.valueOf(minValue), minInclusive, Integer.valueOf(maxValue), - maxInclusive, milliseconds); - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - this.set(accessor, Integer.parseInt(value)); - } - - @Override - protected Element getNonMappingElement() { - return new NonMappingSignedInteger16Element(this); - } - - @Override - public Integer elementMask(Integer value) { - return value; - } - - @Override - public long getNumericBitValue() { - return getValue() & 0xFFFFFFFFL; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/StringElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/StringElement.java deleted file mode 100644 index c4bc2d82865..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/StringElement.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements; - -import java.util.Collection; -import java.util.logging.Level; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.MethodFormatter; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckPoint; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.condition.EmptyStringCondition; -import org.eclipse.osee.ote.message.condition.StringTrimCondition; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.nonmapping.NonMappingStringElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class StringElement extends DiscreteElement<String> { - - @Override - public void visit(IElementVisitor visitor) { - visitor.asStringElement(this); - } - - public StringElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - this(message, elementName, messageData, byteOffset, msb, lsb, msb, lsb); - } - - public StringElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - public StringElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - @Override - public StringElement switchMessages(Collection<? extends Message<?, ?, ?>> messages) { - return (StringElement) super.switchMessages(messages); - } - - @Override - public String toString(String obj) { - return obj; - } - - @Override - public void setValue(String value) { - getMsgData().getMem().setASCIIString(value, byteOffset, msb, lsb); - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - set(accessor, value); - } - - @Override - public String getValue() { - return getMsgData().getMem().getASCIIString(byteOffset, msb, lsb); - } - - /** - * copies this elements chars into the given array. The array must be big enough to contain this elements data or an - * ArrayIndexOutOfBoundsException will be thrown. Does not exclude or stop on null (\0) characters in the element - * data. - * - * @param destination the destination array that will receive the char data - * @return the actual number of characters copied. The destination array will contain undefined data starting at this - * index until the end of the char array. - * @throws ArrayIndexOutOfBoundsException if the destination array is too small - */ - public int getChars(char[] destination) throws ArrayIndexOutOfBoundsException { - return getMsgData().getMem().getASCIIChars(byteOffset, msb, lsb, destination); - } - - public void setChars(final char[] data) { - final int sizeInBytes = (lsb - msb + 1) / 8; - if (data.length > sizeInBytes) { - OseeLog.log(getClass(), Level.WARNING, - "char[] passed to setChars() is bigger than the element, setting with subset of passed data"); - } else if (data.length < sizeInBytes) { - OseeLog.log(getClass(), Level.WARNING, - "char[] passed to setChars() is smaller than element, setting subset of element"); - } - MemoryResource memory = getMsgData().getMem(); - final int bytesToSet = Math.min(data.length, sizeInBytes); - for (int i = 0; i < bytesToSet; i++) { - memory.setByte(data[i], byteOffset + i, 0, 7); - } - } - - public boolean equals(String other) { - return getMsgData().getMem().asciiEquals(byteOffset, msb, lsb, other); - } - - @Override - public String valueOf(MemoryResource mem) { - return mem.getASCIIString(byteOffset, msb, lsb); - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkTrimWhiteSpace(ITestAccessor accessor, String value, int milliseconds) throws InterruptedException { - if (accessor == null) { - throw new NullPointerException("The parameter accessor is null"); - } - - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), - new MethodFormatter().add(value).add(milliseconds), getMessage()); - final StringTrimCondition c = new StringTrimCondition(this, value); - - MsgWaitResult result = getMessage().waitForCondition(accessor, c, false, milliseconds); - CheckPoint passFail = - new CheckPoint(getFullName(), toString(value), toString(c.getLastCheckValue()), result.isPassed(), - result.getElapsedTime()); - - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - - accessor.getLogger().methodEnded(accessor); - return passFail.isPass(); - } - - /** - * Sets the element to the "value" passed and immediately sends the message that contains it.. - * - * @param value The value to set. - */ - public void setAndSend(ITestEnvironmentAccessor accessor, String value) { - parseAndSet(accessor, value); - super.sendMessage(); - } - - @Override - protected NonMappingStringElement getNonMappingElement() { - return new NonMappingStringElement(this); - } - - @Override - public void zeroize() { - int sizeInBytes = (lsb - msb + 1) / 8; - getMsgData().getMem().zeroizeFromOffset(byteOffset, sizeInBytes); - } - - public boolean isEmpty() { - return new EmptyStringCondition(this).check(); - } - - public boolean checkEmpty(ITestAccessor accessor, int milliseconds) throws InterruptedException { - if (accessor == null) { - throw new NullPointerException("The parameter accessor is null"); - } - - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), new MethodFormatter().add(milliseconds), - getMessage()); - final EmptyStringCondition c = new EmptyStringCondition(this); - - MsgWaitResult result = getMessage().waitForCondition(accessor, c, false, milliseconds); - CheckPoint passFail = - new CheckPoint(getFullName(), "Empty", result.isPassed() ? "Empty" : "Not Empty", result.isPassed(), - result.getElapsedTime()); - - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - - accessor.getLogger().methodEnded(accessor); - return passFail.isPass(); - } - - public boolean checkMaintainEmpty(ITestAccessor accessor, int milliseconds) throws InterruptedException { - if (accessor == null) { - throw new NullPointerException("The parameter accessor is null"); - } - - accessor.getLogger().methodCalledOnObject(accessor, getFullName(), new MethodFormatter().add(milliseconds), - getMessage()); - final EmptyStringCondition c = new EmptyStringCondition(this); - - MsgWaitResult result = getMessage().waitForCondition(accessor, c, true, milliseconds); - CheckPoint passFail = - new CheckPoint(getFullName(), "Empty", result.isPassed() ? "Empty" : "Not Empty", result.isPassed(), - result.getElapsedTime()); - - accessor.getLogger().testpoint(accessor, accessor.getTestScript(), accessor.getTestCase(), passFail); - - accessor.getLogger().methodEnded(accessor); - return passFail.isPass(); - } - - @Override - public String elementMask(String value) { - return value; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingCharElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingCharElement.java deleted file mode 100644 index 05d336547cb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingCharElement.java +++ /dev/null @@ -1,910 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.CharElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andy Jury - */ -public class NonMappingCharElement extends CharElement { - - public NonMappingCharElement(CharElement element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), element.getByteOffset(), - element.getMsb(), element.getLsb()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingCharElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, byteOffset, msb, lsb); - } - - public NonMappingCharElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public NonMappingCharElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, CharElement cause, char value) throws InterruptedException { - - throwNoMappingElementException(); - } - - /** - * Verifies that the element is set to "value". - * - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, char value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, char value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, char minValue, char maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, char maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param value value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, char value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, char value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, char minValue, char maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, char maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, char value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, char value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, char minValue, char maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, char maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minimum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, char value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, char value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, char minValue, char maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, char maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is Not set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - @Override - public boolean checkNot(ITestAccessor accessor, String value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is Not set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - @Override - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, String value, int milliseconds) throws InterruptedException { - - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - @Override - public boolean check(ITestAccessor accessor, String value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - @Override - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, String value, int milliseconds) throws InterruptedException { - - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the string starting at the element is not set to "value". - * - * @param value Expected value - * @return if the check passed - */ - @Override - public boolean checkNot(ITestAccessor accessor, String value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the string starting at the element is not set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value - * @return if the check passed - */ - @Override - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, String value) { - - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the string starting at the element is set to "value". - * - * @param value Expected value - * @return if the check passed - */ - @Override - public boolean check(ITestAccessor accessor, String value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the string starting at the element is set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value - * @return if the check passed - */ - @Override - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, String value) { - - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed. Either value expected or value found at timeout. - */ - public char checkMaintain(ITestAccessor accessor, CheckGroup checkGroup, char value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed - */ - public char checkMaintainNot(ITestAccessor accessor, CheckGroup checkGroup, char value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public char checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, char maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public char checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public char checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, char maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public char checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - @Override - public Character get(ITestEnvironmentAccessor accessor) { - throwNoMappingElementException(); - return ' '; - } - - /** - * Returns the string of length "stringLength" starting as the position of the element. - * - * @param stringLength the length of the string to return - * @return the string starting with this element - */ - @Override - public String getString(ITestEnvironmentAccessor accessor, int stringLength) { - throwNoMappingElementException(); - return null; - } - - /** - * Sets the element and the next ("value".length() -1) bytes to "value".charAt(). - * - * @param value the string to set the bytes to - */ - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) { - - throwNoMappingElementException(); - } - - /** - * Sets the element and the next ("value".length() -1) bytes to "value".charAt(). <b>No Log Record gets created in - * the Script Log File.</b> - * - * @param value the string to set the bytes to - */ - @Override - public void setNoLog(ITestEnvironmentAccessor accessor, String value) { - throwNoMappingElementException(); - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - public void set(ITestEnvironmentAccessor accessor, char value) { - throwNoMappingElementException(); - } - - /** - * Sets the element to the "value" passed and immediately sends the message that contains it. - * - * @param value The value to set. - */ - public void setAndSend(ITestEnvironmentAccessor accessor, char value) { - throwNoMappingElementException(); - } - - /** - * Sets the element to the "value" passed. <b>No Log Record gets created in the Script Log File.</b> - * - * @param value The value to set. - */ - public void setNoLog(ITestEnvironmentAccessor accessor, char value) { - throwNoMappingElementException(); - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public char waitForNotRange(ITestEnvironmentAccessor accessor, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Waits until the element has a value within the range specified. Range is assumes to be inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public char waitForNotRange(ITestEnvironmentAccessor accessor, char minValue, char maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public char waitForRange(ITestEnvironmentAccessor accessor, char minValue, boolean minInclusive, char maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Waits until the element has a value within the range specified. Assumes the range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public char waitForRange(ITestEnvironmentAccessor accessor, char minValue, char maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Waits until the element has a value other than the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public char waitNotValue(ITestEnvironmentAccessor accessor, char value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Waits until the element equals the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value found. Either value expected or value found at timeout. - */ - public char waitForValue(ITestEnvironmentAccessor accessor, char value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ' '; - } - - /** - * Waits until the element equals the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value found. Either value expected or value found at timeout. - */ - @Override - protected String waitForValue(ITestEnvironmentAccessor accessor, String value, int milliseconds) throws InterruptedException { - - throwNoMappingElementException(); - return null; - } - - /** - * Waits until the element does not equal the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value found. Either value expected or value found at timeout. - */ - @Override - protected String waitForNotValue(ITestEnvironmentAccessor accessor, String value, int milliseconds) throws InterruptedException { - - throwNoMappingElementException(); - return null; - } - - @Override - public void setValue(Character value) { - - throwNoMappingElementException(); - } - - @Override - public Character getValue() { - throwNoMappingElementException(); - return ' '; - } - - @Override - public String toString(Character obj) { - throwNoMappingElementException(); - return null; - } - - @Override - public boolean isNonMappingElement() { - return true; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingEmptyEnumElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingEmptyEnumElement.java deleted file mode 100644 index 122b538342c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingEmptyEnumElement.java +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.core.testPoint.CheckPoint; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.condition.IDiscreteElementCondition; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.DiscreteElement; -import org.eclipse.osee.ote.message.elements.Element; -import org.eclipse.osee.ote.message.elements.EmptyEnum_Element; -import org.eclipse.osee.ote.message.elements.IElementVisitor; -import org.eclipse.osee.ote.message.enums.EmptyEnum; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -public class NonMappingEmptyEnumElement extends EmptyEnum_Element { - - /** - * Copy constructor. - */ - public NonMappingEmptyEnumElement(EmptyEnum_Element element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), element.getByteOffset(), - element.getMsb(), element.getLsb()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingEmptyEnumElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, byteOffset, msb, lsb); - } - - public NonMappingEmptyEnumElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public NonMappingEmptyEnumElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - @Override - public void checkForwarding(ITestAccessor accessor, EmptyEnum_Element cause, EmptyEnum value) throws InterruptedException { - throwNoMappingElementException(); - } - - @Override - public EmptyEnum elementMask(EmptyEnum value) { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum get(ITestEnvironmentAccessor accessor) { - throwNoMappingElementException(); - return null; - } - - @Override - protected Element getNonMappingElement() { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum getValue() { - throwNoMappingElementException(); - return null; - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - throwNoMappingElementException(); - } - - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, EmptyEnum enumeration) { - throwNoMappingElementException(); - } - - @Override - public void setValue(EmptyEnum obj) { - throwNoMappingElementException(); - } - - @Override - public String toString(EmptyEnum obj) { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum valueOf(MemoryResource mem) { - throwNoMappingElementException(); - return null; - } - - @Override - public void visit(IElementVisitor visitor) { - throwNoMappingElementException(); - } - - @Override - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum value) { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkList(ITestAccessor accessor, CheckGroup checkGroup, boolean isInList, EmptyEnum[] list, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkList(ITestAccessor accessor, CheckGroup checkGroup, boolean wantInList, EmptyEnum[] list) { - throwNoMappingElementException(); - return false; - } - - @Override - public EmptyEnum checkMaintain(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum checkMaintainList(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum[] list, boolean isInList, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum checkMaintainNot(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum checkMaintainNotNT(ITestAccessor accessor, EmptyEnum value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum checkMaintainNotRangeNT(ITestAccessor accessor, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum checkMaintainNT(ITestAccessor accessor, EmptyEnum value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum checkMaintainRangeNT(ITestAccessor accessor, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum value) { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkNotNT(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum value) { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkNotRangeNT(ITestAccessor accessor, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkPulse(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum pulsedValue, EmptyEnum nonPulsedValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkRangeNT(ITestAccessor accessor, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int millis) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkRangeNT(ITestAccessor accessor, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean checkNT(ITestAccessor accessor, CheckGroup checkGroup, EmptyEnum value) { - throwNoMappingElementException(); - return false; - } - - @Override - public int compareTo(DiscreteElement<EmptyEnum> o) { - throwNoMappingElementException(); - return 0; - } - - @Override - public EmptyEnum get() { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum getNoLog() { - throwNoMappingElementException(); - return null; - } - - @Override - public void set(EmptyEnum value) { - throwNoMappingElementException(); - } - - @Override - public void set(ITestEnvironmentAccessor accessor, EmptyEnum value) { - throwNoMappingElementException(); - } - - @Override - public void setNoLog(EmptyEnum value) { - throwNoMappingElementException(); - } - - @Override - public void setNoLog(ITestEnvironmentAccessor accessor, EmptyEnum value) { - throwNoMappingElementException(); - } - - @Override - public synchronized void toggle(ITestEnvironmentAccessor accessor, EmptyEnum value1, EmptyEnum value2, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - } - - @Override - public String toString() { - throwNoMappingElementException(); - return "non mapping empty enum"; - } - - @Override - public String valueOf() { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum waitForList(ITestAccessor accessor, EmptyEnum[] list, boolean isInList, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum waitForNotRange(ITestEnvironmentAccessor accessor, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum waitForNotValue(ITestEnvironmentAccessor accessor, EmptyEnum value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum waitForRange(ITestEnvironmentAccessor accessor, EmptyEnum minValue, boolean minInclusive, EmptyEnum maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - public EmptyEnum waitForValue(ITestEnvironmentAccessor accessor, EmptyEnum value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - protected CheckPoint waitWithCheckPoint(ITestAccessor accessor, CheckGroup checkGroup, String expected, IDiscreteElementCondition<EmptyEnum> condition, boolean maintain, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingEnumeratedElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingEnumeratedElement.java deleted file mode 100644 index c5eeaf6dac4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingEnumeratedElement.java +++ /dev/null @@ -1,381 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.EnumeratedElement; -import org.eclipse.osee.ote.message.elements.IEnumValue; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andy Jury - */ -public class NonMappingEnumeratedElement<T extends Enum<T> & IEnumValue<T>> extends EnumeratedElement<T> { - - public NonMappingEnumeratedElement(EnumeratedElement<T> element) { - this(element.getMessage(), element.getElementName(), element.getEnumClass(), element.getMsgData(), - element.getByteOffset(), element.getMsb(), element.getLsb()); - - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingEnumeratedElement(Message<?, ?, ?> msg, String elementName, Class<T> clazz, MessageData messageData, int byteOffset, int msb, int lsb, int originalMsb, int originalLsb) { - super(msg, elementName, clazz, messageData, byteOffset, msb, lsb, originalMsb, originalLsb); - } - - public NonMappingEnumeratedElement(Message<?, ?, ?> msg, String elementName, Class<T> clazz, MessageData messageData, int byteOffset, int msb, int lsb) { - super(msg, elementName, clazz, messageData, byteOffset, msb, lsb); - } - - public NonMappingEnumeratedElement(Message<?, ?, ?> message, String elementName, Class<T> clazz, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, clazz, messageData, bitOffset, bitLength); - } - - /** - * Verifies that the element is set to a value IN or NOT IN the "list" passed. "wantInList" determines if checking - * for IN the list or NOT. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param wantInList Determines if checking for the element's value to be in or not in the "list". Passing TRUE will - * test for IN the "list". - * @param list List of values to check for - * @return if check passed - */ - @Override - public boolean checkList(ITestAccessor accessor, CheckGroup checkGroup, boolean wantInList, T[] list) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value IN or NOT IN the "list" passed. "isInList" determines if checking for - * IN the list or NOT. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param isInList Determines if checking for the element's value to be in or not in the "list". Passing TRUE will - * test for IN the "list". - * @param list List of values to check for - * @param milliseconds Number of milliseconds to wait - * @return if check passed - */ - @Override - public boolean checkList(ITestAccessor accessor, CheckGroup checkGroup, boolean isInList, T[] list, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value in (or not in as determined by "isInList") the list for the entire - * time passed into milliseconds. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param list The list of values to check against - * @param isInList If the value is expected to be in or not in the "list" - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public T checkMaintainList(ITestAccessor accessor, CheckGroup checkGroup, T[] list, boolean isInList, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - /** - * Waits until the element is set to a value either in or not in the "list" as determined by "isInList". - * - * @param list The list of values to check against - * @param isInList If the value is expected to be in or not in the "list" - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public T waitForList(ITestAccessor accessor, T[] list, boolean isInList, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - /** - * Waits until the element has a value other than the "value" passed. Returns last value observed upon a time-out. - * - * @param enumeration The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public T waitForNotValue(ITestEnvironmentAccessor accessor, T enumeration, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - /** - * Sets the element to the first enumeration for the wait time and then it sets it to the second - * enumeration. - * - */ - public void toggle(ITestEnvironmentAccessor accessor, T enumeration1, T enumeration2, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - } - - @Override - /** - * Returns the current value of the element. - * - * @return The current value of the element. - */ - public T get(ITestEnvironmentAccessor accessor) { - throwNoMappingElementException(); - return null; - } - - @Override - /** - * Sets the element to the "value" passed. - * - * @param enumeration The value to set. - */ - public void set(ITestEnvironmentAccessor accessor, T enumeration) { - throwNoMappingElementException(); - } - - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, T enumeration) { - throwNoMappingElementException(); - } - - @Override - /** - * Waits until the element is set to a value not in the "list" passed - * - * @param list The list of values to check against - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T waitForNotInList(ITestAccessor accessor, T[] list, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - /** - * Waits until the element is set to a value in the "list" passed - * - * @param list The list of values to check against - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public T waitForInList(ITestAccessor accessor, T[] list, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - /** - * Verifies that the element is set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is - * going to log then the reference to the CheckGroup must be passed and this method - * will add the result of the check to the group with out logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference - * should be passed and this method will log the test point. - * @param enumeration Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, T enumeration) { - throwNoMappingElementException(); - return false; - } - - @Override - /** - * Verifies that the element is NOT set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is - * going to log then the reference to the CheckGroup must be passed and this method - * will add the result of the check to the group with out logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference - * should be passed and this method will log the test point. - * @param enumeration value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, T enumeration) { - throwNoMappingElementException(); - return false; - } - - @Override - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is - * going to log then the reference to the CheckGroup must be passed and this method - * will add the result of the check to the group with out logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference - * should be passed and this method will log the test point. - * @param enumeration Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, T enumeration, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - /** - * Verifies that the element is set to some value other than "value" within the number of - * "milliseconds" passed. Passes if at any point with in the time allowed, the element is set to - * a value other than "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is - * going to log then the reference to the CheckGroup must be passed and this method - * will add the result of the check to the group with out logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference - * should be passed and this method will log the test point. - * @param enumeration value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, T enumeration, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - /** - * Verifies that the element is set to the "value" passed for the entire time passed into - * "milliseconds". Returns value found that caused failure or last value observed if time - * expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is - * going to log then the reference to the CheckGroup must be passed and this method - * will add the result of the check to the group with out logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference - * should be passed and this method will log the test point. - * @return last value observed. Either value expected or value found at timeout. - */ - public T checkMaintain(ITestAccessor accessor, CheckGroup checkGroup, T enumeration, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - @Override - /** - * Verifies that the element is set to a value other than the "value" passed for the entire time - * passed into "milliseconds". Returns value found that caused failure or last value observed if - * time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is - * going to log then the reference to the CheckGroup must be passed and this method - * will add the result of the check to the group with out logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference - * should be passed and this method will log the test point. - * @return last value observed - */ - public T checkMaintainNot(ITestAccessor accessor, CheckGroup checkGroup, T enumeration, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return null; - } - - /** - * This function will verify that this signal is pulsed for 2 cycles. - * - * @param value The value to be checked - */ - @Override - public void checkPulse(ITestAccessor accessor, T value) throws InterruptedException { - throwNoMappingElementException(); - } - - @Override - public boolean checkPulse(ITestAccessor accessor, CheckGroup checkGroup, T pulsedValue, T nonPulsedValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - @Override - protected T toEnum(int intValue) { - throwNoMappingElementException(); - return null; - } - - @Override - public T[] getEnumValues() { - throwNoMappingElementException(); - return null; - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - throwNoMappingElementException(); - } - - @Override - public boolean isNonMappingElement() { - return true; - } - - @Override - public void setbyEnumIndex(int index) throws IllegalArgumentException { - throwNoMappingElementException(); - } - - @Override - public void setValue(T obj) { - throwNoMappingElementException(); - } - - @Override - public String toString(T obj) { - throwNoMappingElementException(); - return super.toString(obj); - } - - @Override - public String valueOf() { - throwNoMappingElementException(); - return super.valueOf(); - } - - @Override - public T valueOf(MemoryResource otherMem) { - throwNoMappingElementException(); - return super.valueOf(otherMem); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingFixedPointElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingFixedPointElement.java deleted file mode 100644 index c1a5979f330..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingFixedPointElement.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.FixedPointElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andy Jury - */ -public class NonMappingFixedPointElement extends FixedPointElement { - - /** - * Copy constructor. - */ - public NonMappingFixedPointElement(FixedPointElement element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), 0, false, element.getByteOffset(), - element.getMsb(), element.getLsb()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingFixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, boolean signed, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, resolution, signed, byteOffset, msb, lsb); - } - - public NonMappingFixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, double minVal, boolean signed, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, resolution, minVal, signed, byteOffset, msb, lsb); - } - - public NonMappingFixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, boolean signed, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, resolution, signed, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public NonMappingFixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, double minVal, boolean signed, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, resolution, minVal, signed, byteOffset, msb, lsb, originalLsb, - originalMsb); - } - - public NonMappingFixedPointElement(Message<?, ?, ?> message, String elementName, MessageData messageData, double resolution, double minVal, boolean signed, int bitOffset, int bitLength) { - super(message, elementName, messageData, resolution, minVal, signed, bitOffset, bitLength); - } - - @Override - public void checkForwarding(ITestAccessor accessor, FixedPointElement cause, double value) throws InterruptedException { - throwNoMappingElementException(); - } - - /** - * @return Returns the minVal. - */ - @Override - public double getMinVal() { - throwNoMappingElementException(); - return 0; - } - - /** - * @return Returns the resolution. - */ - @Override - public double getResolution() { - throwNoMappingElementException(); - return 0; - } - - /** - * @return Returns the signed. - */ - @Override - public boolean isSigned() { - throwNoMappingElementException(); - return false; - } - - @Override - public boolean isNonMappingElement() { - return true; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingFloat32Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingFloat32Element.java deleted file mode 100644 index 1fa7d4d5407..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingFloat32Element.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.Float32Element; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andy Jury - */ -public class NonMappingFloat32Element extends Float32Element { - - /** - * Copy constructor. - */ - public NonMappingFloat32Element(Float32Element element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), element.getByteOffset(), - element.getMsb(), element.getLsb()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingFloat32Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, byteOffset, msb, lsb); - } - - public NonMappingFloat32Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public NonMappingFloat32Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - @Override - public void checkForwarding(ITestAccessor accessor, Float32Element cause, double value) throws InterruptedException { - throwNoMappingElementException(); - } - - @Override - public boolean isNonMappingElement() { - return true; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingFloat64Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingFloat64Element.java deleted file mode 100644 index 932b975c1c1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingFloat64Element.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.Float64Element; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andy Jury - */ -public class NonMappingFloat64Element extends Float64Element { - - /** - * Copy constructor. - */ - public NonMappingFloat64Element(Float64Element element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), element.getByteOffset(), - element.getMsb(), element.getLsb()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingFloat64Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, byteOffset, msb, lsb); - } - - public NonMappingFloat64Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - public NonMappingFloat64Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - @Override - public void checkForwarding(ITestAccessor accessor, Float64Element cause, double value) throws InterruptedException { - throwNoMappingElementException(); - - } - - @Override - public boolean isNonMappingElement() { - return true; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingIntegerElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingIntegerElement.java deleted file mode 100644 index ac02cdbe6e5..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingIntegerElement.java +++ /dev/null @@ -1,841 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.IntegerElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andy Jury - */ -public class NonMappingIntegerElement extends IntegerElement { - - /** - * Copy constructor. - */ - public NonMappingIntegerElement(IntegerElement element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), element.getByteOffset(), - element.getMsb(), element.getLsb()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingIntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, byteOffset, msb, lsb); - } - - public NonMappingIntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - public NonMappingIntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - @Override - public String toString(Integer obj) { - throwNoMappingElementException(); - return null; - } - - @Override - public void setValue(Integer value) { - throwNoMappingElementException(); - } - - @Override - public Integer getValue() { - throwNoMappingElementException(); - return 0; - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - @Override - public void checkForwarding(ITestAccessor accessor, IntegerElement cause, int value) throws InterruptedException { - - throwNoMappingElementException(); - } - - /** - * Verifies that the element is set to "value". - * - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param value value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * This function will verify that this signal is pulsed for 2 cycles. - * - * @param value The value to be checked - */ - public void checkPulse(ITestAccessor accessor, int value) throws InterruptedException { - - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, int pulsedValue, int nonPulsedValue) throws InterruptedException { - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, CheckGroup checkGroup, int pulsedValue, int nonPulsedValue) throws InterruptedException { - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, int pulsedValue, int nonPulsedValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, CheckGroup checkGroup, int pulsedValue, int nonPulsedValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @return last value observed. Either value expected or value found at timeout. - */ - public int checkMaintain(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed. Either value expected or value found at timeout. - */ - public int checkMaintain(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @return last value observed - */ - public int checkMaintainNot(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed - */ - public int checkMaintainNot(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - // /** - // * Verifies that the element is set to a value within the range specified for the entire time - // specified. Assumes range is inclusive. - // * - // // * @param minValue The minimum value of the range. - // * @param maxValue The maximum value of the range. - // * @param milliseconds Number of milliseconds to wait before failing. - // * @return last value observed - // // */ - // public int checkMaintainRange(ITestAccessor accessor, int minValue, int maxValue, int - // milliseconds) throws InterruptedException { - // return checkMaintainRange(accessor, (CheckGroup)null, minValue, true, maxValue, true, - // milliseconds);} - // - // /** - // * Verifies that the element is set to a value within the range specified for the entire time - // specified. - // * - // // * @param minValue The minimum value of the range. - // * @param minInclusive If the minumum value of the range is inclusive. - // * @param maxValue The maximum value of the range. - // * @param maxInclusive If the maximum value of the range is inclusive. - // * @param milliseconds Number of milliseconds to wait before failing. - // * @return last value observed - // // */ - // public int checkMaintainRange(ITestAccessor accessor, int minValue, boolean minInclusive, int - // maxValue, boolean maxInclusive, - // int milliseconds) throws InterruptedException { - // return checkMaintainRangeBase(accessor, (CheckGroup)null, minValue, minInclusive, maxValue, - // maxInclusive, milliseconds); - // } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Returns the current value of the element. - * - * @return The current value of the element. - */ - @Override - public Integer get(ITestEnvironmentAccessor accessor) { - throwNoMappingElementException(); - return 0; - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - public void set(ITestEnvironmentAccessor accessor, int value) { - throwNoMappingElementException(); - } - - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, int value) { - throwNoMappingElementException(); - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - public void setNoLog(ITestEnvironmentAccessor accessor, int value) { - throwNoMappingElementException(); - } - - /** - * Waits until the element equals the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value found. Either value expected or value found at timeout. - */ - public int waitForValue(ITestEnvironmentAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value other than the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForNotValue(ITestEnvironmentAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Assumes the range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public int waitForRange(ITestEnvironmentAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public int waitForRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Range is assumes to be inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - throwNoMappingElementException(); - } - - @Override - public boolean isNonMappingElement() { - return true; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingLongIntegerElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingLongIntegerElement.java deleted file mode 100644 index bcb4d31b225..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingLongIntegerElement.java +++ /dev/null @@ -1,831 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.IntegerElement; -import org.eclipse.osee.ote.message.elements.LongIntegerElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andy Jury - */ -public class NonMappingLongIntegerElement extends LongIntegerElement { - - /** - * Copy constructor. - */ - public NonMappingLongIntegerElement(LongIntegerElement element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), element.getByteOffset(), - element.getMsb(), element.getLsb()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingLongIntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, byteOffset, msb, lsb); - } - - public NonMappingLongIntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - public NonMappingLongIntegerElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - @Override - public void setValue(Long value) { - throwNoMappingElementException(); - } - - @Override - public Long getValue() { - throwNoMappingElementException(); - return 0L; - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - public void checkForwarding(ITestAccessor accessor, IntegerElement cause, int value) throws InterruptedException { - - throwNoMappingElementException(); - } - - /** - * Verifies that the element is set to "value". - * - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param value value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * This function will verify that this signal is pulsed for 2 cycles. - * - * @param value The value to be checked - */ - public void checkPulse(ITestAccessor accessor, int value) throws InterruptedException { - - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, int pulsedValue, int nonPulsedValue) throws InterruptedException { - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, CheckGroup checkGroup, int pulsedValue, int nonPulsedValue) throws InterruptedException { - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, int pulsedValue, int nonPulsedValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, CheckGroup checkGroup, int pulsedValue, int nonPulsedValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @return last value observed. Either value expected or value found at timeout. - */ - public int checkMaintain(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed. Either value expected or value found at timeout. - */ - public int checkMaintain(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @return last value observed - */ - public int checkMaintainNot(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed - */ - public int checkMaintainNot(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - // /** - // * Verifies that the element is set to a value within the range specified for the entire time - // specified. Assumes range is inclusive. - // * - // // * @param minValue The minimum value of the range. - // * @param maxValue The maximum value of the range. - // * @param milliseconds Number of milliseconds to wait before failing. - // * @return last value observed - // // */ - // public int checkMaintainRange(ITestAccessor accessor, int minValue, int maxValue, int - // milliseconds) throws InterruptedException { - // return checkMaintainRange(accessor, (CheckGroup)null, minValue, true, maxValue, true, - // milliseconds);} - // - // /** - // * Verifies that the element is set to a value within the range specified for the entire time - // specified. - // * - // // * @param minValue The minimum value of the range. - // * @param minInclusive If the minumum value of the range is inclusive. - // * @param maxValue The maximum value of the range. - // * @param maxInclusive If the maximum value of the range is inclusive. - // * @param milliseconds Number of milliseconds to wait before failing. - // * @return last value observed - // // */ - // public int checkMaintainRange(ITestAccessor accessor, int minValue, boolean minInclusive, int - // maxValue, boolean maxInclusive, - // int milliseconds) throws InterruptedException { - // return checkMaintainRangeBase(accessor, (CheckGroup)null, minValue, minInclusive, maxValue, - // maxInclusive, milliseconds); - // } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Returns the current value of the element. - * - * @return The current value of the element. - */ - @Override - public Long get(ITestEnvironmentAccessor accessor) { - throwNoMappingElementException(); - return 0L; - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - public void set(ITestEnvironmentAccessor accessor, int value) { - throwNoMappingElementException(); - } - - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, long value) { - throwNoMappingElementException(); - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - public void setNoLog(ITestEnvironmentAccessor accessor, int value) { - throwNoMappingElementException(); - } - - /** - * Waits until the element equals the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value found. Either value expected or value found at timeout. - */ - public int waitForValue(ITestEnvironmentAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value other than the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForNotValue(ITestEnvironmentAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Assumes the range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForRange(ITestEnvironmentAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Range is assumes to be inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - throwNoMappingElementException(); - } - - @Override - public boolean isNonMappingElement() { - return true; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingRecordElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingRecordElement.java deleted file mode 100644 index 968bc0306c0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingRecordElement.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.RecordElement; - -/** - * @author Andy Jury - */ -public class NonMappingRecordElement extends RecordElement { - - public NonMappingRecordElement(RecordElement element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), element.getByteOffset(), - element.getBitLength()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingRecordElement(Message<?, ?, ?> message, String elementName, int index, MessageData messageData, int firstRecordBitOffset, int recordBitSize) { - super(message, elementName, index, messageData, firstRecordBitOffset, recordBitSize); - } - - public NonMappingRecordElement(RecordElement message, String elementName, int offset, MessageData messageData, int firstRecordByteOffset, int recordByteSize) { - super(message, elementName, offset, messageData, firstRecordByteOffset, recordByteSize); - } - - public NonMappingRecordElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int firstRecordByteOffset, int recordByteSize) { - super(message, elementName, messageData, firstRecordByteOffset, recordByteSize); - } - - @Override - public boolean isNonMappingElement() { - return true; - } - - public int compareTo(RecordElement o) { - throwNoMappingElementException(); - return 0; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingSignedInteger16Element.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingSignedInteger16Element.java deleted file mode 100644 index 9ec35091990..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingSignedInteger16Element.java +++ /dev/null @@ -1,844 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.IntegerElement; -import org.eclipse.osee.ote.message.elements.SignedInteger16Element; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andy Jury - */ -public class NonMappingSignedInteger16Element extends IntegerElement { - - /** - * Copy constructor. - */ - public NonMappingSignedInteger16Element(SignedInteger16Element element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), element.getByteOffset(), - element.getMsb(), element.getLsb()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingSignedInteger16Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, byteOffset, msb, lsb); - } - - public NonMappingSignedInteger16Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - public NonMappingSignedInteger16Element(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - /** - * Checks that this element correctly forwards a message sent from cause with the value passed. - * - * @param cause The originator of the signal - * @param value The value sent by cause and being forwarded by this element - */ - @Override - public void checkForwarding(ITestAccessor accessor, IntegerElement cause, int value) throws InterruptedException { - - throwNoMappingElementException(); - } - - /** - * Verifies that the element is set to "value". - * - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value - * @return if the check passed - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param value value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is NOT set to "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against - * @return if the check passed - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, int value) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. Therefore observed value may not equal either of the range values. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive) { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * This function will verify that this signal is pulsed for 2 cycles. - * - * @param value The value to be checked - */ - public void checkPulse(ITestAccessor accessor, int value) throws InterruptedException { - - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, int pulsedValue, int nonPulsedValue) throws InterruptedException { - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, CheckGroup checkGroup, int pulsedValue, int nonPulsedValue) throws InterruptedException { - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, int pulsedValue, int nonPulsedValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - } - - public void checkPulse(ITestAccessor accessor, CheckGroup checkGroup, int pulsedValue, int nonPulsedValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value within the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait for the element to be within the range. - * @return if the check passed - */ - public boolean checkRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Assumes that both ends of the range are - * inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to a value outside the range specified. Either end of the range can be set to be - * inclusive or not. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait for the element to be outside the range. - * @return if the check passed - */ - public boolean checkNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @return last value observed. Either value expected or value found at timeout. - */ - public int checkMaintain(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed. Either value expected or value found at timeout. - */ - public int checkMaintain(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @return last value observed - */ - public int checkMaintainNot(ITestAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed - */ - public int checkMaintainNot(ITestAccessor accessor, CheckGroup checkGroup, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainRange(ITestAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - // /** - // * Verifies that the element is set to a value within the range specified for the entire time - // specified. Assumes range is inclusive. - // * - // // * @param minValue The minimum value of the range. - // * @param maxValue The maximum value of the range. - // * @param milliseconds Number of milliseconds to wait before failing. - // * @return last value observed - // // */ - // public int checkMaintainRange(ITestAccessor accessor, int minValue, int maxValue, int - // milliseconds) throws InterruptedException { - // return checkMaintainRange(accessor, (CheckGroup)null, minValue, true, maxValue, true, - // milliseconds);} - // - // /** - // * Verifies that the element is set to a value within the range specified for the entire time - // specified. - // * - // // * @param minValue The minimum value of the range. - // * @param minInclusive If the minumum value of the range is inclusive. - // * @param maxValue The maximum value of the range. - // * @param maxInclusive If the maximum value of the range is inclusive. - // * @param milliseconds Number of milliseconds to wait before failing. - // * @return last value observed - // // */ - // public int checkMaintainRange(ITestAccessor accessor, int minValue, boolean minInclusive, int - // maxValue, boolean maxInclusive, - // int milliseconds) throws InterruptedException { - // return checkMaintainRangeBase(accessor, (CheckGroup)null, minValue, minInclusive, maxValue, - // maxInclusive, milliseconds); - // } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. Assumes - * range is inclusive. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Verifies that the element is set to a value within the range specified for the entire time specified. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int checkMaintainNotRange(ITestAccessor accessor, CheckGroup checkGroup, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Returns the current value of the element. - * - * @return The current value of the element. - */ - @Override - public Integer get(ITestEnvironmentAccessor accessor) { - throwNoMappingElementException(); - return 0; - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - public void set(ITestEnvironmentAccessor accessor, int value) { - throwNoMappingElementException(); - } - - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, int value) { - throwNoMappingElementException(); - } - - /** - * Sets the element to the "value" passed. - * - * @param value The value to set. - */ - public void setNoLog(ITestEnvironmentAccessor accessor, int value) { - throwNoMappingElementException(); - } - - /** - * Waits until the element equals the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value found. Either value expected or value found at timeout. - */ - public int waitForValue(ITestEnvironmentAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value other than the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - public int waitForNotValue(ITestEnvironmentAccessor accessor, int value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Assumes the range is inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public int waitForRange(ITestEnvironmentAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public int waitForRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Range is assumes to be inclusive. - * - * @param minValue The minimum value of the range. - * @param maxValue The maximum value of the range. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, int maxValue, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - /** - * Waits until the element has a value within the range specified. Either end of the range can be inclusive or not. - * - * @param minValue The minimum value of the range. - * @param minInclusive If the minumum value of the range is inclusive. If true the actual value must not < and not = - * to the range value. - * @param maxValue The maximum value of the range. - * @param maxInclusive If the maximum value of the range is inclusive. If true the actual value must not > and not = - * to the range value. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public int waitForNotRange(ITestEnvironmentAccessor accessor, int minValue, boolean minInclusive, int maxValue, boolean maxInclusive, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return 0; - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - throwNoMappingElementException(); - } - - @Override - public boolean isNonMappingElement() { - return true; - } - - @Override - public Integer getValue() { - throwNoMappingElementException(); - return 0; - } - - @Override - public void setValue(Integer value) { - throwNoMappingElementException(); - } - - @Override - public Integer valueOf(MemoryResource mem) { - throwNoMappingElementException(); - return 0; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingStringElement.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingStringElement.java deleted file mode 100644 index 16b65666130..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/elements/nonmapping/NonMappingStringElement.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.elements.nonmapping; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.testPoint.CheckGroup; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.StringElement; -import org.eclipse.osee.ote.message.interfaces.ITestAccessor; - -/** - * @author Andy Jury - */ -public class NonMappingStringElement extends StringElement { - - /** - * Copy constructor. - */ - public NonMappingStringElement(StringElement element) { - super(element.getMessage(), element.getElementName(), element.getMsgData(), element.getByteOffset(), - element.getMsb(), element.getLsb()); - for (Object obj : element.getElementPath()) { - this.getElementPath().add(obj); - } - } - - public NonMappingStringElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(message, elementName, messageData, byteOffset, msb, lsb); - } - - public NonMappingStringElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int bitOffset, int bitLength) { - super(message, elementName, messageData, bitOffset, bitLength); - } - - public NonMappingStringElement(Message<?, ?, ?> message, String elementName, MessageData messageData, int byteOffset, int msb, int lsb, int originalLsb, int originalMsb) { - super(message, elementName, messageData, byteOffset, msb, lsb, originalLsb, originalMsb); - } - - @Override - public String get(ITestEnvironmentAccessor accessor) { - throwNoMappingElementException(); - return null; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - @Override - public boolean checkTrimWhiteSpace(ITestAccessor accessor, String value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to "value" within the number of "milliseconds" passed. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value Expected value. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - @Override - public boolean check(ITestAccessor accessor, CheckGroup checkGroup, String value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to some value other than "value" within the number of "milliseconds" passed. - * Passes if at any point with in the time allowed, the elment is set to a value other than "value". - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @param value value to test against. - * @param milliseconds Number of milliseconds to wait for the element to equal the "value". - * @return If the check passed. - */ - @Override - public boolean checkNot(ITestAccessor accessor, CheckGroup checkGroup, String value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return false; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed. Either value expected or value found at timeout. - */ - @Override - public String checkMaintain(ITestAccessor accessor, CheckGroup checkGroup, String value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ""; - } - - /** - * Verifies that the element is set to the "value" passed for the entire time passed into "milliseconds". Returns - * value found that caused failure or last value observed if time expires. - * - * @param checkGroup If this check is part of a larger set of checks which another method is going to log then the - * reference to the CheckGroup must be passed and this method will add the result of the check to the group with out - * logging a point. - * <p> - * If an outside method is not going to log the check then a <b>null </b> reference should be passed and this method - * will log the test point. - * @return last value observed - */ - @Override - public String checkMaintainNot(ITestAccessor accessor, CheckGroup checkGroup, String value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ""; - } - - /** - * Waits until the element has a value other than the "value" passed. Returns last value observed upon a timout. - * - * @param value The expected value to wait for. - * @param milliseconds Number of milliseconds to wait before failing. - * @return last value observed - */ - @Override - public String waitForNotValue(ITestEnvironmentAccessor accessor, String value, int milliseconds) throws InterruptedException { - throwNoMappingElementException(); - return ""; - } - - @Override - public void parseAndSet(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - throwNoMappingElementException(); - } - - @Override - public void setAndSend(ITestEnvironmentAccessor accessor, String value) throws IllegalArgumentException { - throwNoMappingElementException(); - } - - @Override - public boolean isNonMappingElement() { - return true; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/enums/DataType.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/enums/DataType.java deleted file mode 100644 index 5f9bdbbe49c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/enums/DataType.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.enums; - -import java.io.Serializable; -import org.eclipse.osee.ote.message.interfaces.INamespace; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public interface DataType extends Serializable, INamespace { - - String name(); - - int getToolingDepth(); - - int getToolingBufferSize(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/enums/EmptyEnum.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/enums/EmptyEnum.java deleted file mode 100644 index ae5c1821c4b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/enums/EmptyEnum.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.enums; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import javax.print.attribute.EnumSyntax; -import org.eclipse.osee.framework.jdk.core.util.EnumBase; - -/** - * @author Michael P. Masterson - */ -public class EmptyEnum extends EnumBase implements Comparable<EmptyEnum> { - - private static final long serialVersionUID = 1305742348409814145L; - private static final HashMap<Integer, EmptyEnum> valuesMap = new HashMap<>(16); - - private final int value; - - private EmptyEnum(int value) { - super(value); - this.value = value; - } - - // public static EmptyEnum getEnum(String str) { - // return (EmptyEnum) getEnum(str, stringTable, enumValueTable); - // } - - public static EmptyEnum toEnum(int value) { - EmptyEnum newValue = valuesMap.get(value); - if (newValue == null) { - newValue = new EmptyEnum(value); - valuesMap.put(value, newValue); - } - return newValue; - } - - // private static void printTable() - // { - // for( int value : valuesMap.keySet()) - // { - // System.out.println(value + " -> " + valuesMap.get(value)); - // } - // } - public static EmptyEnum toEnum(EnumBase otherEnum) { - return toEnum(otherEnum.getValue()); - } - - @Override - protected String[] getStringTable() { - List<String> retVal = new LinkedList<>(); - for (EmptyEnum current : valuesMap.values()) { - retVal.add("EMPTY_ENUM_" + current.getValue()); - } - return retVal.toArray(new String[16]); - } - - @Override - protected EnumSyntax[] getEnumValueTable() { - EnumSyntax[] retVal = new EnumSyntax[0]; - return valuesMap.values().toArray(retVal); - } - - @Override - public String getName() { - return "EMPTY_ENUM_" + getValue(); - } - - @Override - public String toString() { - return getName(); - } - - @Override - public int getValue() { - return value; - } - - @Override - public int compareTo(EmptyEnum o) { - return value - o.value; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/ADDRESS_TYPE.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/ADDRESS_TYPE.java deleted file mode 100644 index 5f0a443f416..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/ADDRESS_TYPE.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE - */ -package org.eclipse.osee.ote.message.event; - -import org.eclipse.osee.ote.message.elements.IEnumValue; - -public enum ADDRESS_TYPE implements IEnumValue<ADDRESS_TYPE> { - - IPV4(0), - IPV6(1), - - __UNDEFINED(-99999); - - private int value; - private static int maxValue = 0; - - private static ADDRESS_TYPE[] lbaValues; - private static ADDRESS_TYPE[] lookup = null; - - static { - lbaValues(); - if(maxValue < 32000){ - lookup = new ADDRESS_TYPE[maxValue + 1]; - for(int i = 0; i < lbaValues.length; i++){ - lookup[lbaValues[i].value] = lbaValues[i]; - } - } - } - - private ADDRESS_TYPE(int value) { - this.value = value; - } - - @Override - public int getIntValue(){ - return value; - } - - public static ADDRESS_TYPE toEnum(int value){ - if(lookup == null){ - for(ADDRESS_TYPE myEnum: values()){ - if(myEnum.getIntValue() == value){ - return myEnum; - } - } - __UNDEFINED.value = value; - return __UNDEFINED; - } else if(value < 0 || value >= lookup.length ){ - __UNDEFINED.value = value; - return __UNDEFINED; - } else { - ADDRESS_TYPE enumeration = lookup[value]; - if(enumeration == null){ - __UNDEFINED.value = value; - return __UNDEFINED; - } else { - return enumeration; - } - } - } - - @Override - public ADDRESS_TYPE getEnum(int value){ - return toEnum(value); - } - - public static ADDRESS_TYPE[] lbaValues(){ - if(lbaValues == null){ - int count = 0; - lbaValues = new ADDRESS_TYPE[values().length-1]; - for(ADDRESS_TYPE myEnum: values()){ - if(!"__UNDEFINED".equals(myEnum.name())){ - lbaValues[count++] = myEnum; - if(myEnum.value > maxValue){ - maxValue = myEnum.value; - } - } - } - } - return lbaValues; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/FileAvailableRequest.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/FileAvailableRequest.java deleted file mode 100644 index 194e7963e0a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/FileAvailableRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.osee.ote.message.event; - -import org.eclipse.osee.ote.message.elements.StringElement; - -public class FileAvailableRequest extends OteEventMessage { - public static final int _BYTE_SIZE = 250; - public static final String _TOPIC = "ote/server/FileAvailableRequest"; - public static final int _MESSAGE_ID = -1; - - public final StringElement FILE; - - public FileAvailableRequest() { - super(FileAvailableRequest.class.getSimpleName(), _TOPIC, _BYTE_SIZE); - - int currentOffset = 0; - int bitLength; - FILE = new StringElement(this, "FILE", getDefaultMessageData(), currentOffset, bitLength=(8*250)); currentOffset+=bitLength; - - if (currentOffset > _BYTE_SIZE*8) { - throw new IllegalStateException("Total size of elements exceeds defined message size"); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/FileAvailableStatus.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/FileAvailableStatus.java deleted file mode 100644 index 7027b471926..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/FileAvailableStatus.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.eclipse.osee.ote.message.event; - -import org.eclipse.osee.ote.message.elements.BooleanElement; -import org.eclipse.osee.ote.message.elements.StringElement; - -public class FileAvailableStatus extends OteEventMessage{ - public static final int _BYTE_SIZE = 251; - public static final String _TOPIC = "ote/server/FileAvailableStatus"; - public static final int _MESSAGE_ID = -1; - - public final StringElement FILE; - public final BooleanElement EXISTS; - - public FileAvailableStatus() { - super(FileAvailableRequest.class.getSimpleName(), _TOPIC, _BYTE_SIZE); - - int currentOffset = 0; - int bitLength; - FILE = new StringElement(this, "FILE", getDefaultMessageData(), currentOffset, bitLength=(8*250)); currentOffset+=bitLength; - EXISTS = new BooleanElement(this, "EXISTS", getDefaultMessageData(), currentOffset, bitLength=1); currentOffset+=bitLength; - - if (currentOffset > _BYTE_SIZE*8) { - throw new IllegalStateException("Total size of elements exceeds defined message size"); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/MyObjectInputStream.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/MyObjectInputStream.java deleted file mode 100644 index caf4936e35f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/MyObjectInputStream.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.osee.ote.message.event; - -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectStreamClass; - -import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader; - -public class MyObjectInputStream extends ObjectInputStream { - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { - try { - return ExportClassLoader.getInstance().loadClass(desc.getName()); - } catch (Exception e) { - } - return super.resolveClass(desc); - } - - public MyObjectInputStream(InputStream in) throws IOException { - super(in); - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessage.java deleted file mode 100644 index ede78c1da64..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessage.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event; - -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.MessageSystemTestEnvironment; -import org.eclipse.osee.ote.message.elements.ArrayElement; -import org.eclipse.osee.ote.message.elements.EnumeratedElement; -import org.eclipse.osee.ote.message.elements.IEnumValue; -import org.eclipse.osee.ote.message.elements.IntegerElement; - -/** - * This class is a version of OTEByteMessage used for code that is part of the release. - * - * - */ -public class OteEventMessage extends Message<MessageSystemTestEnvironment, OteEventMessageData, OteEventMessage>{ - - private int currentOffset = 0; - - private final OteEventMessageData data; - - public OteEventMessage(String name, String topic, int defaultByteSize) { - super(name, defaultByteSize, 0, false, 0, 0); - data = new OteEventMessageData(this, topic, defaultByteSize); - setDefaultMessageData(data); - setMemSource(OteEventMessageType.OTE_EVENT_MESSAGE); - } - - public OteEventMessage(byte[] bytedata) { - super("holder", 0, 0, false, 0, 0); - data = new OteEventMessageData(this, bytedata.length); - data.getMem().setData(bytedata); - setDefaultMessageData(data); - setMemSource(OteEventMessageType.OTE_EVENT_MESSAGE); - } - - public OteEventMessageHeader getHeader(){ - return getDefaultMessageData().getMsgHeader(); - } - - protected <T extends Enum<T> & IEnumValue<T>> EnumeratedElement<T> createEnumeratedElement(String name, int size, Class<T> clazz) { - EnumeratedElement<T> el = new EnumeratedElement<>(this, name, clazz, getDefaultMessageData(), currentOffset, 0, size*8-1); - currentOffset+=size; - return el; - } - - protected IntegerElement createIntegerElement(String string, int size) { - IntegerElement el = new IntegerElement(this, string, getDefaultMessageData(), currentOffset, 0, size*8-1); - currentOffset+=size; - return el; - } - - protected ArrayElement createArrayElement(String string, int size) { - ArrayElement el = new ArrayElement(this, string, getDefaultMessageData(), currentOffset, 0, size*8-1); - currentOffset+=size; - return el; - } - - public static int sizeBytesBits(int size){ - return 8*size-1; - } - - public void setResponse(OteEventMessage msg){ - getHeader().RESPONSE_ID.setValue(msg.getHeader().MESSAGE_SEQUENCE_NUMBER.getValue()); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageData.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageData.java deleted file mode 100644 index 3f4497514fe..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageData.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event; - -import org.eclipse.osee.ote.message.data.IMessageDataVisitor; -import org.eclipse.osee.ote.message.data.MessageData; - - -public class OteEventMessageData extends MessageData{ - - private final OteEventMessageHeader header; - - public OteEventMessageData(OteEventMessage msg, String topic, int dataByteSize) { - super(msg.getName(), OteEventMessageHeader.HEADER_SIZE + dataByteSize, OteEventMessageHeader.HEADER_SIZE, OteEventMessageType.OTE_EVENT_MESSAGE); - this.header = new OteEventMessageHeader(msg, topic, 0, getMem().slice(0, OteEventMessageHeader.HEADER_SIZE)); - } - - public OteEventMessageData(OteEventMessage msg, int dataByteSize) { - super("default", OteEventMessageHeader.HEADER_SIZE + dataByteSize, OteEventMessageHeader.HEADER_SIZE, OteEventMessageType.OTE_EVENT_MESSAGE); - this.header = new OteEventMessageHeader(msg, "", 0, getMem().slice(0, OteEventMessageHeader.HEADER_SIZE)); - } - -@Override - public OteEventMessageHeader getMsgHeader() { - return header; - } - - @Override - public void initializeDefaultHeaderValues() { - } - - @Override - public int getPayloadSize() { - return super.getDefaultDataByteSize() - OteEventMessageHeader.HEADER_SIZE; - } - - @Override - public void visit(IMessageDataVisitor visitor) { - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageHeader.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageHeader.java deleted file mode 100644 index c0b16de506c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageHeader.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event; - -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import org.eclipse.osee.ote.message.IMessageHeader; -import org.eclipse.osee.ote.message.data.HeaderData; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.Element; -import org.eclipse.osee.ote.message.elements.IntegerElement; -import org.eclipse.osee.ote.message.elements.LongIntegerElement; -import org.eclipse.osee.ote.message.elements.StringElement; - -public class OteEventMessageHeader implements IMessageHeader { - - public static final int HEADER_SIZE = 164 + 53; - public static final int MARKER_VALUE = 0xFADE; - private final HeaderData headerData; - private final Object[] paths; - - public final IntegerElement MARKER; - public final StringElement TOPIC; - public final IntegerElement MESSAGE_ID; - public final IntegerElement MESSAGE_SEQUENCE_NUMBER; - public final LongIntegerElement UUID_LOW; - public final LongIntegerElement UUID_HIGH; - public final IntegerElement TTL; - public final StringElement RESPONSE_TOPIC; - public final IntegerElement RESPONSE_ID; - public final SOCKET_ADDRESS_RECORD ADDRESS; - - private final String name; - - public OteEventMessageHeader(OteEventMessage msg, String topic, int messageId, MemoryResource data) { - this.name = msg.getName(); - headerData = new HeaderData("OteEventMessageHeader", data); - paths = new Object[] {(msg.getClass().getName()), "HEADER(OteEventMessageHeader)"}; - MARKER = new IntegerElement(msg, "MARKER", headerData, 0, 0, 15); - TOPIC = new StringElement(msg, "TOPIC", headerData, 2, 0, 8 * 96); - MESSAGE_ID = new IntegerElement(msg, "MESSAGE_ID", headerData, 66 + 32, 0, 31); - MESSAGE_SEQUENCE_NUMBER = new IntegerElement(msg, "MESSAGE_ID", headerData, 66 + 32, 0, 31); - UUID_LOW = new LongIntegerElement(msg, "UUID_LOW", headerData, 74 + 32, 0, 63); - UUID_HIGH = new LongIntegerElement(msg, "UUID_HIGH", headerData, 82 + 32, 0, 63); - TTL = new IntegerElement(msg, "TTL", headerData, 90 + 32, 0, 31); - RESPONSE_TOPIC = new StringElement(msg, "TOPIC", headerData, 94 + 32, 0, 8 * 64); - RESPONSE_ID = new IntegerElement(msg, "RESPONSE_ID", headerData, 158 + 32, 0, 31); - ADDRESS = new SOCKET_ADDRESS_RECORD(msg, "ADDRESS", headerData, 164 + 32, 0, SOCKET_ADDRESS_RECORD.SIZE * 8 - 1); - - TOPIC.setValue(topic); - MARKER.setValue(MARKER_VALUE); - MESSAGE_ID.setValue(messageId); - addElement(MARKER); - addElement(TOPIC); - addElement(MESSAGE_ID); - } - - private <T extends Element> T addElement(T instance) { - instance.addPath(paths); - return instance; - } - - @Override - public int getHeaderSize() { - return HEADER_SIZE; - } - - @Override - public byte[] getData() { - return headerData.toByteArray(); - } - - @Override - public Element[] getElements() { - return new Element[] {MARKER, TOPIC}; - } - - @Override - public void setNewBackingBuffer(byte[] data) { - headerData.setNewBackingBuffer(data); - } - - @Override - public String toXml() { - StringBuilder builder = new StringBuilder(256); - builder.append("<OteEventMessageHeader> ").append("MARKER=\"").append(MARKER.getValue()).append("\" ").append( - "TOPIC=\"").append(TOPIC.getValue()).append("\" ").append("MESSAGE_ID=\"").append( - MESSAGE_ID.getValue()).append("\" ").append("</OteEventMessageHeader>"); - return builder.toString(); - } - - @Override - public String getMessageName() { - return name; - } - - public InetSocketAddress getSourceInetSocketAddress() throws UnknownHostException { - return new InetSocketAddress(ADDRESS.getAddress(), ADDRESS.getPort()); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageType.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageType.java deleted file mode 100644 index 496a85a4f8b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageType.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event; - -import org.eclipse.osee.ote.message.enums.DataType; - -public enum OteEventMessageType implements DataType { - OTE_EVENT_MESSAGE(2, 2048); - - private final int depth; - private final int bufferSize; - - private OteEventMessageType(int depth, int bufferSize) { - this.depth = depth; - this.bufferSize = bufferSize; - } - - @Override - public int getToolingBufferSize() { - return bufferSize; - } - - @Override - public int getToolingDepth() { - return depth; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageUtil.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageUtil.java deleted file mode 100644 index f3e92137131..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/OteEventMessageUtil.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event; - -import java.util.Dictionary; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Map; -import java.util.UUID; - -import org.eclipse.osee.ote.core.ServiceUtility; -import org.eclipse.osee.ote.endpoint.OteUdpEndpointSender; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventHandler; - -public class OteEventMessageUtil { - - public final static String BYTE_KEY = "oteeventbytes"; - - public final static String BYTE_KEY_2 = "bytes"; - - private static EventAdmin eventAdmin; - - private static EventAdmin getEventAdmin(){ - if(eventAdmin == null){ - eventAdmin = ServiceUtility.getService(EventAdmin.class); - } - return eventAdmin; - } - - public static void sendEvent(OteEventMessage message) { - sendEvent(message, getEventAdmin()); - } - - public static void postEvent(OteEventMessage message) { - postEvent(message, getEventAdmin()); - } - - public static void sendEvent(OteEventMessage message, EventAdmin eventAdmin) { - message.getHeader().UUID_HIGH.setNoLog((long) 0x0); - message.getHeader().UUID_LOW.setNoLog((long) 0x0); - Map<String, Object> data = new HashMap<>(); - data.put(BYTE_KEY, message.getData()); - Event newevent = new Event(message.getHeader().TOPIC.getValue(), data); - eventAdmin.sendEvent(newevent); - } - - public static void postEvent(OteEventMessage message, EventAdmin eventAdmin) { - message.getHeader().UUID_HIGH.setNoLog((long) 0x0); - message.getHeader().UUID_LOW.setNoLog((long) 0x0); - Map<String, Object> data = new HashMap<>(); - data.put(BYTE_KEY, message.getData()); - Event newevent = new Event(message.getHeader().TOPIC.getValue(), data); - eventAdmin.postEvent(newevent); - } - - public static void sendEvent(OteEventMessage message, OteUdpEndpointSender sender) throws InterruptedException { - sender.send(message); - } - - public static void postEvent(OteEventMessage message, OteUdpEndpointSender sender) throws InterruptedException { - sender.send(message); - } - - public static UUID getUUID(OteEventMessage msg) { - return new UUID(msg.getHeader().UUID_HIGH.getValue(), msg.getHeader().UUID_LOW.getValue()); - } - - public static UUID getUUID(byte[] data) { - long low = getLong(data, 74); - long high = getLong(data, 82); - return new UUID(high, low); - } - - private static long getLong(byte[] data, int index){ - return - (long)(0xff & data[index]) << 56 | - (long)(0xff & data[index+1]) << 48 | - (long)(0xff & data[index+2]) << 40 | - (long)(0xff & data[index+3]) << 32 | - (long)(0xff & data[index+4]) << 24 | - (long)(0xff & data[index+5]) << 16 | - (long)(0xff & data[index+6]) << 8 | - (long)(0xff & data[index+7]) << 0; - } - - public static void setUUID(OteEventMessage msg, UUID id) { - msg.getHeader().UUID_HIGH.setValue(id.getMostSignificantBits()); - msg.getHeader().UUID_LOW.setValue(id.getLeastSignificantBits()); - } - - public static OteEventMessage getOteEventMessage(Event event) { - Object obj = event.getProperty(BYTE_KEY); - if (obj != null && obj instanceof byte[]) { - return new OteEventMessage((byte[]) obj); - } else { - obj = event.getProperty(BYTE_KEY_2); - if(obj != null && obj instanceof byte[]){ - return new OteEventMessage((byte[]) obj); - } - } - return null; - } - - public static byte[] getBytes(Event event) { - Object obj = event.getProperty(BYTE_KEY); - if (obj != null && obj instanceof byte[]) { - return (byte[]) obj; - } else { - obj = event.getProperty(BYTE_KEY_2); - if (obj != null && obj instanceof byte[]) { - return (byte[]) obj; - } - return null; - } - } - - public static void putBytes(Event event, OteEventMessage signal) { - signal.getDefaultMessageData().getMem().setData(getBytes(event)); - } - - public static ServiceRegistration<EventHandler> subscribe(String topic, EventHandler handler){ - Dictionary<String, String> props = new Hashtable<>(); - props.put("event.topics", topic); - return ServiceUtility.getContext().registerService(EventHandler.class, handler, props); - } - - public static ServiceRegistration<EventHandler> subscribe(OteEventMessage signal, EventHandler eventHandler) { - BundleContext context = ServiceUtility.getContext(); - if (context == null) { - return null; - } - Hashtable<String, Object> props = new Hashtable<>(); - props.put("event.topics", signal.getHeader().TOPIC.getValue()); - return context.registerService(EventHandler.class, eventHandler, props); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/SOCKET_ADDRESS_RECORD.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/SOCKET_ADDRESS_RECORD.java deleted file mode 100644 index 27a5ec759bb..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/SOCKET_ADDRESS_RECORD.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.eclipse.osee.ote.message.event; - -import java.net.InetAddress; -import java.net.UnknownHostException; - -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.ArrayElement; -import org.eclipse.osee.ote.message.elements.EnumeratedElement; -import org.eclipse.osee.ote.message.elements.IntegerElement; - -public class SOCKET_ADDRESS_RECORD extends ArrayElement{ - - public static final int SIZE = 21; - - private final EnumeratedElement<ADDRESS_TYPE> type; - private final ArrayElement ipaddress; - private final IntegerElement port; - - public SOCKET_ADDRESS_RECORD(Message<?, ?, ?> msg, String elementName, MessageData messageData, int byteOffset, int msb, int lsb) { - super(msg, elementName, messageData, byteOffset, msb, lsb); - - type = new EnumeratedElement<>(msg, "type", ADDRESS_TYPE.class, messageData, byteOffset, 0, 7); - ipaddress = new ArrayElement(msg, "ipaddress", messageData, byteOffset + 1, 0, 8*16-1); - port = new IntegerElement(msg, "port", messageData, ipaddress.getByteOffset() + 16, 0, 31); - } - - public void setAddress(InetAddress address){ - byte[] bytes = address.getAddress(); - - if(bytes.length == 4){ - type.setValue(ADDRESS_TYPE.IPV4); - } else { - type.setValue(ADDRESS_TYPE.IPV6); - } - - ipaddress.zeroize(); - for(int i = 0; i < bytes.length; i++){ - ipaddress.setValue(i, bytes[i]); - } - } - - public InetAddress getAddress() throws UnknownHostException{ - byte[] bytes = null; - if(type.getValue() == ADDRESS_TYPE.IPV4){ - bytes = new byte[4]; - for(int i = 0; i < 4; i++){ - bytes[i] = ipaddress.getValue(i); - } - } else { - bytes = new byte[16]; - for(int i = 0; i < 6; i++){ - bytes[i] = ipaddress.getValue(i); - } - } - return InetAddress.getByAddress(bytes); - } - - public int getPort(){ - return port.getValue(); - } - - public void setPort(int port){ - this.port.setValue(port); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/SerializedClassMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/SerializedClassMessage.java deleted file mode 100644 index eda4166610e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/SerializedClassMessage.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -import org.eclipse.osee.ote.message.elements.ArrayElement; - -public class SerializedClassMessage<T> extends OteEventMessage { - - public static final int _BYTE_SIZE = 0; - - public ArrayElement OBJECT; - - public SerializedClassMessage(String topic) { - super(SerializedClassMessage.class.getSimpleName(), topic, _BYTE_SIZE); - OBJECT = new ArrayElement(this, "CLAZZ", getDefaultMessageData(), 0, 0, 0); - addElements(OBJECT); - } - - - public SerializedClassMessage(String topic, Serializable object) throws IOException { - this(topic); - setObject(object); - } - - public SerializedClassMessage(byte[] bytes) { - super(bytes); - OBJECT = new ArrayElement(this, "CLAZZ", getDefaultMessageData(), 0, 0, 0); - addElements(OBJECT); - } - - public void setObject(Serializable obj) throws IOException{ - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - GZIPOutputStream gos = new GZIPOutputStream(bos); - ObjectOutputStream oos = new ObjectOutputStream(gos); - oos.writeObject(obj); - oos.close(); - byte[] data = bos.toByteArray(); - int offset = OBJECT.getByteOffset() + getHeaderSize(); - byte[] newData = new byte[data.length + offset]; - System.arraycopy(getData(), 0, newData, 0, offset); - System.arraycopy(data, 0, newData, offset, data.length); - getDefaultMessageData().setNewBackingBuffer(newData); - } - - @SuppressWarnings("unchecked") - public T getObject() throws IOException, ClassNotFoundException{ - int offset = OBJECT.getByteOffset() + getHeaderSize(); - ByteArrayInputStream bis = new ByteArrayInputStream(getData(), offset, getData().length - offset); - GZIPInputStream gis = new GZIPInputStream(bis); - MyObjectInputStream ois = new MyObjectInputStream(gis); - try{ - Object obj = ois.readObject(); - return (T)obj; - } finally { - ois.close(); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEndpointSendEventMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEndpointSendEventMessage.java deleted file mode 100644 index cb12d805d2d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEndpointSendEventMessage.java +++ /dev/null @@ -1,228 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event.send; - -import java.net.InetSocketAddress; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.osee.ote.OTEException; -import org.eclipse.osee.ote.endpoint.OteUdpEndpoint; -import org.eclipse.osee.ote.internal.message.event.send.NotifyOnResponse; -import org.eclipse.osee.ote.internal.message.event.send.OteEventMessageFutureImpl; -import org.eclipse.osee.ote.internal.message.event.send.OteEventMessageFutureMultipleResponseImpl; -import org.eclipse.osee.ote.internal.message.event.send.OteEventMessageResponseFutureImpl; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class OteEndpointSendEventMessage { - - private final OteUdpEndpoint endpoint; - private final Lock lock; - private final Condition responseReceived; - private final InetSocketAddress destination; - - public OteEndpointSendEventMessage(OteUdpEndpoint eventAdmin, InetSocketAddress destination){ - this.endpoint = eventAdmin; - this.destination = destination; - lock = new ReentrantLock(); - responseReceived = lock.newCondition(); - } - - /** - * sends a message and returns immediately - */ - public void asynchSend(OteEventMessage message) { - updateHeaderInfo(message); - endpoint.getOteEndpointThreadedSender(destination).send(message); - } - - /** - * Registers for a callback of the given message type as specified by the RESPONSE_TOPIC element in the sent message - * and the class type passed in, then sends the given message and returns immediately. The returned value can be used to - * wait for the response using waitForCompletion(). The callback expects you to handle both the response and the timeout case. - * - * @param clazz - Type of OteEventMessage for the response - * @param message - message to send - * @param callable - callback executed when the response is recieved or if a timeout occurs or called immediately after the send if - * no response is expected - * @param timeout - amount of time in milliseconds to wait for response before calling timeout on the passed in OteEventMessageCallable - * @return <T extends OteEventMessage> Future<T> - a future that contains the response message - */ - public <T extends OteEventMessage, R extends OteEventMessage> OteEventMessageFuture<T, R> asynchSendAndResponse(Class<R> clazz, T message, OteEventMessageCallable<T, R> callable, long timeout){ - int responseId = updateHeaderInfo(message); - String responseTopic = message.getHeader().RESPONSE_TOPIC.getValue(); - OteEventMessageFutureImpl<T, R> response = new OteEventMessageFutureImpl<>(clazz, callable, message, responseTopic, responseId, timeout); - endpoint.getOteEndpointThreadedSender(destination).send(message); - return response; - } - - /** - * Registers for a callback of the given message type as specified by the RESPONSE_TOPIC element in the sent message - * and the class type passed in, then sends the given message and returns immediately. The returned value can be used to - * wait for the response using waitForCompletion(). The callback expects you to handle both the response and the timeout case and to determine - * when the appropriate number of responses has been received, by specifying it is complete. - * - * @param clazz - Type of OteEventMessage for the response - * @param message - message to send - * @param callable - callback executed when the response is recieved or if a timeout occurs or called immediately after the send if - * no response is expected - * @param timeout - amount of time in milliseconds to wait for response before calling timeout on the passed in OteEventMessageCallable - * @return <T extends OteEventMessage> Future<T> - a future that contains the response message - */ - public <T extends OteEventMessage, R extends OteEventMessage> OteEventMessageFuture<T, R> asynchSendAndMultipleResponse(Class<R> clazz, T message, OteEventMessageCallable<T, R> callable, long timeout){ - int responseId = updateHeaderInfo(message); - String responseTopic = message.getHeader().RESPONSE_TOPIC.getValue(); - OteEventMessageFutureImpl<T, R> response = new OteEventMessageFutureMultipleResponseImpl<>(clazz, callable, message, responseTopic, responseId, timeout); - endpoint.getOteEndpointThreadedSender(destination).send(message); - return response; - } - - /** - * Registers for a callback of the given message type and topic. - * - * @param clazz - Type of OteEventMessage for the response - * @param callable - callback executed when the response is recieved - * @return a future that you should cancel when done listening so resources can be cleaned up. - */ - public <R extends OteEventMessage> OteEventMessageResponseFuture<R> asynchResponse(Class<R> clazz, String topic, OteEventMessageResponseCallable<R> callable){ - OteEventMessageResponseFutureImpl<R> response = new OteEventMessageResponseFutureImpl<>(clazz, callable, topic); - return response; - } - - /** - * Sends a message and waits for a response. - * - * @param class - return type - * @param message - message to send - * @param timeout - timeout in milliseconds - * @return <T extends OteEventMessage> T - NULL if the timeout occurs before a response, otherwise returns the - * message specified by the RESPONSE_TOPIC field in the passed in message header. - * @throws Exception - */ - public <T extends OteEventMessage> T synchSendAndResponse(Class<T> clazz, String responseTopic, OteEventMessage message, long timeout) throws OTEException { - lock.lock(); - try{ - int responseId = updateHeaderInfo(message); - message.getHeader().RESPONSE_TOPIC.setValue(responseTopic); - NotifyOnResponse<T> response = new NotifyOnResponse<>(clazz, responseTopic, responseId, lock, responseReceived); - try{ - endpoint.getOteEndpointThreadedSender(destination).send(message); - long nanos = TimeUnit.MILLISECONDS.toNanos(timeout); - while(nanos > 0 && !response.hasResponse()) { - try { - nanos = responseReceived.awaitNanos(nanos); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } finally { - response.dispose(); - } - return response.getMessage(); - } finally { - lock.unlock(); - } - } - - /** - * Sends a message and waits for a response. - * - * @param T - response Message to populate type - * @param message - message to send - * @param timeout - timeout in milliseconds - * @return <T extends OteEventMessage> T - NULL if the timeout occurs before a response, otherwise returns the - * message specified by the RESPONSE_TOPIC field in the passed in message header. - * @throws Exception - */ - public <T extends OteEventMessage> T synchSendAndResponse(T responseMessage, OteEventMessage sendMessage, long timeout) throws OTEException { - lock.lock(); - try{ - int responseId = updateHeaderInfo(sendMessage); - sendMessage.getHeader().RESPONSE_TOPIC.setValue(responseMessage.getHeader().TOPIC.getValue()); - NotifyOnResponse<T> response = new NotifyOnResponse<>(responseMessage, responseId, lock, responseReceived); - try{ - endpoint.getOteEndpointThreadedSender(destination).send(sendMessage); - long nanos = TimeUnit.MILLISECONDS.toNanos(timeout); - while(nanos > 0 && !response.hasResponse()) { - try { - nanos = responseReceived.awaitNanos(nanos); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } finally { - response.dispose(); - } - return response.getMessage(); - } finally { - lock.unlock(); - } - } - - - /** - * Increment the sequence number and set the source InetSocketAddress - * - * @param message - * @return returns the sequence number that was set - */ - private int updateHeaderInfo(OteEventMessage message){ - int responseId = message.getHeader().MESSAGE_SEQUENCE_NUMBER.getValue(); - if(responseId >= Integer.MAX_VALUE){ - responseId = 1; - } else { - responseId++; - } - message.getHeader().MESSAGE_SEQUENCE_NUMBER.setValue(responseId); - - message.getHeader().ADDRESS.setAddress(endpoint.getLocalEndpoint().getAddress()); - message.getHeader().ADDRESS.setPort(endpoint.getLocalEndpoint().getPort()); - return responseId; - } - - /** - * Sends a message and waits for a response without creating a sender thread - * - * @param T - response Message to populate type - * @param message - message to send - * @param timeout - timeout in milliseconds - * @return <T extends OteEventMessage> T - NULL if the timeout occurs before a response, otherwise returns the - * message specified by the RESPONSE_TOPIC field in the passed in message header. - * @throws Exception - */ - public <T extends OteEventMessage> T synchSendAndResponseInline(T responseMessage, OteEventMessage sendMessage, long timeout) { - lock.lock(); - try{ - int responseId = updateHeaderInfo(sendMessage); - sendMessage.getHeader().RESPONSE_TOPIC.setValue(responseMessage.getHeader().TOPIC.getValue()); - NotifyOnResponse<T> response = new NotifyOnResponse<>(responseMessage, responseId, lock, responseReceived); - try{ - endpoint.getOteEndpointInlineSender(destination).send(sendMessage); - long nanos = TimeUnit.MILLISECONDS.toNanos(timeout); - while(nanos > 0 && !response.hasResponse()) { - try { - nanos = responseReceived.awaitNanos(nanos); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } finally { - response.dispose(); - } - return response.getMessage(); - } finally { - lock.unlock(); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageCallable.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageCallable.java deleted file mode 100644 index fc9a2b889b9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageCallable.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event.send; - -public interface OteEventMessageCallable<T,R> { - - void timeout(T transmitted); - - void call(T transmitted, R recieved, OteEventMessageFuture<?, ?> future); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageFuture.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageFuture.java deleted file mode 100644 index 6b7a461d223..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageFuture.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event.send; - -import org.eclipse.osee.ote.message.event.OteEventMessage; - - - -public interface OteEventMessageFuture<T extends OteEventMessage, R extends OteEventMessage> { - - void cancel(); - - void waitForCompletion(); - - public boolean isDone(); - - public boolean isTimedOut(); - - public boolean gotResponse(); - - void complete(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageResponseCallable.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageResponseCallable.java deleted file mode 100644 index 6c14cd0cf85..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageResponseCallable.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event.send; - -public interface OteEventMessageResponseCallable<R> { - - void call(R received); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageResponseFuture.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageResponseFuture.java deleted file mode 100644 index 5467847da4d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteEventMessageResponseFuture.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event.send; - -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public interface OteEventMessageResponseFuture<R extends OteEventMessage> { - - void cancel(); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteSendEventMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteSendEventMessage.java deleted file mode 100644 index 5a834ebb918..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/event/send/OteSendEventMessage.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.event.send; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import org.eclipse.osee.ote.OTEException; -import org.eclipse.osee.ote.internal.message.event.send.NotifyOnResponse; -import org.eclipse.osee.ote.internal.message.event.send.OteEventMessageFutureImpl; -import org.eclipse.osee.ote.internal.message.event.send.OteEventMessageResponseFutureImpl; -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.OteEventMessageUtil; -import org.osgi.service.event.EventAdmin; - -public class OteSendEventMessage { - - private final EventAdmin eventAdmin; - private final Lock lock; - private final Condition responseReceived; - - public OteSendEventMessage(EventAdmin eventAdmin){ - this.eventAdmin = eventAdmin; - lock = new ReentrantLock(); - responseReceived = lock.newCondition(); - } - - /** - * sends a message and returns immediately - */ - public void asynchSend(OteEventMessage message) { - incrementSequenceNumber(message); - OteEventMessageUtil.postEvent(message, eventAdmin); - } - - /** - * Registers for a callback of the given message type as specified by the RESPONSE_TOPIC element in the sent message - * and the class type passed in, then sends the given message and returns immediately. The returned value can be used to - * wait for the response using waitForCompletion(). The callback expects you to handle both the response and the timeout case. - * - * @param clazz - Type of OteEventMessage for the response - * @param message - message to send - * @param callable - callback executed when the response is recieved or if a timeout occurs or called immediately after the send if - * no response is expected - * @param timeout - amount of time in milliseconds to wait for response before calling timeout on the passed in OteEventMessageCallable - * @return <T extends OteEventMessage> Future<T> - a future that contains the response message - */ - public <T extends OteEventMessage, R extends OteEventMessage> OteEventMessageFuture<T, R> asynchSendAndResponse(Class<R> clazz, T message, OteEventMessageCallable<T, R> callable, long timeout){ - int responseId = incrementSequenceNumber(message); - String responseTopic = message.getHeader().RESPONSE_TOPIC.getValue(); - OteEventMessageFutureImpl<T, R> response = new OteEventMessageFutureImpl<>(clazz, callable, message, responseTopic, responseId, timeout); - OteEventMessageUtil.postEvent(message, eventAdmin); - return response; - } - - /** - * Registers for a callback of the given message type and topic. - * - * @param clazz - Type of OteEventMessage for the response - * @param callable - callback executed when the response is recieved - * @return a future that you should cancel when done listening so resources can be cleaned up. - */ - public <R extends OteEventMessage> OteEventMessageResponseFuture<R> asynchResponse(Class<R> clazz, String topic, OteEventMessageResponseCallable<R> callable){ - OteEventMessageResponseFutureImpl<R> response = new OteEventMessageResponseFutureImpl<>(clazz, callable, topic); - return response; - } - - /** - * Sends a message and waits for a response. - * - * @param class - return type - * @param message - message to send - * @param timeout - timeout in milliseconds - * @return <T extends OteEventMessage> T - NULL if the timeout occurs before a response, otherwise returns the - * message specified by the RESPONSE_TOPIC field in the passed in message header. - * @throws Exception - */ - public <T extends OteEventMessage> T synchSendAndResponse(Class<T> clazz, String responseTopic, OteEventMessage message, long timeout) throws OTEException { - lock.lock(); - try{ - int responseId = incrementSequenceNumber(message); - message.getHeader().RESPONSE_TOPIC.setValue(responseTopic); - NotifyOnResponse<T> response = new NotifyOnResponse<>(clazz, responseTopic, responseId, lock, responseReceived); - try{ - OteEventMessageUtil.postEvent(message, eventAdmin); - long nanos = TimeUnit.MILLISECONDS.toNanos(timeout); - while(nanos > 0 && !response.hasResponse()) { - try { - nanos = responseReceived.awaitNanos(nanos); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } finally { - response.dispose(); - } - return response.getMessage(); - } finally { - lock.unlock(); - } - } - - /** - * Sends a message and waits for a response. - * - * @param T - response Message to populate type - * @param message - message to send - * @param timeout - timeout in milliseconds - * @return <T extends OteEventMessage> T - NULL if the timeout occurs before a response, otherwise returns the - * message specified by the RESPONSE_TOPIC field in the passed in message header. - * @throws Exception - */ - public <T extends OteEventMessage> T synchSendAndResponse(T responseMessage, OteEventMessage sendMessage, long timeout) throws OTEException { - lock.lock(); - try{ - int responseId = incrementSequenceNumber(sendMessage); - sendMessage.getHeader().RESPONSE_TOPIC.setValue(responseMessage.getHeader().TOPIC.getValue()); - NotifyOnResponse<T> response = new NotifyOnResponse<>(responseMessage, responseId, lock, responseReceived); - try{ - OteEventMessageUtil.postEvent(sendMessage, eventAdmin); - long nanos = TimeUnit.MILLISECONDS.toNanos(timeout); - while(nanos > 0 && !response.hasResponse()) { - try { - nanos = responseReceived.awaitNanos(nanos); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } finally { - response.dispose(); - } - return response.getMessage(); - } finally { - lock.unlock(); - } - } - - - - private int incrementSequenceNumber(OteEventMessage message){ - int responseId = message.getHeader().MESSAGE_SEQUENCE_NUMBER.getValue(); - if(responseId >= Integer.MAX_VALUE){ - responseId = 1; - } else { - responseId++; - } - message.getHeader().MESSAGE_SEQUENCE_NUMBER.setValue(responseId); - return responseId; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/BaseIOInstrumentation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/BaseIOInstrumentation.java deleted file mode 100644 index a40a41942ac..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/BaseIOInstrumentation.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.instrumentation; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.nio.ByteBuffer; -import java.nio.channels.DatagramChannel; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.MessageSystemTestEnvironment; - -/** - * @author Andrew M. Finkbeiner - */ -public class BaseIOInstrumentation implements IOInstrumentation { - - private final List<InetSocketAddress> addresses; - private final DatagramChannel channel; - - public BaseIOInstrumentation() throws IOException { - addresses = new ArrayList<>(); - channel = DatagramChannel.open(); - channel.configureBlocking(true); - - } - - @Override - public void command(byte[] cmd) { - } - - @Override - public void register(InetSocketAddress address) { - if (address == null) { - throw new IllegalArgumentException("address cannot be null"); - } - addresses.add(address); - } - - @Override - public void unregister(InetSocketAddress address) { - addresses.remove(address); - } - - public void send(byte[] bytes) { - send(ByteBuffer.wrap(bytes)); - } - - public void send(byte[] bytes, int offset, int length) { - send(ByteBuffer.wrap(bytes, offset, length)); - } - - public void send(ByteBuffer bytes) { - bytes.mark(); - int size = addresses.size(); - for (int i = 0; i < size; i++) { - try { - channel.send(bytes, addresses.get(i)); - bytes.reset(); - } catch (Exception ex) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex.toString(), ex); - } - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/IOInstrumentation.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/IOInstrumentation.java deleted file mode 100644 index ed0f72f44b5..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/instrumentation/IOInstrumentation.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.instrumentation; - -import java.net.InetSocketAddress; -import java.rmi.Remote; -import java.rmi.RemoteException; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IOInstrumentation extends Remote { - - void register(InetSocketAddress address) throws RemoteException; - - void command(byte[] cmd) throws RemoteException; - - void unregister(InetSocketAddress address) throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMessageManager.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMessageManager.java deleted file mode 100644 index 2ad899cbe4c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMessageManager.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import java.util.Collection; -import org.eclipse.osee.ote.core.TestException; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IMessageManager<T extends MessageData, U extends Message<? extends ITestEnvironmentMessageSystemAccessor, T, U>> { - void destroy(); - - <CLASSTYPE extends U> CLASSTYPE createMessage(Class<CLASSTYPE> messageClass) throws TestException; - - <CLASSTYPE extends U> int getReferenceCount(CLASSTYPE classtype); - - <CLASSTYPE extends U> CLASSTYPE findInstance(Class<CLASSTYPE> clazz, boolean writer); - - Collection<U> getAllMessages(); - - Collection<U> getAllReaders(); - - Collection<U> getAllWriters(); - - Collection<U> getAllReaders(DataType type); - - Collection<U> getAllWriters(DataType type); - - void init() throws Exception; - - void publishMessages(boolean publish); - - boolean isPhysicalTypeAvailable(DataType physicalType); - - IMessageRequestor<T, U> createMessageRequestor(String name); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMessageRequestor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMessageRequestor.java deleted file mode 100644 index aa51bef91e0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMessageRequestor.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import org.eclipse.osee.ote.core.TestException; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.data.MessageData; - -/** - * @author Ken J. Aguilar - */ -public interface IMessageRequestor<T extends MessageData, U extends Message<? extends ITestEnvironmentMessageSystemAccessor, T, U>> { - <CLASSTYPE extends U> CLASSTYPE getMessageReader(Class<CLASSTYPE> type) throws TestException; - - <CLASSTYPE extends U> CLASSTYPE getMessageWriter(Class<CLASSTYPE> type) throws TestException; - - String getName(); - - void remove(U message) throws TestException; - - void dispose(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMessageScheduleChangeListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMessageScheduleChangeListener.java deleted file mode 100644 index 12b98967566..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMessageScheduleChangeListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import org.eclipse.osee.ote.message.Message; - -/** - * @author Andy Jury - */ -public interface IMessageScheduleChangeListener { - - public void onRateChanged(Message<?, ?, ?> message, double oldRate, double newRate); - - public void isScheduledChanged(boolean isScheduled); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMsgToolServiceClient.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMsgToolServiceClient.java deleted file mode 100644 index 57790937f75..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IMsgToolServiceClient.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import java.net.InetSocketAddress; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.UUID; - -import org.eclipse.osee.ote.message.enums.DataType; - -public interface IMsgToolServiceClient extends Remote { - InetSocketAddress getAddressByType(String messageName, DataType memType) throws RemoteException; - - void changeRate(String msgName, double rate) throws RemoteException; - - void changeIsScheduled(String msgName, boolean isScheduled) throws RemoteException; - - UUID getTestSessionKey() throws RemoteException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/INamespace.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/INamespace.java deleted file mode 100644 index 71764b5c235..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/INamespace.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -public interface INamespace { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageReader.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageReader.java deleted file mode 100644 index 59c8ed4a108..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageReader.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IOSEEMessageReader { - void set(byte[] data); - - byte[] get(); - - void set(IOSEEMessageWriterListener listener); - - void takeNextSample(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageReaderListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageReaderListener.java deleted file mode 100644 index 039f77fe459..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageReaderListener.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import org.eclipse.osee.ote.message.listener.IOSEEMessageListener; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IOSEEMessageReaderListener extends IOSEEMessageListener { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageWriter.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageWriter.java deleted file mode 100644 index 3ccf8c042a8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageWriter.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import org.eclipse.osee.ote.message.MessageSystemException; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IOSEEMessageWriter { - void set(byte[] data); - - byte[] get(); - - void set(IOSEEMessageWriterListener listener); - - void send() throws MessageSystemException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageWriterListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageWriterListener.java deleted file mode 100644 index c4b03a18ae8..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IOSEEMessageWriterListener.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import org.eclipse.osee.ote.message.listener.IOSEEMessageListener; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IOSEEMessageWriterListener extends IOSEEMessageListener { - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IRemoteMessageService.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IRemoteMessageService.java deleted file mode 100644 index a149430f729..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/IRemoteMessageService.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import java.net.InetSocketAddress; -import java.util.Map; -import java.util.Set; - -import org.eclipse.osee.ote.message.commands.RecordCommand; -import org.eclipse.osee.ote.message.commands.SetElementValue; -import org.eclipse.osee.ote.message.commands.SubscribeToMessage; -import org.eclipse.osee.ote.message.commands.UnSubscribeToMessage; -import org.eclipse.osee.ote.message.commands.ZeroizeElement; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.tool.SubscriptionDetails; -import org.eclipse.osee.ote.message.tool.rec.IMessageEntryFactory; - -/** - * defines the operations clients can request of a remote message manager service - * - * @author Andrew M. Finkbeiner - */ -public interface IRemoteMessageService { - - void unsubscribeToMessage(UnSubscribeToMessage cmd); - - /** - * Sets a message element to a specified value - */ - void setElementValue(SetElementValue cmd); - - void zeroizeElement(ZeroizeElement cmd); - - /** - * Notifies service to send message updates to the specified ip address - */ - SubscriptionDetails subscribeToMessage(SubscribeToMessage cmd); - - Set<? extends DataType> getAvailablePhysicalTypes(); - - boolean startRecording(RecordCommand cmd); - - InetSocketAddress getRecorderSocketAddress(); - - InetSocketAddress getMsgUpdateSocketAddress(); - - void stopRecording(); - - void terminateService(); - - void reset(); - - void setupRecorder(IMessageEntryFactory factory); - - public Map<String, Throwable> getCancelledSubscriptions(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/ITestAccessor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/ITestAccessor.java deleted file mode 100644 index 478a8571fbc..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/ITestAccessor.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import org.eclipse.osee.ote.core.TestCase; -import org.eclipse.osee.ote.core.TestScript; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public interface ITestAccessor extends ITestEnvironmentMessageSystemAccessor { - public TestCase getTestCase(); - - @Override - public TestScript getTestScript(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/ITestEnvironmentMessageSystem.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/ITestEnvironmentMessageSystem.java deleted file mode 100644 index b8e4de0a698..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/ITestEnvironmentMessageSystem.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import java.rmi.RemoteException; - -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment; -import org.eclipse.osee.ote.message.IInstrumentationRegistrationListener; - -/** - * @author Andrew M. Finkbeiner - */ -public interface ITestEnvironmentMessageSystem extends ITestEnvironment { - - @Override - void addInstrumentationRegistrationListener(IInstrumentationRegistrationListener listener) throws RemoteException; - - @Override - void removeInstrumentationRegistrationListener(IInstrumentationRegistrationListener listener) throws RemoteException; - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/ITestEnvironmentMessageSystemAccessor.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/ITestEnvironmentMessageSystemAccessor.java deleted file mode 100644 index c3dccb9c35a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/ITestEnvironmentMessageSystemAccessor.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -import java.util.Set; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Andrew M. Finkbeiner - */ -public interface ITestEnvironmentMessageSystemAccessor extends ITestEnvironmentAccessor { - IMessageManager getMsgManager(); - - boolean isPhysicalTypeAvailable(DataType physicalType); - - Set<? extends DataType> getDataTypes(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/Namespace.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/Namespace.java deleted file mode 100644 index 9a16f685cca..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/interfaces/Namespace.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.interfaces; - -/** - * @author Andrew M. Finkbeiner - */ -public class Namespace implements INamespace { - - private final String namespace; - - public Namespace(String string) { - namespace = string; - } - - @Override - public String toString() { - return namespace; - } - - @Override - public boolean equals(Object obj) { - Namespace ns = (Namespace) obj; - return namespace.equals(ns.namespace); - } - - @Override - public int hashCode() { - return namespace.hashCode(); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/internal/MessageIoManagementStarter.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/internal/MessageIoManagementStarter.java deleted file mode 100644 index eb725d5b66b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/internal/MessageIoManagementStarter.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.internal; - -import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface; -import org.eclipse.osee.ote.message.io.IMessageIoManagementService; -import org.eclipse.osee.ote.message.io.MessageIoManagementService; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.ServiceRegistration; -import org.osgi.util.tracker.ServiceTracker; - -/** - * @author Ken J. Aguilar - */ -public class MessageIoManagementStarter extends ServiceTracker { - - private ServiceRegistration registration; - - public MessageIoManagementStarter(BundleContext context) { - super(context, TestEnvironmentInterface.class.getName(), null); - } - - @Override - public synchronized TestEnvironmentInterface addingService(ServiceReference reference) { - TestEnvironmentInterface manager = (TestEnvironmentInterface) super.addingService(reference); - registration = - context.registerService(IMessageIoManagementService.class.getName(), new MessageIoManagementService(), null); - return manager; - } - - @Override - public synchronized void removedService(ServiceReference reference, Object service) { - unregister(); - super.removedService(reference, service); - } - - @Override - public synchronized void close() { - unregister(); - super.close(); - } - - private void unregister(){ - if (registration != null) { - try{ - registration.unregister(); - } catch (IllegalStateException ex){ - //do nothing, we're just making sure it got cleaned up - } finally { - registration = null; - } - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/io/IMessageIoDriver.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/io/IMessageIoDriver.java deleted file mode 100644 index d0ff2136635..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/io/IMessageIoDriver.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.io; - -/** - * @author Ken J. Aguilar - */ -public interface IMessageIoDriver { - void start(); - - void stop(); - - boolean isStarted(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/io/IMessageIoManagementService.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/io/IMessageIoManagementService.java deleted file mode 100644 index f288374f477..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/io/IMessageIoManagementService.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.io; - -/** - * @author Ken J. Aguilar - */ -public interface IMessageIoManagementService { - - void install(IMessageIoDriver ioDriver); - - void uninstall(IMessageIoDriver ioDriver); - - void startIO(); - - void stopIO(); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/io/MessageIoManagementService.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/io/MessageIoManagementService.java deleted file mode 100644 index 591f8690bc2..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/io/MessageIoManagementService.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.io; - -import java.util.HashSet; -import java.util.Set; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -/** - * @author Ken J. Aguilar - */ -public class MessageIoManagementService implements IMessageIoManagementService { - - private final HashSet<IMessageIoDriver> drivers = new HashSet<>(); - - private final Lock lock = new ReentrantLock(); - private boolean ioStarted = false; - - @Override - public void install(IMessageIoDriver ioDriver) { - lock.lock(); - if (!drivers.add(ioDriver)) { - // driver was already installed - lock.unlock(); - return; - } - if (ioStarted) { - // make sure we release the lock before entering unknown code - lock.unlock(); - ioDriver.start(); - } else { - lock.unlock(); - } - } - - @Override - public void startIO() { - lock.lock(); - ioStarted = true; - - Set<IMessageIoDriver> copiedDrivers = new HashSet<>(drivers); - lock.unlock(); - for (IMessageIoDriver driver : copiedDrivers) { - driver.start(); - } - - } - - @Override - public void stopIO() { - lock.lock(); - ioStarted = false; - Set<IMessageIoDriver> copiedDrivers = new HashSet<>(drivers); - lock.unlock(); - for (IMessageIoDriver driver : copiedDrivers) { - driver.stop(); - } - } - - @Override - public void uninstall(IMessageIoDriver ioDriver) { - lock.lock(); - boolean changed = drivers.remove(ioDriver); - lock.unlock(); - if (changed && ioDriver.isStarted()) { - ioDriver.stop(); - } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/listener/IOSEEMessageListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/listener/IOSEEMessageListener.java deleted file mode 100644 index 79fb807f3ab..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/listener/IOSEEMessageListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.listener; - -import org.eclipse.osee.ote.message.MessageSystemException; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Andrew M. Finkbeiner - */ -public interface IOSEEMessageListener { - void onDataAvailable(MessageData data, DataType type) throws MessageSystemException; - - void onInitListener() throws MessageSystemException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/listener/MessageSystemListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/listener/MessageSystemListener.java deleted file mode 100644 index 07e8abb28ea..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/listener/MessageSystemListener.java +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.listener; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Locale; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import org.eclipse.osee.framework.jdk.core.util.benchmark.Benchmark; -import org.eclipse.osee.ote.core.CopyOnWriteNoIteratorList; -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironmentAccessor; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.MessageSystemException; -import org.eclipse.osee.ote.message.condition.ICondition; -import org.eclipse.osee.ote.message.data.MessageData; -import org.eclipse.osee.ote.message.elements.MsgWaitResult; -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.interfaces.IOSEEMessageReaderListener; -import org.eclipse.osee.ote.message.interfaces.IOSEEMessageWriterListener; -import org.eclipse.osee.ote.properties.OtePropertiesCore; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class MessageSystemListener implements IOSEEMessageReaderListener, IOSEEMessageWriterListener, ITimeout { - - private static long debugTimeout = OtePropertiesCore.timeDebugTimeout.getLongValue(); - private static boolean debugTime = OtePropertiesCore.timeDebug.getBooleanValue(); - - - private volatile boolean isTimedOut = false; - private int masterMessageCount = 0; - // private final Message message; - private final WeakReference<Message<?, ?, ?>> message; - private static final Benchmark tbm = new Benchmark("Total Message System Listener", 2500); - - - - private int messageCount = 0; - - // public static enum SPEED { - //// FAST, SLOW - // }; - - /** - * A thread pool for handling slow listeners. We start the pool with 5 threads, which should in most cases be more - * than enough threads to handle the listeners. Because the queue is static, it will be shared by all - * "slow listeners". Because of the expense of thread creation, we want to avoid creating threads when possible. To - * accomplish this, we start with more threads than we think we'll need, and we keep any newly created threads around - * for a long period of time. We assume that if we need a lot of threads now, we may continue to need a lot of - * threads for an extended period of time. - * <p> - * We use a SynchronousQueue in order to avoid queueing. We prefer to create a new thread to handle requests if - * necessary to help ensure that listeners are notified as quickly as possible and without delays caused by other - * listeners. - */ - private static final ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, Integer.MAX_VALUE, 60 * 30, - TimeUnit.SECONDS, new SynchronousQueue<Runnable>()); - - private final CopyOnWriteNoIteratorList<IOSEEMessageListener> fastListeners = new CopyOnWriteNoIteratorList<>(IOSEEMessageListener.class); - private final CopyOnWriteNoIteratorList<IOSEEMessageListener> slowListeners = new CopyOnWriteNoIteratorList<>(IOSEEMessageListener.class); - private volatile boolean disposed = false; - - /** - * This class takes in a message in the constructor so that it can tell the message to update when it recieves new - * data. - */ - public MessageSystemListener(Message<?, ?, ?> msg) { - super(); - this.message = new WeakReference<>(msg); - } - - /** - * returns the number of received messages since the last call to waitForData - */ - public synchronized int getLocalMessageCount() { - return messageCount; - } - - public synchronized int getMasterMessageCount() { - return masterMessageCount; - } - - /** - * return whether new data has been received since the last call to waitForData - */ - @Override - public boolean isTimedOut() { - return this.isTimedOut; - } - - @Override - public void setTimeout(boolean timeout) { - this.isTimedOut = timeout; - } - - public synchronized boolean waitForData() throws InterruptedException { - messageCount = 0; - if (this.isTimedOut) { - return true; - } - while (messageCount == 0 && !isTimedOut) { - wait(); // the test environment will notify us after a specified time out - } - return isTimedOut; - } - - public synchronized boolean waitForMessageNumber(int count) throws InterruptedException { - while (masterMessageCount < count) { - messageCount = 0; - wait();// onDataAvailable - if (isTimedOut()) {//we timed out - return false; - } - } - return true; - } - - public MsgWaitResult waitForCondition(ITestEnvironmentAccessor accessor, ICondition condition, boolean maintain, int milliseconds) throws InterruptedException { - long time = 0l; - boolean pass; - if (milliseconds > 0) { - ICancelTimer cancelTimer; - synchronized (this) { - pass = condition.check(); - time = accessor.getEnvTime(); - boolean done = pass ^ maintain; - cancelTimer = accessor.setTimerFor(this, milliseconds); - while (!done) { - if (waitForData()) { - // we timed out - break; - } else { - pass = condition.checkAndIncrement(); - done = pass ^ maintain; - } - } - time = accessor.getEnvTime() - time; - } - cancelTimer.cancelTimer(); - } else { - pass = condition.check(); - } - return new MsgWaitResult(time, condition.getCheckCount(), pass); - } - - /** - * Registers a listener for the message. If the listener will not respond quickly (for example, if the listener is - * going to make RMI calls, or other network activites which it will wait for the remote side to respond), then it - * should identify itself as a slow listener by passing "false" for isFastListener. "Slow" listeners will be notified - * by a separate thread, thereby not forcing other listener notifications to be delayed, and subsequent messages from - * being processed. - * - * @param listener - The listener to be added - * @param listenerSpeed - - * @return Returns boolean success indication. - */ - public boolean addListener(IOSEEMessageListener listener, SPEED listenerSpeed) { - CopyOnWriteNoIteratorList c = listenerSpeed == SPEED.FAST ? fastListeners : slowListeners; - if (!c.contains(listener)) { - c.add(listener); - } - return true; - } - - /** - * Adds the listener as a "fast" listener. - * - * @see MessageSystemListener#addListener(IOSEEMessageListener, SPEED) - */ - public boolean addListener(IOSEEMessageListener listener) { - return addListener(listener, SPEED.FAST); - } - - /** - * Checks to see if the specified listener is registered - * - * @return true if the listener is register false otherwise - */ - public boolean containsListener(final IOSEEMessageListener listener, final SPEED listenerSpeed) { - return listenerSpeed.equals(SPEED.FAST) ? fastListeners.contains(listener) : slowListeners.contains(listener); - } - - /** - * Convience method. - * - * @return Returns presence boolean indication. - * @see #containsListener(IOSEEMessageListener, SPEED) - */ - public boolean containsListener(final IOSEEMessageListener listener) { - return containsListener(listener, SPEED.FAST); - - } - - public boolean removeListener(IOSEEMessageListener listener, SPEED listenerSpeed) { - - return listenerSpeed == SPEED.FAST ? fastListeners.remove(listener) : slowListeners.remove(listener); - } - - public boolean removeListener(IOSEEMessageListener listener) { - return removeListener(listener, SPEED.FAST) || removeListener(listener, SPEED.SLOW); - } - - @Override - public synchronized void onDataAvailable(final MessageData data, DataType type) throws MessageSystemException { - if(disposed) return; - tbm.startSample(); - if (message.get().getMemType() == type) { - messageCount++; - masterMessageCount++; - notifyAll(); - } - - long start = 0, elapsed; - IOSEEMessageListener[] ref = fastListeners.get(); - for (int i = 0; i < ref.length; i++) { - IOSEEMessageListener listener = ref[i]; -// for (IOSEEMessageListener listener : fastListeners) { - if(debugTime){ - start = System.nanoTime(); - } - listener.onDataAvailable(data, type); - if(debugTime){ - elapsed = System.nanoTime() - start; - if(elapsed > debugTimeout){ - Locale.setDefault(Locale.US); - System.out.printf("%s %s SLOW %,d\n", message.get().getName(), listener.getClass().getName(), elapsed); - } - } - } - - ref = slowListeners.get(); - for (int i = 0; i < ref.length; i++){ - IOSEEMessageListener listener = ref[i]; -// for (IOSEEMessageListener listener : slowListeners) { - if(debugTime){ - start = System.nanoTime(); - } - threadPool.execute(new SlowListenerNotifier(listener, data, type, false)); - if(debugTime){ - elapsed = System.nanoTime() - start; - if(elapsed > debugTimeout){ - Locale.setDefault(Locale.US); - System.out.printf("%s %s SLOW TO SUBMIT SLOW %,d\n", message.get().getName(), listener.getClass().getName(), elapsed); - } - } - } - tbm.endSample(); - } - - @Override - public synchronized void onInitListener() throws MessageSystemException { - if(disposed) return; - IOSEEMessageListener[] ref = fastListeners.get(); - for (int i = 0; i < ref.length; i++) { - IOSEEMessageListener listener = ref[i]; -// for (IOSEEMessageListener listener : fastListeners) { - listener.onInitListener(); - } - - ref = slowListeners.get(); - for (int i = 0; i < ref.length; i++){ - IOSEEMessageListener listener = ref[i]; -// for (IOSEEMessageListener listener : slowListeners) { - threadPool.execute(new SlowListenerNotifier(listener, null, null, true)); - } - } - - /** - * Manages the notification of a slow IOSEEMessageListener. The implementation prevents multiple calls into the - * listener at the same time. - * - * @author David Diepenbrock - */ - private static final class SlowListenerNotifier implements Runnable { - - /** - * Indicates if we are performing the onInitListener() call or onDataAvailable() call - */ - private final boolean isOnInit; - - private final IOSEEMessageListener listener; - - private final MessageData data; - - private final DataType type; - - public SlowListenerNotifier(IOSEEMessageListener listener, MessageData data, DataType type, boolean isOnInit) { - this.listener = listener; - this.data = data; - this.type = type; - this.isOnInit = isOnInit; - } - - @Override - public void run() { - synchronized (listener) { - if (isOnInit) { - listener.onInitListener(); - } else { - listener.onDataAvailable(data, type); - } - } - } - } - - public Collection<IOSEEMessageListener> getRegisteredFastListeners() { - return fastListeners.fillCollection(new ArrayList<IOSEEMessageListener>(fastListeners.length())); - } - - public Collection<IOSEEMessageListener> getRegisteredSlowListeners() { - return slowListeners.fillCollection(new ArrayList<IOSEEMessageListener>(slowListeners.length())); - } - - public void dispose() { - this.disposed = true; - this.clearListeners(); - } - - public void clearListeners() { - this.fastListeners.clear(); - this.slowListeners.clear(); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/listener/SPEED.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/listener/SPEED.java deleted file mode 100644 index 07c2e1da976..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/listener/SPEED.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.listener; - -/** - * @author Andrew M. Finkbeiner - */ -public enum SPEED { - FAST, - SLOW -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/log/record/MessageJarConfigrecord.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/log/record/MessageJarConfigrecord.java deleted file mode 100644 index 49510ef370e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/log/record/MessageJarConfigrecord.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.log.record; - -import java.io.File; -import java.util.Map; -import java.util.logging.Level; -import org.eclipse.osee.ote.core.TestScript; -import org.eclipse.osee.ote.core.log.record.TestRecord; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class MessageJarConfigrecord extends TestRecord { - - private final String[] jarVersions; - - private static final long serialVersionUID = 6919229589873467398L; - - /** - * ScriptConfigRecord Constructor. Constructs test script configuration log message with timestamp. - * - * @param script The test script who's configuration is to be recorded. - */ - public MessageJarConfigrecord(TestScript script, String[] jarVersions, Map<String, File> availableJars) { - super(script.getTestEnvironment(), Level.CONFIG, script.getClass().getName(), false); - this.jarVersions = jarVersions; - } - - /** - * Convert an element to XML format. - * - * @return XML formated config element. - */ - @Override - public Element toXml(Document doc) { - Element jarConfig = doc.createElement("JarConfig"); - doc.appendChild(jarConfig); - - for (String version : jarVersions) { - Element el = doc.createElement("Jar"); - el.setTextContent(version); - jarConfig.appendChild(el); - } - return jarConfig; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/AlarmClock.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/AlarmClock.java deleted file mode 100644 index abd52923b11..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/AlarmClock.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.timer; - -import java.util.TimerTask; -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class AlarmClock extends TimerTask implements ICancelTimer { - private final ITimeout sleeper; - - public AlarmClock(ITimeout sleeper) { - super(); - this.sleeper = sleeper; - sleeper.setTimeout(false); - } - - /** - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - synchronized (sleeper) { - sleeper.notify(); - sleeper.setTimeout(true); - } - } - - @Override - public void cancelTimer() { - this.cancel(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/CycleCountDown.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/CycleCountDown.java deleted file mode 100644 index 1f8e8f09c58..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/CycleCountDown.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.timer; - -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.IScriptControl; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; - -/** - * This class is used as a 'Time Out' object while waiting for the desired message element value. - * - * @author Ryan D. Brooks - */ -public class CycleCountDown implements ICancelTimer { - private int cycleCount; - private volatile boolean completed; - private final ITimeout objToNotify; - private final IScriptControl scriptLock; - - /** - * @param objToNotify The Object that is in wait() on which we will call notifyAll() - * @param cycleCount The number of cycles to countdown. - */ - public CycleCountDown(IScriptControl scriptLock, ITimeout objToNotify, int cycleCount) { - super(); - this.scriptLock = scriptLock; - this.cycleCount = cycleCount; - this.objToNotify = objToNotify; - this.completed = false; - objToNotify.setTimeout(false); - } - - /** - * @return true if the countdown is complete/canceled, otherwise false - */ - public boolean cycleOccurred() { - if (cycleCount == 0 && !completed) { - completed = true; - synchronized (objToNotify) { - objToNotify.setTimeout(true); - objToNotify.notifyAll(); - } - } - else { - cycleCount--; - } - return completed; - } - - @Override - public void cancelTimer() { - this.completed = true; - if (this.scriptLock != null) { - this.scriptLock.lock(); - } - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/RealTime.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/RealTime.java deleted file mode 100644 index 21c1b4b5313..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/RealTime.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.timer; - -import java.lang.ref.WeakReference; -import java.util.HashMap; -import java.util.List; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Level; - -import org.eclipse.osee.framework.jdk.core.util.benchmark.Benchmark; -import org.eclipse.osee.ote.core.environment.EnvironmentTask; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.TimerControl; -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; - -/** - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class RealTime extends TimerControl { - private final HashMap<EnvironmentTask, ScheduledFuture<?>> handleMap = - new HashMap<EnvironmentTask, ScheduledFuture<?>>(32); - - /** - * Constructor - */ - public RealTime() { - super((Runtime.getRuntime().availableProcessors() + 1) / 2 + 1); - } - - @Override - public void addTask(final EnvironmentTask task, final TestEnvironment environment) { - if (!handleMap.containsKey(task)) { - final WeakReference<TestEnvironment> te = new WeakReference<>(environment); - final ScheduledFuture<?> handle = schedulePeriodicTask(new Runnable() { - final Benchmark bm = new Benchmark(task.getClass().getName() + ":" + task.getHzRate() + "Hz", - (long) (1000000.0 / task.getHzRate())); - - @Override - public void run() { - - try { - bm.samplePoint(); - if (task.isRunning()) { - task.runOneCycle(); - } - } catch (Throwable ex) { - ScheduledFuture<?> h = handleMap.get(task); - if (h != null) { - h.cancel(false); - } - te.get().handleException(ex, "exception while running one cycle for task " + task.toString(), - Level.SEVERE, false); - } - } - - }, 0, (long) Math.rint(1000.0 / task.getHzRate())); - handleMap.put(task, handle); - } - } - - @Override - public void removeTask(EnvironmentTask task) { - ScheduledFuture<?> handle = handleMap.remove(task); - if (handle != null) { - handle.cancel(false); - } - } - - @Override - public long getEnvTime() { - return System.currentTimeMillis(); - } - - @Override - public void envWait(ITimeout obj, int milliseconds) throws InterruptedException { - synchronized (obj) { - obj.wait(milliseconds); - } - } - - @Override - public ICancelTimer setTimerFor(final ITimeout objToNotify, int milliseconds) { - objToNotify.setTimeout(false); - final ScheduledFuture<?> handle = scheduleOneShotTask(new Runnable() { - - @Override - public void run() { - synchronized (objToNotify) { - objToNotify.setTimeout(true); - objToNotify.notifyAll(); - } - } - }, milliseconds); - - return new ICancelTimer() { - - @Override - public void cancelTimer() { - handle.cancel(false); - } - }; - } - - @Override - public int getCycleCount() { - return (int) System.currentTimeMillis() / 20; - } - - @Override - public void incrementCycleCount() { - } - - public List<CycleCountDown> getCycleCounters() { - return null; - } - - public void setCycleCounters(List<CycleCountDown> cycleCounters) { - } - - @Override - public void setCycleCount(int cycle) { - } - - @Override - public void dispose() { - } - - @Override - public void cancelAllTasks() { - for (ScheduledFuture<?> handle : handleMap.values()) { - handle.cancel(false); - } - handleMap.clear(); - } - - @Override - public void step() { - } - - @Override - public long getTimeOfDay() { - return getEnvTime(); - } - - @Override - public boolean isRealtime() { - return true; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/SimulatedTime.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/SimulatedTime.java deleted file mode 100644 index 2c78d216dbd..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/timer/SimulatedTime.java +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.timer; - -import java.io.IOException; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.EnvironmentTask; -import org.eclipse.osee.ote.core.environment.TestEnvironment; -import org.eclipse.osee.ote.core.environment.TimerControl; -import org.eclipse.osee.ote.core.environment.interfaces.ICancelTimer; -import org.eclipse.osee.ote.core.environment.interfaces.IScriptControl; -import org.eclipse.osee.ote.core.environment.interfaces.ITimeout; -import org.eclipse.osee.ote.message.MessageSystemTestEnvironment; - -/** - * We use a frequency resolution of 300hz. - * - * @author Ryan D. Brooks - * @author Andrew M. Finkbeiner - */ -public class SimulatedTime extends TimerControl { - - private static final class Task { - private final EnvironmentTask task; - private final TestEnvironment env; - - public Task(EnvironmentTask task, TestEnvironment env) { - super(); - this.task = task; - this.env = env; - } - - public void doTask(int cycleCount) { - try { - task.baseRunOneCycle(cycleCount); - } catch (Throwable ex) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, - "Aborting the test script because an Environment Task is failing", ex); - env.getRunManager().abort(ex, false); - } - } - } - private final Collection<CycleCountDown> cycleCounters; - private final Collection<CycleCountDown> scriptCycleCounters; - private final IScriptControl scriptControl; - private int cycleCount; - private final CopyOnWriteArrayList<Task> tasks = new CopyOnWriteArrayList<>(); - - private final long sysTime; - - /** - * @param scriptControl - - */ - public SimulatedTime(IScriptControl scriptControl) throws IOException { - super(3); - this.scriptControl = scriptControl; - cycleCounters = new HashSet<>(32); - scriptCycleCounters = new HashSet<>(32); - cycleCount = 0; - sysTime = System.currentTimeMillis(); - } - - @Override - public long getEnvTime() { - return (long) (cycleCount * 1000.0 / EnvironmentTask.cycleResolution); - } - - @Override - public ICancelTimer setTimerFor(ITimeout objToNotify, int milliseconds) { - CycleCountDown cycleCountDown = new CycleCountDown(scriptControl, objToNotify, - (int) Math.rint(milliseconds / (1000.0 / EnvironmentTask.cycleResolution)) - 1); - synchronized (cycleCounters) { - if(getRunManager().isCurrentThreadScript()){ - scriptCycleCounters.add(cycleCountDown); - } else { - cycleCounters.add(cycleCountDown); - } - } - - unlockScriptControl(); - - return cycleCountDown; - } - - protected void unlockScriptControl() { - try { - scriptControl.unlock(); - } catch (IllegalMonitorStateException ex) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex); - } - } - - @Override - public void addTask(EnvironmentTask envTask, TestEnvironment environment) { - for (Task task : tasks) { - if (task.task == envTask) { - return; - } - } - - tasks.add(new Task(envTask, environment)); - } - - @Override - public void removeTask(EnvironmentTask task) { - Task itemToRemove = null; - for (Task t : tasks) { - if (t.task == task) { - itemToRemove = t; - break; - } - } - if (itemToRemove != null) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.FINE, "removing environment task " + task.toString()); - tasks.remove(itemToRemove); - } - } - - @Override - public void step() { - - for (Task t : tasks) { - t.doTask(cycleCount); - } - incrementCycleCount(); - } - - @Override - public int getCycleCount() { - return cycleCount; - } - - public Collection<CycleCountDown> getCycleCounters() { - return scriptCycleCounters; - } - - @Override - public void incrementCycleCount() { - cycleCount++; - } - - @Override - public void setCycleCount(int cycle) { - cycleCount = cycle; - } - - @Override - public void cancelAllTasks() { - for (Task t : tasks) { - t.task.cancel(); - } - tasks.clear(); - } - - public void removeOccurredCycleCounters() { - synchronized (cycleCounters) { - Iterator<CycleCountDown> iter = cycleCounters.iterator(); - while (iter.hasNext()) { - CycleCountDown counter = iter.next(); - if (counter.cycleOccurred()) { - iter.remove(); - } - } - iter = scriptCycleCounters.iterator(); - while (iter.hasNext()) { - CycleCountDown counter = iter.next(); - if (counter.cycleOccurred()) { - iter.remove(); - } - } - } - } - - @Override - public void dispose() { - cycleCounters.clear(); - scriptCycleCounters.clear(); - tasks.clear(); - } - - @Override - public long getTimeOfDay() { - return sysTime + getEnvTime(); - } - - @Override - public boolean isRealtime() { - return false; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/IFileTransferHandle.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/IFileTransferHandle.java deleted file mode 100644 index b4e4f3503ab..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/IFileTransferHandle.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool; - -import java.io.IOException; - -/** - * @author Ken J. Aguilar - */ -public interface IFileTransferHandle { - void stop() throws IOException; - - void addListener(IUdpTransferListener listener); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/IUdpTransferListener.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/IUdpTransferListener.java deleted file mode 100644 index 302f8f88d00..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/IUdpTransferListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool; - -/** - * @author Ken J. Aguilar - */ -public interface IUdpTransferListener { - /** - * called by the file transfer handler when a file transfer is complete - * - * @param config the transfer configuration - */ - void onTransferComplete(TransferConfig config); - - /** - * called when the an error is experienced during transfer operations. The handle for this transfer will be - * automatically stopped prior to this method being called - */ - void onTransferException(TransferConfig config, Throwable t); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/MessageMode.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/MessageMode.java deleted file mode 100644 index c87a95d3571..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/MessageMode.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool; - -import java.io.Serializable; - -/** - * @author Ken J. Aguilar - */ -public enum MessageMode implements Serializable { - READER, - WRITER; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/SubscriptionDetails.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/SubscriptionDetails.java deleted file mode 100644 index fdbd070a9e6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/SubscriptionDetails.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool; - -import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Ken J. Aguilar - */ -public class SubscriptionDetails implements Serializable { - - private static final long serialVersionUID = -3968654375167145281L; - - private final SubscriptionKey key; - private final byte[] currentData; - private final Set<DataType> availableMemTypes; - - public SubscriptionDetails(SubscriptionKey key, byte[] currentData, Set<DataType> availableMemTypes) { - this.key = key; - this.currentData = currentData; - this.availableMemTypes = new HashSet<>(availableMemTypes); - } - - public SubscriptionKey getKey() { - return key; - } - - public byte[] getCurrentData() { - return currentData; - } - - public Set<DataType> getAvailableMemTypes() { - return availableMemTypes; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/SubscriptionKey.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/SubscriptionKey.java deleted file mode 100644 index a3da131b25b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/SubscriptionKey.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool; - -import java.io.Serializable; -import org.eclipse.osee.ote.message.enums.DataType; - -/** - * @author Ken J. Aguilar - */ -public final class SubscriptionKey implements Serializable { - - private static final long serialVersionUID = 4385205425559852952L; - - private final int id; - private final DataType type; - private final MessageMode mode; - private final String messageClassName; - - public SubscriptionKey(int id, DataType type, MessageMode mode, String messageClassName) { - this.id = id; - this.type = type; - this.mode = mode; - this.messageClassName = messageClassName; - } - - public int getId() { - return id; - } - - public DataType getType() { - return type; - } - - public MessageMode getMode() { - return mode; - } - - public String getMessageClassName() { - return messageClassName; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/TransferConfig.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/TransferConfig.java deleted file mode 100644 index c2ad7452f65..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/TransferConfig.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool; - -import java.net.InetSocketAddress; -import java.nio.channels.SelectionKey; - -public final class TransferConfig { - public static enum Direction { - SOCKET_TO_FILE(SelectionKey.OP_READ), - FILE_TO_SOCKET(SelectionKey.OP_WRITE); - - private int accessType; - - private Direction(int accessType) { - this.accessType = accessType; - } - - public int getSelectionAccessOperation() { - return accessType; - } - - } - private final String fileName; - private final InetSocketAddress sourceAddress; - private final InetSocketAddress destinationAddress; - private final Direction direction; - private final int blockCount; - private final boolean appendMode; - - public TransferConfig(final String fileName, final InetSocketAddress sourceAddress, final InetSocketAddress destinationAddress, final Direction direction, final int blockCount) { - this(fileName, sourceAddress, destinationAddress, direction, blockCount, false); - } - - public TransferConfig(final String fileName, final InetSocketAddress sourceAddress, final InetSocketAddress destinationAddress, final Direction direction, final int blockCount, boolean appendMode) { - super(); - this.fileName = fileName; - this.sourceAddress = sourceAddress; - this.destinationAddress = destinationAddress; - this.direction = direction; - this.blockCount = blockCount; - this.appendMode = appendMode; - } - - /** - * @return the direction - */ - public Direction getDirection() { - return direction; - } - - /** - * @return the fileChannel - */ - public String getFileName() { - return fileName; - } - - /** - * @return the destination of the data - */ - public InetSocketAddress getDestinationAddress() { - return destinationAddress; - } - - /** - * @return the sourceAddress - */ - public InetSocketAddress getSourceAddress() { - return sourceAddress; - } - - /** - * @return the blockCount - */ - public int getBlockCount() { - return blockCount; - } - - public boolean isAppendMode() { - return appendMode; - } - -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/UdpFileTransferHandler.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/UdpFileTransferHandler.java deleted file mode 100644 index 9b6db88c764..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/UdpFileTransferHandler.java +++ /dev/null @@ -1,284 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.DatagramSocket; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.UnknownHostException; -import java.nio.channels.ClosedByInterruptException; -import java.nio.channels.ClosedChannelException; -import java.nio.channels.DatagramChannel; -import java.nio.channels.FileChannel; -import java.nio.channels.FileLock; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.logging.Level; - -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.message.MessageSystemTestEnvironment; - -public class UdpFileTransferHandler { - - private final Thread thread; - private final Selector selector; - private volatile boolean done = false; - - private final HashMap<SelectionKey, Handle> handles = new HashMap<>(); - private final Object gate = new Object(); - - private final class Handle implements IFileTransferHandle { - private final CopyOnWriteArrayList<IUdpTransferListener> listeners = - new CopyOnWriteArrayList<IUdpTransferListener>(); - private final SelectionKey key; - private final TransferConfig config; - private final FileLock lock; - - public Handle(SelectionKey key, TransferConfig config, FileLock lock) { - if (key == null) { - throw new IllegalArgumentException("The selection key cannot be null"); - } - if (config == null) { - throw new IllegalArgumentException("The transfer configuration cannot be null"); - } - if (lock == null) { - throw new IllegalArgumentException("The file lock cannot be null"); - } - this.key = key; - this.config = config; - this.lock = lock; - } - - @Override - public void addListener(IUdpTransferListener listener) { - if (!listeners.contains(listener)) { - listeners.add(listener); - } - } - - @Override - public void stop() throws IOException { - synchronized (gate) { - handles.remove(key); - key.cancel(); - //selector.wakeup(); - OseeLog.log(MessageSystemTestEnvironment.class, Level.INFO, "stopping transfer for " + config.getFileName()); - key.channel().close(); - lock.channel().close(); - for (IUdpTransferListener listener : listeners) { - listener.onTransferComplete(config); - } - listeners.clear(); - } - } - - } - - public UdpFileTransferHandler() throws IOException { - selector = Selector.open(); - thread = new Thread(new Runnable() { - - @Override - public void run() { - try { - while (!done) { - selector.select(); - processReadySet(selector.selectedKeys()); - synchronized (gate) { - // we do this to prevent entry to the selector.select() when - // registering new channels from a different thread. Otherwise - // we would deadlock - } - } - } catch (ClosedByInterruptException ex) { - if (!done) { - // interrupted but we were not stopped - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex); - } - } catch (IOException ex) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex); - } - } - - }); - thread.setName("UDP File Transfer Handler"); - } - - /** - * @return true if successful or false if a lock on the file was not obtained - */ - public IFileTransferHandle registerTransfer(TransferConfig config) throws IOException, FileNotFoundException { - synchronized (gate) { - selector.wakeup(); - return addTransfer(config); - } - } - - private synchronized IFileTransferHandle addTransfer(final TransferConfig config) throws IOException, FileNotFoundException { - File file = new File(config.getFileName()); - final FileChannel fileChannel; - final FileLock lock; - if (config.getDirection() == TransferConfig.Direction.SOCKET_TO_FILE) { - FileOutputStream fos = new FileOutputStream(file, config.isAppendMode()); - fileChannel = fos.getChannel(); - lock = fileChannel.tryLock(0l, Long.MAX_VALUE, false); - } else { - FileInputStream fis = new FileInputStream(file); - fileChannel = fis.getChannel(); - lock = fileChannel.tryLock(0l, Long.MAX_VALUE, true); - } - - if (lock == null) { - return null; - } - fileChannel.position(0); - final DatagramChannel sourceChannel = DatagramChannel.open(); - sourceChannel.configureBlocking(false); - final DatagramSocket socket = sourceChannel.socket(); - socket.bind(config.getDestinationAddress()); - sourceChannel.connect(config.getSourceAddress()); - System.out.println("file side bind address=" + socket.getLocalAddress() + ":" + socket.getLocalPort()); - System.out.println("connected socket address=" + config.getSourceAddress()); - - if (config.getDirection() == TransferConfig.Direction.SOCKET_TO_FILE && socket.getReceiveBufferSize() < config.getBlockCount()) { - socket.setReceiveBufferSize(config.getBlockCount()); - System.out.println("internal UDP receive buffer size =" + socket.getReceiveBufferSize()); - } - final SelectionKey key = sourceChannel.register(selector, config.getDirection().getSelectionAccessOperation()); - Handle h = new Handle(key, config, lock); - handles.put(key, h); - return h; - } - - public void start() throws IOException { - thread.start(); - } - - public void stop(int time) throws InterruptedException, IOException { - done = true; - thread.interrupt(); - thread.join(time); - stopAllTransfers(); - handles.clear(); - selector.close(); - } - - private void processReadySet(final Set<SelectionKey> readySet) throws ClosedByInterruptException, IOException { - /* iterate through the set of readable channels */ - final Iterator<SelectionKey> keys = readySet.iterator(); - while (keys.hasNext()) { - final SelectionKey key = keys.next(); - if (key.isValid()) { - final Handle handle = handles.get(key); - final FileChannel fileChannel = handle.lock.channel(); - final DatagramChannel channel = (DatagramChannel) key.channel(); - final long pos = fileChannel.position(); - try { - if ((key.interestOps() & SelectionKey.OP_READ) > 0) { - final long count = fileChannel.transferFrom(channel, pos, handle.config.getBlockCount()); - fileChannel.position(pos + count); - if (count == 0) { - System.out.println("warning! read zero bytes"); - } - } else if ((key.interestOps() & SelectionKey.OP_WRITE) > 0) { - final long count = fileChannel.transferTo(pos, handle.config.getBlockCount(), channel); - if (count == 0) { - System.out.println("warning! wrote zero bytes"); - } - fileChannel.position(pos + count); - if (fileChannel.position() >= fileChannel.size()) { - synchronized (this) { - System.out.println("done transfering file " + handle.config.getFileName()); - handle.stop(); - } - } - } - } catch (ClosedChannelException ex) { - handle.stop(); - } catch (Throwable t) { - try { - handle.key.cancel(); - handle.key.channel().close(); - handle.lock.release(); - handle.lock.channel().close(); - } finally { - for (IUdpTransferListener listener : handle.listeners) { - listener.onTransferException(handle.config, t); - } - handle.listeners.clear(); - } - } - } - keys.remove(); - } - } - - public static void main(String[] args) { - try { - final UdpFileTransferHandler rec = new UdpFileTransferHandler(); - String file = args[0]; - InetAddress ipAddr = InetAddress.getByName(args[1]); - int remotePort = Integer.parseInt(args[2]); - int localPort = Integer.parseInt(args[3]); - TransferConfig.Direction direction = TransferConfig.Direction.values()[Integer.parseInt(args[4])]; - InetSocketAddress address = new InetSocketAddress(ipAddr, remotePort); - if (direction == TransferConfig.Direction.FILE_TO_SOCKET) { - System.out.printf("Transfering %s to %s via local port %d\n", file, address.toString(), localPort); - } else { - System.out.printf("Writing to %s data recieved from %s via local port %d\n", file, address.toString(), - localPort); - } - TransferConfig config = - new TransferConfig(file, address, new InetSocketAddress(InetAddress.getLocalHost(), localPort), direction, - 7 * 188); - rec.registerTransfer(config); - System.in.read(); - rec.stop(2500); - } catch (UnknownHostException ex) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex); - } catch (FileNotFoundException ex) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex); - } catch (IOException ex) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex); - } catch (InterruptedException ex) { - OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex); - } - } - - /** - * stops all currently running file transfers but does not shutdown the file transfer service - */ - public synchronized void stopAllTransfers() throws IOException { - OseeLog.log(MessageSystemTestEnvironment.class, Level.FINE, "stopping all transfers"); - for (Handle handle : handles.values()) { - handle.stop(); - } - handles.clear(); - } - - public synchronized boolean hasActiveTransfers() { - return !handles.isEmpty(); - } - - public boolean isRunning() { - final Thread.State state = thread.getState(); - return state != Thread.State.NEW && state != Thread.State.TERMINATED && !done; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/ElementEntryFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/ElementEntryFactory.java deleted file mode 100644 index 8d1abc77ed9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/ElementEntryFactory.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec; - -import org.eclipse.osee.ote.message.elements.ArrayElement; -import org.eclipse.osee.ote.message.elements.BooleanElement; -import org.eclipse.osee.ote.message.elements.CharElement; -import org.eclipse.osee.ote.message.elements.Element; -import org.eclipse.osee.ote.message.elements.EmptyEnum_Element; -import org.eclipse.osee.ote.message.elements.EnumeratedElement; -import org.eclipse.osee.ote.message.elements.FixedPointElement; -import org.eclipse.osee.ote.message.elements.Float32Element; -import org.eclipse.osee.ote.message.elements.Float64Element; -import org.eclipse.osee.ote.message.elements.IElementVisitor; -import org.eclipse.osee.ote.message.elements.IntegerElement; -import org.eclipse.osee.ote.message.elements.LongIntegerElement; -import org.eclipse.osee.ote.message.elements.RealElement; -import org.eclipse.osee.ote.message.elements.RecordElement; -import org.eclipse.osee.ote.message.elements.RecordMap; -import org.eclipse.osee.ote.message.elements.SignedInteger16Element; -import org.eclipse.osee.ote.message.elements.StringElement; -import org.eclipse.osee.ote.message.tool.rec.entry.ArrayElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.BooleanElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.CharElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.EmptyEnumEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.EnumeratedElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.IElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.IntegerElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.LongIntegerElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.RealElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.RecordElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.RecordMapEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.SignedInteger16ElementEntry; -import org.eclipse.osee.ote.message.tool.rec.entry.StringElementEntry; - -public class ElementEntryFactory { - - private static final class ElementVisitor implements IElementVisitor { - - private IElementEntry entry = null; - - public IElementEntry getEntry() { - return entry; - } - - @Override - public void asCharElement(CharElement element) { - entry = new CharElementEntry(element); - } - - @Override - public void asEnumeratedElement(EnumeratedElement<?> element) { - entry = new EnumeratedElementEntry(element); - } - - @Override - public void asFixedPointElement(FixedPointElement element) { - entry = new RealElementEntry(element); - } - - @Override - public void asFloat32(Float32Element element) { - entry = new RealElementEntry(element); - } - - @Override - public void asFloat64(Float64Element element) { - entry = new RealElementEntry(element); - } - - @Override - public void asGenericElement(Element element) { - } - - @Override - public void asIntegerElement(IntegerElement element) { - entry = new IntegerElementEntry(element); - } - - @Override - public void asRealElement(RealElement element) { - entry = new RealElementEntry(element); - } - - @Override - public void asRecordElement(RecordElement element) { - entry = new RecordElementEntry(element); - } - - @Override - public void asStringElement(StringElement element) { - entry = new StringElementEntry(element); - } - - @Override - public void asBooleanElement(BooleanElement element) { - entry = new BooleanElementEntry(element); - } - - @Override - public void asRecordMap(RecordMap<? extends RecordElement> element) { - entry = new RecordMapEntry(element); - } - - @Override - public void asEmptyEnumElement(EmptyEnum_Element element) { - entry = new EmptyEnumEntry(element); - } - - @Override - public void asArrayElement(ArrayElement element) { - entry = new ArrayElementEntry(element); - } - - @Override - public void asLongIntegerElement(LongIntegerElement element) { - entry = new LongIntegerElementEntry(element); - } - - @Override - public void asSignedInteger16Element(SignedInteger16Element element) { - entry = new SignedInteger16ElementEntry(element); - } - - } - - public static IElementEntry createEntry(Element element) { - - ElementVisitor visitor = new ElementVisitor(); - element.visit(visitor); - IElementEntry entry = visitor.getEntry(); - if (entry != null) { - return entry; - } - throw new IllegalArgumentException("factory cannot generate an entry for class " + element.getClass().getName()); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/IMessageEntryFactory.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/IMessageEntryFactory.java deleted file mode 100644 index 2676cd6e8ad..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/IMessageEntryFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec; - -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.tool.rec.entry.IMessageEntry; - -public interface IMessageEntryFactory<T extends Message<?, ?, T>> { - - public IMessageEntry createMessageEntry(MessageRecordConfig config, MessageRecorder recorder) throws OseeCoreException; -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/MessageRecordConfig.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/MessageRecordConfig.java deleted file mode 100644 index a60da94ed60..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/MessageRecordConfig.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec; - -import java.util.Collection; -import org.eclipse.osee.ote.message.Message; -import org.eclipse.osee.ote.message.elements.Element; -import org.eclipse.osee.ote.message.enums.DataType; - -public class MessageRecordConfig { - private final Message<?, ?, ?> msg; - private final Element[] headerElements; - private final Element[] bodyElements; - private final DataType type; - private final boolean headerDump; - private final boolean bodyDump; - - public MessageRecordConfig(final Message<?, ?, ?> msg, final DataType type, final boolean headerDump, final Element[] headerElements, final boolean bodyDump, final Element[] bodyElements) { - this.msg = msg; - this.headerElements = headerElements; - this.bodyElements = bodyElements; - this.type = type; - this.headerDump = headerDump; - this.bodyDump = bodyDump; - } - - public MessageRecordConfig(final Message<?, ?, ?> msg, final DataType type, Element[] hdrElements) { - this.msg = msg; - this.headerElements = hdrElements; - Collection<Element> elements = msg.getElements(); - this.bodyElements = elements.toArray(new Element[elements.size()]); - this.type = type; - this.headerDump = true; - this.bodyDump = true; - } - - // public MessageRecordConfig(final Message<?, ? ,?> msg, final MemType type) { - // super(); - // this.msg = msg; - // this.headerElements = msg.getActiveDataSource().getMsgHeader().getElements(); - // Collection<Element> vals = msg.getElementMap().values(); - // this.bodyElements = vals.toArray(new Element[vals.size()]); - // this.type = type; - // } - // - // public MessageRecordConfig(final Message<?, ? ,?> msg, Element[] hdrElements) { - // super(); - // this.msg = msg; - // this.headerElements = hdrElements; - // Collection<Element> vals = msg.getElementMap().values(); - // this.bodyElements = vals.toArray(new Element[vals.size()]); - // this.type = msg.getMemType(); - // } - - public Element[] getBodyElements() { - return bodyElements; - } - - public Element[] getHeaderElements() { - return headerElements; - } - - public boolean getBodyDump() { - return bodyDump; - } - - public boolean getHeaderDump() { - return headerDump; - } - - public Message<?, ?, ?> getMsg() { - return msg; - } - - public DataType getType() { - return type; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/MessageRecorder.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/MessageRecorder.java deleted file mode 100644 index 87e6a25b2ab..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/MessageRecorder.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.nio.channels.WritableByteChannel; -import java.util.ArrayList; -import java.util.Collection; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; -import java.util.logging.Level; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.logging.OseeLog; -import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface; -import org.eclipse.osee.ote.core.internal.Activator; -import org.eclipse.osee.ote.message.MessageSystemTestEnvironment; -import org.eclipse.osee.ote.message.tool.rec.entry.IMessageEntry; - -public class MessageRecorder { - private static final int NUM_BUFFERS = 3; - private WritableByteChannel channel; - - private final ArrayList<IMessageEntry> msgsToRecord = new ArrayList<>(64); - private final Lock recLock = new ReentrantLock(); - private volatile boolean isRecording = false; - private final IMessageEntryFactory factory; - - private final ExecutorService taskHandler = Executors.newFixedThreadPool(2); - private final ArrayBlockingQueue<ByteBuffer> bufferQueue = new ArrayBlockingQueue<>(NUM_BUFFERS); - - public MessageRecorder(IMessageEntryFactory factory) { - this.factory = factory; - try { - for (int i = 0; i < NUM_BUFFERS; i++) { - bufferQueue.put(ByteBuffer.allocateDirect(256000)); - } - } catch (InterruptedException e) { - // this should be absolutely impossible - throw new Error("What on Earth has happened here!", e); - } - } - - public void startRecording(Collection<MessageRecordConfig> list, WritableByteChannel channel) throws OseeCoreException { - if (list == null) { - throw new IllegalArgumentException("list cannot be null"); - } - if (channel == null) { - throw new IllegalArgumentException("channel cannot be null"); - } - recLock.lock(); - try { - this.channel = channel; - for (MessageRecordConfig config : list) { - IMessageEntry handler = factory.createMessageEntry(config, this); - msgsToRecord.add(handler); - handler.enable(true); - } - OseeLog.log(MessageSystemTestEnvironment.class, Level.INFO, "recording " + list.size() + "messages"); - isRecording = true; - } finally { - recLock.unlock(); - } - } - - public ByteBuffer acquireOutputBuffer() throws InterruptedException { - return bufferQueue.take(); - } - - public void releaseOutputBuffer(ByteBuffer buffer) throws InterruptedException { - bufferQueue.put(buffer); - } - - public WritableByteChannel getChannel() { - return channel; - } - - public Future<?> submitTask(Runnable task) { - return taskHandler.submit(task); - } - - public boolean isRecording() { - return isRecording; - } - - public void stopRecording(boolean closeOutputChannel) throws IOException { - OseeLog.log(MessageSystemTestEnvironment.class, Level.INFO, "stopping message recorder..."); - isRecording = false; - recLock.lock(); - try { - for (IMessageEntry handler : msgsToRecord) { - handler.enable(false); - } - msgsToRecord.clear(); - if (closeOutputChannel) { - channel.close(); - } - } finally { - recLock.unlock(); - OseeLog.log(MessageSystemTestEnvironment.class, Level.INFO, "message recorder stopped"); - } - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/RecUtil.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/RecUtil.java deleted file mode 100644 index 9f83a0408ca..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/RecUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec; - -import java.nio.ByteBuffer; - -/** - * @author Ken J. Aguilar - */ -public class RecUtil { - private static final int ASCII_A_ADDITIVE = 'A' - 10; - private static final int ASCII_0_ADDITIVE = '0'; - - /** - * a very fast way of converting a byte into a two digit, zero padded hex value that is written directly into a byte - * buffer - */ - public static void byteToAsciiHex(byte byteValue, ByteBuffer buffer) { - int value = byteValue & 0xFF; - int code = value >>> 4; - code += code >= 10 ? ASCII_A_ADDITIVE : ASCII_0_ADDITIVE; - buffer.put((byte) code); - code = value & 0x0F; - code += code >= 10 ? ASCII_A_ADDITIVE : ASCII_0_ADDITIVE; - buffer.put((byte) code); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/ArrayElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/ArrayElementEntry.java deleted file mode 100644 index 057bffc673e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/ArrayElementEntry.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.ArrayElement; -import org.eclipse.osee.ote.message.tool.rec.RecUtil; - -public class ArrayElementEntry implements IElementEntry { - - private final ArrayElement element; - private final byte[] nameAsBytes; - private static final byte[] LENGTH_BYTES = ".LENGTH".getBytes(); - - public ArrayElementEntry(ArrayElement element) { - this.element = element; - nameAsBytes = element.getElementPathAsString().getBytes(); - } - - @Override - public ArrayElement getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - int msgLimit = limit - element.getArrayStartOffset(); - int length = element.getArrayEndOffset() - element.getArrayStartOffset(); - length = msgLimit < length ? msgLimit : length; - buffer.put(nameAsBytes).put(LENGTH_BYTES).put(COMMA).put(Integer.toString(length).getBytes()).put(COMMA).put( - nameAsBytes).put(COMMA); - for (int i = 0; i < length; i++) { - RecUtil.byteToAsciiHex(element.getValue(mem, i), buffer); - buffer.put((byte) ' '); - } - buffer.put(COMMA); - } - - public static void main(String[] args) { - ByteBuffer buffer = ByteBuffer.allocate(100); - - RecUtil.byteToAsciiHex((byte) 21, buffer); - buffer.put((byte) ' '); - RecUtil.byteToAsciiHex((byte) 255, buffer); - buffer.put((byte) ' '); - RecUtil.byteToAsciiHex((byte) 1, buffer); - buffer.put((byte) ' '); - RecUtil.byteToAsciiHex((byte) 254, buffer); - buffer.put((byte) ' '); - RecUtil.byteToAsciiHex((byte) 128, buffer); - buffer.put((byte) ' '); - RecUtil.byteToAsciiHex((byte) 16, buffer); - buffer.put((byte) ' '); - RecUtil.byteToAsciiHex((byte) 17, buffer); - buffer.put((byte) ' '); - RecUtil.byteToAsciiHex((byte) 0, buffer); - buffer.put((byte) ' '); - RecUtil.byteToAsciiHex((byte) 12, buffer); - buffer.flip(); - byte[] data = new byte[buffer.remaining()]; - buffer.get(data); - String ascii = new String(data); - System.out.println(ascii); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/BooleanElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/BooleanElementEntry.java deleted file mode 100644 index 2d000429981..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/BooleanElementEntry.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.BooleanElement; - -public class BooleanElementEntry implements IElementEntry { - - private final BooleanElement element; - private final byte[] nameAsBytes; - - public BooleanElementEntry(BooleanElement element) { - this.element = element; - StringBuilder sb = new StringBuilder(); - for (int i = 1; i < element.getElementPath().size(); i++) { - sb.append(element.getElementPath().get(i)); - } - nameAsBytes = sb.toString().getBytes(); - // nameAsBytes = element.getName().getBytes(); - } - - @Override - public BooleanElement getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - buffer.put(nameAsBytes).put(COMMA).put(element.valueOf(mem).toString().getBytes()).put(COMMA); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/CharElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/CharElementEntry.java deleted file mode 100644 index 6bca2c0c461..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/CharElementEntry.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.CharElement; - -/** - * @author Ken J. Aguilar - */ -public class CharElementEntry implements IElementEntry { - - private final CharElement element; - private final byte[] nameAsBytes; - - public CharElementEntry(CharElement element) { - this.element = element; - nameAsBytes = element.getName().getBytes(); - } - - @Override - public CharElement getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - buffer.put(nameAsBytes).put(COMMA).put((byte) element.valueOf(mem).charValue()).put(COMMA); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/EmptyEnumEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/EmptyEnumEntry.java deleted file mode 100644 index 68d1d3021da..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/EmptyEnumEntry.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.Element; -import org.eclipse.osee.ote.message.elements.EmptyEnum_Element; - -/** - * @author Ken J. Aguilar - */ -public class EmptyEnumEntry implements IElementEntry { - - private final EmptyEnum_Element element; - private final byte[] nameAsBytes; - - public EmptyEnumEntry(final EmptyEnum_Element element) { - this.element = element; - nameAsBytes = element.getName().getBytes(); - } - - @Override - public Element getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - buffer.put(nameAsBytes).put(COMMA).put(element.valueOf(mem).toString().getBytes()).put(COMMA); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/EnumeratedElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/EnumeratedElementEntry.java deleted file mode 100644 index 750a3785e22..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/EnumeratedElementEntry.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.EnumeratedElement; -import org.eclipse.osee.ote.message.elements.IEnumValue; - -public class EnumeratedElementEntry implements IElementEntry { - - private final byte[] nameAsBytes; - private final byte[][] valueToBytes; - private final EnumeratedElement<?> element; - private static final byte[] SPACE_LEFT_PAREN = new byte[] {' ', '('}; - - public EnumeratedElementEntry(EnumeratedElement<?> element) { - this.element = element; - nameAsBytes = element.getElementPathAsString().getBytes(); - valueToBytes = new byte[element.getEnumValues().length][]; - for (Enum<?> val : element.getEnumValues()) { - valueToBytes[val.ordinal()] = val.name().getBytes(); - } - } - - @Override - public EnumeratedElement<?> getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - Enum<?> val = element.valueOf(mem); - byte[] bytes = Integer.toString(((IEnumValue<?>) val).getIntValue()).getBytes(); - buffer.put(nameAsBytes).put(COMMA).put(valueToBytes[val.ordinal()]); - buffer.put(SPACE_LEFT_PAREN).put(bytes).put(RIGHT_PAREN).put(COMMA); - - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/IElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/IElementEntry.java deleted file mode 100644 index 15f42214006..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/IElementEntry.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.Element; - -public interface IElementEntry { - public static final byte COMMA = ','; - public static final byte EQUALS = '='; - public static final byte LEFT_PAREN = '('; - public static final byte RIGHT_PAREN = ')'; - public static final byte TICK = '\''; - - public Element getElement(); - - public void write(ByteBuffer buffer, MemoryResource mem, int limit); - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/IMessageEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/IMessageEntry.java deleted file mode 100644 index a391ca72911..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/IMessageEntry.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import org.eclipse.osee.ote.message.listener.IOSEEMessageListener; - -public interface IMessageEntry extends IOSEEMessageListener { - public void enable(boolean enable); -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/IntegerElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/IntegerElementEntry.java deleted file mode 100644 index 21320146636..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/IntegerElementEntry.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.IntegerElement; - -public class IntegerElementEntry implements IElementEntry { - - private final IntegerElement element; - private final byte[] nameAsBytes; - - public IntegerElementEntry(IntegerElement element) { - this.element = element; - nameAsBytes = element.getElementPathAsString().getBytes(); - } - - @Override - public IntegerElement getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - buffer.put(nameAsBytes).put(COMMA).put(element.valueOf(mem).toString().getBytes()).put(COMMA); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/LongIntegerElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/LongIntegerElementEntry.java deleted file mode 100644 index c2736681299..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/LongIntegerElementEntry.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.LongIntegerElement; - -public class LongIntegerElementEntry implements IElementEntry { - - private final LongIntegerElement element; - private final byte[] nameAsBytes; - - public LongIntegerElementEntry(LongIntegerElement element) { - this.element = element; - nameAsBytes = element.getElementPathAsString().getBytes(); - } - - @Override - public LongIntegerElement getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - buffer.put(nameAsBytes).put(COMMA).put(element.valueOf(mem).toString().getBytes()).put(COMMA); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/RealElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/RealElementEntry.java deleted file mode 100644 index 31b61dba3ff..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/RealElementEntry.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.RealElement; - -public class RealElementEntry implements IElementEntry { - - private final RealElement element; - private final byte[] nameAsBytes; - - public RealElementEntry(RealElement element) { - this.element = element; - nameAsBytes = element.getElementPathAsString().getBytes(); - } - - @Override - public RealElement getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - buffer.put(nameAsBytes).put(COMMA).put(element.valueOf(mem).toString().getBytes()).put(COMMA); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/RecordElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/RecordElementEntry.java deleted file mode 100644 index 90bb82667d9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/RecordElementEntry.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import java.util.Collection; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.Element; -import org.eclipse.osee.ote.message.elements.RecordElement; -import org.eclipse.osee.ote.message.tool.rec.ElementEntryFactory; - -public class RecordElementEntry implements IElementEntry { - - private final RecordElement element; - private final IElementEntry[] entries; - private final byte[] nameAsBytes; - - public RecordElementEntry(RecordElement element) { - this.element = element; - nameAsBytes = element.getName().getBytes(); - Collection<Element> elements = element.getElementMap().values(); - entries = new IElementEntry[elements.size()]; - int i = 0; - for (Element elem : elements) { - entries[i] = ElementEntryFactory.createEntry(elem); - i++; - } - } - - @Override - public RecordElement getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - // for (IElementEntry entry : entries) { - // if (entry.getElement().getByteOffset() < limit) { - // buffer.put(nameAsBytes).put((byte)'.'); - // entry.write(buffer, mem, limit); - // buffer.put(COMMA); - // } - // } - } - - public void write(byte[] prefix, ByteBuffer buffer, MemoryResource mem, int limit) { - // for (IElementEntry entry : entries) { - // if (entry.getElement().getByteOffset() < limit) { - // buffer.put(prefix).put(nameAsBytes).put((byte)'.'); - // entry.write(buffer, mem, limit); - // buffer.put(COMMA); - // } - // } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/RecordMapEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/RecordMapEntry.java deleted file mode 100644 index 0126519bf91..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/RecordMapEntry.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.Element; -import org.eclipse.osee.ote.message.elements.RecordElement; -import org.eclipse.osee.ote.message.elements.RecordMap; - -/** - * @author Ken J. Aguilar - */ -public class RecordMapEntry implements IElementEntry { - - private final RecordMap<? extends RecordElement> element; - private final RecordElementEntry[] entries; - - public RecordMapEntry(final RecordMap<? extends RecordElement> element) { - this.element = element; - entries = new RecordElementEntry[element.length()]; - - for (int i = 0; i < element.length(); i++) { - entries[i] = new RecordElementEntry(element.get(i)); - } - } - - @Override - public Element getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - // for (int i = 0; i < element.length(); i++) { - // if (entries[i].getElement().getByteOffset() < limit) { - // final byte[] prefix = String.format("[%d]", i).getBytes(); - // entries[i].write(prefix, buffer, mem, limit); - // buffer.put(COMMA); - // } - // } - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/SignedInteger16ElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/SignedInteger16ElementEntry.java deleted file mode 100644 index 85a289b97e4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/SignedInteger16ElementEntry.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.SignedInteger16Element; - -public class SignedInteger16ElementEntry implements IElementEntry { - - private final SignedInteger16Element element; - private final byte[] nameAsBytes; - - public SignedInteger16ElementEntry(SignedInteger16Element element) { - this.element = element; - nameAsBytes = element.getName().getBytes(); - } - - @Override - public SignedInteger16Element getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - buffer.put(nameAsBytes).put(COMMA).put(element.valueOf(mem).toString().getBytes()).put(COMMA); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/StringElementEntry.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/StringElementEntry.java deleted file mode 100644 index a62cb1a89ea..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/rec/entry/StringElementEntry.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.message.tool.rec.entry; - -import java.nio.ByteBuffer; -import org.eclipse.osee.ote.message.data.MemoryResource; -import org.eclipse.osee.ote.message.elements.StringElement; - -public class StringElementEntry implements IElementEntry { - - private final StringElement element; - private final byte[] nameAsBytes; - - public StringElementEntry(final StringElement element) { - this.element = element; - nameAsBytes = element.getName().getBytes(); - } - - @Override - public StringElement getElement() { - return element; - } - - @Override - public void write(ByteBuffer buffer, MemoryResource mem, int limit) { - mem.setOffset(element.getMsgData().getMem().getOffset()); - buffer.put(nameAsBytes).put(COMMA).put(TICK).put(element.valueOf(mem).getBytes()).put(TICK).put(COMMA); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/AVAILABLE_PHYSICAL_TYPES_REQ.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/AVAILABLE_PHYSICAL_TYPES_REQ.java deleted file mode 100644 index 3188e5667b6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/AVAILABLE_PHYSICAL_TYPES_REQ.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class AVAILABLE_PHYSICAL_TYPES_REQ extends OteEventMessage { - - public static String TOPIC = "ote/message/availabletypesreq"; - - public AVAILABLE_PHYSICAL_TYPES_REQ() { - super("AVAILABLE_PHYSICAL_TYPES_REQ", TOPIC, 0); - - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/BooleanResponse.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/BooleanResponse.java deleted file mode 100644 index f9a161f5f28..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/BooleanResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.BooleanElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class BooleanResponse extends OteEventMessage { - - public static String TOPIC = "ote/message/boolresponse"; - - private static int SIZE = 1; - - public BooleanElement VALUE; - - public BooleanResponse() { - super("MESSAGE_META_DATA_STAT", TOPIC, SIZE); - VALUE = new BooleanElement(this, "IS_SCHEDULED", getDefaultMessageData(), 0, 0, 7); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConfigurationAndResponse.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConfigurationAndResponse.java deleted file mode 100644 index 44aa10aabe6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConfigurationAndResponse.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import java.io.Serializable; - -import org.eclipse.osee.ote.Configuration; - -public class ConfigurationAndResponse implements Serializable { - - private static final long serialVersionUID = 8496858852630392143L; - - private final String address; - private final int port; - private final boolean install; - private final Configuration configuration; - private final String id; - - public ConfigurationAndResponse(String address, int port, Configuration configuration, boolean install, String id){ - this.address = address; - this.port = port; - this.configuration = configuration; - this.install = install; - this.id = id; - } - - public String getAddress(){ - return address; - } - - public int getPort(){ - return port; - } - - public Configuration getConfiguration(){ - return configuration; - } - - public boolean install(){ - return install; - } - - public String getId(){ - return id; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConsoleInputMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConsoleInputMessage.java deleted file mode 100644 index 7162047b920..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConsoleInputMessage.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -public class ConsoleInputMessage extends ConsoleMessage { - - public static String TOPIC = "ote/message/consoleinput"; - - public ConsoleInputMessage() { - super(ConsoleInputMessage.class.getSimpleName(), TOPIC); - } -} - - diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConsoleMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConsoleMessage.java deleted file mode 100644 index 9038b7ff74e..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConsoleMessage.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import org.eclipse.osee.ote.message.elements.ArrayElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - - -public class ConsoleMessage extends OteEventMessage { - - public static final int _BYTE_SIZE = 0; - public ArrayElement STRINGDATA; - - public ConsoleMessage(String name, String topic) { - super(ConsoleMessage.class.getSimpleName(), topic, _BYTE_SIZE); - STRINGDATA = new ArrayElement(this, "STRINGDATA", getDefaultMessageData(), 0, 0, 0); - addElements(STRINGDATA); - } - - public void setString(String str) throws IOException{ - byte[] data = str.getBytes(); - int offset = STRINGDATA.getByteOffset() + getHeaderSize(); - byte[] newData = new byte[data.length + offset]; - System.arraycopy(getData(), 0, newData, 0, offset); - System.arraycopy(data, 0, newData, offset, data.length); - getDefaultMessageData().setNewBackingBuffer(newData); - } - - public String getString() throws IOException, ClassNotFoundException{ - int offset = STRINGDATA.getByteOffset() + getHeaderSize(); - byte[] stringData = new byte[getData().length - offset]; - System.arraycopy(getData(), offset, stringData, 0, stringData.length); - return new String(stringData); - } - - public void setStringData(ByteBuffer buffer) { - int offset = STRINGDATA.getByteOffset() + getHeaderSize(); - byte[] newData = new byte[buffer.remaining() + offset]; - System.arraycopy(getData(), 0, newData, 0, offset); - buffer.get(newData, offset, buffer.remaining()); - getDefaultMessageData().setNewBackingBuffer(newData); - } -} - - diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConsoleOutputMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConsoleOutputMessage.java deleted file mode 100644 index 40cfcea7c61..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/ConsoleOutputMessage.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - - -public class ConsoleOutputMessage extends ConsoleMessage { - - public static String TOPIC = "ote/message/consoleoutput"; - - public ConsoleOutputMessage() { - super(ConsoleOutputMessage.class.getSimpleName(), TOPIC); - } - -} - - diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/DisconnectRemoteTestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/DisconnectRemoteTestEnvironment.java deleted file mode 100644 index 5f02abb23f0..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/DisconnectRemoteTestEnvironment.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import java.io.Serializable; -import java.util.UUID; - -public class DisconnectRemoteTestEnvironment implements Serializable { - - private static final long serialVersionUID = 1100894850334052780L; - - private UUID id; - - public DisconnectRemoteTestEnvironment(UUID id){ - this.id = id; - } - - public UUID getId() { - return id; - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/GET_INET_ADDRESS_REQ.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/GET_INET_ADDRESS_REQ.java deleted file mode 100644 index 3cdb9e96fe4..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/GET_INET_ADDRESS_REQ.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.EnumeratedElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class GET_INET_ADDRESS_REQ extends OteEventMessage { - - public static String TOPIC = "ote/message/addressreq"; - - public final EnumeratedElement<SOCKET_ID> SOCKET_ID; - - public GET_INET_ADDRESS_REQ() { - super("GET_INET_ADDRESS_REQ", TOPIC, 1); - SOCKET_ID = createEnumeratedElement("SOCKET_ID", 1, SOCKET_ID.class); - - getDefaultMessageData().getMsgHeader().RESPONSE_TOPIC.setValue(GET_INET_ADDRESS_RESP.TOPIC); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/GET_INET_ADDRESS_RESP.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/GET_INET_ADDRESS_RESP.java deleted file mode 100644 index 75c51b457ff..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/GET_INET_ADDRESS_RESP.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.EnumeratedElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.SOCKET_ADDRESS_RECORD; - -public class GET_INET_ADDRESS_RESP extends OteEventMessage { - - public static String TOPIC = "ote/message/addressresp"; - - public final EnumeratedElement<SOCKET_ID> SOCKET_ID; - public final SOCKET_ADDRESS_RECORD ADDRESS; - - public GET_INET_ADDRESS_RESP() { - super("GET_INET_ADDRESS_RESP", TOPIC, 22); - SOCKET_ID = createEnumeratedElement("SOCKET_ID", 1, SOCKET_ID.class); - ADDRESS = new SOCKET_ADDRESS_RECORD(this, "ADDRESS", getDefaultMessageData(), 1, 0, SOCKET_ADDRESS_RECORD.SIZE*8-1); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/JobStatus.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/JobStatus.java deleted file mode 100644 index 4096e0bab1c..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/JobStatus.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import java.io.Serializable; -import java.net.URL; - -public class JobStatus implements Serializable { - - private static final long serialVersionUID = -5316721802558614714L; - private URL updatedJobStatus; - private String jobId; - - private int totalUnitsOfWork; - private int unitsWorked; - private String errorLog; - private boolean jobComplete; - private boolean success; - - public JobStatus(){ - errorLog = ""; - jobComplete = false; - success = true; - totalUnitsOfWork = 0; - unitsWorked = 0; - } - - public int getTotalUnitsOfWork() { - return totalUnitsOfWork; - } - - public int getUnitsWorked() { - return unitsWorked; - } - - public String getErrorLog() { - return errorLog; - } - - public boolean isJobComplete() { - return jobComplete; - } - - public void setTotalUnitsOfWork(int i) { - totalUnitsOfWork = i; - } - - public void jobComplete() { - jobComplete = true; - } - - public void incrememtUnitsWorked() { - unitsWorked++; - } - - public void setUnitsWorked(int unitsWorked) { - this.unitsWorked = unitsWorked; - } - - public void setErrorLog(String log) { - this.errorLog = log; - } - - public void setJobComplete(boolean jobComplete) { - this.jobComplete = jobComplete; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public URL getUpdatedJobStatus() { - return updatedJobStatus; - } - - public void setUpdatedJobStatus(URL updatedJobStatus) { - this.updatedJobStatus = updatedJobStatus; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/MESSAGE_META_DATA_STAT.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/MESSAGE_META_DATA_STAT.java deleted file mode 100644 index 8fcde751b4d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/MESSAGE_META_DATA_STAT.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.BooleanElement; -import org.eclipse.osee.ote.message.elements.Float64Element; -import org.eclipse.osee.ote.message.elements.RealElement; -import org.eclipse.osee.ote.message.elements.StringElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class MESSAGE_META_DATA_STAT extends OteEventMessage { - - public static String TOPIC = "ote/message/metadatastat"; - - private static int SIZE = 256+4+1; - - public StringElement MESSAGE; - public BooleanElement IS_SCHEDULED; - public RealElement RATE; - - public MESSAGE_META_DATA_STAT() { - super("MESSAGE_META_DATA_STAT", TOPIC, SIZE); - MESSAGE = new StringElement(this, "MESSAGE", getDefaultMessageData(), 0, 0, OteEventMessage.sizeBytesBits(256)); - IS_SCHEDULED = new BooleanElement(this, "IS_SCHEDULED", getDefaultMessageData(), MESSAGE.getByteOffset()+MESSAGE.getBitLength()/8, 0, 7); - RATE = new Float64Element(this, "IS_WRITER", getDefaultMessageData(), IS_SCHEDULED.getByteOffset()+IS_SCHEDULED.getBitLength()/8, 0, 63); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RequestHostEnvironmentProperties.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RequestHostEnvironmentProperties.java deleted file mode 100644 index 052e615ad05..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RequestHostEnvironmentProperties.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class RequestHostEnvironmentProperties extends OteEventMessage { - - public static String TOPIC = "ote/message/propertiesreq"; - - public RequestHostEnvironmentProperties() { - super("RequestHostEnvironmentProperties", TOPIC, 1); - - getDefaultMessageData().getMsgHeader().RESPONSE_TOPIC.setValue(SerializedEnhancedProperties.EVENT); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RequestRemoteTestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RequestRemoteTestEnvironment.java deleted file mode 100644 index a3f4a8309e6..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RequestRemoteTestEnvironment.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import java.io.Serializable; -import java.util.UUID; - -import org.eclipse.osee.ote.core.IRemoteUserSession; -import org.eclipse.osee.ote.core.environment.TestEnvironmentConfig; - -public class RequestRemoteTestEnvironment implements Serializable { - - private static final long serialVersionUID = -6720107128761044291L; - - private IRemoteUserSession session; - private UUID id; - private TestEnvironmentConfig config; - - public RequestRemoteTestEnvironment(IRemoteUserSession session, UUID id, TestEnvironmentConfig config){ - this.session = session; - this.id = id; - this.config = config; - } - - public IRemoteUserSession getSession() { - return session; - } - - public UUID getId() { - return id; - } - - public TestEnvironmentConfig getConfig() { - return config; - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsCancel.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsCancel.java deleted file mode 100644 index d4889eab263..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsCancel.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.BooleanElement; -import org.eclipse.osee.ote.message.elements.StringElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class RunTestsCancel extends OteEventMessage { - - public static String TOPIC = "ote/message/runtests/cancel"; - - private static int SIZE = 256+1; - - public StringElement GUID; - public BooleanElement CANCEL_ALL; - - public RunTestsCancel() { - super("MESSAGE_META_DATA_STAT", TOPIC, SIZE); - GUID = new StringElement(this, "GUID", getDefaultMessageData(), 0, 0, OteEventMessage.sizeBytesBits(256)); - CANCEL_ALL = new BooleanElement(this, "CANCEL_ALL", getDefaultMessageData(), GUID.getByteOffset()+GUID.getBitLength()/8, 0, 7); - - getDefaultMessageData().getMsgHeader().RESPONSE_TOPIC.setValue(BooleanResponse.TOPIC); - } - - public RunTestsCancel(byte[] bytes) { - this(); - setData(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsGetCommandResultReq.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsGetCommandResultReq.java deleted file mode 100644 index d5e2f4a4a29..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsGetCommandResultReq.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.StringElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class RunTestsGetCommandResultReq extends OteEventMessage { - - public static String TOPIC = "ote/message/runtests/commandresultreq"; - - private static int SIZE = 256; - - public StringElement GUID; - - public RunTestsGetCommandResultReq() { - super("MESSAGE_META_DATA_STAT", TOPIC, SIZE); - GUID = new StringElement(this, "MESSAGE", getDefaultMessageData(), 0, 0, OteEventMessage.sizeBytesBits(256)); - getDefaultMessageData().getMsgHeader().RESPONSE_TOPIC.setValue(BooleanResponse.TOPIC); - } - - public RunTestsGetCommandResultReq(byte[] bytes) { - this(); - setData(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsGetCommandResultResp.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsGetCommandResultResp.java deleted file mode 100644 index cfc1c6e549a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsGetCommandResultResp.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.framework.command.ITestCommandResult; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class RunTestsGetCommandResultResp extends SerializedClassMessage<ITestCommandResult> { - - public static final String TOPIC = "ote/message/runtests/commandresultresp"; - - public RunTestsGetCommandResultResp() { - super(TOPIC); - } - - public RunTestsGetCommandResultResp(ITestCommandResult commandAdded) throws IOException { - super(TOPIC, commandAdded); - } - - public RunTestsGetCommandResultResp(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsIsCancelled.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsIsCancelled.java deleted file mode 100644 index cc8aec621a1..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsIsCancelled.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.StringElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class RunTestsIsCancelled extends OteEventMessage { - - public static String TOPIC = "ote/message/runtests/iscanceled"; - - private static int SIZE = 256; - - public StringElement GUID; - - public RunTestsIsCancelled() { - super("MESSAGE_META_DATA_STAT", TOPIC, SIZE); - GUID = new StringElement(this, "MESSAGE", getDefaultMessageData(), 0, 0, OteEventMessage.sizeBytesBits(256)); - - getDefaultMessageData().getMsgHeader().RESPONSE_TOPIC.setValue(BooleanResponse.TOPIC); - } - - public RunTestsIsCancelled(byte[] bytes) { - this(); - setData(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsIsDone.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsIsDone.java deleted file mode 100644 index 5ad7b3cfdfe..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsIsDone.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.StringElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class RunTestsIsDone extends OteEventMessage { - - public static String TOPIC = "ote/message/runtests/isdone"; - - private static int SIZE = 256; - - public StringElement GUID; - - public RunTestsIsDone() { - super("MESSAGE_META_DATA_STAT", TOPIC, SIZE); - GUID = new StringElement(this, "MESSAGE", getDefaultMessageData(), 0, 0, OteEventMessage.sizeBytesBits(256)); - - getDefaultMessageData().getMsgHeader().RESPONSE_TOPIC.setValue(BooleanResponse.TOPIC); - } - - public RunTestsIsDone(byte[] bytes) { - this(); - setData(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsSerialized.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsSerialized.java deleted file mode 100644 index 12c3a6ebebf..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/RunTestsSerialized.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* -ConfigurationAndResponse * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.framework.command.RunTests; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class RunTestsSerialized extends SerializedClassMessage<RunTests> { - - public static final String RUNTESTS_NAMESPACE = "ote/message/runtests/"; - public static final String TOPIC = RUNTESTS_NAMESPACE + "serialized"; - - public RunTestsSerialized() { - super(TOPIC); - } - - public RunTestsSerialized(RunTests commandAdded) throws IOException { - super(TOPIC, commandAdded); - } - - public RunTestsSerialized(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SOCKET_ID.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SOCKET_ID.java deleted file mode 100644 index 550e9395423..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SOCKET_ID.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE - */ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.IEnumValue; - -public enum SOCKET_ID implements IEnumValue<SOCKET_ID> { - - MSG_UPDATES(0), - RECORDER(1), - - __UNDEFINED(-99999); - - private int value; - private static int maxValue = 0; - - private static SOCKET_ID[] lbaValues; - private static SOCKET_ID[] lookup = null; - - static { - lbaValues(); - if(maxValue < 32000){ - lookup = new SOCKET_ID[maxValue + 1]; - for(int i = 0; i < lbaValues.length; i++){ - lookup[lbaValues[i].value] = lbaValues[i]; - } - } - } - - private SOCKET_ID(int value) { - this.value = value; - } - - @Override - public int getIntValue(){ - return value; - } - - public static SOCKET_ID toEnum(int value){ - if(lookup == null){ - for(SOCKET_ID myEnum: values()){ - if(myEnum.getIntValue() == value){ - return myEnum; - } - } - __UNDEFINED.value = value; - return __UNDEFINED; - } else if(value < 0 || value >= lookup.length ){ - __UNDEFINED.value = value; - return __UNDEFINED; - } else { - SOCKET_ID enumeration = lookup[value]; - if(enumeration == null){ - __UNDEFINED.value = value; - return __UNDEFINED; - } else { - return enumeration; - } - } - } - - @Override - public SOCKET_ID getEnum(int value){ - return toEnum(value); - } - - public static SOCKET_ID[] lbaValues(){ - if(lbaValues == null){ - int count = 0; - lbaValues = new SOCKET_ID[values().length-1]; - for(SOCKET_ID myEnum: values()){ - if(!"__UNDEFINED".equals(myEnum.name())){ - lbaValues[count++] = myEnum; - if(myEnum.value > maxValue){ - maxValue = myEnum.value; - } - } - } - } - return lbaValues; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/STOP_RECORDING_CMD.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/STOP_RECORDING_CMD.java deleted file mode 100644 index 079a1021b15..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/STOP_RECORDING_CMD.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class STOP_RECORDING_CMD extends OteEventMessage { - - public static String TOPIC = "ote/message/recordstop"; - - public STOP_RECORDING_CMD() { - super("STOP_RECORDING_CMD", TOPIC, 0); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedAvailablePhysicalTypesMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedAvailablePhysicalTypesMessage.java deleted file mode 100644 index 24b8a1b45fc..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedAvailablePhysicalTypesMessage.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* -ConfigurationAndResponse * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; -import java.util.HashSet; - -import org.eclipse.osee.ote.message.enums.DataType; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedAvailablePhysicalTypesMessage extends SerializedClassMessage<HashSet<DataType>> { - - public static final String EVENT = "ote/message/serialavailabletypes"; - - public SerializedAvailablePhysicalTypesMessage() { - super(EVENT); - } - - public SerializedAvailablePhysicalTypesMessage(HashSet<DataType> commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedAvailablePhysicalTypesMessage(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedConfigurationAndResponse.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedConfigurationAndResponse.java deleted file mode 100644 index c53cb9e79b3..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedConfigurationAndResponse.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* -ConfigurationAndResponse * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedConfigurationAndResponse extends SerializedClassMessage<ConfigurationAndResponse> { - - public static final String EVENT = "ote/message/serialconfigandresponse"; - - public SerializedConfigurationAndResponse() { - super(EVENT); - } - - public SerializedConfigurationAndResponse(ConfigurationAndResponse commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedConfigurationAndResponse(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedConnectionRequestResult.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedConnectionRequestResult.java deleted file mode 100644 index 1fed3167976..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedConnectionRequestResult.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.core.ConnectionRequestResult; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedConnectionRequestResult extends SerializedClassMessage<ConnectionRequestResult> { - - public static final String EVENT = "ote/message/connectionrequestresult"; - - public SerializedConnectionRequestResult() { - super(EVENT); - } - - public SerializedConnectionRequestResult(ConnectionRequestResult commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedConnectionRequestResult(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedDisconnectRemoteTestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedDisconnectRemoteTestEnvironment.java deleted file mode 100644 index c9f0c396cf9..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedDisconnectRemoteTestEnvironment.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedDisconnectRemoteTestEnvironment extends SerializedClassMessage<DisconnectRemoteTestEnvironment> { - - public static final String TOPIC = "ote/message/serialdisconnecttestenv"; - - public SerializedDisconnectRemoteTestEnvironment() { - super(TOPIC); - } - - public SerializedDisconnectRemoteTestEnvironment(DisconnectRemoteTestEnvironment commandAdded) throws IOException { - super(TOPIC, commandAdded); - } - - public SerializedDisconnectRemoteTestEnvironment(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedEnhancedProperties.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedEnhancedProperties.java deleted file mode 100644 index 9552f8f091d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedEnhancedProperties.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* -ConfigurationAndResponse * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.framework.jdk.core.util.EnhancedProperties; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedEnhancedProperties extends SerializedClassMessage<EnhancedProperties> { - - public static final String EVENT = "ote/message/enhancedproperties"; - - public SerializedEnhancedProperties() { - super(EVENT); - } - - public SerializedEnhancedProperties(EnhancedProperties commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedEnhancedProperties(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedOTEJobStatus.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedOTEJobStatus.java deleted file mode 100644 index 8fbf3de278f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedOTEJobStatus.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedOTEJobStatus extends SerializedClassMessage<JobStatus> { - - public static final String EVENT = "ote/message/otejobstatus"; - - public SerializedOTEJobStatus() { - super(EVENT); - } - - public SerializedOTEJobStatus(JobStatus commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedOTEJobStatus(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedRecordCommandMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedRecordCommandMessage.java deleted file mode 100644 index 90daafc852b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedRecordCommandMessage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.commands.RecordCommand; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedRecordCommandMessage extends SerializedClassMessage<RecordCommand> { - - public static final String EVENT = "ote/message/recordstart"; - - public SerializedRecordCommandMessage() { - super(EVENT); - } - - public SerializedRecordCommandMessage(RecordCommand commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedRecordCommandMessage(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedRequestRemoteTestEnvironment.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedRequestRemoteTestEnvironment.java deleted file mode 100644 index b321c215123..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedRequestRemoteTestEnvironment.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedRequestRemoteTestEnvironment extends SerializedClassMessage<RequestRemoteTestEnvironment> { - - public static final String TOPIC = "ote/message/serialrequesttestenv"; - - public SerializedRequestRemoteTestEnvironment() { - super(TOPIC); - - getHeader().RESPONSE_TOPIC.setValue(SerializedConnectionRequestResult.EVENT); - } - - public SerializedRequestRemoteTestEnvironment(RequestRemoteTestEnvironment commandAdded) throws IOException { - super(TOPIC, commandAdded); - } - - public SerializedRequestRemoteTestEnvironment(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedSetElementMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedSetElementMessage.java deleted file mode 100644 index 0f6ba56075a..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedSetElementMessage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.commands.SetElementValue; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedSetElementMessage extends SerializedClassMessage<SetElementValue> { - - public static final String EVENT = "ote/message/setelement"; - - public SerializedSetElementMessage() { - super(EVENT); - } - - public SerializedSetElementMessage(SetElementValue commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedSetElementMessage(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedSubscribeToMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedSubscribeToMessage.java deleted file mode 100644 index ad86df85531..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedSubscribeToMessage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.commands.SubscribeToMessage; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedSubscribeToMessage extends SerializedClassMessage<SubscribeToMessage> { - - public static final String EVENT = "ote/message/subscriptiondetails"; - - public SerializedSubscribeToMessage() { - super(EVENT); - } - - public SerializedSubscribeToMessage(SubscribeToMessage commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedSubscribeToMessage(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedSubscriptionDetailsMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedSubscriptionDetailsMessage.java deleted file mode 100644 index 5845874300d..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedSubscriptionDetailsMessage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.event.SerializedClassMessage; -import org.eclipse.osee.ote.message.tool.SubscriptionDetails; - -public class SerializedSubscriptionDetailsMessage extends SerializedClassMessage<SubscriptionDetails> { - - public static final String EVENT = "ote/message/subscribeserial"; - - public SerializedSubscriptionDetailsMessage() { - super(EVENT); - } - - public SerializedSubscriptionDetailsMessage(SubscriptionDetails commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedSubscriptionDetailsMessage(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedUnSubscribeMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedUnSubscribeMessage.java deleted file mode 100644 index e9665626aed..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedUnSubscribeMessage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.commands.UnSubscribeToMessage; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedUnSubscribeMessage extends SerializedClassMessage<UnSubscribeToMessage> { - - public static final String EVENT = "ote/message/unsubscribeserial"; - - public SerializedUnSubscribeMessage() { - super(EVENT); - } - - public SerializedUnSubscribeMessage(UnSubscribeToMessage commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedUnSubscribeMessage(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedZeroizeElementMessage.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedZeroizeElementMessage.java deleted file mode 100644 index c2fbe5fcd88..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/SerializedZeroizeElementMessage.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Boeing. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boeing - initial API and implementation - *******************************************************************************/ -package org.eclipse.osee.ote.remote.messages; - -import java.io.IOException; - -import org.eclipse.osee.ote.message.commands.ZeroizeElement; -import org.eclipse.osee.ote.message.event.SerializedClassMessage; - -public class SerializedZeroizeElementMessage extends SerializedClassMessage<ZeroizeElement> { - - public static final String EVENT = "ote/message/zeroizeelement"; - - public SerializedZeroizeElementMessage() { - super(EVENT); - } - - public SerializedZeroizeElementMessage(ZeroizeElement commandAdded) throws IOException { - super(EVENT, commandAdded); - } - - public SerializedZeroizeElementMessage(byte[] bytes){ - super(bytes); - } -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/TestEnvironmentServerShutdown.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/TestEnvironmentServerShutdown.java deleted file mode 100644 index 83c3fa2512b..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/TestEnvironmentServerShutdown.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.StringElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class TestEnvironmentServerShutdown extends OteEventMessage { - - public static String TOPIC = "ote/message/servershutdown"; - - private static int SIZE = 512; - - public StringElement SERVER_ID; - - public TestEnvironmentServerShutdown() { - super("TestEnvironmentSetBatchMode", TOPIC, SIZE); - SERVER_ID = new StringElement(this, "SERVER_ID", getDefaultMessageData(), 0, 0, 512*8-1); - } - - public TestEnvironmentServerShutdown(byte[] bytes) { - this(); - setBackingBuffer(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/TestEnvironmentSetBatchMode.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/TestEnvironmentSetBatchMode.java deleted file mode 100644 index 3a496ee2f48..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/TestEnvironmentSetBatchMode.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.BooleanElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; - -public class TestEnvironmentSetBatchMode extends OteEventMessage { - - public static String TOPIC = "ote/message/setbatchmode"; - - private static int SIZE = 1; - - public BooleanElement SET_BATCH_MODE; - - public TestEnvironmentSetBatchMode() { - super("TestEnvironmentSetBatchMode", TOPIC, SIZE); - SET_BATCH_MODE = new BooleanElement(this, "SET_BATCH_MODE", getDefaultMessageData(), 0, 0, 7); - } - - public TestEnvironmentSetBatchMode(byte[] bytes) { - this(); - setBackingBuffer(bytes); - } - -} diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/TestEnvironmentTransferFile.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/TestEnvironmentTransferFile.java deleted file mode 100644 index 6fb5e9e161f..00000000000 --- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/remote/messages/TestEnvironmentTransferFile.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.eclipse.osee.ote.remote.messages; - -import org.eclipse.osee.ote.message.elements.StringElement; -import org.eclipse.osee.ote.message.event.OteEventMessage; -import org.eclipse.osee.ote.message.event.SOCKET_ADDRESS_RECORD; - -public class TestEnvironmentTransferFile extends OteEventMessage { - - public static String TOPIC = "ote/message/transferfile"; - - private static int SIZE = SOCKET_ADDRESS_RECORD.SIZE + 1024; - - public SOCKET_ADDRESS_RECORD ADDRESS; - public StringElement FILE_PATH; - - public TestEnvironmentTransferFile() { - super("TestEnvironmentSetBatchMode", TOPIC, SIZE); - ADDRESS = new SOCKET_ADDRESS_RECORD(this, "ADDRESS", getDefaultMessageData(), 0, 0, SOCKET_ADDRESS_RECORD.SIZE*8-1); - FILE_PATH = new StringElement(this, "FILE_PATH", getDefaultMessageData(), SOCKET_ADDRESS_RECORD.SIZE, 0, 1024*8-1); - } - - public TestEnvironmentTransferFile(byte[] bytes) { - this(); - setBackingBuffer(bytes); - } - -} |