diff options
author | Noel Grandin <noel@peralex.com> | 2012-09-03 09:43:32 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-09-05 21:01:46 +0200 |
commit | 97b5851e97c72f44c4d1f498c8cd786fe8561803 (patch) | |
tree | 48a0b96eca123c19d30903b21db0f07708de02af /odk/examples | |
parent | 44325e03b1740dd91fd8b6a7b54d4f916adbd2b0 (diff) |
Java cleanup, update code for changes in UNO encryption API
Change-Id: Ib7133d090dbf881d43b4adf363fb065c682476c5
Diffstat (limited to 'odk/examples')
-rw-r--r-- | odk/examples/java/Storage/Test01.java | 16 | ||||
-rw-r--r-- | odk/examples/java/Storage/Test02.java | 14 | ||||
-rw-r--r-- | odk/examples/java/Storage/Test03.java | 6 | ||||
-rw-r--r-- | odk/examples/java/Storage/Test04.java | 22 | ||||
-rw-r--r-- | odk/examples/java/Storage/Test05.java | 36 | ||||
-rw-r--r-- | odk/examples/java/Storage/Test06.java | 10 | ||||
-rw-r--r-- | odk/examples/java/Storage/Test07.java | 4 | ||||
-rw-r--r-- | odk/examples/java/Storage/Test08.java | 20 | ||||
-rw-r--r-- | odk/examples/java/Storage/Test09.java | 4 | ||||
-rw-r--r-- | odk/examples/java/Storage/TestHelper.java | 24 |
10 files changed, 78 insertions, 78 deletions
diff --git a/odk/examples/java/Storage/Test01.java b/odk/examples/java/Storage/Test01.java index 4cc08ab99291..5ecf7673e75f 100644 --- a/odk/examples/java/Storage/Test01.java +++ b/odk/examples/java/Storage/Test01.java @@ -68,7 +68,7 @@ public class Test01 implements StorageTest { // open a new substorage XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xTempSubStorage == null ) { m_aTestHelper.Error( "Can't create substorage!" ); @@ -91,20 +91,20 @@ public class Test01 implements StorageTest { if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType3", true, - ElementModes.ELEMENT_READWRITE ) ) + ElementModes.READWRITE ) ) return false; // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, "MediaType4", false, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; // create temporary storage based on a previously created temporary file Object pArgs[] = new Object[2]; pArgs[0] = (Object) sTempFileURL; - pArgs[1] = new Integer( ElementModes.ELEMENT_WRITE ); + pArgs[1] = new Integer( ElementModes.WRITE ); Object oTempFileStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xTempFileStorage = (XStorage)UnoRuntime.queryInterface( XStorage.class, oTempFileStorage ); @@ -128,7 +128,7 @@ public class Test01 implements StorageTest { // ================================================ // the temporary file must not be locked any more after storage disposing - pArgs[1] = new Integer( ElementModes.ELEMENT_READWRITE ); + pArgs[1] = new Integer( ElementModes.READWRITE ); Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xResultStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResultStorage ); if ( xResultStorage == null ) @@ -137,20 +137,20 @@ public class Test01 implements StorageTest { return false; } - if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType3", true, ElementModes.ELEMENT_READWRITE ) ) + if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType3", true, ElementModes.READWRITE ) ) return false; // open existing substorage XStorage xResultSubStorage = m_aTestHelper.openSubStorage( xResultStorage, "SubStorage1", - ElementModes.ELEMENT_READ ); + ElementModes.READ ); if ( xResultSubStorage == null ) { m_aTestHelper.Error( "Can't open existing substorage!" ); return false; } - if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType4", false, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType4", false, ElementModes.READ ) ) return false; if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream1", "MediaType1", pBytes1 ) ) diff --git a/odk/examples/java/Storage/Test02.java b/odk/examples/java/Storage/Test02.java index 015ebb1a86ef..e4bc5b787aa8 100644 --- a/odk/examples/java/Storage/Test02.java +++ b/odk/examples/java/Storage/Test02.java @@ -57,7 +57,7 @@ public class Test02 implements StorageTest { // create storage based on the temporary stream Object pArgs[] = new Object[2]; pArgs[0] = (Object) xTempFileStream; - pArgs[1] = new Integer( ElementModes.ELEMENT_WRITE ); + pArgs[1] = new Integer( ElementModes.WRITE ); Object oTempStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xTempStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oTempStorage ); @@ -70,7 +70,7 @@ public class Test02 implements StorageTest { // open a new substorage XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xTempSubStorage == null ) { m_aTestHelper.Error( "Can't create substorage!" ); @@ -87,14 +87,14 @@ public class Test02 implements StorageTest { if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType2", true, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, "MediaType3", false, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; // commit substorage first @@ -138,20 +138,20 @@ public class Test02 implements StorageTest { return false; } - if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType2", true, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType2", true, ElementModes.READ ) ) return false; // open existing substorage XStorage xResultSubStorage = m_aTestHelper.openSubStorage( xResultStorage, "SubStorage1", - ElementModes.ELEMENT_READ ); + ElementModes.READ ); if ( xResultSubStorage == null ) { m_aTestHelper.Error( "Can't open existing substorage!" ); return false; } - if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType3", false, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType3", false, ElementModes.READ ) ) return false; if ( !m_aTestHelper.checkStream( xResultSubStorage, "SubStream1", "MediaType1", pBytes1 ) ) diff --git a/odk/examples/java/Storage/Test03.java b/odk/examples/java/Storage/Test03.java index fd59a6cbe183..deff72a4422e 100644 --- a/odk/examples/java/Storage/Test03.java +++ b/odk/examples/java/Storage/Test03.java @@ -62,7 +62,7 @@ public class Test03 implements StorageTest { // open a new substorage XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xTempSubStorage == null ) { m_aTestHelper.Error( "Can't create substorage!" ); @@ -85,7 +85,7 @@ public class Test03 implements StorageTest { if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, "MediaType3", false, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; if ( !m_aTestHelper.commitStorage( xTempSubStorage ) ) @@ -176,7 +176,7 @@ public class Test03 implements StorageTest { if ( xResultSubStorage == null ) return false; - if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType3", false, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType3", false, ElementModes.READ ) ) return false; XNameAccess xChildAccess = (XNameAccess) UnoRuntime.queryInterface( XNameAccess.class, xResultSubStorage ); diff --git a/odk/examples/java/Storage/Test04.java b/odk/examples/java/Storage/Test04.java index 18d9ab902c2a..c5a7fd6f6524 100644 --- a/odk/examples/java/Storage/Test04.java +++ b/odk/examples/java/Storage/Test04.java @@ -73,7 +73,7 @@ public class Test04 implements StorageTest { // first substorage of the root storage XStorage xTempSubStorage1 = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xTempSubStorage1 == null ) { m_aTestHelper.Error( "Can't create substorage!" ); @@ -89,7 +89,7 @@ public class Test04 implements StorageTest { // second substorage of the root storage XStorage xTempSubStorage2 = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage2", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xTempSubStorage2 == null ) { m_aTestHelper.Error( "Can't create substorage!" ); @@ -106,27 +106,27 @@ public class Test04 implements StorageTest { if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType3", true, - ElementModes.ELEMENT_READWRITE ) ) + ElementModes.READWRITE ) ) return false; // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage1, "MediaType4", false, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage2, "MediaType5", false, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; // create temporary storage based on a previously created temporary file Object pArgs[] = new Object[2]; pArgs[0] = (Object) sTempFileURL; - pArgs[1] = new Integer( ElementModes.ELEMENT_WRITE ); + pArgs[1] = new Integer( ElementModes.WRITE ); Object oTempFileStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xTempFileStorage = (XStorage)UnoRuntime.queryInterface( XStorage.class, oTempFileStorage ); @@ -187,7 +187,7 @@ public class Test04 implements StorageTest { // ================================================ // the temporary file must not be locked any more after storage disposing - pArgs[1] = new Integer( ElementModes.ELEMENT_READWRITE ); + pArgs[1] = new Integer( ElementModes.READWRITE ); Object oResStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xResStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResStorage ); if ( xResStorage == null ) @@ -199,28 +199,28 @@ public class Test04 implements StorageTest { // open and check SubStorage1 XStorage xResSubStorage1 = m_aTestHelper.openSubStorage( xResStorage, "SubStorage1", - ElementModes.ELEMENT_READ ); + ElementModes.READ ); if ( xResSubStorage1 == null ) { m_aTestHelper.Error( "Can't open existing substorage!" ); return false; } - if ( !m_aTestHelper.checkStorageProperties( xResSubStorage1, "MediaType4", false, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResSubStorage1, "MediaType4", false, ElementModes.READ ) ) return false; // open and check SubStorage2 XStorage xResSubStorage2 = m_aTestHelper.openSubStorage( xResStorage, "SubStorage2", - ElementModes.ELEMENT_READ ); + ElementModes.READ ); if ( xResSubStorage2 == null ) { m_aTestHelper.Error( "Can't open existing substorage!" ); return false; } - if ( !m_aTestHelper.checkStorageProperties( xResSubStorage2, "MediaType5", false, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResSubStorage2, "MediaType5", false, ElementModes.READ ) ) return false; diff --git a/odk/examples/java/Storage/Test05.java b/odk/examples/java/Storage/Test05.java index 0b0fa4e12efe..c9877e0a5c9d 100644 --- a/odk/examples/java/Storage/Test05.java +++ b/odk/examples/java/Storage/Test05.java @@ -59,7 +59,7 @@ public class Test05 implements StorageTest { // create temporary storage based on a previously created temporary file Object pArgs[] = new Object[2]; pArgs[0] = (Object) sTempFileURL; - pArgs[1] = new Integer( ElementModes.ELEMENT_WRITE ); + pArgs[1] = new Integer( ElementModes.WRITE ); Object oTempFileStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xTempFileStorage = (XStorage)UnoRuntime.queryInterface( XStorage.class, oTempFileStorage ); @@ -72,7 +72,7 @@ public class Test05 implements StorageTest { // open a new substorage XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempFileStorage, "SubStorage1", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xTempSubStorage == null ) { m_aTestHelper.Error( "Can't create substorage!" ); @@ -82,7 +82,7 @@ public class Test05 implements StorageTest { // open a new substorage XStorage xSubSubStorage = m_aTestHelper.openSubStorage( xTempSubStorage, "SubSubStorage1", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xSubSubStorage == null ) { m_aTestHelper.Error( "Can't create substorage!" ); @@ -106,21 +106,21 @@ public class Test05 implements StorageTest { if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempFileStorage, "MediaType3", true, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, "MediaType4", false, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xSubSubStorage, "MediaType5", false, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; @@ -142,28 +142,28 @@ public class Test05 implements StorageTest { // reopen created streams XStream xSubStream1 = m_aTestHelper.OpenStream( xSubSubStorage, "SubStream1", - ElementModes.ELEMENT_READWRITE | ElementModes.ELEMENT_NOCREATE ); + ElementModes.READWRITE | ElementModes.NOCREATE ); XStream xSubStream2 = m_aTestHelper.OpenStream( xSubSubStorage, "SubStream2", - ElementModes.ELEMENT_READ | ElementModes.ELEMENT_NOCREATE ); + ElementModes.READ | ElementModes.NOCREATE ); if ( xSubStream1 == null || xSubStream2 == null ) return false; // it should be possible to have more then one copy of stream for reading XStream xSubStream2clone = m_aTestHelper.OpenStream( xSubSubStorage, "SubStream2", - ElementModes.ELEMENT_READ | ElementModes.ELEMENT_NOCREATE ); + ElementModes.READ | ElementModes.NOCREATE ); if ( xSubStream2 == null ) return false; // so now the first stream can not be open neither for reading nor for writing - if ( !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream1", ElementModes.ELEMENT_WRITE ) - || !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream1", ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream1", ElementModes.WRITE ) + || !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream1", ElementModes.READ ) ) return false; // the second stream can not be open for writing - if ( !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream2", ElementModes.ELEMENT_WRITE ) ) + if ( !m_aTestHelper.cantOpenStream( xSubSubStorage, "SubStream2", ElementModes.WRITE ) ) return false; @@ -224,7 +224,7 @@ public class Test05 implements StorageTest { // now check all the written and copied information // ================================================ - pArgs[1] = new Integer( ElementModes.ELEMENT_READ ); + pArgs[1] = new Integer( ElementModes.READ ); Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xResultStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResultStorage ); if ( xResultStorage == null ) @@ -233,33 +233,33 @@ public class Test05 implements StorageTest { return false; } - if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType3", true, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType3", true, ElementModes.READ ) ) return false; // open existing substorage XStorage xResSubStorage = m_aTestHelper.openSubStorage( xResultStorage, "SubStorage1", - ElementModes.ELEMENT_READ ); + ElementModes.READ ); if ( xResSubStorage == null ) { m_aTestHelper.Error( "Can't open existing substorage 'SubSubStorage'!" ); return false; } - if ( !m_aTestHelper.checkStorageProperties( xResSubStorage, "MediaType4", false, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResSubStorage, "MediaType4", false, ElementModes.READ ) ) return false; // open existing substorage XStorage xResSubSubStorage = m_aTestHelper.openSubStorage( xResSubStorage, "SubSubStorage1", - ElementModes.ELEMENT_READ ); + ElementModes.READ ); if ( xResSubSubStorage == null ) { m_aTestHelper.Error( "Can't open existing substorage 'SubSubStorage'!" ); return false; } - if ( !m_aTestHelper.checkStorageProperties( xResSubSubStorage, "MediaType5", false, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResSubSubStorage, "MediaType5", false, ElementModes.READ ) ) return false; // check substreams diff --git a/odk/examples/java/Storage/Test06.java b/odk/examples/java/Storage/Test06.java index bbc9aadecf07..6702a10a9df2 100644 --- a/odk/examples/java/Storage/Test06.java +++ b/odk/examples/java/Storage/Test06.java @@ -81,10 +81,10 @@ public class Test06 implements StorageTest { // open new substorages XStorage xTempSubStorage1 = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); XStorage xTempSubStorage2 = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage2", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xTempSubStorage1 == null || xTempSubStorage2 == null ) { m_aTestHelper.Error( "Can't create substorage!" ); @@ -94,7 +94,7 @@ public class Test06 implements StorageTest { // in case stream is open for reading it must exist try { - xTempSubStorage1.openStreamElement( "NonExistingStream", ElementModes.ELEMENT_READ ); + xTempSubStorage1.openStreamElement( "NonExistingStream", ElementModes.READ ); m_aTestHelper.Error( "The method must throw an exception in case of try to open nonexistent stream for reading!" ); return false; } @@ -109,7 +109,7 @@ public class Test06 implements StorageTest { // in case a storage is open for reading it must exist try { - xTempSubStorage1.openStreamElement( "NonExistingStorage", ElementModes.ELEMENT_READ ); + xTempSubStorage1.openStreamElement( "NonExistingStorage", ElementModes.READ ); m_aTestHelper.Error( "The method must throw an exception in case of try to open nonexistent storage for reading!" ); return false; } @@ -215,7 +215,7 @@ public class Test06 implements StorageTest { // open a new substorage XStorage xTargetSubStorage = m_aTestHelper.openSubStorage( xTargetStorage, "SubStorage1", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xTargetSubStorage == null ) { m_aTestHelper.Error( "Can't create substorage!" ); diff --git a/odk/examples/java/Storage/Test07.java b/odk/examples/java/Storage/Test07.java index 52daa1366096..164c1133e2c6 100644 --- a/odk/examples/java/Storage/Test07.java +++ b/odk/examples/java/Storage/Test07.java @@ -82,7 +82,7 @@ public class Test07 implements StorageTest { // create temporary storage based on a previously created temporary file Object pArgs[] = new Object[2]; pArgs[0] = (Object) sTempFileURL; - pArgs[1] = new Integer( ElementModes.ELEMENT_WRITE ); + pArgs[1] = new Integer( ElementModes.WRITE ); Object oTempFileStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xTempFileStorage = (XStorage)UnoRuntime.queryInterface( XStorage.class, oTempFileStorage ); @@ -106,7 +106,7 @@ public class Test07 implements StorageTest { // ================================================ // the temporary file must not be locked any more after storage disposing - pArgs[1] = new Integer( ElementModes.ELEMENT_READWRITE ); + pArgs[1] = new Integer( ElementModes.READWRITE ); Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xResultStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResultStorage ); if ( xResultStorage == null ) diff --git a/odk/examples/java/Storage/Test08.java b/odk/examples/java/Storage/Test08.java index 7511ec661f60..df058d55514c 100644 --- a/odk/examples/java/Storage/Test08.java +++ b/odk/examples/java/Storage/Test08.java @@ -73,7 +73,7 @@ public class Test08 implements StorageTest { byte pPass2[] = { 3, 2, 1 }; try { - xTempStorageEncryption.setEncryptionKey( pPass1 ); + xTempStorageEncryption.setEncryptionPassword( new String(pPass1) ); } catch( Exception e ) { @@ -84,7 +84,7 @@ public class Test08 implements StorageTest { // open a new substorage XStorage xTempSubStorage = m_aTestHelper.openSubStorage( xTempStorage, "SubStorage1", - ElementModes.ELEMENT_WRITE ); + ElementModes.WRITE ); if ( xTempSubStorage == null ) { m_aTestHelper.Error( "Can't create substorage!" ); @@ -116,14 +116,14 @@ public class Test08 implements StorageTest { if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempStorage, "MediaType4", true, - ElementModes.ELEMENT_READWRITE ) ) + ElementModes.READWRITE ) ) return false; // set "MediaType" property for storages and check that "IsRoot" and "OpenMode" properties are set correctly if ( !m_aTestHelper.setStorageTypeAndCheckProps( xTempSubStorage, "MediaType5", false, - ElementModes.ELEMENT_WRITE ) ) + ElementModes.WRITE ) ) return false; // create temporary file @@ -137,7 +137,7 @@ public class Test08 implements StorageTest { // create temporary storage based on a previously created temporary file Object pArgs[] = new Object[2]; pArgs[0] = (Object) sTempFileURL; - pArgs[1] = new Integer( ElementModes.ELEMENT_WRITE ); + pArgs[1] = new Integer( ElementModes.WRITE ); Object oTempFileStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xTempFileStorage = (XStorage)UnoRuntime.queryInterface( XStorage.class, oTempFileStorage ); @@ -161,7 +161,7 @@ public class Test08 implements StorageTest { // ================================================ // the temporary file must not be locked any more after storage disposing - pArgs[1] = new Integer( ElementModes.ELEMENT_READ ); + pArgs[1] = new Integer( ElementModes.READ ); Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xResultStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResultStorage ); if ( xResultStorage == null ) @@ -170,20 +170,20 @@ public class Test08 implements StorageTest { return false; } - if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType4", true, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResultStorage, "MediaType4", true, ElementModes.READ ) ) return false; // open existing substorage XStorage xResultSubStorage = m_aTestHelper.openSubStorage( xResultStorage, "SubStorage1", - ElementModes.ELEMENT_READ ); + ElementModes.READ ); if ( xResultSubStorage == null ) { m_aTestHelper.Error( "Can't open existing substorage!" ); return false; } - if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType5", false, ElementModes.ELEMENT_READ ) ) + if ( !m_aTestHelper.checkStorageProperties( xResultSubStorage, "MediaType5", false, ElementModes.READ ) ) return false; // set the global password for the root storage @@ -197,7 +197,7 @@ public class Test08 implements StorageTest { } try { - xResultStorageEncryption.setEncryptionKey( pPass2 ); + xResultStorageEncryption.setEncryptionPassword( new String(pPass2) ); } catch( Exception e ) { diff --git a/odk/examples/java/Storage/Test09.java b/odk/examples/java/Storage/Test09.java index 76ac5822b90e..557d90874ed0 100644 --- a/odk/examples/java/Storage/Test09.java +++ b/odk/examples/java/Storage/Test09.java @@ -79,7 +79,7 @@ public class Test09 implements StorageTest { // create temporary storage based on a previously created temporary file Object pArgs[] = new Object[2]; pArgs[0] = (Object) sTempFileURL; - pArgs[1] = new Integer( ElementModes.ELEMENT_WRITE ); + pArgs[1] = new Integer( ElementModes.WRITE ); Object oTempFileStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xTempFileStorage = (XStorage)UnoRuntime.queryInterface( XStorage.class, oTempFileStorage ); @@ -113,7 +113,7 @@ public class Test09 implements StorageTest { // ================================================ // the temporary file must not be locked any more after storage disposing - pArgs[1] = new Integer( ElementModes.ELEMENT_READ ); + pArgs[1] = new Integer( ElementModes.READ ); Object oResultStorage = m_xStorageFactory.createInstanceWithArguments( pArgs ); XStorage xResultStorage = (XStorage) UnoRuntime.queryInterface( XStorage.class, oResultStorage ); if ( xResultStorage == null ) diff --git a/odk/examples/java/Storage/TestHelper.java b/odk/examples/java/Storage/TestHelper.java index 1aeca038c6a0..d34c17d2dd6b 100644 --- a/odk/examples/java/Storage/TestHelper.java +++ b/odk/examples/java/Storage/TestHelper.java @@ -130,7 +130,7 @@ public class TestHelper { XStream xSubStream = null; try { - Object oSubStream = xStorage.openStreamElement( sStreamName, ElementModes.ELEMENT_WRITE ); + Object oSubStream = xStorage.openStreamElement( sStreamName, ElementModes.WRITE ); xSubStream = (XStream) UnoRuntime.queryInterface( XStream.class, oSubStream ); if ( xSubStream == null ) { @@ -158,7 +158,7 @@ public class TestHelper { XStream xSubStream = null; try { - Object oSubStream = xStorage.openEncryptedStreamElement( sStreamName, ElementModes.ELEMENT_WRITE, pPass ); + Object oSubStream = xStorage.openEncryptedStreamElement( sStreamName, ElementModes.WRITE, new String(pPass) ); xSubStream = (XStream) UnoRuntime.queryInterface( XStream.class, oSubStream ); if ( xSubStream == null ) { @@ -186,7 +186,7 @@ public class TestHelper { XStream xSubStream = null; try { - Object oSubStream = xStorage.openStreamElement( sStreamName, ElementModes.ELEMENT_WRITE ); + Object oSubStream = xStorage.openStreamElement( sStreamName, ElementModes.WRITE ); xSubStream = (XStream) UnoRuntime.queryInterface( XStream.class, oSubStream ); if ( xSubStream == null ) { @@ -231,7 +231,7 @@ public class TestHelper { XStream xSubStream = null; try { - Object oSubStream = xStorage.openEncryptedStreamElement( sStreamName, ElementModes.ELEMENT_WRITE, pOldPass ); + Object oSubStream = xStorage.openEncryptedStreamElement( sStreamName, ElementModes.WRITE, new String(pOldPass) ); xSubStream = (XStream) UnoRuntime.queryInterface( XStream.class, oSubStream ); if ( xSubStream == null ) { @@ -257,7 +257,7 @@ public class TestHelper { } try { - xStreamEncryption.setEncryptionKey( pNewPass ); + xStreamEncryption.setEncryptionPassword( new String(pNewPass) ); } catch( Exception e ) { @@ -301,7 +301,7 @@ public class TestHelper { bOk = false; } - if ( ( bIsRoot && ( nPropMode | ElementModes.ELEMENT_READ ) != ( nMode | ElementModes.ELEMENT_READ ) ) + if ( ( bIsRoot && ( nPropMode | ElementModes.READ ) != ( nMode | ElementModes.READ ) ) || ( !bIsRoot && ( nPropMode & nMode ) != nMode ) ) { Error( "'OpenMode' property contains wrong value!" ); @@ -350,7 +350,7 @@ public class TestHelper { bOk = false; } - if ( ( bIsRoot && ( nPropMode | ElementModes.ELEMENT_READ ) != ( nMode | ElementModes.ELEMENT_READ ) ) + if ( ( bIsRoot && ( nPropMode | ElementModes.READ ) != ( nMode | ElementModes.READ ) ) || ( !bIsRoot && ( nPropMode & nMode ) != nMode ) ) { Error( "'OpenMode' property contains wrong value!" ); @@ -469,7 +469,7 @@ public class TestHelper { XStream xSubStream = null; try { - Object oSubStream = xParentStorage.openStreamElement( sName, ElementModes.ELEMENT_READ ); + Object oSubStream = xParentStorage.openStreamElement( sName, ElementModes.READ ); xSubStream = (XStream) UnoRuntime.queryInterface( XStream.class, oSubStream ); if ( xSubStream == null ) { @@ -503,7 +503,7 @@ public class TestHelper { try { - Object oSubStream = xParentStorage.openStreamElement( sName, ElementModes.ELEMENT_READ ); + Object oSubStream = xParentStorage.openStreamElement( sName, ElementModes.READ ); Error( "Encrypted stream '" + sName + "' was opened without password!" ); return false; } @@ -519,7 +519,7 @@ public class TestHelper { pWrongPass[0] += pPass[0]; try { - Object oSubStream = xParentStorage.openEncryptedStreamElement( sName, ElementModes.ELEMENT_READ, pWrongPass ); + Object oSubStream = xParentStorage.openEncryptedStreamElement( sName, ElementModes.READ, new String(pWrongPass) ); Error( "Encrypted stream '" + sName + "' was opened with wrong password!" ); return false; } @@ -534,7 +534,7 @@ public class TestHelper { XStream xSubStream = null; try { - Object oSubStream = xParentStorage.openEncryptedStreamElement( sName, ElementModes.ELEMENT_READ, pPass ); + Object oSubStream = xParentStorage.openEncryptedStreamElement( sName, ElementModes.READ, new String(pPass) ); xSubStream = (XStream) UnoRuntime.queryInterface( XStream.class, oSubStream ); if ( xSubStream == null ) { @@ -842,7 +842,7 @@ public class TestHelper { // try to open an opened substorage, open call must fail try { - Object oDummyStorage = xStorage.openStorageElement( sName, ElementModes.ELEMENT_READ ); + Object oDummyStorage = xStorage.openStorageElement( sName, ElementModes.READ ); Error( "The trying to reopen opened substorage '" + sName + "' must fail!" ); } catch( Exception e ) |