REM ***** BASIC ***** const cMessageExtensionService = "Extension Service" const cMessageExtensionInstall = "Install Extension" const cMessageExtensionUninstall = "Uninstall Extension" Sub TestExtensions Dim oTestExtension as Object, obj_null as Object Dim sCurrentMessage as String Dim bResult as Boolean Dim sImplementationNameString as String sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension" On Local Error GoTo EXTERROR gCurrentTestCase = cLogfileFailed LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) sCurrentMessage = cMessageExtensionService gCurrentTestCase = cEXTService 'Create an implementation of com.sun.star.ucb.XCommandEnvironment which is needed for 'adding the extension. The implementation is in 'javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java and the code is in juh.jar cmdEnv = createUnoService(cUnoSmoketestCommandEnvironment) 'Create the component context and then get the singleton ExtensionManager 'A singleton cannot be created with createUnoService ctx = getDefaultContext ext_mgr = ctx.getValueByName("/singletons/" + cExtensionManager) LogTestResult( "Extension "+ cMessageExtensionService, not IsNull (ext_mgr) ) if (IsNull(ext_mgr)) then Close #LocalTestLog% LocalTestLog = 0 Exit Sub End If sCurrentMessage = cMessageExtensionInstall gCurrentTestCase = cEXTInstall 'Add the extension. We must provide a file URL here. 'By passing "user" we determine that the actions we perform on 'XExtensionManager only affect the user installation. To modify the share installation one would pass "share". Dim props() as Object ext_mgr.addExtension(sExtensionURL + cExtensionFileName, props, "user", obj_null, cmdEnv) 'Check if the extension has been added by creating a service which is contained in the extension. oTestExtension = createUnoService(cUnoSmoketestTestExtension) bResult = (oTestExtension.getImplementationName = sImplementationNameString) LogTestResult( "Extension "+ cMessageExtensionInstall, bResult ) if (not bResult) then Close #LocalTestLog% LocalTestLog = 0 Exit Sub End If sCurrentMessage = cMessageExtensionUninstall gCurrentTestCase = cEXTUninstall 'Remove the package ext_mgr.removeExtension("org.openoffice.legacy." + cExtensionFileName, cExtensionFileName, "user",obj_null, cmdEnv) 'Try to create the service which is contained in the now removed extension. oTestExtension = createUnoService(cUnoSmoketestTestExtension) 'The service must not be available anymore. Therefor isNull must return true. LogTestResult( "Extension "+ cMessageExtensionUninstall, IsNull (oTestExtension) ) Print #LocalTestLog, "---" Close #LocalTestLog% LocalTestLog = 0 Exit Sub ' Without error EXTERROR: If ( gCurrentTestCase = cLogfileFailed ) then LogTestResult( " ", False ) Exit Sub else LogTestResult( "Extension "+ sCurrentMessage, False ) Close #LocalTestLog% LocalTestLog = 0 End If Exit Sub ' With error End Sub