Commit d81ded66 authored by balaskoa's avatar balaskoa
Browse files

Merge branch 'master' of github.com:eclipse/titan.EclipsePlug-ins into master

Change-Id: I7e657c5271edaf7d89a43ddbe49496507ac4aaf9
parents 7b3f5674 b4d42c6d
......@@ -9,7 +9,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.ui.console,
org.eclipse.debug.core,
org.eclipse.debug.core,
org.eclipse.titan.common;bundle-version="7.2.0",
org.eclipse.titan.designer;bundle-version="7.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
......
......@@ -67,7 +67,7 @@ public class NativeJavaExecutor extends BaseExecutor {
private int configFileExecutionRequestCounter = -1;
private boolean createMTCRequested = false;
private boolean executeRequested = false;
private List<String> executeList = new ArrayList<String>();
private final List<String> executeList = new ArrayList<String>();
private boolean shutdownRequested = false;
private boolean simpleExecutionRunning = false;
......@@ -83,14 +83,14 @@ public class NativeJavaExecutor extends BaseExecutor {
private final Matcher reasonMatcher = REASON_PATTERN.matcher("");
private static final String EMPTY_STRING = "";
private Action automaticExecution, startSession, configure, startHCs, cmtc, smtc, generalPause, cont, stop, emtc, generalLogging,
private final Action automaticExecution, startSession, configure, startHCs, cmtc, smtc, generalPause, cont, stop, emtc, generalLogging,
shutdownSession, info;
private ConfigFileHandler configHandler = null;
private MainController mainController = null;
private final MainController mainController;
public static class NativeJavaUI extends UserInterface {
private NativeJavaExecutor callback;
private final NativeJavaExecutor callback;
public NativeJavaUI(final NativeJavaExecutor callback) {
this.callback = callback;
......@@ -243,7 +243,7 @@ public class NativeJavaExecutor extends BaseExecutor {
};
info.setToolTipText("Updates the status displaying hierarchy");
NativeJavaUI tempUI = new NativeJavaUI(this);
final NativeJavaUI tempUI = new NativeJavaUI(this);
mainController = new MainController();
mainController.initialize(tempUI, 1500);// mx_ptcs
......@@ -355,7 +355,7 @@ public class NativeJavaExecutor extends BaseExecutor {
* @param s
* the list of String arrays.
* */
public void batchedInsertNotify(final ArrayList<String[]> s) {
public void batchedInsertNotify(final List<String[]> s) {
if (loggingIsEnabled && consoleLogging) {
for (final String[] sv : s) {
TITANConsole.println(sv[2] + ": " + sv[4]);
......@@ -678,7 +678,7 @@ public class NativeJavaExecutor extends BaseExecutor {
}
/* this is not a constant null, it just so happens to trick your eyes */
MainController.Host host = mainController.get_host_data(0);
final MainController.Host host = mainController.get_host_data(0);
mainController.release_data();
mainController.create_mtc(host);
createMTCRequested = false;
......
......@@ -342,16 +342,19 @@ public final class TTCN_Communication {
if (!mc_addr_set) {
throw new TtcnError("Trying to connect to MC, but the address of MC has not yet been set.");
}
mc_socketchannel.set(hcnh.connect_to_mc());
if (mc_socketchannel.get() == null) {
final SocketChannel newChannel = hcnh.connect_to_mc();
mc_socketchannel.set(newChannel);
if (newChannel == null) {
throw new TtcnError(MessageFormat.format("Connecting to MC failed. MC address: {0}:{1,number,#} \r\n", hcnh.get_mc_addr_str(), hcnh.get_mc_port()));
}
//FIXME register
mc_connection.set(new MC_Connection(mc_socketchannel.get(), incoming_buf.get()));
final MC_Connection newMCConnection = new MC_Connection(newChannel, incoming_buf.get());
mc_connection.set(newMCConnection);
try {
mc_socketchannel.get().configureBlocking(false);
TTCN_Snapshot.channelMap.get().put(mc_socketchannel.get(), mc_connection.get());
mc_socketchannel.get().register(TTCN_Snapshot.selector.get(), SelectionKey.OP_READ);
newChannel.configureBlocking(false);
TTCN_Snapshot.channelMap.get().put(newChannel, newMCConnection);
newChannel.register(TTCN_Snapshot.selector.get(), SelectionKey.OP_READ);
} catch (IOException e) {
throw new TtcnError(e);
}
......@@ -1036,7 +1039,8 @@ public final class TTCN_Communication {
text_buf.calculate_length();
final byte[] msg_ptr = text_buf.get_data();
final int msg_len = text_buf.get_len();
final ByteBuffer buffer = ByteBuffer.wrap(msg_ptr, text_buf.get_begin(), msg_len);
final int msg_begin =text_buf.get_begin();
final ByteBuffer buffer = ByteBuffer.wrap(msg_ptr, msg_begin, msg_len);
final SocketChannel localChannel = mc_socketchannel.get();
try {
......
......@@ -629,7 +629,7 @@ public final class TTCN_Runtime {
}
public static int ptc_main() {
//FIXME implement rest
//FIXME implement logger plugin loading
int returnValue = 0;
TTCN_Logger.open_file();
......@@ -642,6 +642,7 @@ public final class TTCN_Runtime {
}
TTCN_Logger.log_event_str(". Version: " + PRODUCT_NUMBER + '.');
TTCN_Logger.end_event();
TTCN_Logger.write_logger_settings();
//FIXME implement missing parts
try {
......@@ -2398,7 +2399,7 @@ public final class TTCN_Runtime {
public void run() {
//runs in the MTC
TTCN_Snapshot.re_open();
TTCN_Communication.close_mc_connection();
//TTCN_Communication.close_mc_connection();not needed on the Java side
TitanComponent.self.set(new TitanComponent(TitanComponent.MTC_COMPREF));
executorState.set(executorStateEnum.MTC_INITIAL);
......@@ -2445,7 +2446,7 @@ public final class TTCN_Runtime {
public void run() {
//runs in the PTC
TTCN_Snapshot.re_open();
TTCN_Communication.close_mc_connection();
//TTCN_Communication.close_mc_connection();not needed on the Java side
TitanComponent.self.set(new TitanComponent(component_reference));
set_component_type(component_type_module, component_type_name);
......
......@@ -30,22 +30,25 @@ public class CfgPreprocessorUtils {
if (str != null && str.charAt(0) == '$' && str.charAt(1) == '{') {
final StringBuilder sb = new StringBuilder();
int i = 2;
char charat_i = str.charAt(i);
// skip over the whitespaces after the brace
while (str.charAt(i) == ' ' || str.charAt(i) == '\t') {
while (charat_i == ' ' || charat_i == '\t') {
i++;
charat_i = str.charAt(i);
}
if ((str.charAt(i) >= 'A' && str.charAt(i) <= 'Z') ||
(str.charAt(i) >= 'a' && str.charAt(i) <= 'z')) {
if ((charat_i >= 'A' && charat_i <= 'Z') ||
(charat_i >= 'a' && charat_i <= 'z')) {
// the first character of the id shall be a letter
do {
sb.append(str.charAt(i));
sb.append(charat_i);
i++;
} while ((str.charAt(i) >= 'A' && str.charAt(i) <= 'Z') ||
(str.charAt(i) >= 'a' && str.charAt(i) <= 'z') ||
(str.charAt(i) >= '0' && str.charAt(i) <= '9') ||
charat_i = str.charAt(i);
} while ((charat_i >= 'A' && charat_i <= 'Z') ||
(charat_i >= 'a' && charat_i <= 'z') ||
(charat_i >= '0' && charat_i <= '9') ||
str.charAt(i) == '_');
if (str.charAt(i) != ' ' && str.charAt(i) != '\t' && str.charAt(i) != ',' && str.charAt(i) != '}') {
if (charat_i != ' ' && charat_i != '\t' && charat_i != ',' && charat_i != '}') {
// the next character after the id is not a whitespace or , or }
return null;
}
......
......@@ -79,7 +79,7 @@ public class Cli extends UserInterface {
}
@Override
public int enterLoop(String[] args) {
public int enterLoop(final String[] args) {
if (args.length > 1) {
printUsage("mctr");
return 1; //EXIT_FAILURE
......@@ -91,7 +91,7 @@ public class Cli extends UserInterface {
final File config_file = new File(args[0]);
System.out.printf("Using configuration file: %s\n", config_file.getName());
CfgAnalyzer cfgAnalyzer = new CfgAnalyzer();
final CfgAnalyzer cfgAnalyzer = new CfgAnalyzer();
final boolean config_file_failure = cfgAnalyzer.parse(config_file);
if (config_file_failure) {
System.out.println("Error was found in the configuration file. Exiting");
......@@ -180,51 +180,51 @@ public class Cli extends UserInterface {
* Callback functions for command processing.
* (All callback functions MUST be public!!!)
*/
public void cmtcCallback(String arguments) {
public void cmtcCallback(final String arguments) {
}
public void smtcCallback(String arguments) {
public void smtcCallback(final String arguments) {
}
public void stopCallback(String arguments) {
public void stopCallback(final String arguments) {
}
public void pauseCallback(String arguments) {
public void pauseCallback(final String arguments) {
}
public void continueCallback(String arguments) {
public void continueCallback(final String arguments) {
}
public void emtcCallback(String arguments) {
public void emtcCallback(final String arguments) {
}
public void logCallback(String arguments) {
public void logCallback(final String arguments) {
}
public void infoCallback(String arguments) {
public void infoCallback(final String arguments) {
}
public void reconfCallback(String arguments) {
public void reconfCallback(final String arguments) {
}
public void helpCallback(String arguments) {
public void helpCallback(final String arguments) {
}
public void shellCallback(String arguments) {
public void shellCallback(final String arguments) {
}
public void exitCallback(String arguments) {
public void exitCallback(final String arguments) {
if (arguments == null || arguments.isEmpty()) {
switch (mainController.get_state()) {
case MC_READY:
......@@ -272,7 +272,7 @@ public class Cli extends UserInterface {
/**
* Print program usage information.
*/
private static void printUsage(String prg_name) {
private static void printUsage(final String prg_name) {
System.err.printf(
"TTCN-3 Test Executor - Main Controller 2\n"+
"Version: " + TTCN_Runtime.PRODUCT_NUMBER + "\n\n"+
......@@ -290,7 +290,7 @@ public class Cli extends UserInterface {
return 1; //EXIT_FAILURE
}
BufferedReader console_reader = new BufferedReader(new InputStreamReader(System.in));
final BufferedReader console_reader = new BufferedReader(new InputStreamReader(System.in));
do {
try {
......@@ -378,7 +378,7 @@ public class Cli extends UserInterface {
}
}
private boolean conditionHolds(waitStateEnum askedState) {
private boolean conditionHolds(final waitStateEnum askedState) {
switch (askedState) {
case WAIT_HC_CONNECTED:
if (mainController.get_state() == mcStateEnum.MC_HC_CONNECTED) {
......@@ -416,7 +416,8 @@ public class Cli extends UserInterface {
return mainController.get_state() == mcStateEnum.MC_INACTIVE;
case WAIT_EXECUTE_LIST:
if (mainController.get_state() == mcStateEnum.MC_READY) {
if (++executeListIndex < mycfg.getExecuteItems().size()) {
++executeListIndex;
if (executeListIndex < mycfg.getExecuteItems().size()) {
executeFromList(executeListIndex);
} else {
System.out.println("Execution of [EXECUTE] section finished.");
......@@ -429,7 +430,7 @@ public class Cli extends UserInterface {
}
}
private void waitMCState(waitStateEnum newWaitState) {
private void waitMCState(final waitStateEnum newWaitState) {
if (newWaitState != waitStateEnum.WAIT_NOTHING) {
if (conditionHolds(newWaitState) == true) {
waitState = waitStateEnum.WAIT_NOTHING;
......@@ -450,8 +451,9 @@ public class Cli extends UserInterface {
if (line_read == null || line_read.isEmpty()) {
return;
}
String[] splitted_line = line_read.split("\\s");
String command = splitted_line[0];
final String[] splitted_line = line_read.split("\\s");
final String command = splitted_line[0];
String argument = null;
if (splitted_line.length == 2) {
argument = splitted_line[1];
......@@ -489,7 +491,7 @@ public class Cli extends UserInterface {
/*
* Executes the index-th element of the execute list
*/
private void executeFromList(int index) {
private void executeFromList(final int index) {
if (index >= mycfg.getExecuteItems().size()) {
System.err.println("Cli.executeFromList: invalid argument");
return;
......
......@@ -9,9 +9,9 @@ package org.eclipse.titan.runtime.core.mctr;
public class CliMain {
public static void main(String[] args) {
Cli userInterface = new Cli();
int max_ptcs = -1;
public static void main(final String[] args) {
final Cli userInterface = new Cli();
final int max_ptcs = -1;
final MainController mainController = new MainController();
userInterface.setMainController(mainController);
......
......@@ -8,7 +8,6 @@
package org.eclipse.titan.runtime.core.mctr;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.titan.runtime.core.cfgparser.ComponentSectionHandler.Component;
......@@ -49,7 +48,7 @@ public class ConfigData {
*
* @param group_list: The list of groups in config file.
*/
public void add_host(List<Group> group_list) {
public void add_host(final List<Group> group_list) {
this.group_list = group_list;
}
......@@ -57,7 +56,7 @@ public class ConfigData {
*
* @param component_list: The components in config file.
*/
public void add_component(List<Component> component_list) {
public void add_component(final List<Component> component_list) {
this.component_list = component_list;
}
......@@ -73,7 +72,7 @@ public class ConfigData {
*
* @param f file name skeleton; the function takes ownership
*/
public void set_log_file(String f) {
public void set_log_file(final String f) {
if (f != null) {
log_file_name = f;
}
......@@ -111,19 +110,19 @@ public class ConfigData {
return kill_timer;
}
public void setLocal_addr(String local_addr) {
public void setLocal_addr(final String local_addr) {
this.local_addr = local_addr;
}
public void setTcp_listen_port(int tcp_listen_port) {
public void setTcp_listen_port(final int tcp_listen_port) {
this.tcp_listen_port = tcp_listen_port;
}
public void setNum_hcs(BigInteger num_hcs) {
public void setNum_hcs(final BigInteger num_hcs) {
this.num_hcs = num_hcs;
}
public void setKill_timer(Double kill_timer) {
public void setKill_timer(final Double kill_timer) {
this.kill_timer = kill_timer;
}
}
......@@ -41,7 +41,7 @@ public class MainControllerCommand {
return name;
}
public void setName(String name) {
public void setName(final String name) {
this.name = name;
}
......@@ -49,7 +49,7 @@ public class MainControllerCommand {
return synopsis;
}
public void setSynopsis(String synopsis) {
public void setSynopsis(final String synopsis) {
this.synopsis = synopsis;
}
......@@ -57,7 +57,7 @@ public class MainControllerCommand {
return description;
}
public void setDescription(String description) {
public void setDescription(final String description) {
this.description = description;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment