Package i5.las2peer.testing
Class TestService
java.lang.Object
i5.las2peer.api.Configurable
i5.las2peer.api.Service
i5.las2peer.testing.TestService
Simple test service for connectors to have a service with methods to call.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
throws an Exception indication, that the access (for the current user) has been denied.Returns the given date increased by one day.long
byteAdder
(byte[] bytes) returns the sum of an bytearraybyte[]
byteArrayReturner
(byte[] ab) simply returns the given byte array for connector coding testsconcatStrings
(String[] strings) concats an array of String to one single String.int
counter()
a simple counter, returns the number fo calls within each session.String[]
void
Throws an ExceptiongetAHash()
returns a Hashtable with one entry to test complex result typestest for envelopes: store a string in an envelopeget a string stored for the Group1getProps()
access to the property filereturns the stored stringlong[]
longArrayReturner
(long[] al) simply returns the given long array for connector coding testinglong
longReturner
(long l) simply returns the given long value for connector coding testingmultipleArguments
(int i, String s, long l, boolean b) A method with multiple arguments returning a string summary over the argumentmultipleArguments2
(Integer i, String s, Long l, Boolean b) A method with multiple arguments returning a string summary over the argumentvoid
throws an exception that shouldn't be kown at the client.void
Throws a RuntimeException updateAgentvoid
Stores a String in the service instancevoid
test for envelopes: get stored Stringvoid
storeGroupEnvelopeString
(String store) store a simple string encrypted for the groupString[]
Returns a fixed array with strings.String[]
stringArrayReturner
(String[] ar) Returns a reverted version of the given string arrayMethods inherited from class i5.las2peer.api.Service
getAgent, getAlias, getCustomMessageDescriptions, getLogger, isMonitor, isSelfDeployable, onStart, onStart, onStop, setFieldValues
Methods inherited from class i5.las2peer.api.Configurable
getProperties
-
Constructor Details
-
TestService
public TestService()
-
-
Method Details
-
counter
public int counter()a simple counter, returns the number fo calls within each session.- Returns:
- an int
-
getStoredString
returns the stored string- Returns:
- a String
-
setStoredString
Stores a String in the service instance- Parameters:
s
- a String
-
exceptionThrower
Throws an Exception- Throws:
Exception
- on each call
-
runtimeExceptionThrower
Throws a RuntimeException updateAgent- Throws:
RuntimeException
- on each call
-
myExceptionThrower
throws an exception that shouldn't be kown at the client.- Throws:
MyOwnException
-
byteAdder
public long byteAdder(byte[] bytes) returns the sum of an bytearray- Parameters:
bytes
- a byte[]- Returns:
- a long
-
getAHash
returns a Hashtable with one entry to test complex result types- Returns:
- a Hashtable
-
stringArrayReturner
Returns a fixed array with strings.- Returns:
- a String[]
-
stringArrayReturner
Returns a reverted version of the given string array- Parameters:
ar
- a String[]- Returns:
- a String[]
-
emptyStringArrayReturner
- Returns:
- an empty array of strings
-
multipleArguments
A method with multiple arguments returning a string summary over the argument- Parameters:
i
- an ints
- a Stringl
- a longb
- a boolean- Returns:
- a String
-
multipleArguments2
A method with multiple arguments returning a string summary over the argument- Parameters:
i
- an ints
- a Stringl
- a longb
- a boolean- Returns:
- a String
-
accessForbidden
throws an Exception indication, that the access (for the current user) has been denied.- Throws:
ServiceAccessDeniedException
-
concatStrings
concats an array of String to one single String. Basically for testing array of Strings as invocation parameter.- Parameters:
strings
- a String[]- Returns:
- a String
-
byteArrayReturner
public byte[] byteArrayReturner(byte[] ab) simply returns the given byte array for connector coding tests- Parameters:
ab
- a byte[]- Returns:
- a byte[]
-
longArrayReturner
public long[] longArrayReturner(long[] al) simply returns the given long array for connector coding testing- Parameters:
al
- a long[]- Returns:
- a long[]
-
longReturner
public long longReturner(long l) simply returns the given long value for connector coding testing- Parameters:
l
- a long- Returns:
- a long
-
addADay
Returns the given date increased by one day. This may be used as test for delivering Serializables in connectors.- Parameters:
input
- a Date- Returns:
- a Date
-
getProps
access to the property file- Returns:
- hashtable with properties
-
getEnvelopeString
public String getEnvelopeString() throws EnvelopeAccessDeniedException, EnvelopeNotFoundException, EnvelopeOperationFailedExceptiontest for envelopes: store a string in an envelope- Returns:
- previously stored string
- Throws:
EnvelopeOperationFailedException
EnvelopeNotFoundException
EnvelopeAccessDeniedException
-
storeEnvelopeString
public void storeEnvelopeString(String s) throws EnvelopeOperationFailedException, EnvelopeAccessDeniedException test for envelopes: get stored String- Parameters:
s
-- Throws:
IllegalArgumentException
EnvelopeOperationFailedException
EnvelopeAccessDeniedException
-
getGroupEnvelopeString
public String getGroupEnvelopeString() throws EnvelopeAccessDeniedException, EnvelopeNotFoundException, EnvelopeOperationFailedExceptionget a string stored for the Group1- Returns:
- a simple stored string
- Throws:
EnvelopeOperationFailedException
EnvelopeNotFoundException
EnvelopeAccessDeniedException
-
storeGroupEnvelopeString
public void storeGroupEnvelopeString(String store) throws EnvelopeAccessDeniedException, EnvelopeOperationFailedException, AgentAccessDeniedException, AgentAlreadyExistsException, AgentOperationFailedException, MalformedXMLException, IOException, AgentLockedException store a simple string encrypted for the group- Parameters:
store
- a string to store for the group- Throws:
EnvelopeOperationFailedException
EnvelopeAccessDeniedException
IOException
MalformedXMLException
AgentOperationFailedException
AgentAlreadyExistsException
AgentAccessDeniedException
AgentLockedException
-