01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.aegis.type.array;
19:
20: import java.util.HashMap;
21: import java.util.Map;
22:
23: import org.apache.cxf.aegis.AbstractAegisTest;
24: import org.apache.cxf.aegis.databinding.AegisDatabinding;
25: import org.apache.cxf.aegis.type.Configuration;
26: import org.apache.cxf.aegis.type.DefaultTypeMappingRegistry;
27: import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
28: import org.junit.Test;
29:
30: public class DuplicateArrayTest extends AbstractAegisTest {
31:
32: @Test
33: public void testServiceStart() throws Exception {
34: AegisDatabinding binder = new AegisDatabinding();
35:
36: JaxWsServerFactoryBean serviceFactory = new JaxWsServerFactoryBean();
37: serviceFactory.getServiceFactory().setDataBinding(binder);
38:
39: DefaultTypeMappingRegistry tmr = (DefaultTypeMappingRegistry) binder
40: .getTypeMappingRegistry();
41: Configuration configuration = tmr.getConfiguration();
42: configuration.setDefaultMinOccurs(1);
43: configuration.setDefaultNillable(false);
44:
45: // Create a properties hashmap
46: Map<String, Object> props = new HashMap<String, Object>();
47:
48: // Enable the writing of xsi:type attributes
49: props.put(AegisDatabinding.WRITE_XSI_TYPE_KEY, Boolean.TRUE);
50:
51: serviceFactory.setAddress("local:://DuplicateArrayService");
52: serviceFactory.setServiceBean(new DuplicateArrayServiceBean());
53: serviceFactory.setServiceClass(DuplicateArrayService.class);
54: serviceFactory.setProperties(props);
55: serviceFactory.create();
56:
57: }
58:
59: }
|