| /* |
| * Copyright (c) 2005, 2018 Oracle and/or its affiliates. All rights reserved. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0, which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * This Source Code may also be made available under the following Secondary |
| * Licenses when the conditions for such availability set forth in the |
| * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, |
| * version 2 with the GNU Classpath Exception, which is available at |
| * https://www.gnu.org/software/classpath/license.html. |
| * |
| * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 |
| */ |
| |
| package com.sun.s1asdev.security.wss.roles2.client; |
| |
| import java.util.Map; |
| |
| import jakarta.xml.ws.BindingProvider; |
| import jakarta.xml.ws.WebServiceRef; |
| |
| import com.sun.ejte.ccl.reporter.SimpleReporterAdapter; |
| |
| import com.sun.s1asdev.security.wss.roles2.ejbws.HelloEjb; |
| import com.sun.s1asdev.security.wss.roles2.ejbws.WssRoles2EjbService; |
| |
| public class Client { |
| private static SimpleReporterAdapter stat = |
| new SimpleReporterAdapter("appserv-tests"); |
| private static String testSuite = "Sec:WSS Roles2 test "; |
| |
| @WebServiceRef(wsdlLocation="http://@HOST@:@PORT@/WssRoles2EjbService/HelloEjb?WSDL") |
| private static WssRoles2EjbService service; |
| |
| public static void main(String[] args) { |
| stat.addDescription("security-wss-roles2"); |
| String description = null; |
| try { |
| HelloEjb port = service.getHelloEjbPort(); |
| |
| description = testSuite + " ejbws: hello"; |
| port.hello("Sun"); |
| stat.addStatus(description, stat.PASS); |
| |
| description = testSuite + " ejbws: rolesAllowed1"; |
| port.rolesAllowed1("Sun"); |
| stat.addStatus(description, stat.PASS); |
| |
| try { |
| description = testSuite + " ejbws: rolesAllowed2"; |
| port.rolesAllowed2("Sun"); |
| stat.addStatus(description, stat.FAIL); |
| } catch(Exception e) { |
| System.out.println("Expected failure: " + e); |
| stat.addStatus(description, stat.PASS); |
| } |
| |
| description = testSuite + " ejbws: permitAll"; |
| port.permitAll("Sun"); |
| stat.addStatus(description, stat.PASS); |
| |
| try { |
| description = testSuite + " ejbws: denyAll"; |
| port.denyAll("Sun"); |
| stat.addStatus(description, stat.FAIL); |
| } catch(Exception e) { |
| System.out.println("Expected failure: " + e); |
| stat.addStatus(description, stat.PASS); |
| } |
| |
| try { |
| description = testSuite + " ejbws: runAs1"; |
| port.runAs1(); |
| stat.addStatus(description, stat.FAIL); |
| } catch(Exception e) { |
| System.out.println("Expected failure: " + e); |
| stat.addStatus(description, stat.PASS); |
| } |
| |
| description = testSuite + " ejbws: runAs2"; |
| port.runAs2(); |
| stat.addStatus(description, stat.PASS); |
| |
| description = testSuite + " ejbws: runAsRunAs1"; |
| port.runAsRunAs1(); |
| stat.addStatus(description, stat.PASS); |
| |
| try { |
| description = testSuite + " ejbws: runAsRunAs2"; |
| port.runAsRunAs2(); |
| stat.addStatus(description, stat.FAIL); |
| } catch(Exception e) { |
| System.out.println("Expected failure: " + e); |
| stat.addStatus(description, stat.PASS); |
| } |
| |
| } catch(Exception ex) { |
| ex.printStackTrace(); |
| stat.addStatus(description, stat.FAIL); |
| } |
| |
| stat.printSummary("security-wss-roles2"); |
| } |
| } |