diff options
Diffstat (limited to 'javaunohelper/test')
13 files changed, 326 insertions, 326 deletions
diff --git a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java index 3fe9bd53beb6..c5908f3452cb 100644 --- a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java +++ b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -36,12 +36,12 @@ import com.sun.star.lang.XMultiServiceFactory; public class Bootstrap_Test { - + static public boolean test( String ini_file, java.util.Hashtable bootstrap_parameters ) throws java.lang.Exception { boolean passed = false; - System.err.println(); + System.err.println(); System.out.println("*******************************************************************"); System.err.println("Bootstrap - doing tests..."); System.err.println(); @@ -50,7 +50,7 @@ public class Bootstrap_Test { XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.defaultBootstrap_InitialComponentContext( ini_file, bootstrap_parameters ); - + if (AnyConverter.isVoid( xContext.getValueByName( "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) )) @@ -58,7 +58,7 @@ public class Bootstrap_Test { throw new Exception( "no /singletons/com.sun.star.reflection.theTypeDescriptionManager!" ); } - + XMultiServiceFactory msf = UnoRuntime.queryInterface( XMultiServiceFactory.class, xContext.getServiceManager() ); String services[] = msf.getAvailableServiceNames(); @@ -67,16 +67,16 @@ public class Bootstrap_Test { if (services.length == 0) System.out.println("No services avialable!"); - else + else for ( int i=0; i<services.length; i++ ) System.out.println(services[i]); XComponent xComp = UnoRuntime.queryInterface( XComponent.class, xContext ); xComp.dispose(); - + passed = true; - } + } catch (Exception e) { e.printStackTrace(); } @@ -99,7 +99,7 @@ public class Bootstrap_Test { static public void main(String args[]) throws java.lang.Exception { if ( args.length == 0 ) usage(); - + java.util.Hashtable bootstrap_parameters = new java.util.Hashtable(); for ( int nPos = 1; nPos < args.length; ++nPos ) { @@ -110,8 +110,8 @@ public class Bootstrap_Test { bootstrap_parameters.put( arg.substring( 0, n ), arg.substring( n +1 ) ); } } - - System.exit( test(args[0], bootstrap_parameters) == true ? 0: -1 ); + + System.exit( test(args[0], bootstrap_parameters) == true ? 0: -1 ); } } diff --git a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java index f38ecf543249..94f8a1591a4b 100644 --- a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java +++ b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,12 +43,12 @@ public class ComponentContext_Test { Hashtable table = new Hashtable(); table.put( "bla1", new ComponentContextEntry( null, new Integer( 1 ) ) ); XComponentContext xInitialContext = Bootstrap.createInitialComponentContext( table ); - + table = new Hashtable(); table.put( "bla2", new ComponentContextEntry( new Integer( 2 ) ) ); table.put( "bla3", new Integer( 3 ) ); XComponentContext xContext = new ComponentContext( table, xInitialContext ); - + XMultiComponentFactory xSMgr = xContext.getServiceManager(); Object o = xSMgr.createInstanceWithContext( "com.sun.star.loader.Java", xContext ); if (o == null) @@ -68,7 +68,7 @@ public class ComponentContext_Test { o = xSMgr.createInstanceWithContext( "com.sun.star.lang.ServiceManager", xContext ); if (o == null) System.err.println( "### failed raising service: 6!" ); - + if (xContext.getValueByName( "bla1" ) == null || xContext.getValueByName( "bla2" ) == null || xContext.getValueByName( "bla3" ) == null || @@ -84,7 +84,7 @@ public class ComponentContext_Test { { System.err.println( "### bootstrap context test failed: 2!" ); } - + XComponent xComp = UnoRuntime.queryInterface( XComponent.class, xInitialContext ); xComp.dispose(); diff --git a/javaunohelper/test/com/sun/star/comp/helper/RegistryServiceFactory_Test.java b/javaunohelper/test/com/sun/star/comp/helper/RegistryServiceFactory_Test.java index 18a0cac49fa4..c7fe7e69d02c 100644 --- a/javaunohelper/test/com/sun/star/comp/helper/RegistryServiceFactory_Test.java +++ b/javaunohelper/test/com/sun/star/comp/helper/RegistryServiceFactory_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,10 +50,10 @@ import com.sun.star.loader.XImplementationLoader; import com.sun.star.registry.XSimpleRegistry; public class RegistryServiceFactory_Test { - + static public boolean test(String applicat) throws java.lang.Exception { boolean passed = false; - System.err.println(); + System.err.println(); System.out.println("*******************************************************************"); System.err.println("RegistryServiceFactory - doing tests..."); System.err.println(); @@ -66,12 +66,12 @@ public class RegistryServiceFactory_Test { if (services.length == 0) System.out.println("No services avialable!"); - else + else for ( int i=0; i<services.length; i++ ) System.out.println(services[i]); - + passed = true; - } + } catch (Exception e) { e.printStackTrace(); } @@ -94,7 +94,7 @@ public class RegistryServiceFactory_Test { static public void main(String args[]) throws java.lang.Exception { if ( args.length != 1 ) usage(); - System.exit( test(args[0]) == true ? 0: -1 ); + System.exit( test(args[0]) == true ? 0: -1 ); } } diff --git a/javaunohelper/test/com/sun/star/comp/helper/SharedLibraryLoader_Test.java b/javaunohelper/test/com/sun/star/comp/helper/SharedLibraryLoader_Test.java index b417c2544060..885c3c607ffd 100644 --- a/javaunohelper/test/com/sun/star/comp/helper/SharedLibraryLoader_Test.java +++ b/javaunohelper/test/com/sun/star/comp/helper/SharedLibraryLoader_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -51,35 +51,35 @@ import com.sun.star.registry.XSimpleRegistry; public class SharedLibraryLoader_Test { - + private static final String NATIVE_SERVICE_MANAGER_IMP_NAME = "com.sun.star.comp.stoc.OServiceManager"; private static final String NATIVE_SERVICE_MANAGER_LIB_NAME = "servicemgr.uno"; private static final String NATIVE_REGISTRY_IMP_NAME = "com.sun.star.comp.stoc.SimpleRegistry"; private static final String NATIVE_REGISTRY_LIB_NAME = "simplereg.uno"; - - private static XMultiServiceFactory nativeServiceManager = null; - private static XSingleServiceFactory sharedLibraryLoaderFactory = null; - private static XImplementationLoader sharedLibraryLoader = null; - private static XSimpleRegistry simpleRegistry = null; - - static public boolean test_getSharedLibraryLoaderFactory() - throws java.lang.Exception + + private static XMultiServiceFactory nativeServiceManager = null; + private static XSingleServiceFactory sharedLibraryLoaderFactory = null; + private static XImplementationLoader sharedLibraryLoader = null; + private static XSimpleRegistry simpleRegistry = null; + + static public boolean test_getSharedLibraryLoaderFactory() + throws java.lang.Exception { sharedLibraryLoaderFactory = null; System.out.println("*******************************************************************"); System.out.println("Test: <<< get SharedLibraryLoader factory >>>"); sharedLibraryLoaderFactory = SharedLibraryLoader.getServiceFactory(null, null); - + System.out.print("Test - "); - System.out.println(sharedLibraryLoaderFactory == null? "failed" : "successfull"); + System.out.println(sharedLibraryLoaderFactory == null? "failed" : "successfull"); System.out.println("*******************************************************************"); System.out.println(); - + return sharedLibraryLoaderFactory != null; } - static public boolean test_instantiateSharedLibraryLoader() - throws java.lang.Exception + static public boolean test_instantiateSharedLibraryLoader() + throws java.lang.Exception { sharedLibraryLoader = null; System.out.println("*******************************************************************"); @@ -87,47 +87,47 @@ public class SharedLibraryLoader_Test { if ( sharedLibraryLoaderFactory == null ) if ( ! test_getSharedLibraryLoaderFactory() ) return false; - - sharedLibraryLoader = UnoRuntime.queryInterface( + + sharedLibraryLoader = UnoRuntime.queryInterface( XImplementationLoader.class, sharedLibraryLoaderFactory.createInstance() ); - + System.out.print("Test - "); - System.out.println(sharedLibraryLoader == null? "failed" : "successfull"); + System.out.println(sharedLibraryLoader == null? "failed" : "successfull"); System.out.println("*******************************************************************"); System.out.println(); - + return sharedLibraryLoader != null; } - - static public boolean test_loadNativeServiceManager() - throws java.lang.Exception + + static public boolean test_loadNativeServiceManager() + throws java.lang.Exception { nativeServiceManager = null; - + System.out.println("*******************************************************************"); System.out.println("Test: <<< load native ServiceManager >>>"); if ( sharedLibraryLoader == null ) if ( ! test_instantiateSharedLibraryLoader() ) return false; - + System.err.println("- get the native ServiceManger factory"); - XSingleServiceFactory aSMgrFac = - UnoRuntime.queryInterface( XSingleServiceFactory.class, + XSingleServiceFactory aSMgrFac = + UnoRuntime.queryInterface( XSingleServiceFactory.class, sharedLibraryLoader.activate(NATIVE_SERVICE_MANAGER_IMP_NAME, null, NATIVE_SERVICE_MANAGER_LIB_NAME, null)); - + System.err.println("- instantiate the native ServiceManger"); nativeServiceManager = UnoRuntime.queryInterface( XMultiServiceFactory.class, aSMgrFac.createInstance() ); - + System.out.print("Test - "); System.out.println(nativeServiceManager == null? "failed" : "successfull"); - + System.out.println("*******************************************************************"); System.out.println(); return nativeServiceManager != null; } - - static public boolean test_loadNativeSimpleRegistry() - throws java.lang.Exception + + static public boolean test_loadNativeSimpleRegistry() + throws java.lang.Exception { boolean result = false; System.out.println("*******************************************************************"); @@ -137,34 +137,34 @@ public class SharedLibraryLoader_Test { return false; System.err.println("- get factory of the Registry"); - XSingleServiceFactory aRegFac = - UnoRuntime.queryInterface( XSingleServiceFactory.class, + XSingleServiceFactory aRegFac = + UnoRuntime.queryInterface( XSingleServiceFactory.class, sharedLibraryLoader.activate(NATIVE_REGISTRY_IMP_NAME, null, NATIVE_REGISTRY_LIB_NAME, null) ); System.err.println("- instantiate the Registry"); - simpleRegistry = + simpleRegistry = UnoRuntime.queryInterface( XSimpleRegistry.class, aRegFac.createInstance() ); System.out.print("Test - "); System.out.println(simpleRegistry == null? "failed" : "successfull"); System.out.println("*******************************************************************"); - System.err.println(); + System.err.println(); return true; } - static public boolean test_registerSharedLibraryLoader() - throws java.lang.Exception + static public boolean test_registerSharedLibraryLoader() + throws java.lang.Exception { boolean result = true; System.out.println("*******************************************************************"); System.out.println("Test: <<< register SharedLibraryLoader at the Registry >>>"); - + if ( simpleRegistry == null ) if ( ! test_loadNativeSimpleRegistry() ) return false; com.sun.star.registry.XRegistryKey regKey = simpleRegistry.getRootKey(); result = SharedLibraryLoader.writeRegistryServiceInfo( null, regKey ); - + System.out.print("Test - "); System.out.println( result==false ? "failed" : "successfull"); System.out.println("*******************************************************************"); @@ -188,7 +188,7 @@ public class SharedLibraryLoader_Test { } static public void main(String args[]) throws java.lang.Exception { - System.exit( test() == true ? 0: -1 ); + System.exit( test() == true ? 0: -1 ); } } diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/AWeakBase.java b/javaunohelper/test/com/sun/star/lib/uno/helper/AWeakBase.java index 262c13dcf7cc..d44b91006f4b 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/AWeakBase.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/AWeakBase.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,19 +32,19 @@ import com.sun.star.lang.XEventListener; public class AWeakBase extends WeakBase implements XEventListener { public int nDisposingCalled= 0; - + public AWeakBase(int i) { } public AWeakBase() { } - + public void disposing(com.sun.star.lang.EventObject eventObject) { // System.out.println(getClass().getName() + " .disposing called"); nDisposingCalled++; } - + } diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java index 236b8bf312ab..86358d53cb85 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/ComponentBase_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -52,7 +52,7 @@ public class ComponentBase_Test proxyObj2TypeProv= ProxyProvider.createProxy(obj2, XTypeProvider.class); proxyObj3TypeProv= ProxyProvider.createProxy(obj3, XTypeProvider.class); } - + public boolean dispose() { System.out.println("Testing ComponentBase"); @@ -60,7 +60,7 @@ public class ComponentBase_Test boolean r[]= new boolean[50]; int i= 0; // addEventListener - + comp.addEventListener(obj1); comp.addEventListener(obj2); comp.addEventListener(obj3); @@ -85,7 +85,7 @@ public class ComponentBase_Test obj3.nDisposingCalled= 0; comp.dispose(); // allready disposed; r[i++]= obj1.nDisposingCalled == 0; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -95,7 +95,7 @@ public class ComponentBase_Test System.out.println("Ok"); return bOk; } - + public boolean test_finalize() { System.out.println("Testing ComponentBase"); @@ -119,7 +119,7 @@ public class ComponentBase_Test } } r[i++]= obj1.nDisposingCalled == 1; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -129,16 +129,16 @@ public class ComponentBase_Test System.out.println("Ok"); return bOk; } - + public static void main(String[] args) { ComponentBase_Test test= new ComponentBase_Test(); - + boolean r[]= new boolean[50]; int i= 0; r[i++]= test.dispose(); r[i++]= test.test_finalize(); - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -148,6 +148,6 @@ public class ComponentBase_Test System.out.println("No errors."); } - + } diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/Factory_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/Factory_Test.java index 55ad6d687555..c40b4c410286 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/Factory_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/Factory_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -53,7 +53,7 @@ public class Factory_Test static final String m_impl_name = Factory_Test.class.getName(); static final String m_supported_services [] = { "Factory_Test.Service0", "Factory_Test.Service1" }; - + //______________________________________________________________________________________________ public Factory_Test() { @@ -74,7 +74,7 @@ public class Factory_Test { return new Factory_Test( xContext ); } - + // XServiceInfo impl //______________________________________________________________________________________________ public final String getImplementationName() @@ -96,7 +96,7 @@ public class Factory_Test { return m_supported_services; } - + //============================================================================================== public static XSingleComponentFactory __getComponentFactory( String implName ) { @@ -113,12 +113,12 @@ public class Factory_Test return Factory.writeRegistryServiceInfo( m_impl_name, Factory_Test.m_supported_services, xKey ); } - + //============================================================================================== static void service_info_test( Object inst ) { XServiceInfo xInfo = UnoRuntime.queryInterface( XServiceInfo.class, inst ); - + if (! xInfo.getImplementationName().equals( m_impl_name )) { System.err.println( "Factory_Test: err -- 1" ); @@ -153,7 +153,7 @@ public class Factory_Test String rdb = "file://" + new java.io.File( args[ 1 ] ).toURL().getPath(); System.out.println( "jar file = " + jar ); System.out.println( "rdb file = " + rdb ); - + // bootstrap service manager XMultiServiceFactory xMgr = RegistryServiceFactory.create( rdb ); XPropertySet xProps = UnoRuntime.queryInterface( @@ -174,7 +174,7 @@ public class Factory_Test xContext.getServiceManager().createInstanceWithContext( "com.sun.star.registry.ImplementationRegistration", xContext ) ); xImpReg.registerImplementation( "com.sun.star.loader.Java2", jar, xRDB ); - + // tests System.out.println( "testing instance" ); service_info_test( new Factory_Test() ); diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java index 60f87d71ee1e..ba6df3038e0d 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -68,7 +68,7 @@ public class InterfaceContainer_Test List list2; //contains original object + proxies + null value List list3; - + public InterfaceContainer_Test() { obj1= new AWeakBase(); @@ -80,7 +80,7 @@ public class InterfaceContainer_Test proxyObj3Weak2= ProxyProvider.createProxy(obj3, XWeak.class); proxyObj2TypeProv= ProxyProvider.createProxy(obj2, XTypeProvider.class); proxyObj3TypeProv= ProxyProvider.createProxy(obj3, XTypeProvider.class); - + list1= new ArrayList(); list1.add(obj1); list1.add(obj2); @@ -95,7 +95,7 @@ public class InterfaceContainer_Test list3.add(proxyObj2TypeProv); list3.add(proxyObj3Weak1); } - + /** Tests add(object), size(), clear(); */ public boolean add() @@ -104,7 +104,7 @@ public class InterfaceContainer_Test InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + r[i++]= cont.size() == 0; r[i++]= cont.add(obj1); r[i++]= cont.size() == 1; @@ -116,7 +116,7 @@ public class InterfaceContainer_Test cont.clear(); r[i++]= cont.size() == 0; r[i++]= cont.isEmpty(); - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -126,7 +126,7 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + /**Tests list.addAll(Collection c), list.addAll(int index, Collection c) */ public boolean listConstructors() @@ -135,7 +135,7 @@ public class InterfaceContainer_Test boolean r[]= new boolean[50]; int i= 0; InterfaceContainer cont= new InterfaceContainer(100); - + r[i++]= cont.elementData.length == 100; boolean bOk= true; for (int c= 0; c < i; c++) @@ -173,7 +173,7 @@ public class InterfaceContainer_Test InterfaceContainer cont= new InterfaceContainer(10); boolean r[]= new boolean[50]; int i= 0; - + cont.ensureCapacity(9); r[i++]= cont.elementData.length >= 9; cont.ensureCapacity(11); @@ -187,14 +187,14 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean addAll() { System.out.println("Testing List.addAll(Collection c), List.addAll(int index, Collection c)"); InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + r[i++]= cont.addAll(list1); r[i++]= cont.size() == list1.size(); for (int c= 0; c < cont.size(); c++) @@ -216,7 +216,7 @@ public class InterfaceContainer_Test r[i++]= cont.get(0) == list3.get(0); r[i++]= cont.get(1) == list3.get(2); r[i++]= cont.get(2) == list3.get(3); - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -226,7 +226,7 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + /** Tests List.add(int index, Object element), List.get(int index) */ public boolean get() @@ -235,7 +235,7 @@ public class InterfaceContainer_Test InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + cont.add(0, obj1); cont.add(1, obj2); cont.add(1, proxyObj3Weak1); @@ -251,7 +251,7 @@ public class InterfaceContainer_Test { r[i++]= true; } - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -269,7 +269,7 @@ public class InterfaceContainer_Test InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + r[i++]= cont.contains(obj1) ? false : true; // nothing in the list cont.add(obj1); cont.add(proxyObj2TypeProv); @@ -281,7 +281,7 @@ public class InterfaceContainer_Test r[i++]= cont.contains(proxyObj1Weak1); r[i++]= cont.contains(obj3); r[i++]= cont.contains(null) ? false : true; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -315,7 +315,7 @@ public class InterfaceContainer_Test cont.add(3, list1.get(1)); cont.add(5, list1.get(2)); r[i++]= cont.contains(list1) ? false : true; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -342,7 +342,7 @@ public class InterfaceContainer_Test cont.addAll(list2); r[i++]= cont.indexOf(proxyObj3Weak1) == 2; r[i++]= cont.lastIndexOf(proxyObj3Weak2) == 5; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -352,7 +352,7 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + /** Tests List.remove(int index), List.remove(Object element), List.removeAll(Collection c) */ public boolean remove() @@ -361,7 +361,7 @@ public class InterfaceContainer_Test InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + cont.addAll(list2); r[i++]= proxyObj2TypeProv.equals(cont.remove(1)); r[i++]= cont.size() == 2; @@ -376,14 +376,14 @@ public class InterfaceContainer_Test r[i++]= cont.removeAll(list3); r[i++]= cont.isEmpty(); cont.addAll(list2); - + List list= new ArrayList(); list.add(list2.get(0)); list.add(list2.get(1)); list.add(proxyObj3Weak2); r[i++]= cont.removeAll(list); r[i++]= cont.isEmpty(); - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -393,7 +393,7 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + /** Tests List.retainAll */ public boolean retainAll() @@ -402,20 +402,20 @@ public class InterfaceContainer_Test InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + cont.addAll(list1); //obj1, obj2, obj3 cont.addAll(list2); //obj1, proxyObj2TypeProv, proxyObj3TypeProv List list = new ArrayList(); list.add(obj1); list.add(proxyObj3Weak1); - + r[i++]= cont.retainAll(list); r[i++]= cont.get(0) == obj1; r[i++]= cont.get(1) == obj3; r[i++]= cont.get(2) == obj1; r[i++]= cont.get(3) == proxyObj3TypeProv; r[i++]= 4 == cont.size(); - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -425,7 +425,7 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + /** Tests List.set(int index, Object element) **/ public boolean set() @@ -441,7 +441,7 @@ public class InterfaceContainer_Test r[i++]= o2 == list2.get(2); r[i++]= cont.get(0) == obj3; r[i++]= cont.get(2) == proxyObj3Weak1; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -451,7 +451,7 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + /** Tests List.toArray(), List.toArray(Object[] a) */ public boolean toArray() @@ -460,16 +460,16 @@ public class InterfaceContainer_Test InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + cont.addAll(list1); Object[] ar= cont.toArray(); Object[] arOrig= list1.toArray(); r[i++]= ar.length == arOrig.length; - + r[i]= true; for (int c= 0; c < ar.length; c++) r[i]= r[i] && ar[c] == arOrig[c]; - + i++; XWeak[] arWeak= new XWeak[3]; XWeak[] arWeak2= (XWeak[])cont.toArray(arWeak); @@ -477,9 +477,9 @@ public class InterfaceContainer_Test r[i]= true; for (int c= 0; c < ar.length; c++) r[i]= r[i] && ar[c] == arWeak2[c]; - + i++; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -489,14 +489,14 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean Iterator_next() { System.out.println("Testing InterfaceContainer.iterator, Iterator.next()"); InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + cont.addAll(list1); Iterator it= cont.iterator(); r[i++]= it.next() == list1.get(0); @@ -512,7 +512,7 @@ public class InterfaceContainer_Test { r[i++]= false; } - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -522,14 +522,14 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean Iterator_hasNext() { System.out.println("Testing, Iterator.next()"); InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + Iterator it= cont.iterator(); r[i++]= ! it.hasNext(); cont.addAll(list1); @@ -541,7 +541,7 @@ public class InterfaceContainer_Test r[i++]= it.hasNext(); it.next(); r[i++]= ! it.hasNext(); - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -551,14 +551,14 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean Iterator_remove() { System.out.println("Testing, Iterator.remove()"); InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + Iterator it= cont.iterator(); try { @@ -598,7 +598,7 @@ public class InterfaceContainer_Test it.remove(); } r[i++]= cont.isEmpty(); - + // 2 iterators, remove must not impair the other iterator cont.clear(); cont.addAll(list1); @@ -621,7 +621,7 @@ public class InterfaceContainer_Test r[i++]= false; } r[i++]= cont.size() == 0; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -637,7 +637,7 @@ public class InterfaceContainer_Test InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + cont.addAll(list1); Iterator it= cont.listIterator(); r[i++]= it.next() == list1.get(0); @@ -653,7 +653,7 @@ public class InterfaceContainer_Test { r[i++]= false; } - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -663,14 +663,14 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean ListIterator_hasNext() { System.out.println("Testing ListIterator.hasNext()"); InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + Iterator it= cont.listIterator(); r[i++]= ! it.hasNext(); cont.addAll(list1); @@ -682,7 +682,7 @@ public class InterfaceContainer_Test r[i++]= it.hasNext(); it.next(); r[i++]= ! it.hasNext(); - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -692,14 +692,14 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean ListIterator_remove() { System.out.println("Testing ListIterator.remove()"); InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + ListIterator it= cont.listIterator(); try { @@ -739,7 +739,7 @@ public class InterfaceContainer_Test it.remove(); } r[i++]= cont.isEmpty(); - + // 2 iterators, remove must not impair the other iterator cont.clear(); cont.addAll(list1); @@ -762,7 +762,7 @@ public class InterfaceContainer_Test r[i++]= false; } r[i++]= cont.size() == 0; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -772,14 +772,14 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean ListIterator_hasPrevious() { System.out.println("Testing ListIterator.hasPrevious()"); InterfaceContainer cont= new InterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + ListIterator it= cont.listIterator(); r[i++]= ! it.hasPrevious(); cont.addAll(list1); @@ -789,7 +789,7 @@ public class InterfaceContainer_Test it.next(); r[i++]= it.hasPrevious(); } - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -799,7 +799,7 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean ListIterator_previous() { System.out.println("Testing ListIterator.previous()"); @@ -807,7 +807,7 @@ public class InterfaceContainer_Test boolean r[]= new boolean[50]; int i= 0; boolean bOk= true; - + cont.addAll(list1); // go to the end of our list and list1 ListIterator it= cont.listIterator(); @@ -816,7 +816,7 @@ public class InterfaceContainer_Test ListIterator it_list1= list1.listIterator(); while (it_list1.hasNext()) it_list1.next(); - + while (it.hasPrevious()) { r[i++]= it.previous() == it_list1.previous(); @@ -830,7 +830,7 @@ public class InterfaceContainer_Test { r[i++]=true; } - + for (int c= 0; c < i; c++) bOk= bOk && r[c]; if ( ! bOk ) @@ -839,7 +839,7 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean ListIterator_nextIndex() { System.out.println("Testing ListIterator.nextIndex()"); @@ -847,7 +847,7 @@ public class InterfaceContainer_Test boolean r[]= new boolean[50]; int i= 0; boolean bOk= true; - + ListIterator it= cont.listIterator(); cont.addAll(list1); it= cont.listIterator(); @@ -856,7 +856,7 @@ public class InterfaceContainer_Test r[i++]= it.nextIndex() == 1; it.next(); r[i++]= it.nextIndex() == 2; - + for (int c= 0; c < i; c++) bOk= bOk && r[c]; if ( ! bOk ) @@ -872,20 +872,20 @@ public class InterfaceContainer_Test boolean r[]= new boolean[50]; int i= 0; boolean bOk= true; - + ListIterator it= cont.listIterator(); cont.addAll(list1); it= cont.listIterator(); while (it.hasNext()) it.next(); - + r[i++]= it.previousIndex() == 2; it.previous(); r[i++]= it.previousIndex() == 1; it.previous(); r[i++]= it.previousIndex() == 0; it.previous(); - + for (int c= 0; c < i; c++) bOk= bOk && r[c]; if ( ! bOk ) @@ -901,7 +901,7 @@ public class InterfaceContainer_Test boolean r[]= new boolean[50]; int i= 0; boolean bOk= true; - + ListIterator it= cont.listIterator(); it.add(obj1); r[i++]= cont.size() == 1; @@ -911,7 +911,7 @@ public class InterfaceContainer_Test r[i++]= it.previous() == obj3; r[i++]= it.previous() == obj2; r[i++]= it.previous() == obj1; - + for (int c= 0; c < i; c++) bOk= bOk && r[c]; if ( ! bOk ) @@ -920,14 +920,14 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean disposeAndClear() { System.out.println("Testing InterfaceContainer.disposeAndClear"); InterfaceContainer cont= new InterfaceContainer(10); boolean r[]= new boolean[50]; int i= 0; - + cont.add(obj1); cont.add(obj2); cont.add(obj3); @@ -947,7 +947,7 @@ public class InterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public static void main(String[] args) { @@ -986,7 +986,7 @@ public class InterfaceContainer_Test System.out.println("Test finished.\nErrors occured!!!"); else System.out.println("Test finished. \nNo errors."); - + } - + } diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java index c953e7bb98d9..9a855db6ddb5 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,13 +62,13 @@ public class MultiTypeInterfaceContainer_Test obj2= new AWeakBase(); obj3= new AWeakBase(); obj4= new AWeakBase(); - + proxyObj1Weak1= ProxyProvider.createProxy(obj1, XWeak.class); proxyObj3Weak1= ProxyProvider.createProxy(obj3, XWeak.class); proxyObj3Weak2= ProxyProvider.createProxy(obj3, XWeak.class); proxyObj2TypeProv= ProxyProvider.createProxy(obj2, XTypeProvider.class); proxyObj3TypeProv= ProxyProvider.createProxy(obj3, XTypeProvider.class); - + list1= new ArrayList(); list1.add(obj1); list1.add(obj2); @@ -94,7 +94,7 @@ public class MultiTypeInterfaceContainer_Test // Object retVal= null; // if (obj == null || iface == null || iface.isInstance(obj) == false ) // return retVal; -// +// // Type type= new Type(TypeDescription.getTypeDescription(iface)); // Type evtType= new Type(TypeDescription.getTypeDescription(com.sun.star.lang.XEventListener.class)); // // find the object identifier @@ -108,7 +108,7 @@ public class MultiTypeInterfaceContainer_Test // Object aProxyEvt = Proxy.create(eventRequester, sOid, evtType, false, false); // String[] arOid= new String[]{sOid}; // retVal= env.registerInterface(aProxyEvt, arOid, evtType); -// +// // Requester requester = new Requester(false, false, aProxyEvt); // Object aProxy = Proxy.create(requester, sOid, type, false, false); // arOid= new String[] {sOid}; @@ -123,7 +123,7 @@ public class MultiTypeInterfaceContainer_Test MultiTypeInterfaceContainer cont= new MultiTypeInterfaceContainer(); boolean r[]= new boolean[200]; int i= 0; - + int ci= 0; ci= cont.addInterface(new Type(XInterface.class), obj1); ci= cont.addInterface(new Type(XInterface.class), obj2); @@ -136,7 +136,7 @@ public class MultiTypeInterfaceContainer_Test r[i++]= ci == 1; ci= cont.addInterface(new Type(XTypeProvider.class), null); r[i++]= ci == 0; - + cont= new MultiTypeInterfaceContainer(); AWeakBase[] arObj= new AWeakBase[100]; for (int c= 0; c < 100; c++) @@ -149,7 +149,7 @@ public class MultiTypeInterfaceContainer_Test { ci= cont.removeInterface(new Type(XInterface.class), arObj[c]); r[i++]= ci == 100 -c -1; - + } boolean bOk= true; for (int c= 0; c < i; c++) @@ -160,14 +160,14 @@ public class MultiTypeInterfaceContainer_Test System.out.println("Ok"); return bOk; } - + public boolean getContainedTypes() { System.out.println("Testing MultiTypeInterfaceContainer.getContainedTypes"); MultiTypeInterfaceContainer cont= new MultiTypeInterfaceContainer(); boolean r[]= new boolean[50]; int i= 0; - + cont.addInterface(new Type(XInterface.class), obj1); cont.addInterface(new Type(XWeak.class), obj1); cont.addInterface(null, obj1); @@ -230,7 +230,7 @@ public class MultiTypeInterfaceContainer_Test r[i++]= icont.size() == 2; icont= cont.getContainer(null); r[i++]= icont.size() == 1; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -255,7 +255,7 @@ public class MultiTypeInterfaceContainer_Test r[i++]= count == 0; count= cont.removeInterface(null, obj2); r[i++]= count == 0; - + cont.addInterface(new Type(XInterface.class), obj1); cont.addInterface(null, obj1); count= cont.removeInterface(null, obj2); @@ -265,7 +265,7 @@ public class MultiTypeInterfaceContainer_Test r[i++]= count == 0; count= cont.removeInterface(new Type(XInterface.class), obj1); r[i++]= count == 0; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -300,7 +300,7 @@ public class MultiTypeInterfaceContainer_Test cont.clear(); types= cont.getContainedTypes(); r[i++]= types.length == 0; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -328,13 +328,13 @@ public class MultiTypeInterfaceContainer_Test cont.addInterface(new Type(XWeak.class), obj2); cont.addInterface(new Type(XTypeProvider.class), obj1); cont.disposeAndClear(new com.sun.star.lang.EventObject("blabla")); - + r[i++]= obj1.nDisposingCalled == 3; r[i++]= obj2.nDisposingCalled == 2; r[i++]= obj3.nDisposingCalled == 1; Type[] types= cont.getContainedTypes(); r[i++]= types.length == 0; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -344,8 +344,8 @@ public class MultiTypeInterfaceContainer_Test System.out.println("Ok"); return bOk; } - - + + public static void main(String[] args) { MultiTypeInterfaceContainer_Test test= new MultiTypeInterfaceContainer_Test(); @@ -364,8 +364,8 @@ public class MultiTypeInterfaceContainer_Test System.out.println("Test finished.\nErrors occured!!!"); else System.out.println("Test finished. \nNo errors."); - - } + + } } diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java index da63cc1f105b..1a00899cbcf1 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,18 +49,18 @@ import java.util.Arrays; public class PropertySet_Test { - + /** Creates a new instance of PropertySet_Test */ public PropertySet_Test() { } - + public boolean convertPropertyValue() { System.out.println("PropertySet.convertPropertyValue"); boolean[] r= new boolean[50]; int i= 0; - + TestClass cl= new TestClass(); try { r[i++]= cl.test_convertPropertyValue(); @@ -82,7 +82,7 @@ public class PropertySet_Test System.out.println("PropertySet.setValueNoBroadcast"); boolean[] r= new boolean[50]; int i= 0; - + TestClass cl= new TestClass(); try { r[i++]= cl.test_setPropertyValueNoBroadcast(); @@ -104,7 +104,7 @@ public class PropertySet_Test System.out.println("PropertySet.setPropertyValue"); boolean[] r= new boolean[150]; int i= 0; - + TestClass cl= new TestClass(); try { cl.resetPropertyMembers(); @@ -166,7 +166,7 @@ public class PropertySet_Test cl.setPropertyValue("PropTypeA", value); ret= cl.getPropertyValue("PropTypeA"); r[i++]= ((Type) ret).equals(value); - + // test protected,package,private members value= new Boolean(true); cl.setPropertyValue("PropBoolB", value); @@ -175,7 +175,7 @@ public class PropertySet_Test cl.setPropertyValue("PropBoolC", value); ret= cl.getPropertyValue("PropBoolC"); r[i++]= ((Boolean) ret).equals((Boolean) value); - + try{ cl.setPropertyValue("PropBoolD", value); i++; @@ -184,7 +184,7 @@ public class PropertySet_Test r[i++]= true; } cl.resetPropertyMembers(); - + value= new Boolean(true); cl.setPropertyValue("PropObjectA", value); ret= cl.getPropertyValue("PropObjectA"); @@ -240,8 +240,8 @@ public class PropertySet_Test cl.setPropertyValue("PropObjectA", new Any( new Type(byte.class), new Byte((byte)1))); ret= cl.getPropertyValue("PropObjectA"); r[i++]= ((Byte) ret).byteValue() == 1; - - cl.resetPropertyMembers(); + + cl.resetPropertyMembers(); value= new Boolean(true); cl.setPropertyValue("PropAnyA", value); ret= cl.getPropertyValue("PropAnyA"); @@ -295,7 +295,7 @@ public class PropertySet_Test ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); - cl.resetPropertyMembers(); + cl.resetPropertyMembers(); value= new Any(new Type(boolean.class), new Boolean(true)); cl.setPropertyValue("PropBoolA", value); ret= cl.getPropertyValue("PropBoolA"); @@ -348,9 +348,9 @@ public class PropertySet_Test cl.setPropertyValue("PropTypeA", value); ret= cl.getPropertyValue("PropTypeA"); r[i++]= ret instanceof Type && util.anyEquals(value, ret); - - cl.resetPropertyMembers(); + + cl.resetPropertyMembers(); value= new Any(new Type(boolean.class), new Boolean(true)); cl.setPropertyValue("PropAnyA", value); ret= cl.getPropertyValue("PropAnyA"); @@ -403,8 +403,8 @@ public class PropertySet_Test cl.setPropertyValue("PropAnyA", value); ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); - - + + // ------------------------------------------------------------------------------ cl.resetPropertyMembers(); value= new Boolean(true); @@ -439,10 +439,10 @@ public class PropertySet_Test cl.setPropertyValue("PropDoubleClass",value); ret= cl.getPropertyValue("PropDoubleClass"); r[i++]= ((Double) ret).equals((Double) value); - + + cl.resetPropertyMembers(); + cl.resetPropertyMembers(); - - cl.resetPropertyMembers(); value= new Any(new Type(boolean.class), new Boolean(true)); cl.setPropertyValue("PropBoolClass", value); ret= cl.getPropertyValue("PropBoolClass"); @@ -477,7 +477,7 @@ public class PropertySet_Test r[i++]= ret instanceof Double && util.anyEquals(value, ret); value= new Any(new Type(String.class), new String("string")); - + // PropertyAttribute.READONLY cl.propBoolA.Attributes= PropertyAttribute.READONLY; @@ -489,13 +489,13 @@ public class PropertySet_Test r[i++]= true; } cl.propBoolA.Attributes= 0; - + // MAYBEVOID cl.resetPropertyMembers(); // first MAYBEVOID not set - + //primitive members: must not work - + cl.boolPropA= false; try { cl.setPropertyValue("PropBoolA", null); i++; @@ -514,7 +514,7 @@ public class PropertySet_Test r[i++]= true; } cl.propBoolA.Attributes= 0; - + cl.propBoolClass.Attributes= PropertyAttribute.MAYBEVOID; cl.boolClassProp= null; cl.setPropertyValue("PropBoolClass", null); @@ -522,7 +522,7 @@ public class PropertySet_Test // the returned value must be a void any Object objAny= cl.getPropertyValue("PropBoolClass"); r[i++]= util.isVoidAny( objAny); - + cl.boolClassProp= new Boolean(true); cl.setPropertyValue("PropBoolClass", null); r[i++]= cl.boolClassProp == null; @@ -534,7 +534,7 @@ public class PropertySet_Test cl.setPropertyValue("PropXWeakA", null); r[i++]= util.isVoidAny(cl.getPropertyValue("PropXWeakA")); cl.propXWeakA.Attributes= 0; - + cl.anyPropA= null; try{ cl.setPropertyValue("PropAnyA", null); i++; @@ -543,17 +543,17 @@ public class PropertySet_Test } cl.anyPropA= null; cl.propAnyA.Attributes= PropertyAttribute.MAYBEVOID; - + Type _t= new Type(Object.class); cl.setPropertyValue("PropAnyA", null); r[i++]= cl.anyPropA.getType().equals(new Type(void.class)) && cl.anyPropA.getObject() == null; - + cl.anyPropA= new Any(new Type(byte.class),new Byte((byte) 111)); cl.setPropertyValue("PropAnyA", null); r[i++]= cl.anyPropA.getType().equals(new Type(byte.class)) && cl.anyPropA.getObject() == null; - + cl.anyPropA= null; try{ cl.setPropertyValue("PropAnyA", new Object()); i++; @@ -561,7 +561,7 @@ public class PropertySet_Test { r[i++]= true; } - + cl.propObjectA.Attributes= 0; try{ cl.setPropertyValue("PropObjectA", null); i++; @@ -575,19 +575,19 @@ public class PropertySet_Test { r[i++]= true; } - + cl.propObjectA.Attributes= PropertyAttribute.MAYBEVOID; cl.propObjectA= null; cl.setPropertyValue("PropObjectA", null); r[i++]= cl.propObjectA == null; - + cl.propObjectA= null; cl.setPropertyValue("PropObjectA", new Any( new Type(byte.class), null)); r[i++]= cl.propObjectA == null; - - - // - + + + // + }catch(java.lang.Exception e){ i++; } @@ -604,7 +604,7 @@ public class PropertySet_Test public boolean addPropertyChangeListener() { System.out.println("PropertySet.addPropertyChangeListener,\n" + - "PropertySet.removePropertChangeListener," + + "PropertySet.removePropertChangeListener," + "PropertySet.addVetoableChangeListener, \n" + "PropertySet.removeVetoableChangeListener" + "Notification of listeners"); @@ -623,7 +623,7 @@ public class PropertySet_Test cl.setPropertyValue("PropByteA", val2); r[i++]= li.nChangeCalled == 1 && li.nVetoCalled == 0; r[i++]= li.evt.OldValue.equals(val1) && li.evt.NewValue.equals(val2) && li.evt.Source == cl; - + li.reset(); Listener li2= new Listener(); cl.addPropertyChangeListener("PropByteA", li2); @@ -631,9 +631,9 @@ public class PropertySet_Test cl.setPropertyValue("PropByteA", val3); r[i++]= li.nChangeCalled == 1 && li.nVetoCalled == 0 && li2.nChangeCalled == 1 && li2.nVetoCalled == 0; - r[i++]= li.evt.OldValue.equals(val2) && li.evt.NewValue.equals(val3) && li.evt.Source == cl + r[i++]= li.evt.OldValue.equals(val2) && li.evt.NewValue.equals(val3) && li.evt.Source == cl && li2.evt.OldValue.equals(val2) && li2.evt.NewValue.equals(val3) && li2.evt.Source == cl ; - + li.reset(); li2.reset(); Listener li3= new Listener(); @@ -643,8 +643,8 @@ public class PropertySet_Test r[i++]= li.nChangeCalled == 1 && li.nVetoCalled == 0 && li2.nChangeCalled == 1 && li2.nVetoCalled == 0 && li3.nChangeCalled == 1 && li3.nVetoCalled == 0; - r[i++]= li.evt.OldValue.equals(val3) && li.evt.NewValue.equals(val1) && li.evt.Source == cl; - r[i++]= li2.evt.OldValue.equals(val3) && li2.evt.NewValue.equals(val1) && li2.evt.Source == cl; + r[i++]= li.evt.OldValue.equals(val3) && li.evt.NewValue.equals(val1) && li.evt.Source == cl; + r[i++]= li2.evt.OldValue.equals(val3) && li2.evt.NewValue.equals(val1) && li2.evt.Source == cl; r[i++]= li3.evt.OldValue.equals(val3) && li3.evt.NewValue.equals(val1) && li3.evt.Source == cl ; li.reset(); @@ -663,7 +663,7 @@ public class PropertySet_Test r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0 && li2.nChangeCalled == 0 && li2.nVetoCalled == 0 && li3.nChangeCalled == 1 && li3.nVetoCalled == 0; - + cl.removePropertyChangeListener("", li3); li.reset(); li2.reset(); @@ -686,7 +686,7 @@ public class PropertySet_Test { r[i++]= true; } - + //Vetoable tests cl= new TestClass(); li.reset(); @@ -703,7 +703,7 @@ public class PropertySet_Test cl.setPropertyValue("PropByteA", val2); r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 1; r[i++]= li.evt.OldValue.equals(val1) && li.evt.NewValue.equals(val2) && li.evt.Source == cl; - + li.reset(); li2.reset(); li3.reset(); @@ -712,9 +712,9 @@ public class PropertySet_Test cl.setPropertyValue("PropByteA", val3); r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 1 && li2.nChangeCalled == 0 && li2.nVetoCalled == 1; - r[i++]= li.evt.OldValue.equals(val2) && li.evt.NewValue.equals(val3) && li.evt.Source == cl + r[i++]= li.evt.OldValue.equals(val2) && li.evt.NewValue.equals(val3) && li.evt.Source == cl && li2.evt.OldValue.equals(val2) && li2.evt.NewValue.equals(val3) && li2.evt.Source == cl ; - + li.reset(); li2.reset(); li3.reset(); @@ -724,8 +724,8 @@ public class PropertySet_Test r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 1 && li2.nChangeCalled == 0 && li2.nVetoCalled == 1 && li3.nChangeCalled == 0 && li3.nVetoCalled == 1; - r[i++]= li.evt.OldValue.equals(val3) && li.evt.NewValue.equals(val1) && li.evt.Source == cl; - r[i++]= li2.evt.OldValue.equals(val3) && li2.evt.NewValue.equals(val1) && li2.evt.Source == cl; + r[i++]= li.evt.OldValue.equals(val3) && li.evt.NewValue.equals(val1) && li.evt.Source == cl; + r[i++]= li2.evt.OldValue.equals(val3) && li2.evt.NewValue.equals(val1) && li2.evt.Source == cl; r[i++]= li3.evt.OldValue.equals(val3) && li3.evt.NewValue.equals(val1) && li3.evt.Source == cl ; li.reset(); @@ -759,7 +759,7 @@ public class PropertySet_Test r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0 && li2.nChangeCalled == 0 && li2.nVetoCalled == 0 && li3.nChangeCalled == 0 && li3.nVetoCalled == 1; - + cl.removeVetoableChangeListener("", li3); li.reset(); li2.reset(); @@ -801,7 +801,7 @@ public class PropertySet_Test System.out.println("PropertySet.getPropertySetInfo"); boolean[] r= new boolean[50]; int i= 0; - + TestClass cl= new TestClass(); try { XPropertySetInfo info= cl.getPropertySetInfo(); @@ -822,7 +822,7 @@ public class PropertySet_Test if ( !bFound) r[i++]= false; } - + for (int j= 0; j < arRegProps.length; j++) { Property prop= info.getPropertyByName(arRegProps[j].Name); @@ -831,13 +831,13 @@ public class PropertySet_Test if (! info.hasPropertyByName(arRegProps[j].Name)) r[i++]= false; } - - + + }catch(java.lang.Exception e){ System.out.println(e.getMessage()); i++; } - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -853,7 +853,7 @@ public class PropertySet_Test System.out.println("PropertySet.setFastPropertyValue"); boolean[] r= new boolean[50]; int i= 0; - + TestClass cl= new TestClass(); try { cl.setFastPropertyValue(5, new Integer(111)); @@ -868,7 +868,7 @@ public class PropertySet_Test System.out.println(e.getMessage()); i++; } - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -884,7 +884,7 @@ public class PropertySet_Test System.out.println("PropertySet.setFastPropertyValue"); boolean[] r= new boolean[50]; int i= 0; - + TestClass cl= new TestClass(); try { cl.setFastPropertyValue(5, new Integer(111)); @@ -894,7 +894,7 @@ public class PropertySet_Test System.out.println(e.getMessage()); i++; } - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -910,7 +910,7 @@ public class PropertySet_Test System.out.println("PropertySet.setPropertyValues"); boolean[] r= new boolean[50]; int i= 0; - + TestClass cl= new TestClass(); try { cl.setPropertyValues(new String[0], new Object[0]); @@ -921,7 +921,7 @@ public class PropertySet_Test Object[] values= new Object[]{aChar, aInt, aByte}; cl.setPropertyValues(arNames, values); r[i++]= cl.charPropA == 'A' && cl.intClassProp.intValue() == 111 && ((Byte)cl.objectPropA).byteValue() == 11; - + arNames= new String[] {"blabla","PropIntClass","PropObjectA"}; cl.resetPropertyMembers(); cl.setPropertyValues(arNames, values); @@ -945,15 +945,15 @@ public class PropertySet_Test System.out.println("PropertySet.getPropertyValues"); boolean[] r= new boolean[50]; int i= 0; - + TestClass cl= new TestClass(); try { cl.charPropA= 'A'; cl.intClassProp= new Integer(111); cl.objectPropA= new Byte((byte)11); Object[] values= cl.getPropertyValues(new String[] {"PropCharA","PropIntClass","PropObjectA"}); - - r[i++]= ((Character) values[0]).charValue() == 'A' && ((Integer) values[1]).intValue() == 111 + + r[i++]= ((Character) values[0]).charValue() == 'A' && ((Integer) values[1]).intValue() == 111 && ((Byte) values[2]).byteValue() == 11; }catch(java.lang.Exception e){ System.out.println(e.getMessage()); @@ -973,12 +973,12 @@ public class PropertySet_Test // The property names in the first argument are ignored. public boolean addPropertiesChangeListener() { - System.out.println("PropertySet.addPropertiesChangeListener\n" + + System.out.println("PropertySet.addPropertiesChangeListener\n" + "PropertySet.removePropertiesChangeListener\n" + "notification of such listeners"); boolean[] r= new boolean[50]; int i= 0; - + TestClass cl= new TestClass(); try { Listener li1= new Listener(); @@ -989,7 +989,7 @@ public class PropertySet_Test cl.propCharA.Attributes= PropertyAttribute.BOUND; cl.setPropertyValue("PropCharA", new Character('C')); r[i++]= li1.nPropertiesChange == 1; - + PropertyChangeEvent evt= li1.arEvt[0]; r[i++]= evt.PropertyName.equals("PropCharA") && ((Character)evt.OldValue).charValue() == 'B' && ((Character) evt.NewValue).charValue() == 'C'; @@ -1013,10 +1013,10 @@ public class PropertySet_Test public boolean firePropertiesChangeEvent() { - System.out.println("PropertySet.firePropertiesChangeEvent"); + System.out.println("PropertySet.firePropertiesChangeEvent"); boolean[] r= new boolean[50]; int i= 0; - + TestClass cl= new TestClass(); try { Listener li1= new Listener(); @@ -1025,10 +1025,10 @@ public class PropertySet_Test cl.firePropertiesChangeEvent(new String[]{"PropCharA","PropIntClass"}, li1); r[i++]= li1.nPropertiesChange == 1; PropertyChangeEvent[] arEvt= li1.arEvt; - r[i++]= arEvt[0].PropertyName.equals("PropCharA") + r[i++]= arEvt[0].PropertyName.equals("PropCharA") && ((Character) arEvt[0].OldValue).charValue() == 'A' && ((Character) arEvt[0].NewValue).charValue() == 'A'; - r[i++]= arEvt[1].PropertyName.equals("PropIntClass") + r[i++]= arEvt[1].PropertyName.equals("PropIntClass") && ((Integer) arEvt[1].OldValue).intValue() == 111 && ((Integer) arEvt[1].NewValue).intValue() == 111; }catch(java.lang.Exception e){ @@ -1044,7 +1044,7 @@ public class PropertySet_Test System.out.println("Ok"); return bOk; } - + public boolean registerProperty1() { TestClass2 cl= new TestClass2(); @@ -1087,7 +1087,7 @@ public class PropertySet_Test public static void main(String[] args) { test(); - } + } } class TestClass extends PropertySet @@ -1122,20 +1122,20 @@ class TestClass extends PropertySet public XInterface xInterfacePropA; public Property propXWeakA= new Property("PropXWeakA", 13, new Type(Any.class), (short) 0); public XWeak xWeakPropA; - public Property propEnum = + public Property propEnum = new Property("PropEnum", 14, new Type("com.sun.star.beans.PropertyState", TypeClass.ENUM), (short)0); public com.sun.star.beans.PropertyState enumPropertyState = com.sun.star.beans.PropertyState.DEFAULT_VALUE; // Test private, protected, package access, Anys as arguments and members, members whith a value public Property propBoolB= new Property("PropBoolB", 101, new Type(Boolean.TYPE), (short) 0); protected boolean boolPropB; - + public Property propBoolC= new Property("PropBoolC", 201, new Type(Boolean.TYPE), (short) 0); boolean boolPropC; - public Property propBoolD= new Property("PropBoolD", 301, new Type(Boolean.TYPE), (short) 0); + public Property propBoolD= new Property("PropBoolD", 301, new Type(Boolean.TYPE), (short) 0); private boolean boolPropD; - + public Property propBoolClass= new Property("PropBoolClass", 1001, new Type(Boolean.class), (short) 0); public Boolean boolClassProp; public Property propCharClass= new Property("PropCharClass", 1002, new Type(Character.class), (short) 0); @@ -1153,10 +1153,10 @@ class TestClass extends PropertySet public Property propDoubleClass= new Property("PropDoubleClass", 1008, new Type(Double.class), (short) 0); public Double doubleClassProp; - + public TestClass() { - + super(); // When adding properties then modify the getRegisteredProperties method //registerProperty(String name, int handle, Type type, short attributes, String memberName) @@ -1188,17 +1188,17 @@ class TestClass extends PropertySet registerProperty(propFloatClass, "floatClassProp"); registerProperty(propDoubleClass, "doubleClassProp"); } - + /** When adding properties then modify the getRegisteredProperties method */ public Property[] getRegisteredProperties() { return new Property[] { propBoolA, propCharA, propByteA, propShortA, - propIntA, propLongA, propFloatA, propDoubleA, - propStringA, propArrayByteA, propTypeA, propObjectA, - propAnyA, propXInterfaceA, propXWeakA, propEnum, propBoolB, - propBoolC, propBoolD, propBoolClass, propCharClass, + propIntA, propLongA, propFloatA, propDoubleA, + propStringA, propArrayByteA, propTypeA, propObjectA, + propAnyA, propXInterfaceA, propXWeakA, propEnum, propBoolB, + propBoolC, propBoolD, propBoolClass, propCharClass, propByteClass, propShortClass, propIntClass, propLongClass, propFloatClass, propDoubleClass }; @@ -1208,11 +1208,11 @@ class TestClass extends PropertySet { boolean[] r= new boolean[150]; int i= 0; - + resetPropertyMembers(); Object[] outOldVal= new Object[1]; Object[] outNewVal= new Object[1]; - + Object value= new Boolean(true); try { @@ -1279,11 +1279,11 @@ class TestClass extends PropertySet r[i++]= outNewVal[0] instanceof XInterface && outNewVal[0].equals(value); r[i++]= convertPropertyValue(propXWeakA, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof XWeak && outNewVal[0].equals(value); - + value = com.sun.star.beans.PropertyState.DIRECT_VALUE; r[i++]= convertPropertyValue(propEnum, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof com.sun.star.uno.Enum && outNewVal[0].equals(value); - + // Any arguments ------------------------------------------------------------------ value= new Any( new Type(Integer.class),new Integer(111)); r[i++]= convertPropertyValue(propIntA, outNewVal, outOldVal, value); @@ -1480,13 +1480,13 @@ class TestClass2 extends PropertySet public char charA; protected char charB; char charC; - + int intMemberA; - + public Character charClassA; protected Character charClassB; Character charClassC; - + boolean test_registerProperty1() { System.out.println("registerProperty Test 1"); @@ -1496,7 +1496,7 @@ class TestClass2 extends PropertySet registerProperty("PropChar", new Type(char.class), (short) 0, "PropChar"); registerProperty("PropInt", new Type(int.class), (short) 0, "PropInt"); registerProperty("PropString", new Type(String.class), (short) 0, "PropString"); - + XPropertySetInfo info= getPropertySetInfo(); Property[] props= info.getProperties(); for (int j= 0; j < props.length; j++) @@ -1524,7 +1524,7 @@ class TestClass2 extends PropertySet System.out.println("Ok"); return bOk; } - + boolean test_registerProperty2() { System.out.println("registerProperty Test 2"); @@ -1536,7 +1536,7 @@ class TestClass2 extends PropertySet registerProperty("charC", "charC", (short) 0); registerProperty("charClassB", "charClassB", PropertyAttribute.MAYBEVOID); registerProperty("IntProp", "intMemberA", (short) 0); - + XPropertySetInfo info= getPropertySetInfo(); Property[] props= info.getProperties(); for (int j= 0; j < props.length; j++) @@ -1590,7 +1590,7 @@ class TestClass2 extends PropertySet } -class util +class util { // An Object is considered an Any with TypeClass.VOID and no value. static boolean anyEquals(Object val1, Object val2) @@ -1642,7 +1642,7 @@ class util } } -class Listener implements XPropertyChangeListener, XVetoableChangeListener, +class Listener implements XPropertyChangeListener, XVetoableChangeListener, XPropertiesChangeListener { int nChangeCalled; @@ -1667,12 +1667,12 @@ XPropertiesChangeListener if (bVeto) throw new PropertyVetoException(); } - + public void disposing( /*IN*/EventObject Source ) { nDisposingCalled++; } - + public void reset() { nChangeCalled= 0; @@ -1689,5 +1689,5 @@ XPropertiesChangeListener nPropertiesChange++; arEvt= propertyChangeEvent; } - + } diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/ProxyProvider.java b/javaunohelper/test/com/sun/star/lib/uno/helper/ProxyProvider.java index ba25567fdc45..483ea7382f7d 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/ProxyProvider.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/ProxyProvider.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,7 +39,7 @@ import com.sun.star.lib.uno.environments.java.java_environment; public class ProxyProvider { static java_environment env= new java_environment(null); - + /** Creates a new instance of ProxyProvider */ public ProxyProvider() { @@ -56,7 +56,7 @@ public class ProxyProvider Object retVal= null; if (obj == null || iface == null || iface.isInstance(obj) == false ) return retVal; - + Type type= new Type(TypeDescription.getTypeDescription(iface)); Type evtType= new Type(TypeDescription.getTypeDescription(com.sun.star.lang.XEventListener.class)); // find the object identifier @@ -86,7 +86,7 @@ class Proxy implements IQueryInterface, XEventListener public String getOid() { return oid; } - + public boolean isSame(Object object) { if (object instanceof IQueryInterface) { @@ -99,21 +99,21 @@ class Proxy implements IQueryInterface, XEventListener return false; } } - + String oidObj = UnoRuntime.generateOid(object); if (oidObj.equals(oid)) return true; else return false; } - + public Object queryInterface(Type type) { return null; } - + public void disposing(com.sun.star.lang.EventObject eventObject) { } - + } @@ -123,7 +123,7 @@ class Proxy implements IQueryInterface, XEventListener // boolean _virtual; // boolean _forceSynchronous; // boolean _passed = true; -// +// // Object _xEventListenerProxy; // int nDisposingCalled= 0; // @@ -132,9 +132,9 @@ class Proxy implements IQueryInterface, XEventListener // _virtual = virtual; // _forceSynchronous = forceSynchronous; // _xEventListenerProxy= evtListener; -// +// // } -// +// // public Object sendRequest(Object object, // Type type, // String operation, @@ -142,7 +142,7 @@ class Proxy implements IQueryInterface, XEventListener // Boolean synchron[], // Boolean mustReply[]) throws Throwable // { -// +// // Object result = null; // if (operation.equals("disposing")) // { diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/UnoUrlTest.java b/javaunohelper/test/com/sun/star/lib/uno/helper/UnoUrlTest.java index 371e3d838300..21b7734f4068 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/UnoUrlTest.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/UnoUrlTest.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ public class UnoUrlTest { } private void assertTrue(boolean b) { - if (!b) + if (!b) fail("boolean assertion failed"); } @@ -217,7 +217,7 @@ public class UnoUrlTest { public static void main(String args[]) { UnoUrlTest t = new UnoUrlTest(); - + log("Running test case 1"); t.testStart1(); log("Running test case 2"); @@ -230,32 +230,32 @@ public class UnoUrlTest { log("Running test case 5"); t.testParam1(); log("Running test case 6"); - t.testParam2(); - + t.testParam2(); + log("Running test case 7"); t.testPartName1(); - + log("Running test case 8"); t.testOID1(); - + log("Running test case 9"); t.testOIDandParams1(); log("Running test case 10"); t.testOIDandParams2(); - + log("Running test case 11"); t.testParams1(); log("Running test case 12"); t.testParams2(); log("Running test case 13"); t.testParams3(); - + log("Running test case 14"); t.testCommon(); - + log("Running test case 15"); t.testUTF(); log("Running test case 16"); - t.testUTF1(); + t.testUTF1(); } } diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java index d80644a4d8d2..ad2869c239b1 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,18 +35,18 @@ import com.sun.star.uno.XAdapter; public class WeakBase_Test { - + /** Creates a new instance of WeakBase_Test */ public WeakBase_Test() { } - + public boolean getTypes() { System.out.println("Testing WeakBase.getTypes"); boolean[] r= new boolean[50]; int i= 0; - + SomeClass comp= new SomeClass(); Type[] types= comp.getTypes(); //XWeak,XTypeProvider,XReference,XBridgeSupplier2 r[i++]= types.length == 4; @@ -62,9 +62,9 @@ public class WeakBase_Test r[i++]= true; else r[i++]= false; - + } - + Foo1 f1= new Foo1(); Foo1 f2= new Foo1(); Type[] t1= f1.getTypes(); @@ -86,11 +86,11 @@ public class WeakBase_Test System.out.println("Testing WeakBase.getImplementationId"); boolean[] r= new boolean[50]; int i= 0; - + SomeClass comp= new SomeClass(); // byte 0 - 3 contain hashcode and the remaining bytes represent the classname byte [] ar= comp.getImplementationId(); - + StringBuffer buff= new StringBuffer(); for (int c= 0; c < ar.length - 4; c++){ buff.append((char) ar[4 + c]); @@ -99,7 +99,7 @@ public class WeakBase_Test String retStr= buff.toString(); r[i++]= retStr.equals("com.sun.star.lib.uno.helper.SomeClass"); // System.out.println(buff.toString()); - + Foo1 f1= new Foo1(); Foo1 f2= new Foo1(); r[i++]= f1.getImplementationId().equals(f2.getImplementationId()); @@ -122,14 +122,14 @@ public class WeakBase_Test System.out.println("Testing WeakBase.queryAdapter, XAdapter tests"); boolean[] r= new boolean[50]; int i= 0; - + SomeClass comp= new SomeClass(); XAdapter adapter= comp.queryAdapter(); MyRef aRef1= new MyRef(); MyRef aRef2= new MyRef(); adapter.addReference(aRef1); adapter.addReference(aRef2); - + r[i++]= adapter.queryAdapted() == comp; comp= null; System.out.println("Wait 5 sec"); @@ -144,21 +144,21 @@ public class WeakBase_Test { } } - + r[i++]= aRef1.nDisposeCalled == 1; r[i++]= aRef2.nDisposeCalled == 1; r[i++]= adapter.queryAdapted() == null; adapter.removeReference(aRef1); // should not do any harm - adapter.removeReference(aRef2); - + adapter.removeReference(aRef2); + comp= new SomeClass(); adapter= comp.queryAdapter(); aRef1.nDisposeCalled= 0; aRef2.nDisposeCalled= 0; - + adapter.addReference(aRef1); adapter.addReference(aRef2); - + adapter.removeReference(aRef1); System.out.println("Wait 5 sec"); comp= null; @@ -175,7 +175,7 @@ public class WeakBase_Test } r[i++]= aRef1.nDisposeCalled == 0; r[i++]= aRef2.nDisposeCalled == 1; - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -194,7 +194,7 @@ public class WeakBase_Test r[i++]= test.getTypes(); r[i++]= test.getImplementationId(); r[i++]= test.queryAdapter(); - + boolean bOk= true; for (int c= 0; c < i; c++) bOk= bOk && r[c]; @@ -204,7 +204,7 @@ public class WeakBase_Test System.out.println("No errors."); } - + } interface Aint @@ -212,7 +212,7 @@ interface Aint } class OtherClass extends WeakBase implements XBridgeSupplier2 { - + public Object createBridge(Object obj, byte[] values, short param, short param3) throws com.sun.star.lang.IllegalArgumentException { return null; @@ -221,17 +221,17 @@ class OtherClass extends WeakBase implements XBridgeSupplier2 class SomeClass extends OtherClass implements Aint,XReference { - + public void dispose() { } - + } class MyRef implements XReference { int nDisposeCalled; - + public void dispose() { nDisposeCalled++; |