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.context.ConfigurationContextFactory;
025: import org.apache.axis2.deployment.DeploymentException;
026: import org.apache.axis2.deployment.ModuleBuilder;
027: import org.apache.axis2.deployment.ServiceBuilder;
028: import org.apache.axis2.description.AxisModule;
029: import org.apache.axis2.description.AxisService;
030:
031: import javax.xml.stream.XMLStreamException;
032: import java.io.FileInputStream;
033: import java.io.FileNotFoundException;
034: import java.io.InputStream;
035:
036: public class ParameterLocked extends TestCase {
037:
038: AxisConfiguration ar;
039: String repo = "./test-resources/deployment/ParaLockedRepo";
040:
041: protected void setUp() throws Exception {
042: ar = ConfigurationContextFactory
043: .createConfigurationContextFromFileSystem(null,
044: repo + "/axis2.xml").getAxisConfiguration();
045: }
046:
047: public void testOveride_Non_locked_Para_Service() {
048: try {
049: assertNotNull(ar);
050: AxisService service = new AxisService();
051: ar.addService(service);
052: InputStream in = new FileInputStream(repo
053: + "/service_overide_non_locked_para.xml");
054: ServiceBuilder sbuilder = new ServiceBuilder(in, null,
055: service);
056: sbuilder.populateService(sbuilder.buildOM());
057: assertNotNull(sbuilder);
058:
059: } catch (FileNotFoundException e) {
060: fail("This can not fail with this FileNotFoundException "
061: + e);
062: } catch (DeploymentException e) {
063: fail("This can not fail with this DeploymentException " + e);
064: } catch (AxisFault axisFault) {
065: fail("This can not fail with this AxisFault " + axisFault);
066: } catch (XMLStreamException e) {
067: fail("This can not fail with this AxisFault " + e);
068: }
069: }
070:
071: public void testOveride_locked_Para_Service() {
072: try {
073: assertNotNull(ar);
074: AxisService service = new AxisService();
075: ar.addService(service);
076: InputStream in = new FileInputStream(repo
077: + "/service_overide_locked_para.xml");
078: ServiceBuilder sbuilder = new ServiceBuilder(in, null,
079: service);
080: sbuilder.populateService(sbuilder.buildOM());
081: assertNotNull(sbuilder);
082: fail("Parmter is locked can not overide");
083: } catch (FileNotFoundException e) {
084: fail("This can not fail with this FileNotFoundException "
085: + e);
086: } catch (DeploymentException e) {
087:
088: } catch (AxisFault axisFault) {
089: fail("This can not fail with this AxisFault " + axisFault);
090: } catch (XMLStreamException e) {
091: fail("This can not fail with this AxisFault " + e);
092: }
093: }
094:
095: public void testOveride_locked_Para_Operation() {
096: try {
097: assertNotNull(ar);
098: AxisService service = new AxisService();
099: ar.addService(service);
100: InputStream in = new FileInputStream(repo
101: + "/op_overide_global_para.xml");
102: ServiceBuilder sbuilder = new ServiceBuilder(in, null,
103: service);
104: sbuilder.populateService(sbuilder.buildOM());
105: assertNotNull(sbuilder);
106: fail("Parmter is locked can not overide");
107: } catch (FileNotFoundException e) {
108: fail("This can not fail with this FileNotFoundException "
109: + e);
110: } catch (DeploymentException e) {
111:
112: } catch (AxisFault axisFault) {
113: fail("This can not fail with this AxisFault " + axisFault);
114: } catch (XMLStreamException e) {
115: fail("This can not fail with this AxisFault " + e);
116: }
117: }
118:
119: public void testOveride_Service_locked_Para_Operation() {
120: try {
121: assertNotNull(ar);
122: AxisService service = new AxisService();
123: ar.addService(service);
124: InputStream in = new FileInputStream(repo
125: + "/Op_overide_Service_para.xml");
126: ServiceBuilder sbuilder = new ServiceBuilder(in, null,
127: service);
128: sbuilder.populateService(sbuilder.buildOM());
129: fail("Parmter is locked can not overide");
130: } catch (FileNotFoundException e) {
131: fail("This can not fail with this FileNotFoundException "
132: + e);
133: } catch (DeploymentException e) {
134:
135: } catch (AxisFault axisFault) {
136: fail("This can not fail with this AxisFault " + axisFault);
137: } catch (XMLStreamException e) {
138: fail("This can not fail with this AxisFault " + e);
139: }
140: }
141:
142: public void testOveride_Non_locked_Para_Module() {
143: try {
144: assertNotNull(ar);
145: AxisModule module = new AxisModule();
146: module.setParent(ar);
147: InputStream in = new FileInputStream(repo
148: + "/module_overide_global_non_locked_para.xml");
149: ModuleBuilder mbuilder = new ModuleBuilder(in, module, ar);
150: mbuilder.populateModule();
151: } catch (FileNotFoundException e) {
152: fail("This can not fail with this FileNotFoundException "
153: + e);
154: } catch (DeploymentException e) {
155:
156: }
157: }
158:
159: public void testOveride_locked_Para_Module() {
160: try {
161: assertNotNull(ar);
162: AxisModule module = new AxisModule();
163: module.setParent(ar);
164: InputStream in = new FileInputStream(repo
165: + "/module_overide_locked_para.xml");
166: ModuleBuilder mbuilder = new ModuleBuilder(in, module, ar);
167: mbuilder.populateModule();
168: fail("Parmter is locked can not overide");
169: } catch (FileNotFoundException e) {
170: fail("This can not fail with this FileNotFoundException "
171: + e);
172: } catch (DeploymentException e) {
173:
174: }
175: }
176: }
|