OOoRunner test harness

basicrunner
Class BasicHandler

basicrunner.BasicHandler

public class BasicHandler

This class is a java-part of BASIC-java interaction "driver" It is used to call Star-Basic's function from java using basic's part of "driver" where listeners are implemented. The instance of the BasicHandler should be added to the MSF that will be used for loading BASIC's part of "driver".
After opening basic's document it creates an instance of the HandlerContainer using BasicHandler. HandlerContainer is a UNO XContainer and XNameContainer. Only one instance of BasicHandler can be used at the moment.

See Also:
com.sun.star.lang.XServiceInfo, XSingleServiceFactory

Constructor Summary
BasicHandler(TestParameters tParam)
          Creates an instance of a HandlerContainer.
 
Method Summary
 void Connect(String sBasicBridgeURL, TestParameters tParam, XMultiServiceFactory xMSF, LogWriter log)
          Establishes a connection between BASIC and Java.
 Object createInstance()
          Create an instance of HandlerContainer.
 Object createInstanceWithArguments(Object[] args)
          Create an instance of HandlerContainer.
 void dispose()
          Dispose the BASIC document.
 String getImplementationName()
          Get the implementation name.
 String[] getSupportedServiceNames()
          Return all supported service names.
 boolean isUptodate(XMultiServiceFactory xMSF)
          Is called by BasicIfcTest to find out if this BasicHandler uses the correct MultiServiceFactory.
 void Log(String info)
          Is called when BASIC sends a signal to write some log information.
 PropertyValue perform(String fName, Object params)
          Perform a test of a method.
 void setTestedInterface(BasicIfcTest ifc, LogWriter log)
          Set the tested interface and a log writer.
 boolean supportsService(String name)
          Returns true, if name is a supported service of this class.
 

Constructor Detail

BasicHandler

public BasicHandler(TestParameters tParam)
Creates an instance of a HandlerContainer. This instance is used from BASIC.
Parameters:
tParam - The test parameters.
Method Detail

setTestedInterface

public void setTestedInterface(BasicIfcTest ifc,
                               LogWriter log)
Set the tested interface and a log writer.
Parameters:
ifc - The test of an interface
log - A log writer.

Log

public void Log(String info)
Is called when BASIC sends a signal to write some log information.
Parameters:
info - The string to write.

isUptodate

public boolean isUptodate(XMultiServiceFactory xMSF)
Is called by BasicIfcTest to find out if this BasicHandler uses the correct MultiServiceFactory.
Parameters:
xMSF - The MultiServiceFactory
Returns:
True, if xMSF is equal to the MultiServiceFactory of this class.
See Also:
XMultiServiceFactory

Connect

public void Connect(String sBasicBridgeURL,
                    TestParameters tParam,
                    XMultiServiceFactory xMSF,
                    LogWriter log)
             throws ConnectionSetupException
Establishes a connection between BASIC and Java. If required, hte BASIC part of the "driver" is loaded.
Parameters:
sBasicBridgeURL - The URL of the basic bridge document (BasicBridge.sxw)
tParam - The test parameters.
xMSF - The MultiServiceFactory
log - The log writer.
Throws:
ConnectionSetupException - Exception is thrown, if no connection could be made.
See Also:
XMultiServiceFactory

perform

public PropertyValue perform(String fName,
                             Object params)
                      throws BasicException
Perform a test of a method.
Parameters:
fName - The name of the method to test.
params - The test parameters.
Returns:
A proprty value as result of the test.
Throws:
BasicException - The method could not be executed.

supportsService

public boolean supportsService(String name)
Returns true, if name is a supported service of this class.
Parameters:
name - The service name.
Returns:
True, if the service is supported.

getSupportedServiceNames

public String[] getSupportedServiceNames()
Return all supported service names.
Returns:
All supported services.

getImplementationName

public String getImplementationName()
Get the implementation name.
Returns:
Implementation name.

createInstanceWithArguments

public Object createInstanceWithArguments(Object[] args)
Create an instance of HandlerContainer. Arguments are not supported here, so they will be ignored.
Parameters:
args - The arguments.
Returns:
The instance.

createInstance

public Object createInstance()
Create an instance of HandlerContainer.
Returns:
The instance.

dispose

public void dispose()
Dispose the BASIC document.

OOoRunner test harness