Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arpad Lovassy
titan.core
Commits
800a2902
Commit
800a2902
authored
Jan 26, 2021
by
Arpad Lovassy
Browse files
fixed indentation
Signed-off-by:
zlovarp
<
arpad.lovassy@semcon.com
>
parent
2afdff6b
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
titan_executor_api/TITAN_Executor_API_test/src/org/eclipse/titan/executorapi/test/HostControllerErrorIllegalArgTest.java
View file @
800a2902
...
...
@@ -24,10 +24,10 @@ import org.junit.Test;
* JniExecutorIllegalArgException is expected.
*/
public
class
HostControllerErrorIllegalArgTest
{
@Test
public
void
testHostControllerConstructor
()
{
// working dir null
try
{
new
HostController
(
null
,
null
,
TestConstants
.
EXECUTABLE
);
...
...
@@ -35,7 +35,7 @@ public class HostControllerErrorIllegalArgTest {
}
catch
(
JniExecutorIllegalArgumentException
e
)
{
//expected
}
// executable null
try
{
new
HostController
(
null
,
TestConstants
.
WORKINGDIR
,
null
);
...
...
@@ -43,7 +43,7 @@ public class HostControllerErrorIllegalArgTest {
}
catch
(
JniExecutorIllegalArgumentException
e
)
{
//expected
}
// working dir does NOT exist
try
{
new
HostController
(
null
,
TestConstants
.
WORKINGDIR
+
TestConstants
.
NONEXISTENTFILENAMEEXT
,
TestConstants
.
EXECUTABLE
);
...
...
@@ -51,7 +51,7 @@ public class HostControllerErrorIllegalArgTest {
}
catch
(
JniExecutorIllegalArgumentException
e
)
{
//expected
}
// working dir exists, but not a directory
try
{
new
HostController
(
null
,
TestConstants
.
EXISTS_BUT_NOT_DIR_WORKINGDIR
,
TestConstants
.
EXECUTABLE
);
...
...
@@ -59,7 +59,7 @@ public class HostControllerErrorIllegalArgTest {
}
catch
(
JniExecutorIllegalArgumentException
e
)
{
//expected
}
// executable does NOT exist
try
{
new
HostController
(
null
,
TestConstants
.
WORKINGDIR
,
TestConstants
.
EXECUTABLE
+
TestConstants
.
NONEXISTENTFILENAMEEXT
);
...
...
@@ -67,7 +67,7 @@ public class HostControllerErrorIllegalArgTest {
}
catch
(
JniExecutorIllegalArgumentException
e
)
{
//expected
}
// executable exists, but not a file (it's a directory)
try
{
new
HostController
(
null
,
TestConstants
.
EXISTS_BUT_NOT_FILE_WORKINGDIR
,
TestConstants
.
EXISTS_BUT_NOT_FILE_EXECUTABLE
);
...
...
titan_executor_api/TITAN_Executor_API_test/src/org/eclipse/titan/executorapi/test/JniExecutorAsyncErrorIllegalArgTest.java
View file @
800a2902
...
...
@@ -25,7 +25,7 @@ import org.junit.Test;
* JniExecutorIllegalArgException is expected.
*/
public
class
JniExecutorAsyncErrorIllegalArgTest
extends
JniExecutorAsyncErrorTest
{
private
void
testIllegalArgAddHostController
(
final
JniExecutor
je
)
{
try
{
je
.
addHostController
(
null
);
...
...
@@ -36,7 +36,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
fail
();
}
}
private
void
testIllegalArgSetConfigFileName
(
final
JniExecutor
je
)
{
try
{
je
.
setConfigFileName
(
null
);
...
...
@@ -46,7 +46,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
}
catch
(
JniExecutorWrongStateException
e
)
{
fail
();
}
try
{
je
.
setConfigFileName
(
""
);
fail
(
"JniExecutorIllegalArgumentException expected"
);
...
...
@@ -56,7 +56,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
fail
();
}
}
private
void
testIllegalArgSetObserver
(
final
JniExecutor
je
,
final
TestData
td
)
{
try
{
je
.
setObserver
(
td
.
mObserver
);
...
...
@@ -66,7 +66,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
fail
();
}
}
private
void
testIllegalArgExecuteControl
(
final
JniExecutor
je
)
{
try
{
je
.
executeControl
(
null
);
...
...
@@ -76,7 +76,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
}
catch
(
JniExecutorWrongStateException
e
)
{
fail
();
}
try
{
je
.
executeControl
(
""
);
fail
(
"JniExecutorIllegalArgumentException expected"
);
...
...
@@ -86,7 +86,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
fail
();
}
}
private
void
testIllegalArgExecuteTestcase
(
final
JniExecutor
je
,
final
TestData
td
)
{
try
{
je
.
executeTestcase
(
null
,
td
.
mTestcases
.
get
(
0
));
...
...
@@ -121,7 +121,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
fail
();
}
}
private
void
testIllegalArgExecuteCfg
(
final
JniExecutor
je
)
{
try
{
je
.
executeCfg
(
-
1
);
...
...
@@ -131,7 +131,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
}
catch
(
JniExecutorWrongStateException
e
)
{
fail
();
}
try
{
final
int
executeCfgLen
=
je
.
getExecuteCfgLen
();
je
.
executeCfg
(
executeCfgLen
);
...
...
@@ -142,7 +142,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
fail
();
}
}
/**
* disconnected (before init())
*/
...
...
@@ -150,7 +150,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
public
void
testExecutorIllegalArgDisconnected
()
{
//nothing to test in disconnected state
}
/**
* connected MC_INACTIVE state (after init())
*/
...
...
@@ -165,12 +165,12 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
testIllegalArgAddHostController
(
je
);
testIllegalArgSetConfigFileName
(
je
);
testIllegalArgSetObserver
(
je
,
td
);
// --------------
je
.
shutdownSession
();
je
.
waitForCompletion
();
}
/**
* MC_LISTENING state (after startSession())
*/
...
...
@@ -178,9 +178,9 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
public
void
testExecutorIllegalArgListening
()
{
final
TestData
td
=
createTestData1
();
final
JniExecutor
je
=
JniExecutor
.
getInstance
();
gotoListening
(
je
,
td
);
// we are now in MC_LISTENING, test all the functions, which has argument
testIllegalArgAddHostController
(
je
);
testIllegalArgSetObserver
(
je
,
td
);
...
...
@@ -189,7 +189,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
je
.
shutdownSession
();
je
.
waitForCompletion
();
}
/**
* MC_HC_CONNECTED after startHostControllers()
*/
...
...
@@ -197,9 +197,9 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
public
void
testExecutorIllegalArgHcConnected
()
{
final
TestData
td
=
createTestData1
();
final
JniExecutor
je
=
JniExecutor
.
getInstance
();
gotoHcConnected
(
je
,
td
);
// we are now in MC_HC_CONNECTED, test all the functions, which has argument
testIllegalArgSetObserver
(
je
,
td
);
...
...
@@ -207,7 +207,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
je
.
shutdownSession
();
je
.
waitForCompletion
();
}
/**
* MC_LISTENING_CONFIGURED state (after configure())
*/
...
...
@@ -217,7 +217,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
final
JniExecutor
je
=
JniExecutor
.
getInstance
();
gotoListeningConfigured
(
je
,
td
);
// we are now in MC_LISTENING_CONFIGURED, test all the functions, which has argument
testIllegalArgAddHostController
(
je
);
testIllegalArgSetObserver
(
je
,
td
);
...
...
@@ -226,7 +226,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
je
.
shutdownSession
();
je
.
waitForCompletion
();
}
/**
* MC_ACTIVE after configure()
*/
...
...
@@ -236,7 +236,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
final
JniExecutor
je
=
JniExecutor
.
getInstance
();
gotoActive
(
je
,
td
);
// we are now in MC_ACTIVE, test all the functions, which has argument
testIllegalArgSetObserver
(
je
,
td
);
...
...
@@ -244,7 +244,7 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
je
.
shutdownSession
();
je
.
waitForCompletion
();
}
/**
* MC_READY after createMTC()
*/
...
...
@@ -252,15 +252,15 @@ public class JniExecutorAsyncErrorIllegalArgTest extends JniExecutorAsyncErrorTe
public
void
testExecutorIllegalArgReady
()
{
final
TestData
td
=
createTestData1
();
final
JniExecutor
je
=
JniExecutor
.
getInstance
();
gotoReady
(
je
,
td
);
// we are now in MC_READY, test all the functions, which has argument
testIllegalArgSetObserver
(
je
,
td
);
testIllegalArgExecuteControl
(
je
);
testIllegalArgExecuteTestcase
(
je
,
td
);
testIllegalArgExecuteCfg
(
je
);
// --------------
je
.
shutdownSession
();
je
.
waitForCompletion
();
...
...
titan_executor_api/TITAN_Executor_API_test/src/org/eclipse/titan/executorapi/test/JniExecutorAsyncErrorTest.java
View file @
800a2902
...
...
@@ -34,7 +34,7 @@ import org.eclipse.titan.executorapi.util.Log;
* Base class of asynchronous JniExecutor error tests.
*/
public
abstract
class
JniExecutorAsyncErrorTest
extends
JniExecutorAsyncTest
{
/**
* structure to hold all the needed data to run tests
*
...
...
@@ -46,7 +46,7 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
public
List
<
String
>
mTestcases
=
null
;
public
IJniExecutorObserver
mObserver
=
null
;
}
protected
TestData
createTestData1
()
{
HostController
hc1
=
null
;
try
{
...
...
@@ -59,10 +59,10 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
final
List
<
String
>
testcases
=
new
ArrayList
<
String
>();
testcases
.
add
(
TestConstants
.
TESTCASE1
);
testcases
.
add
(
TestConstants
.
TESTCASE2
);
final
JniExecutor
je
=
JniExecutor
.
getInstance
();
IJniExecutorObserver
o1
=
new
Test1Observer
(
je
,
module
,
testcases
);
TestData
td
=
new
TestData
();
td
.
mHc
=
hc1
;
td
.
mCfgFileName
=
cfgFileName
;
...
...
@@ -71,9 +71,9 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
td
.
mObserver
=
o1
;
return
td
;
}
// functions to get to different states
protected
void
gotoInactive
(
final
JniExecutor
je
,
final
TestData
td
)
{
Log
.
fi
();
// get to connected MC_INACTIVE
...
...
@@ -85,24 +85,24 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
protected
void
gotoListening
(
final
JniExecutor
je
,
final
TestData
td
)
{
Log
.
fi
();
// get to MC_LISTENING
gotoInactive
(
je
,
td
);
try
{
TestUtil
.
assertState
(
McStateEnum
.
MC_INACTIVE
);
je
.
addHostController
(
td
.
mHc
);
TestUtil
.
assertState
(
McStateEnum
.
MC_INACTIVE
);
je
.
setConfigFileName
(
td
.
mCfgFileName
);
TestUtil
.
assertState
(
McStateEnum
.
MC_INACTIVE
);
je
.
setObserver
(
null
);
TestUtil
.
assertState
(
McStateEnum
.
MC_INACTIVE
);
je
.
startSession
();
TestUtil
.
assertState
(
McStateEnum
.
MC_LISTENING
);
}
catch
(
JniExecutorIllegalArgumentException
|
JniExecutorWrongStateException
|
JniExecutorStartSessionException
e
)
{
...
...
@@ -110,12 +110,12 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
protected
void
gotoListeningConfigured
(
final
JniExecutor
je
,
final
TestData
td
)
{
Log
.
fi
();
// get to MC_LISTENING_CONFIGURED
gotoListening
(
je
,
td
);
try
{
TestUtil
.
assertState
(
McStateEnum
.
MC_LISTENING
);
final
Object
lock
=
new
Object
();
...
...
@@ -130,21 +130,21 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
protected
void
gotoListeningWithoutAddHostController
(
final
JniExecutor
je
,
final
TestData
td
)
{
Log
.
fi
();
// get to MC_LISTENING
gotoInactive
(
je
,
td
);
try
{
TestUtil
.
assertState
(
McStateEnum
.
MC_INACTIVE
);
je
.
setConfigFileName
(
td
.
mCfgFileName
);
TestUtil
.
assertState
(
McStateEnum
.
MC_INACTIVE
);
je
.
setObserver
(
null
);
TestUtil
.
assertState
(
McStateEnum
.
MC_INACTIVE
);
je
.
startSession
();
TestUtil
.
assertState
(
McStateEnum
.
MC_LISTENING
);
}
catch
(
JniExecutorIllegalArgumentException
|
JniExecutorWrongStateException
|
JniExecutorStartSessionException
e
)
{
...
...
@@ -152,12 +152,12 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
protected
void
gotoListeningConfiguredWithoutAddHostController
(
final
JniExecutor
je
,
final
TestData
td
)
{
Log
.
fi
();
// get to MC_LISTENING_CONFIGURED without addHostController()
gotoListeningWithoutAddHostController
(
je
,
td
);
try
{
TestUtil
.
assertState
(
McStateEnum
.
MC_LISTENING
);
final
Object
lock
=
new
Object
();
...
...
@@ -172,12 +172,12 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
protected
void
gotoHcConnected
(
final
JniExecutor
je
,
final
TestData
td
)
{
Log
.
fi
();
// get to MC_HC_CONNECTED
gotoListening
(
je
,
td
);
try
{
TestUtil
.
assertState
(
McStateEnum
.
MC_LISTENING
);
final
Object
lock
=
new
Object
();
...
...
@@ -192,12 +192,12 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
protected
void
gotoActive
(
final
JniExecutor
je
,
final
TestData
td
)
{
Log
.
fi
();
// get to MC_ACTIVE
gotoHcConnected
(
je
,
td
);
try
{
TestUtil
.
assertState
(
McStateEnum
.
MC_HC_CONNECTED
);
final
Object
lock
=
new
Object
();
...
...
@@ -212,12 +212,12 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
protected
void
gotoReady
(
final
JniExecutor
je
,
final
TestData
td
)
{
Log
.
fi
();
// get to MC_READY
gotoActive
(
je
,
td
);
try
{
TestUtil
.
assertState
(
McStateEnum
.
MC_ACTIVE
);
final
Object
lock
=
new
Object
();
...
...
@@ -232,12 +232,12 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
protected
void
gotoPaused
(
final
JniExecutor
je
,
final
TestData
td
)
{
Log
.
fi
();
// get to MC_PAUSED
gotoReady
(
je
,
td
);
try
{
TestUtil
.
assertState
(
McStateEnum
.
MC_READY
);
je
.
pauseExecution
(
true
);
...
...
@@ -253,7 +253,7 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
/**
* First part of waiting until asynchronous function gets to the expected state.
* <p>
...
...
@@ -287,7 +287,7 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
@Override
public
void
error
(
int
aSeverity
,
String
aMsg
)
{
Log
.
fi
(
aSeverity
,
aMsg
);
...
...
@@ -300,7 +300,7 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
@Override
public
void
notify
(
Timeval
aTime
,
String
aSource
,
int
aSeverity
,
String
aMsg
)
{
}
@Override
public
void
verdict
(
String
aTestcase
,
VerdictTypeEnum
aVerdictType
)
{
}
...
...
@@ -319,7 +319,7 @@ public abstract class JniExecutorAsyncErrorTest extends JniExecutorAsyncTest {
}
Log
.
fo
();
}
/**
* Pair of {@link #waitBefore(Object, McStateEnum)}
* @param aLock lock for synchronization
...
...
titan_executor_api/TITAN_Executor_API_test/src/org/eclipse/titan/executorapi/test/JniExecutorAsyncErrorWrongStateTest.java
View file @
800a2902
This diff is collapsed.
Click to expand it.
titan_executor_api/TITAN_Executor_API_test/src/org/eclipse/titan/executorapi/test/JniExecutorAsyncHappyTest.java
View file @
800a2902
...
...
@@ -33,44 +33,44 @@ import org.junit.Test;
*/
public
class
JniExecutorAsyncHappyTest
extends
JniExecutorAsyncTest
{
/**
* Route alternative in the MC state flow,
* or in other words: the order of startHostControllers() and configure() operations
*/
/**
* Route alternative in the MC state flow,
* or in other words: the order of startHostControllers() and configure() operations
*/
public
enum
McRoute
{
/**
* MC_LISTENING -> startHostControllers() -> MC_HC_CONNECTED -> configure() -> (MC_CONFIGURING) -> MC_ACTIVE
*/
ROUTE_1
,
/**
* MC_LISTENING -> configure() -> MC_LISTENING_CONFIGURED -> startHostControllers() -> (MC_CONFIGURING) -> MC_ACTIVE
*/
ROUTE_2
};
/**
* Determines how the tests are executed in when we get to MC_READY state
*/
public
enum
ExecutionMethod
{
/**
* Test is executed by test control name
*/
TEST_CONTROL
,
/**
* Test is executed by test case name, a module name and list of testcase name must be added
*/
TEST_CASE
,
/**
* Execution list of the cfg file is used for test execution
*/
CFG_FILE
}
/**
* Runs test of 1 module.
* Sets up MC, executes tests, shuts down session.
...
...
@@ -119,7 +119,7 @@ public class JniExecutorAsyncHappyTest extends JniExecutorAsyncTest {
assertTrue
(!
je
.
isConnected
());
Log
.
fo
();
}
/**
* Runs test of 1 module. (It has less parameters, calls the other testHappy)
* Sets up MC, executes tests, shuts down session.
...
...
@@ -137,36 +137,36 @@ public class JniExecutorAsyncHappyTest extends JniExecutorAsyncTest {
final
List
<
String
>
testcases
=
new
ArrayList
<
String
>();
testcases
.
add
(
TestConstants
.
TESTCASE1
);
testcases
.
add
(
TestConstants
.
TESTCASE2
);
testHappy
(
hc1
,
cfgFileName
,
module
,
testcases
,
aRoute
,
aExecMethod
);
Log
.
fo
();
}
@Test
public
void
testExecutorAsyncHappyRoute1TestControl
()
throws
JniExecutorException
{
testHappy
(
McRoute
.
ROUTE_1
,
ExecutionMethod
.
TEST_CONTROL
);
}
@Test
public
void
testExecutorAsyncHappyRoute1TestCasel
()
throws
JniExecutorException
{
testHappy
(
McRoute
.
ROUTE_1
,
ExecutionMethod
.
TEST_CASE
);
}
@Test
public
void
testExecutorAsyncHappyRoute1CfgFilel
()
throws
JniExecutorException
{
testHappy
(
McRoute
.
ROUTE_1
,
ExecutionMethod
.
CFG_FILE
);
}
@Test
public
void
testExecutorAsyncHappyRoute2TestControl
()
throws
JniExecutorException
{
testHappy
(
McRoute
.
ROUTE_2
,
ExecutionMethod
.
TEST_CONTROL
);
}