use of org.eclipse.titan.executor.jni.McStateEnum in project titan.EclipsePlug-ins by eclipse.
the class JniExecutor method updateInfoDisplay.
/**
* Updates the information displayed about the MainController's and HostControllers actual states.
*/
private void updateInfoDisplay() {
JNIMiddleWare middleware = jnimw;
McStateEnum mcState = middleware.get_state();
MainControllerElement tempRoot = new MainControllerElement("Temporal root", this);
String mcStateName = middleware.get_mc_state_name(mcState);
tempRoot.setStateInfo(new InformationElement("state: " + mcStateName));
HostControllerElement tempHost;
ComponentStruct comp;
QualifiedName qualifiedName;
ComponentElement tempComponent;
StringBuilder builder;
int nofHosts = middleware.get_nof_hosts();
HostStruct host;
for (int i = 0; i < nofHosts; i++) {
host = middleware.get_host_data(i);
tempHost = new HostControllerElement("Host Controller: ");
tempRoot.addHostController(tempHost);
tempHost.setIPAddressInfo(new InformationElement("IP address: " + host.hostname));
tempHost.setIPNumberInfo(new InformationElement("IP number: " + host.ip_addr));
tempHost.setHostNameInfo(new InformationElement("Local host name:" + host.hostname_local));
tempHost.setOperatingSystemInfo(new InformationElement(host.system_name + " " + host.system_release + " " + host.system_version));
tempHost.setStateInfo(new InformationElement("State: " + middleware.get_hc_state_name(host.hc_state)));
int activeComponents = host.n_active_components;
int[] components = host.components.clone();
middleware.release_data();
for (int component_index = 0; component_index < activeComponents; component_index++) {
comp = middleware.get_component_data(components[component_index]);
tempComponent = new ComponentElement("Component: " + comp.comp_name, new InformationElement("Component reference: " + comp.comp_ref));
tempHost.addComponent(tempComponent);
qualifiedName = comp.comp_type;
if (qualifiedName != null && qualifiedName.definition_name != null) {
builder = new StringBuilder("Component type: ");
if (qualifiedName.module_name != null) {
builder.append(qualifiedName.module_name).append('.');
}
builder.append(qualifiedName.definition_name);
tempComponent.setTypeInfo(new InformationElement(builder.toString()));
}
tempComponent.setStateInfo(new InformationElement(middleware.get_tc_state_name(comp.tc_state)));
qualifiedName = comp.tc_fn_name;
if (qualifiedName.definition_name != null) {
builder = new StringBuilder(comp.comp_ref == 1 ? "test case" : "function");
if (qualifiedName.module_name != null) {
builder.append(qualifiedName.module_name).append('.');
}
builder.append(qualifiedName.definition_name);
tempComponent.setExecutedInfo(new InformationElement(builder.toString()));
}
VerdictTypeEnum localVerdict = comp.local_verdict;
if (localVerdict != null) {
builder = new StringBuilder("local verdict: ");
builder.append(localVerdict.getName());
}
}
}
middleware.release_data();
if (mainControllerRoot != null) {
mainControllerRoot.children().clear();
mainControllerRoot.transferData(tempRoot);
}
if (Activator.getMainView() != null) {
Activator.getMainView().refreshAll();
}
}
use of org.eclipse.titan.executor.jni.McStateEnum in project titan.EclipsePlug-ins by eclipse.
the class JniExecutor method statusChangeCallback.
/**
* Handles a status change reported by the MainController.
*/
@Override
public void statusChangeCallback() {
McStateEnum state = jnimw.get_state();
switch(state.getValue()) {
case MC_LISTENING:
case MC_LISTENING_CONFIGURED:
break;
case MC_HC_CONNECTED:
// 1);
if (shutdownRequested) {
shutdownSession();
} else if (configureRequested) {
configure();
}
break;
case MC_ACTIVE:
if (createMTCRequested) {
createMTC();
} else if (shutdownRequested) {
shutdownSession();
}
break;
case MC_READY:
if (executeList.isEmpty()) {
executeRequested = false;
}
if (executeRequested) {
executeNextTest();
} else if (simpleExecutionRunning || shutdownRequested) {
shutdownSession();
}
break;
case MC_INACTIVE:
if (shutdownRequested) {
shutdownRequested = false;
// session shutdown is finished (requested by jnimw.shutdown_session())
jnimw.terminate_internal();
executeList.clear();
disposeHostControllers();
}
break;
case MC_SHUTDOWN:
break;
default:
}
updateGUI();
}
use of org.eclipse.titan.executor.jni.McStateEnum in project titan.EclipsePlug-ins by eclipse.
the class JniExecutor method terminate.
@Override
public void terminate(final boolean external) {
McStateEnum state = jnimw.get_state();
if (MC_INACTIVE == state.getValue()) {
setRunning(false);
isTerminated = true;
if (mainControllerRoot != null) {
mainControllerRoot.setTerminated();
LaunchElement launchElement = null;
for (Map.Entry<ILaunch, BaseExecutor> entry : ExecutorStorage.getExecutorMap().entrySet()) {
if (entry.getValue().equals(mainControllerRoot.executor()) && LaunchStorage.getLaunchElementMap().containsKey(entry.getKey())) {
launchElement = LaunchStorage.getLaunchElementMap().get(entry.getKey());
}
}
if (launchElement != null) {
launchElement.setTerminated();
}
if (Activator.getMainView() != null) {
Activator.getMainView().refreshAll();
}
}
} else {
shutdownSession();
}
updateGUI();
}
Aggregations