001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019:
020: package org.apache.axis2.engine;
021:
022: import junit.framework.TestCase;
023: import org.apache.axis2.AxisFault;
024: import org.apache.axis2.description.AxisModule;
025: import org.apache.axis2.description.AxisOperation;
026: import org.apache.axis2.description.AxisService;
027: import org.apache.axis2.description.InOutAxisOperation;
028: import org.apache.axis2.description.Parameter;
029:
030: /**
031: * To chcek locked is working corrcetly
032: */
033:
034: public class ParameterAddTest extends TestCase {
035:
036: private AxisConfiguration reg = new AxisConfiguration();
037:
038: public void testAddParameterServiceLockedAtAxisConfig() {
039: try {
040: Parameter para = new Parameter();
041: para.setValue(null);
042: para.setName("PARA_NAME");
043: para.setLocked(true);
044: reg.addParameter(para);
045:
046: AxisService service = new AxisService("Service1");
047: reg.addService(service);
048: service.addParameter(para);
049: fail("This should fails with Parmter is locked can not overide");
050: } catch (AxisFault axisFault) {
051:
052: }
053: }
054:
055: public void testAddParameterModuleLockedAtAxisConfig() {
056: try {
057: Parameter para = new Parameter();
058: para.setValue(null);
059: para.setName("PARA_NAME");
060: para.setLocked(true);
061: reg.addParameter(para);
062: AxisModule module = new AxisModule("Service1");
063: module.setParent(reg);
064: module.addParameter(para);
065: fail("This should fails with Parmter is locked can not overide");
066: } catch (AxisFault axisFault) {
067:
068: }
069: }
070:
071: public void testAddParameterOperationlockedByAxisConfig() {
072: try {
073: Parameter para = new Parameter();
074: para.setValue(null);
075: para.setName("PARA_NAME");
076: para.setLocked(true);
077: reg.addParameter(para);
078:
079: AxisService service = new AxisService("Service1");
080: reg.addService(service);
081:
082: AxisOperation opertion = new InOutAxisOperation();
083: opertion.setParent(service);
084: opertion.addParameter(para);
085: fail("This should fails with Parmter is locked can not overide");
086:
087: } catch (AxisFault axisFault) {
088:
089: }
090: }
091:
092: public void testAddParameterOperationLockebyService() {
093: try {
094: Parameter para = new Parameter();
095: para.setValue(null);
096: para.setName("PARA_NAME");
097: para.setLocked(true);
098:
099: AxisService service = new AxisService("Service1");
100: reg.addService(service);
101: service.addParameter(para);
102:
103: AxisOperation opertion = new InOutAxisOperation();
104: opertion.setParent(service);
105: opertion.addParameter(para);
106: fail("This should fails with Parmter is locked can not overide");
107: } catch (AxisFault axisFault) {
108:
109: }
110: }
111:
112: }
|