Commit 5aa8b31d authored by Arpad Lovassy's avatar Arpad Lovassy
Browse files

fixed comment, removed import, indentation, removed extra ws


Signed-off-by: Arpad Lovassy's avatarzlovarp <arpad.lovassy@semcon.com>
parent 97848270
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
############################################################################### ###############################################################################
# Creates C++ header from the Java code for Java to C++ JNI function calls. # Creates C++ header from the Java code for Java to C++ JNI function calls.
# This must run if any of the native Java methods change (in org.eclipse.titan.executor.jni.JNIMiddleWare). # This must be run if any of the native Java methods change (in org.eclipse.titan.executor.jni.JNIMiddleWare).
# A C++ function header is generated for each native Java method. # A C++ function header is generated for each native Java method.
# Native Java method: declared with native keyword without implementation # Native Java method: declared with native keyword without implementation
# This script generates these files into ../../JNI/ directory: # This script generates these files into ../../JNI/ directory:
......
...@@ -20,9 +20,9 @@ import org.eclipse.titan.executorapi.exception.JniExecutorIllegalArgumentExcepti ...@@ -20,9 +20,9 @@ import org.eclipse.titan.executorapi.exception.JniExecutorIllegalArgumentExcepti
* Contains the data describing a Host Controller. * Contains the data describing a Host Controller.
*/ */
public final class HostController { public final class HostController {
// Exception texts // Exception texts
/** Used by the constructor */ /** Used by the constructor */
private static final String EXCEPTION_TEXT_ILLEGAL_ARG_WORKINGDIR_NULL = "Working directory is null"; private static final String EXCEPTION_TEXT_ILLEGAL_ARG_WORKINGDIR_NULL = "Working directory is null";
/** Used by the constructor */ /** Used by the constructor */
...@@ -31,17 +31,17 @@ public final class HostController { ...@@ -31,17 +31,17 @@ public final class HostController {
private static final String EXCEPTION_TEXT_ILLEGAL_ARG_WORKINGDIR_NOT_EXIST = "Working directory does NOT exists"; private static final String EXCEPTION_TEXT_ILLEGAL_ARG_WORKINGDIR_NOT_EXIST = "Working directory does NOT exists";
/** Used by the constructor */ /** Used by the constructor */
private static final String EXCEPTION_TEXT_ILLEGAL_ARG_EXECUTABLE_NOT_EXIST = "Executable does NOT exists"; private static final String EXCEPTION_TEXT_ILLEGAL_ARG_EXECUTABLE_NOT_EXIST = "Executable does NOT exists";
/** /**
* The name of the host, it can be null, default: null (localhost) * The name of the host, it can be null, default: null (localhost)
*/ */
private String mHost = null; private String mHost = null;
/** /**
* The working directory to use when executing commands * The working directory to use when executing commands
*/ */
private String mWorkingDirectory; private String mWorkingDirectory;
/** /**
* The executable if the Host Controller. * The executable if the Host Controller.
* This executable is started (with 2 parameters: MC host, MC port) * This executable is started (with 2 parameters: MC host, MC port)
...@@ -66,7 +66,7 @@ public final class HostController { ...@@ -66,7 +66,7 @@ public final class HostController {
} else if ( aExecutable == null ) { } else if ( aExecutable == null ) {
throw new JniExecutorIllegalArgumentException( EXCEPTION_TEXT_ILLEGAL_ARG_EXECUTABLE_NULL ); throw new JniExecutorIllegalArgumentException( EXCEPTION_TEXT_ILLEGAL_ARG_EXECUTABLE_NULL );
} }
if ( isLocalhost(aHost) ) { if ( isLocalhost(aHost) ) {
// if working directory directory is local, it must exist // if working directory directory is local, it must exist
final File workingDir = new File(aWorkingdirectory); final File workingDir = new File(aWorkingdirectory);
...@@ -81,12 +81,12 @@ public final class HostController { ...@@ -81,12 +81,12 @@ public final class HostController {
throw new JniExecutorIllegalArgumentException( EXCEPTION_TEXT_ILLEGAL_ARG_EXECUTABLE_NOT_EXIST ); throw new JniExecutorIllegalArgumentException( EXCEPTION_TEXT_ILLEGAL_ARG_EXECUTABLE_NOT_EXIST );
} }
} }
this.mHost = aHost; this.mHost = aHost;
this.mWorkingDirectory = aWorkingdirectory; this.mWorkingDirectory = aWorkingdirectory;
this.mExecutable = aExecutable; this.mExecutable = aExecutable;
} }
public String getHost() { public String getHost() {
return mHost; return mHost;
} }
...@@ -115,10 +115,10 @@ public final class HostController { ...@@ -115,10 +115,10 @@ public final class HostController {
commandSb.append( mHost ); commandSb.append( mHost );
commandSb.append( " " ); commandSb.append( " " );
} }
// local host // local host
// cd %Workingdirectory; %Executable %MCHost %MCPort // cd %Workingdirectory; %Executable %MCHost %MCPort
commandSb.append( "cd " ); commandSb.append( "cd " );
commandSb.append( mWorkingDirectory ); commandSb.append( mWorkingDirectory );
commandSb.append( "; ./" ); commandSb.append( "; ./" );
...@@ -129,7 +129,7 @@ public final class HostController { ...@@ -129,7 +129,7 @@ public final class HostController {
commandSb.append( aMcPort ); commandSb.append( aMcPort );
return commandSb.toString(); return commandSb.toString();
} }
/** /**
* Checks if the host name is localhost * Checks if the host name is localhost
* @param aHostName the host name, it can be IP address, it can be null * @param aHostName the host name, it can be IP address, it can be null
...@@ -142,7 +142,7 @@ public final class HostController { ...@@ -142,7 +142,7 @@ public final class HostController {
"localhost".equalsIgnoreCase( aHostName ) || "localhost".equalsIgnoreCase( aHostName ) ||
"0.0.0.0".equalsIgnoreCase( aHostName ) || "0.0.0.0".equalsIgnoreCase( aHostName ) ||
"NULL".equalsIgnoreCase( aHostName ) "NULL".equalsIgnoreCase( aHostName )
); );
} }
} }
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
******************************************************************************/ ******************************************************************************/
package org.eclipse.titan.executorapi; package org.eclipse.titan.executorapi;
import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.titan.executor.jni.McStateEnum; import org.eclipse.titan.executor.jni.McStateEnum;
...@@ -24,7 +23,7 @@ import org.eclipse.titan.executor.jni.VerdictTypeEnum; ...@@ -24,7 +23,7 @@ import org.eclipse.titan.executor.jni.VerdictTypeEnum;
* @see JniExecutor * @see JniExecutor
*/ */
public interface IJniExecutorObserver { public interface IJniExecutorObserver {
/** /**
* Notification about status change. It also means, that the asynchronous request is finished successfully, if aNewState is the final state. * Notification about status change. It also means, that the asynchronous request is finished successfully, if aNewState is the final state.
* @param aNewState the new MC state * @param aNewState the new MC state
...@@ -41,20 +40,20 @@ public interface IJniExecutorObserver { ...@@ -41,20 +40,20 @@ public interface IJniExecutorObserver {
/** /**
* Notification callback, information comes from MC * Notification callback, information comes from MC
* @param aTime timestamp * @param aTime timestamp
* @param aSource source, the machine identifier of MC * @param aSource source, the machine identifier of MC
* @param aSeverity message severity * @param aSeverity message severity
* @param aMsg message text * @param aMsg message text
*/ */
void notify(final Timeval aTime, final String aSource, final int aSeverity, final String aMsg); void notify(final Timeval aTime, final String aSource, final int aSeverity, final String aMsg);
/** /**
* Verdict notification, that comes after execution of a testcase. * Verdict notification, that comes after execution of a testcase.
* If a test control is executed, this notification is sent multiple times after each testcase. * If a test control is executed, this notification is sent multiple times after each testcase.
* @param aTestcase name of the testcase * @param aTestcase name of the testcase
* @param aVerdictType verdict type * @param aVerdictType verdict type
*/ */
void verdict( final String aTestcase, final VerdictTypeEnum aVerdictType ); void verdict( final String aTestcase, final VerdictTypeEnum aVerdictType );
/** /**
* Verdict statistics notification, that comes after executing all the testcases after exit MTC. * Verdict statistics notification, that comes after executing all the testcases after exit MTC.
* This notification is sent only once for a MTC session. * This notification is sent only once for a MTC session.
......
...@@ -25,7 +25,7 @@ import org.eclipse.titan.executorapi.JniExecutor; ...@@ -25,7 +25,7 @@ import org.eclipse.titan.executorapi.JniExecutor;
* @see JniExecutor#init() * @see JniExecutor#init()
*/ */
public class JniExecutorJniLoadException extends JniExecutorException { public class JniExecutorJniLoadException extends JniExecutorException {
/** /**
* Generated serial version ID * Generated serial version ID
* (to avoid warning) * (to avoid warning)
...@@ -35,7 +35,7 @@ public class JniExecutorJniLoadException extends JniExecutorException { ...@@ -35,7 +35,7 @@ public class JniExecutorJniLoadException extends JniExecutorException {
public JniExecutorJniLoadException( final String aMsg ) { public JniExecutorJniLoadException( final String aMsg ) {
super( aMsg ); super( aMsg );
} }
public JniExecutorJniLoadException(String aMsg, final Throwable aCause) { public JniExecutorJniLoadException(String aMsg, final Throwable aCause) {
super( aMsg, aCause ); super( aMsg, aCause );
......
...@@ -52,7 +52,7 @@ import java.util.Map; ...@@ -52,7 +52,7 @@ import java.util.Map;
* </pre> * </pre>
*/ */
public class Log { public class Log {
/** /**
* Severity of the log message, log level * Severity of the log message, log level
* @see "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html" * @see "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html"
...@@ -60,40 +60,40 @@ public class Log { ...@@ -60,40 +60,40 @@ public class Log {
private enum Severity { private enum Severity {
/** The OFF has the highest possible rank and is intended to turn off logging. */ /** The OFF has the highest possible rank and is intended to turn off logging. */
OFF, OFF,
/** The FATAL level designates very severe error events that will presumably lead the application to abort. */ /** The FATAL level designates very severe error events that will presumably lead the application to abort. */
FATAL, FATAL,
/** The ERROR level designates error events that might still allow the application to continue running. */ /** The ERROR level designates error events that might still allow the application to continue running. */
ERROR, ERROR,
/** The WARN level designates potentially harmful situations. */ /** The WARN level designates potentially harmful situations. */
WARN, WARN,
/** The INFO level designates informational messages that highlight the progress of the application at coarse-grained level. */ /** The INFO level designates informational messages that highlight the progress of the application at coarse-grained level. */
INFO, INFO,
/** The DEBUG Level designates fine-grained informational events that are most useful to debug an application. */ /** The DEBUG Level designates fine-grained informational events that are most useful to debug an application. */
DEBUG, DEBUG,
/** The TRACE Level designates finer-grained informational events than the DEBUG */ /** The TRACE Level designates finer-grained informational events than the DEBUG */
TRACE, TRACE,
/** The ALL has the lowest possible rank and is intended to turn on all logging. */ /** The ALL has the lowest possible rank and is intended to turn on all logging. */
ALL; ALL;
}; };
/** /**
* Global log level. * Global log level.
* It effects all the projects that use Log. * It effects all the projects that use Log.
*/ */
private static Severity sLogLevel = Severity.OFF; private static Severity sLogLevel = Severity.OFF;
/** /**
* Date format for function related logging functions: fi(), fo(), f() * Date format for function related logging functions: fi(), fo(), f()
*/ */
private static final SimpleDateFormat sFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); private static final SimpleDateFormat sFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
/** /**
* Keeps track the call level for each thread. * Keeps track the call level for each thread.
* Call level is a number, that is increased, when a function entry point is logged (fi() is called), * Call level is a number, that is increased, when a function entry point is logged (fi() is called),
...@@ -102,13 +102,13 @@ public class Log { ...@@ -102,13 +102,13 @@ public class Log {
* Negative call level is treated as 0. * Negative call level is treated as 0.
*/ */
private static Map<Long, Integer> sCallLevels = new HashMap<Long, Integer>(); private static Map<Long, Integer> sCallLevels = new HashMap<Long, Integer>();
/** /**
* Logging states separately for each thread. * Logging states separately for each thread.
* Logging can be switched off separately for each thread. true: on, false: off. Default value: true. * Logging can be switched off separately for each thread. true: on, false: off. Default value: true.
*/ */
private static Map<Long, Boolean> sLoggingStates = new HashMap<Long, Boolean>(); private static Map<Long, Boolean> sLoggingStates = new HashMap<Long, Boolean>();
/** /**
* Function in. * Function in.
* Logs the entry and the given parameter(s) of the method in DEBUG level. * Logs the entry and the given parameter(s) of the method in DEBUG level.
...@@ -120,20 +120,20 @@ public class Log { ...@@ -120,20 +120,20 @@ public class Log {
if ( !checkLogLevel( Severity.DEBUG ) || isThreadLoggingOff() ) { if ( !checkLogLevel( Severity.DEBUG ) || isThreadLoggingOff() ) {
return; return;
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
logDateAndThreadId(sb); logDateAndThreadId(sb);
sb.append(" -> "); sb.append(" -> ");
final int callLevel = getCallLevel(); final int callLevel = getCallLevel();
setCallLevel( callLevel + 1 ); setCallLevel( callLevel + 1 );
for (int i = 0; i < callLevel; i++) { for (int i = 0; i < callLevel; i++) {
sb.append(" "); sb.append(" ");
} }
// 0: getStackTrace(), 1: logMethodName(), 2: fi(), 3: this is the caller function we want to log // 0: getStackTrace(), 1: logMethodName(), 2: fi(), 3: this is the caller function we want to log
logMethodName( sb, 3 ); logMethodName( sb, 3 );
// log parameters // log parameters
sb.append("("); sb.append("(");
if ( aParams.length > 0 ) { if ( aParams.length > 0 ) {
...@@ -147,10 +147,10 @@ public class Log { ...@@ -147,10 +147,10 @@ public class Log {
sb.append(" "); sb.append(" ");
} }
sb.append(")"); sb.append(")");
printLog( sb ); printLog( sb );
} }
/** /**
* Function out. * Function out.
* Logs the exit and the given return value of the method in DEBUG level. * Logs the exit and the given return value of the method in DEBUG level.
...@@ -162,20 +162,20 @@ public class Log { ...@@ -162,20 +162,20 @@ public class Log {
if ( !checkLogLevel( Severity.DEBUG ) || isThreadLoggingOff() ) { if ( !checkLogLevel( Severity.DEBUG ) || isThreadLoggingOff() ) {
return; return;
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
logDateAndThreadId(sb); logDateAndThreadId(sb);
sb.append( " <- " ); sb.append( " <- " );
int callLevel = getCallLevel(); int callLevel = getCallLevel();
setCallLevel( --callLevel ); setCallLevel( --callLevel );
for (int i = 0; i < callLevel; i++) { for (int i = 0; i < callLevel; i++) {
sb.append(" "); sb.append(" ");
} }
// 0: getStackTrace(), 1: logMethodName(), 2: fo (this private), 3: fo (one of the public ones), 4: this is caller the function we want to log // 0: getStackTrace(), 1: logMethodName(), 2: fo (this private), 3: fo (one of the public ones), 4: this is caller the function we want to log
logMethodName( sb, 4 ); logMethodName( sb, 4 );
// log return value (if any) // log return value (if any)
sb.append("()"); sb.append("()");
if ( aHasReturnValue ) { if ( aHasReturnValue ) {
...@@ -184,7 +184,7 @@ public class Log { ...@@ -184,7 +184,7 @@ public class Log {
} }
printLog( sb ); printLog( sb );
} }
/** /**
* Function out. * Function out.
* Logs the exit of the method (but not the return value) in DEBUG level. * Logs the exit of the method (but not the return value) in DEBUG level.
...@@ -193,7 +193,7 @@ public class Log { ...@@ -193,7 +193,7 @@ public class Log {
public static void fo() { public static void fo() {
fo( false, null ); fo( false, null );
} }
/** /**
* Function out. * Function out.
* Logs the exit and the given return value of the method in DEBUG level. * Logs the exit and the given return value of the method in DEBUG level.
...@@ -203,7 +203,7 @@ public class Log { ...@@ -203,7 +203,7 @@ public class Log {
public static void fo( final Object aReturnValue ) { public static void fo( final Object aReturnValue ) {
fo( true, aReturnValue ); fo( true, aReturnValue );
} }
/** /**
* function log (just a general log within the function) * function log (just a general log within the function)
* @param aMsg log message * @param aMsg log message
...@@ -212,16 +212,16 @@ public class Log { ...@@ -212,16 +212,16 @@ public class Log {
if ( !checkLogLevel( Severity.TRACE ) || isThreadLoggingOff() ) { if ( !checkLogLevel( Severity.TRACE ) || isThreadLoggingOff() ) {
return; return;
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
logDateAndThreadId(sb); logDateAndThreadId(sb);
sb.append( " " ); sb.append( " " );
final int callLevel = getCallLevel(); final int callLevel = getCallLevel();
for (int i = 0; i < callLevel; i++) { for (int i = 0; i < callLevel; i++) {
sb.append(" "); sb.append(" ");
} }
if ( aMsg != null && aMsg.contains( "\n" ) ) { if ( aMsg != null && aMsg.contains( "\n" ) ) {
// in case of multiline message other lines are also indented with the same number of spaces // in case of multiline message other lines are also indented with the same number of spaces
final int len = sb.length(); final int len = sb.length();
...@@ -230,9 +230,9 @@ public class Log { ...@@ -230,9 +230,9 @@ public class Log {
StringBuilder sbSpaces = new StringBuilder( len ); StringBuilder sbSpaces = new StringBuilder( len );
sbSpaces.append("\n"); sbSpaces.append("\n");
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
sbSpaces.append(" "); sbSpaces.append(" ");
} }
// replace \n -> sbSpaces in sbMsg // replace \n -> sbSpaces in sbMsg
StringUtil.replaceString( sbMsg, "\n", sbSpaces.toString() ); StringUtil.replaceString( sbMsg, "\n", sbSpaces.toString() );
sb.append( sbMsg ); sb.append( sbMsg );
...@@ -240,7 +240,7 @@ public class Log { ...@@ -240,7 +240,7 @@ public class Log {
else { else {
sb.append( aMsg ); sb.append( aMsg );
} }
printLog( sb ); printLog( sb );
} }
...@@ -257,7 +257,7 @@ public class Log { ...@@ -257,7 +257,7 @@ public class Log {
sb.append( " " + aMsg ); sb.append( " " + aMsg );
printLog( sb ); printLog( sb );
} }
/** /**
* info unformatted (without datetime) * info unformatted (without datetime)
* @param aMsg log message * @param aMsg log message
...@@ -269,7 +269,7 @@ public class Log { ...@@ -269,7 +269,7 @@ public class Log {
StringBuilder sb = new StringBuilder( aMsg ); StringBuilder sb = new StringBuilder( aMsg );
printLog( sb ); printLog( sb );
} }
/** /**
* Switch on logging for the current thread * Switch on logging for the current thread
*/ */
...@@ -285,7 +285,7 @@ public class Log { ...@@ -285,7 +285,7 @@ public class Log {
final long threadId = Thread.currentThread().getId(); final long threadId = Thread.currentThread().getId();
sLoggingStates.put(threadId, false); sLoggingStates.put(threadId, false);
} }
/** /**
* Adds full datetime and thread id to the log string. * Adds full datetime and thread id to the log string.
* @param aSb [in/out] the log string, where new strings are added * @param aSb [in/out] the log string, where new strings are added
...@@ -294,7 +294,7 @@ public class Log { ...@@ -294,7 +294,7 @@ public class Log {
final long threadId = Thread.currentThread().getId(); final long threadId = Thread.currentThread().getId();