summaryrefslogtreecommitdiff
path: root/svl/qa/complex/passwordcontainer
diff options
context:
space:
mode:
Diffstat (limited to 'svl/qa/complex/passwordcontainer')
-rw-r--r--svl/qa/complex/passwordcontainer/MasterPasswdHandler.java8
-rw-r--r--svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java81
-rw-r--r--svl/qa/complex/passwordcontainer/Test01.java10
-rw-r--r--svl/qa/complex/passwordcontainer/Test02.java11
-rw-r--r--svl/qa/complex/passwordcontainer/Test03.java12
-rw-r--r--svl/qa/complex/passwordcontainer/TestHelper.java14
-rw-r--r--svl/qa/complex/passwordcontainer/makefile.mk87
7 files changed, 86 insertions, 137 deletions
diff --git a/svl/qa/complex/passwordcontainer/MasterPasswdHandler.java b/svl/qa/complex/passwordcontainer/MasterPasswdHandler.java
index bf6159ee38c5..8e886f0b8269 100644
--- a/svl/qa/complex/passwordcontainer/MasterPasswdHandler.java
+++ b/svl/qa/complex/passwordcontainer/MasterPasswdHandler.java
@@ -36,12 +36,16 @@ public class MasterPasswdHandler extends WeakBase
XInteractionSupplyAuthentication xAuthentication = null;
for( int i = 0; i < xContinuations.length; ++i ) {
- xAuthentication = (XInteractionSupplyAuthentication)UnoRuntime.queryInterface( XInteractionSupplyAuthentication.class, xContinuations[i]);
+ xAuthentication = UnoRuntime.queryInterface(XInteractionSupplyAuthentication.class, xContinuations[i]);
if( xAuthentication != null )
+ {
break;
+ }
}
if( xAuthentication.canSetPassword() )
- xAuthentication.setPassword( "abcdefghijklmnopqrstuvwxyz123456" );
+ {
+ xAuthentication.setPassword("abcdefghijklmnopqrstuvwxyz123456");
+ }
xAuthentication.select();
}
} else {
diff --git a/svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java b/svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java
index 2e3bada4d1bc..ac5c79d134dc 100644
--- a/svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java
+++ b/svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java
@@ -27,47 +27,78 @@
package complex.passwordcontainer;
-import complexlib.ComplexTestCase;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
-public class PasswordContainerUnitTest extends ComplexTestCase {
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+public class PasswordContainerUnitTest {
private XMultiServiceFactory m_xMSF = null;
- public String[] getTestMethodNames() {
- return new String[] {
- "ExecuteTest01",
- "ExecuteTest02",
- "ExecuteTest03"};
- }
- public String getTestObjectName() {
- return "PasswordContainerUnitTest";
- }
+//// public String[] getTestMethodNames() {
+//// return new String[] {
+//// "ExecuteTest01",
+//// "ExecuteTest02",
+//// "ExecuteTest03"};
+//// }
+// public String getTestObjectName() {
+// return "PasswordContainerUnitTest";
+// }
- public void before() {
+ @Before public void before() {
try {
- m_xMSF = (XMultiServiceFactory) param.getMSF();
+ m_xMSF = getMSF();
} catch (Exception e) {
- failed ("Cannot create service factory!");
+ fail ("Cannot create service factory!");
}
if (m_xMSF == null) {
- failed ("Cannot create service factory!");
+ fail ("Cannot create service factory!");
}
}
- public void after() {
+ @After public void after() {
m_xMSF = null;
}
- public void ExecuteTest01() {
- PasswordContainerTest aTest = new Test01(m_xMSF, log);
- assure("Test01 failed!", aTest.test());
+ @Test public void ExecuteTest01()
+ {
+ PasswordContainerTest aTest = new Test01(m_xMSF);
+ assertTrue("Test01 failed!", aTest.test());
}
- public void ExecuteTest02() {
- PasswordContainerTest aTest = new Test02(m_xMSF, log);
- assure("Test02 failed!", aTest.test());
+ @Test public void ExecuteTest02() {
+ PasswordContainerTest aTest = new Test02(m_xMSF);
+ assertTrue("Test02 failed!", aTest.test());
}
- public void ExecuteTest03() {
- PasswordContainerTest aTest = new Test03(m_xMSF, log);
- assure("Test03 failed!", aTest.test());
+ @Test public void ExecuteTest03() {
+ PasswordContainerTest aTest = new Test03(m_xMSF);
+ assertTrue("Test03 failed!", aTest.test());
}
+
+ private XMultiServiceFactory getMSF()
+ {
+ final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+ return xMSF1;
+ }
+
+ // setup and close connections
+ @BeforeClass public static void setUpConnection() throws Exception {
+ System.out.println("setUpConnection()");
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println("tearDownConnection()");
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+
}
diff --git a/svl/qa/complex/passwordcontainer/Test01.java b/svl/qa/complex/passwordcontainer/Test01.java
index 1ca17c922669..9367fea4eb7b 100644
--- a/svl/qa/complex/passwordcontainer/Test01.java
+++ b/svl/qa/complex/passwordcontainer/Test01.java
@@ -36,17 +36,17 @@ import com.sun.star.task.XMasterPasswordHandling;
import com.sun.star.uno.UnoRuntime;
-import share.LogWriter;
+// import share.LogWriter;
public class Test01 implements PasswordContainerTest {
XMultiServiceFactory m_xMSF = null;
XPasswordContainer m_xPasswordContainer = null;
TestHelper m_aTestHelper = null;
- public Test01 ( XMultiServiceFactory xMSF, LogWriter aLogWriter )
+ public Test01 ( XMultiServiceFactory xMSF )
{
m_xMSF = xMSF;
- m_aTestHelper = new TestHelper (aLogWriter, "Test01: ");
+ m_aTestHelper = new TestHelper ( "Test01: ");
}
public boolean test() {
@@ -68,9 +68,9 @@ public class Test01 implements PasswordContainerTest {
}
try {
Object oPasswordContainer = m_xMSF.createInstance( "com.sun.star.task.PasswordContainer" );
- XPasswordContainer xContainer = (XPasswordContainer)UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer);
+ XPasswordContainer xContainer = UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer);
Object oHandler = m_xMSF.createInstance( "com.sun.star.task.InteractionHandler" );
- XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(XInteractionHandler.class, oHandler);
+ XInteractionHandler xHandler = UnoRuntime.queryInterface(XInteractionHandler.class, oHandler);
MasterPasswdHandler aMHandler = new MasterPasswdHandler( xHandler );
// add a set of users and passwords for the same URL for runtime
diff --git a/svl/qa/complex/passwordcontainer/Test02.java b/svl/qa/complex/passwordcontainer/Test02.java
index b77b0fe9bf48..3d0123de3179 100644
--- a/svl/qa/complex/passwordcontainer/Test02.java
+++ b/svl/qa/complex/passwordcontainer/Test02.java
@@ -36,17 +36,16 @@ import com.sun.star.task.UserRecord;
import com.sun.star.uno.UnoRuntime;
-import share.LogWriter;
public class Test02 implements PasswordContainerTest {
XMultiServiceFactory m_xMSF = null;
XPasswordContainer m_xPasswordContainer = null;
TestHelper m_aTestHelper = null;
- public Test02 ( XMultiServiceFactory xMSF, LogWriter aLogWriter )
+ public Test02 ( XMultiServiceFactory xMSF )
{
m_xMSF = xMSF;
- m_aTestHelper = new TestHelper (aLogWriter, "Test02: ");
+ m_aTestHelper = new TestHelper ( "Test02: ");
}
public boolean test() {
@@ -69,11 +68,11 @@ public class Test02 implements PasswordContainerTest {
try {
Object oPasswordContainer = m_xMSF.createInstance("com.sun.star.task.PasswordContainer");
- XPasswordContainer xContainer = (XPasswordContainer)UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer);
+ XPasswordContainer xContainer = UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer);
Object oHandler = m_xMSF.createInstance("com.sun.star.task.InteractionHandler");
- XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(XInteractionHandler.class, oHandler);
+ XInteractionHandler xHandler = UnoRuntime.queryInterface(XInteractionHandler.class, oHandler);
MasterPasswdHandler aMHandler = new MasterPasswdHandler(xHandler);
- XMasterPasswordHandling xMHandling = (XMasterPasswordHandling)UnoRuntime.queryInterface(XMasterPasswordHandling.class, oPasswordContainer);
+ XMasterPasswordHandling xMHandling = UnoRuntime.queryInterface(XMasterPasswordHandling.class, oPasswordContainer);
// allow the storing of the passwords
xMHandling.allowPersistentStoring(true);
diff --git a/svl/qa/complex/passwordcontainer/Test03.java b/svl/qa/complex/passwordcontainer/Test03.java
index 9e38a55893e0..cf2b3d45cbb0 100644
--- a/svl/qa/complex/passwordcontainer/Test03.java
+++ b/svl/qa/complex/passwordcontainer/Test03.java
@@ -36,17 +36,17 @@ import com.sun.star.task.XInteractionHandler;
import com.sun.star.uno.UnoRuntime;
-import share.LogWriter;
+
public class Test03 implements PasswordContainerTest {
XMultiServiceFactory m_xMSF = null;
XPasswordContainer m_xPasswordContainer = null;
TestHelper m_aTestHelper = null;
- public Test03 ( XMultiServiceFactory xMSF, LogWriter aLogWriter )
+ public Test03 ( XMultiServiceFactory xMSF )
{
m_xMSF = xMSF;
- m_aTestHelper = new TestHelper (aLogWriter, "Test03: ");
+ m_aTestHelper = new TestHelper ( "Test03: ");
}
public boolean test() {
@@ -68,11 +68,11 @@ public class Test03 implements PasswordContainerTest {
try {
Object oPasswordContainer = m_xMSF.createInstance("com.sun.star.task.PasswordContainer");
- XPasswordContainer xContainer = (XPasswordContainer)UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer);
+ XPasswordContainer xContainer = UnoRuntime.queryInterface(XPasswordContainer.class, oPasswordContainer);
Object oHandler = m_xMSF.createInstance("com.sun.star.task.InteractionHandler");
- XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface(XInteractionHandler.class, oHandler);
+ XInteractionHandler xHandler = UnoRuntime.queryInterface(XInteractionHandler.class, oHandler);
MasterPasswdHandler aMHandler = new MasterPasswdHandler(xHandler);
- XMasterPasswordHandling xMHandling = (XMasterPasswordHandling)UnoRuntime.queryInterface(XMasterPasswordHandling.class, oPasswordContainer);
+ XMasterPasswordHandling xMHandling = UnoRuntime.queryInterface(XMasterPasswordHandling.class, oPasswordContainer);
// allow the storing of the passwords
xMHandling.allowPersistentStoring(true);
diff --git a/svl/qa/complex/passwordcontainer/TestHelper.java b/svl/qa/complex/passwordcontainer/TestHelper.java
index 1971b61098f5..c91401e74c91 100644
--- a/svl/qa/complex/passwordcontainer/TestHelper.java
+++ b/svl/qa/complex/passwordcontainer/TestHelper.java
@@ -29,23 +29,23 @@ package complex.passwordcontainer;
import com.sun.star.task.UserRecord;
-import share.LogWriter;
+// import share.LogWriter;
public class TestHelper {
- LogWriter m_aLogWriter;
+ // LogWriter m_aLogWriter;
String m_sTestPrefix;
- public TestHelper( LogWriter aLogWriter, String sTestPrefix ) {
- m_aLogWriter = aLogWriter;
+ public TestHelper( String sTestPrefix ) {
+ // m_aLogWriter = aLogWriter;
m_sTestPrefix = sTestPrefix;
}
public void Error( String sError ) {
- m_aLogWriter.println( m_sTestPrefix + "Error: " + sError );
+ System.out.println( m_sTestPrefix + "Error: " + sError );
}
public void Message( String sMessage ) {
- m_aLogWriter.println( m_sTestPrefix + sMessage );
+ System.out.println( m_sTestPrefix + sMessage );
}
public boolean sameLists(UserRecord aUserList1[], UserRecord aUserList2[]) {
@@ -60,7 +60,9 @@ public class TestHelper {
int j;
for(j = 0; j < aUserList2.length; j++) {
if(!aUserList1[i].UserName.equals(aUserList2[j].UserName))
+ {
continue;
+ }
if(aUserList1[i].Passwords[0].equals(aUserList2[j].Passwords[0])) {
break;
}
diff --git a/svl/qa/complex/passwordcontainer/makefile.mk b/svl/qa/complex/passwordcontainer/makefile.mk
deleted file mode 100644
index 57fd4d560f8d..000000000000
--- a/svl/qa/complex/passwordcontainer/makefile.mk
+++ /dev/null
@@ -1,87 +0,0 @@
-#*************************************************************************
-#
-# 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
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ = ..$/..$/..
-TARGET = PasswordContainerUnitTest
-PRJNAME=svl
-PACKAGE = complex$/passwordcontainer
-
-# --- Settings -----------------------------------------------------
-.INCLUDE: settings.mk
-
-
-#----- compile .java files -----------------------------------------
-
-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
-
-JAVAFILES =\
- PasswordContainerUnitTest.java\
- PasswordContainerTest.java\
- TestHelper.java\
- Test01.java\
- Test02.java\
- Test03.java\
- MasterPasswdHandler.java
-
-JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
-
-#----- make a jar from compiled files ------------------------------
-
-MAXLINELENGTH = 100000
-
-JARCLASSDIRS = $(PACKAGE)
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
-
-# --- Parameters for the test --------------------------------------
-
-# start an office if the parameter is set for the makefile
-.IF "$(OFFICE)" == ""
-CT_APPEXECCOMMAND =
-.ELSE
-CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
-.ENDIF
-
-# test base is java complex
-CT_TESTBASE = -TestBase java_complex
-
-# test looks something like the.full.package.TestName
-CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
-
-# start the runner application
-CT_APP = org.openoffice.Runner
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE: target.mk
-
-RUN: run
-
-run:
- +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST)
-
-