1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package complex.passwordcontainer;
29 
30 import com.sun.star.task.UserRecord;
31 
32 // import share.LogWriter;
33 
34 public class TestHelper {
35     // LogWriter m_aLogWriter;
36     String m_sTestPrefix;
37 
38     public TestHelper(  String sTestPrefix ) {
39         // m_aLogWriter = aLogWriter;
40         m_sTestPrefix = sTestPrefix;
41     }
42 
43     public void Error( String sError ) {
44         System.out.println( m_sTestPrefix + "Error: " + sError );
45     }
46 
47     public void Message( String sMessage ) {
48         System.out.println( m_sTestPrefix + sMessage );
49     }
50 
51     public boolean sameLists(UserRecord aUserList1[], UserRecord aUserList2[]) {
52         // only works when every name is unique within the list containing it
53 
54         if(aUserList1.length != aUserList2.length) {
55             Message("User list lengths: " + aUserList1.length + " <--> " + aUserList2.length + " respectively ");
56             return false;
57         }
58 
59         for(int i = 0; i < aUserList1.length; i++) {
60             int j;
61             for(j = 0; j < aUserList2.length; j++) {
62                 if(!aUserList1[i].UserName.equals(aUserList2[j].UserName))
63                 {
64                     continue;
65                 }
66                 if(aUserList1[i].Passwords[0].equals(aUserList2[j].Passwords[0])) {
67                     break;
68                 }
69             }
70             if(j == aUserList2.length) {
71                 for(int k = 0; k < aUserList1.length; k++) {
72                     Message(aUserList1[k].UserName + " <--> " + aUserList2[i].UserName);
73                 }
74                 return false;
75             }
76         }
77         return true;
78     }
79 }
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91