Source Code Cross Referenced for Matrix.java in  » ESB » celtix-1.0 » org » objectweb » celtix » systest » securebasic » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ESB » celtix 1.0 » org.objectweb.celtix.systest.securebasic 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.objectweb.celtix.systest.securebasic;
002:
003:        import org.objectweb.hello_world_soap_http_secure.types.Result;
004:
005:        public class Matrix {
006:
007:            protected static final boolean SUCCEED = true;
008:            protected static final boolean FAIL = false;
009:
010:            protected static final ThreeTierTestItem[] THREE_TIER_TESTS = {
011:            //0 Inter and Target want and require pier authenticaion, 
012:                    //all provided so all succeed                                                            
013:                    new ThreeTierTestItem(new ClientData(
014:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
015:                            "InterSecureSOAPService", SUCCEED, null),
016:                            new InterData("hello_world_secure.wsdl",
017:                                    "SoapPortAllDataSet",
018:                                    "TargetSecureSOAPService", SUCCEED, null),
019:                            new TargetData(SUCCEED, null)),
020:                    //1 Inter and Target want and require pier authenticaion, 
021:                    //all provided by client but inter doesn't have anything set
022:                    new ThreeTierTestItem(new ClientData(
023:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
024:                            "InterSecureSOAPService", SUCCEED, null),
025:                            new InterData("hello_world_secure.wsdl",
026:                                    "SoapPortNoDataSet",
027:                                    "TargetSecureSOAPService", FAIL, null),
028:                            new TargetData(FAIL, null)),
029:
030:                    //2 Wrong Keystore and server wants and needs client auth so should fail
031:                    new ThreeTierTestItem(new ClientData(
032:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
033:                            "InterSecureSOAPService", SUCCEED, null),
034:                            new InterData("hello_world_secure.wsdl",
035:                                    "SoapPortAllDataSetWrongKeystore",
036:                                    "TargetSecureSOAPService", FAIL, null),
037:                            new TargetData(FAIL, null)),
038:                    //3 Wrong Keystore server wants but doesn't need client auth so 
039:                    // should pass                             
040:                    new ThreeTierTestItem(
041:                            new ClientData("hello_world_secure.wsdl",
042:                                    "SoapPortAllDataSet",
043:                                    "InterSecureSOAPService", SUCCEED, null),
044:                            new InterData(
045:                                    "hello_world_secure.wsdl",
046:                                    "SoapPortAllDataSetWrongKeystore",
047:                                    "TargetSecureDontRequireClientAuthSOAPService",
048:                                    SUCCEED, null), new TargetData(SUCCEED,
049:                                    null)),
050:
051:                    //4 Wrong KeystoreType and server wants and needs client auth so should fail
052:                    new ThreeTierTestItem(new ClientData(
053:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
054:                            "InterSecureSOAPService", SUCCEED, null),
055:                            new InterData("hello_world_secure.wsdl",
056:                                    "SoapPortAllDataSetWrongKeystoreType",
057:                                    "TargetSecureSOAPService", FAIL, null),
058:                            new TargetData(FAIL, null)),
059:
060:                    //5 Wrong Keystore Password and server wants and needs client auth so should fail
061:                    new ThreeTierTestItem(new ClientData(
062:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
063:                            "InterSecureSOAPService", SUCCEED, null),
064:                            new InterData("hello_world_secure.wsdl",
065:                                    "SoapPortAllDataSetWrongKeystorePassword",
066:                                    "TargetSecureSOAPService", FAIL, null),
067:                            new TargetData(FAIL, null)),
068:
069:                    //6 Wrong Keystore Password and server wants but does not need client auth so should SUCCEED
070:                    new ThreeTierTestItem(
071:                            new ClientData("hello_world_secure.wsdl",
072:                                    "SoapPortAllDataSet",
073:                                    "InterSecureSOAPService", SUCCEED, null),
074:                            new InterData(
075:                                    "hello_world_secure.wsdl",
076:                                    "SoapPortAllDataSetWrongKeystorePassword",
077:                                    "TargetSecureDontRequireClientAuthSOAPService",
078:                                    SUCCEED, null), new TargetData(SUCCEED,
079:                                    null)),
080:
081:                    //7 Wrong Client Password and server wants and needs client auth which 
082:                    //would at first impl it would fail but due to limitation in JSSE the client password
083:                    //and keystore need to be the same, so all that haapens is that the correct keystore 
084:                    //password is used and a warning is logged to say that the client password is not being
085:                    //used and the invocation succeeds
086:                    new ThreeTierTestItem(new ClientData(
087:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
088:                            "InterSecureSOAPService", SUCCEED, null),
089:                            new InterData("hello_world_secure.wsdl",
090:                                    "SoapPortAllDataSetWrongClientPassword",
091:                                    "TargetSecureSOAPService", SUCCEED, null),
092:                            new TargetData(SUCCEED, null)),
093:
094:                    //8 Wrong Truststore and client auth wants and needs server authentication so the invocation fails
095:                    new ThreeTierTestItem(new ClientData(
096:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
097:                            "InterSecureSOAPService", SUCCEED, null),
098:                            new InterData("hello_world_secure.wsdl",
099:                                    "SoapPortAllDataSetWrongTrustStore",
100:                                    "TargetSecureSOAPService", FAIL, null),
101:                            new TargetData(FAIL, null)),
102:                    //9 Wrong Truststore Type and client auth wants and needs server 
103:                    //authentication so the invocation fails
104:                    new ThreeTierTestItem(new ClientData(
105:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
106:                            "InterSecureSOAPService", SUCCEED, null),
107:                            new InterData("hello_world_secure.wsdl",
108:                                    "SoapPortAllDataSetWrongTrustStoreType",
109:                                    "TargetSecureSOAPService", FAIL, null),
110:                            new TargetData(FAIL, null)),
111:
112:                    //10 Invalid Secure socket protocol used so will fail
113:                    new ThreeTierTestItem(
114:                            new ClientData("hello_world_secure.wsdl",
115:                                    "SoapPortAllDataSet",
116:                                    "InterSecureSOAPService", SUCCEED, null),
117:                            new InterData(
118:                                    "hello_world_secure.wsdl",
119:                                    "SoapPortAllDataSetWrongSecureSocketProtocol",
120:                                    "TargetSecureSOAPService", FAIL, null),
121:                            new TargetData(FAIL, null))
122:
123:            };
124:
125:            protected static final TwoTierTestItem[] TWO_TIER_TESTS = {
126:            //0 Server wants and need client auth so must 
127:                    //provide all data to succeed                                                           
128:                    new TwoTierTestItem(new ClientData(
129:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
130:                            "SecureSOAPService", SUCCEED, null),
131:                            new TargetData(SUCCEED, null)),
132:                    //1 Server wants and need client auth but client auth data 
133:                    //not provided so it will fail                            
134:                    new TwoTierTestItem(new ClientData(
135:                            "hello_world_secure.wsdl", "SoapPortNoDataSet",
136:                            "SecureSOAPService", FAIL, null), new TargetData(
137:                            FAIL, null)),
138:
139:                    //2 Wrong Keystore and server wants and needs client auth so should fail
140:                    new TwoTierTestItem(new ClientData(
141:                            "hello_world_secure.wsdl",
142:                            "SoapPortAllDataSetWrongKeystore",
143:                            "SecureSOAPService", FAIL, null), new TargetData(
144:                            FAIL, null)),
145:                    //3 Wrong Keystore server wants but doesn't need client auth so 
146:                    // should pass                             
147:                    new TwoTierTestItem(new ClientData(
148:                            "hello_world_secure.wsdl",
149:                            "SoapPortAllDataSetWrongKeystore",
150:                            "SecureDontRequireClientAuthSOAPService", SUCCEED,
151:                            null), new TargetData(SUCCEED, null)),
152:
153:                    //4 Wrong KeystoreType and server wants and needs client auth so should fail
154:                    new TwoTierTestItem(new ClientData(
155:                            "hello_world_secure.wsdl",
156:                            "SoapPortAllDataSetWrongKeystoreType",
157:                            "SecureSOAPService", FAIL, null), new TargetData(
158:                            FAIL, null)),
159:
160:                    //5 Wrong Keystore Password and server wants and needs client auth so should fail
161:                    new TwoTierTestItem(new ClientData(
162:                            "hello_world_secure.wsdl",
163:                            "SoapPortAllDataSetWrongKeystorePassword",
164:                            "SecureSOAPService", FAIL, null), new TargetData(
165:                            FAIL, null)),
166:
167:                    //6 Wrong Keystore Password and server wants but does not need client auth so should SUCCEED
168:                    new TwoTierTestItem(new ClientData(
169:                            "hello_world_secure.wsdl",
170:                            "SoapPortAllDataSetWrongKeystorePassword",
171:                            "SecureDontRequireClientAuthSOAPService", SUCCEED,
172:                            null), new TargetData(SUCCEED, null)),
173:
174:                    //7 Wrong Client Password and server wants and needs client auth which 
175:                    //would at first impl it would fail but due to limitation in JSSE the client password
176:                    //and keystore need to be the same, so all that haapens is that the correct keystore 
177:                    //password is used and a warning is logged to say that the client password is not being
178:                    //used and the invocation succeeds
179:                    new TwoTierTestItem(new ClientData(
180:                            "hello_world_secure.wsdl",
181:                            "SoapPortAllDataSetWrongClientPassword",
182:                            "SecureSOAPService", SUCCEED, null),
183:                            new TargetData(SUCCEED, null)),
184:
185:                    //8 Wrong Truststore and client auth wants and needs server authentication so the invocation fails
186:                    new TwoTierTestItem(new ClientData(
187:                            "hello_world_secure.wsdl",
188:                            "SoapPortAllDataSetWrongTrustStore",
189:                            "SecureSOAPService", FAIL, null), new TargetData(
190:                            FAIL, null)),
191:                    //9 Wrong Truststore Type and client auth wants and needs server 
192:                    //authentication so the invocation fails
193:                    new TwoTierTestItem(new ClientData(
194:                            "hello_world_secure.wsdl",
195:                            "SoapPortAllDataSetWrongTrustStoreType",
196:                            "SecureSOAPService", FAIL, null), new TargetData(
197:                            FAIL, null)),
198:
199:                    //10 Invalid Secure socket protocol used so will fail
200:                    new TwoTierTestItem(new ClientData(
201:                            "hello_world_secure.wsdl",
202:                            "SoapPortAllDataSetWrongSecureSocketProtocol",
203:                            "SecureSOAPService", FAIL, null), new TargetData(
204:                            FAIL, null)),
205:                    //11 No data set in client configuration file, all client data retrieved from data provider
206:                    new TwoTierTestItem(new ClientData(
207:                            "hello_world_secure.wsdl",
208:                            "SoapPortNoDataSetProviderSetsAllData",
209:                            "SecureSOAPService", SUCCEED,
210:                            "org.objectweb.celtix.systest.securebasic."
211:                                    + "SetAllDataSecurityDataProvider"),
212:                            new TargetData(SUCCEED, null)),
213:                    //12 All wrong data set in client configuration file, all good client data 
214:                    //retrieved from data provider, will succeed cause provider has precedence over config
215:                    new TwoTierTestItem(new ClientData(
216:                            "hello_world_secure.wsdl",
217:                            "SoapPortAllWrongDataSetProviderSetsGoodData",
218:                            "SecureSOAPService", SUCCEED,
219:                            "org.objectweb.celtix.systest.securebasic."
220:                                    + "SetAllDataSecurityDataProvider"),
221:                            new TargetData(SUCCEED, null)),
222:                    //13 All good data set in client configuration file, but bad client data 
223:                    //retrieved from data provider
224:                    new TwoTierTestItem(new ClientData(
225:                            "hello_world_secure.wsdl",
226:                            "SoapPortAllDataSetProviderSetsBadData",
227:                            "SecureSOAPService", FAIL,
228:                            "org.objectweb.celtix.systest.securebasic."
229:                                    + "SetBadDataSecurityDataProvider"),
230:                            new TargetData(FAIL, null)),
231:                    //14 All client data set in configuration file, all server data retrieved from data provider
232:                    new TwoTierTestItem(new ClientData(
233:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
234:                            "SecureSOAPServiceServerConfiguredByGoodProvider",
235:                            SUCCEED, null), new TargetData(SUCCEED,
236:                            "org.objectweb.celtix.systest.securebasic."
237:                                    + "SetAllDataSecurityDataProvider")),
238:                    //15 All client data set in configuration file, all server data retrieved from configuration but 
239:                    //data provider changes truststore so the invocation will be rejected
240:                    new TwoTierTestItem(new ClientData(
241:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
242:                            "SecureSOAPServiceServerConfiguredByBadProvider",
243:                            FAIL, null), new TargetData(FAIL,
244:                            "org.objectweb.celtix.systest.securebasic."
245:                                    + "SetBadDataSecurityDataProvider")),
246:                    //16 All client data set in configuration file, all server data retrieved from configuration 
247:                    // testing pkcs12 cerst specifically
248:                    new TwoTierTestItem(new ClientData(
249:                            "hello_world_secure.wsdl",
250:                            "SoapPortAllDataSetP12Certs",
251:                            "SecureSOAPServiceP12", SUCCEED, null),
252:                            new TargetData(SUCCEED, null)),
253:
254:                    //17 All client data set in configuration file, all server data retrieved from configuration but 
255:                    // but server has non default ciphersuite so handshake will fail
256:                    new TwoTierTestItem(new ClientData(
257:                            "hello_world_secure.wsdl", "SoapPortAllDataSet",
258:                            "SecureSOAPServiceDifferentCipherSuites", FAIL,
259:                            null), new TargetData(FAIL, null)),
260:                    //18 All client data set in configuration file, all server data retrieved from configuration
261:                    //server and client have non default ciphersuite so handshake will pass
262:                    new TwoTierTestItem(new ClientData(
263:                            "hello_world_secure.wsdl",
264:                            "SoapPortAllDataSetDifferentCipherSuites",
265:                            "SecureSOAPServiceDifferentCipherSuites", SUCCEED,
266:                            null), new TargetData(SUCCEED, null)) };
267:
268:            public Matrix() {
269:                t();
270:            }
271:
272:            protected static Result fail(String reason) {
273:                Result ret = new Result();
274:                ret.setDidPass(Matrix.FAIL);
275:                ret.setReturnString("");
276:                ret.setFailureReason(reason);
277:                return ret;
278:            }
279:
280:            protected static Result dealWithResponse(String expectedResult,
281:                    Result res) {
282:                if (!res.isDidPass()) {
283:                    return fail("The invocation from the server reported a failure = "
284:                            + res.getFailureReason());
285:                }
286:                if (!res.getReturnString().equals(expectedResult)) {
287:                    return fail("The expected return string and the actual return string didn't match");
288:                }
289:
290:                return null;
291:            }
292:
293:            private void t() {
294:                //For compilation reasons we have to have a non static method, must check why
295:            }
296:
297:        }
298:
299:        class ClientData {
300:            String clientWsdl;
301:            String clientPortName;
302:            String clientServiceName;
303:            boolean clientExpectSuccess;
304:            String securityConfigurer;
305:
306:            public ClientData(String clientWsdlParam,
307:                    String clientPortNameParam, String clientServiceNameParam,
308:                    boolean clientExpectSuccessParam,
309:                    String securityConfigurerParam) {
310:                clientWsdl = clientWsdlParam;
311:                clientPortName = clientPortNameParam;
312:                clientServiceName = clientServiceNameParam;
313:                clientExpectSuccess = clientExpectSuccessParam;
314:                securityConfigurer = securityConfigurerParam;
315:
316:            }
317:        }
318:
319:        class InterData {
320:            String interWsdl;
321:            String interPortName;
322:            String interServiceName;
323:            boolean interExpectSuccess;
324:            String securityConfigurer;
325:
326:            public InterData(String interWsdlParam, String interPortNameParam,
327:                    String interServiceNameParam,
328:                    boolean interExpectSuccessParam,
329:                    String securityConfigurerParam) {
330:                interWsdl = interWsdlParam;
331:                interPortName = interPortNameParam;
332:                interServiceName = interServiceNameParam;
333:                interExpectSuccess = interExpectSuccessParam;
334:                securityConfigurer = securityConfigurerParam;
335:
336:            }
337:        }
338:
339:        class TargetData {
340:            boolean targetExpectSuccess;
341:            String securityConfigurer;
342:
343:            public TargetData(boolean targetExpectSuccessParam,
344:                    String securityConfigurerParam) {
345:                targetExpectSuccess = targetExpectSuccessParam;
346:                securityConfigurer = securityConfigurerParam;
347:
348:            }
349:        }
350:
351:        class ThreeTierTestItem {
352:
353:            ClientData clientData;
354:            InterData interData;
355:            TargetData targetData;
356:
357:            public ThreeTierTestItem(ClientData clientDataParam,
358:                    InterData interDataParam, TargetData targetDataParam) {
359:                clientData = clientDataParam;
360:                interData = interDataParam;
361:                targetData = targetDataParam;
362:
363:            }
364:        }
365:
366:        class TwoTierTestItem {
367:            ClientData clientData;
368:            TargetData targetData;
369:
370:            public TwoTierTestItem(ClientData clientDataParam,
371:                    TargetData targetDataParam) {
372:                clientData = clientDataParam;
373:                targetData = targetDataParam;
374:
375:            }
376:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.