You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/02/14 09:49:20 UTC
[15/51] [partial] cxf git commit: Remove all trailing whitespaces
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaConduitTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaConduitTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaConduitTest.java
index b12a902..a21c191 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaConduitTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaConduitTest.java
@@ -64,12 +64,12 @@ import org.omg.CORBA.TypeCode;
public class CorbaConduitTest extends Assert {
-
+
private static IMocksControl control;
private static ORB orb;
private static Bus bus;
protected EndpointInfo endpointInfo;
- protected EndpointReferenceType target;
+ protected EndpointReferenceType target;
protected MessageObserver observer;
Message inMessage;
CorbaBindingFactory factory;
@@ -78,12 +78,12 @@ public class CorbaConduitTest extends Assert {
@Before
public void setUp() throws Exception {
control = EasyMock.createNiceControl();
-
- bus = BusFactory.getDefaultBus();
-
+
+ bus = BusFactory.getDefaultBus();
+
java.util.Properties props = System.getProperties();
-
-
+
+
props.put("yoko.orb.id", "CXF-CORBA-Server-Binding");
orb = ORB.init(new String[0], props);
orbConfig = new OrbConfig();
@@ -97,23 +97,23 @@ public class CorbaConduitTest extends Assert {
} catch (Exception ex) {
// Do nothing. Throw an Exception?
}
- }
+ }
}
-
+
@Test
public void testCorbaConduit() throws Exception {
- CorbaConduit conduit = setupCorbaConduit(false);
+ CorbaConduit conduit = setupCorbaConduit(false);
assertTrue("conduit should not be null", conduit != null);
}
-
+
@Test
- public void testPrepare() throws Exception {
+ public void testPrepare() throws Exception {
setupServiceInfo("http://cxf.apache.org/bindings/corba/simple",
"/wsdl_corbabinding/simpleIdl.wsdl", "SimpleCORBAService",
"SimpleCORBAPort");
CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
-
+
if (System.getProperty("java.vendor").contains("IBM")) {
//IBM requires it to activate to resolve it, but cannot
//activate on sun without more config
@@ -125,17 +125,17 @@ public class CorbaConduitTest extends Assert {
try {
conduit.prepare(message);
} catch (Exception ex) {
- ex.printStackTrace();
+ ex.printStackTrace();
}
OutputStream os = message.getContent(OutputStream.class);
- assertTrue("OutputStream should not be null", os != null);
+ assertTrue("OutputStream should not be null", os != null);
ORB orb2 = (ORB)message.get("orb");
assertTrue("Orb should not be null", orb2 != null);
Object obj = message.get("endpoint");
- assertTrue("EndpointReferenceType should not be null", obj != null);
+ assertTrue("EndpointReferenceType should not be null", obj != null);
}
-
-
+
+
@Test
public void testGetTargetReference() throws Exception {
setupServiceInfo("http://cxf.apache.org/bindings/corba/simple",
@@ -144,12 +144,12 @@ public class CorbaConduitTest extends Assert {
CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
CorbaConduit conduit = new CorbaConduit(endpointInfo, destination.getAddress(), orbConfig);
-
+
EndpointReferenceType t = null;
EndpointReferenceType ref = conduit.getTargetReference(t);
assertTrue("ref should not be null", ref != null);
}
-
+
@Test
public void testGetAddress() throws Exception {
setupServiceInfo("http://cxf.apache.org/bindings/corba/simple",
@@ -158,19 +158,19 @@ public class CorbaConduitTest extends Assert {
CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
endpointInfo.setAddress("corbaloc::localhost:40000/Simple");
- CorbaConduit conduit = new CorbaConduit(endpointInfo, destination.getAddress(), orbConfig);
+ CorbaConduit conduit = new CorbaConduit(endpointInfo, destination.getAddress(), orbConfig);
String address = conduit.getAddress();
assertTrue("address should not be null", address != null);
- assertEquals(address, "corbaloc::localhost:40000/Simple");
+ assertEquals(address, "corbaloc::localhost:40000/Simple");
}
-
+
@Test
- public void testClose() throws Exception {
- Method m = CorbaConduit.class.getDeclaredMethod("buildRequest",
+ public void testClose() throws Exception {
+ Method m = CorbaConduit.class.getDeclaredMethod("buildRequest",
new Class[] {CorbaMessage.class, OperationType.class});
CorbaConduit conduit = EasyMock.createMockBuilder(CorbaConduit.class)
- .addMockedMethod(m).createMock();
-
+ .addMockedMethod(m).createMock();
+
org.omg.CORBA.Object obj = control.createMock(org.omg.CORBA.Object.class);
CorbaMessage msg = control.createMock(CorbaMessage.class);
EasyMock.expect(msg.get(CorbaConstants.CORBA_ENDPOINT_OBJECT)).andReturn(obj);
@@ -187,65 +187,65 @@ public class CorbaConduitTest extends Assert {
EasyMock.expect(msg.getContent(OutputStream.class)).andReturn(os);
os.close();
EasyMock.expectLastCall();
-
+
control.replay();
conduit.close(msg);
control.verify();
}
-
+
@Test
public void testGetTarget() throws Exception {
CorbaConduit conduit = setupCorbaConduit(false);
EndpointReferenceType endpoint = conduit.getTarget();
assertTrue("EndpointReferenceType should not be null", endpoint != null);
}
-
+
@Test
- public void testGetOperationExceptions() {
- CorbaConduit conduit = control.createMock(CorbaConduit.class);
+ public void testGetOperationExceptions() {
+ CorbaConduit conduit = control.createMock(CorbaConduit.class);
OperationType opType = control.createMock(OperationType.class);
CorbaTypeMap typeMap = control.createMock(CorbaTypeMap.class);
-
- List<RaisesType> exlist = CastUtils.cast(control.createMock(ArrayList.class));
+
+ List<RaisesType> exlist = CastUtils.cast(control.createMock(ArrayList.class));
opType.getRaises();
EasyMock.expectLastCall().andReturn(exlist);
int i = 0;
- EasyMock.expect(exlist.size()).andReturn(i);
- RaisesType rType = control.createMock(RaisesType.class);
+ EasyMock.expect(exlist.size()).andReturn(i);
+ RaisesType rType = control.createMock(RaisesType.class);
EasyMock.expect(exlist.get(0)).andReturn(rType);
-
+
control.replay();
conduit.getOperationExceptions(opType, typeMap);
- assertEquals(exlist.size(), 0);
+ assertEquals(exlist.size(), 0);
}
-
+
@Test
public void testBuildRequest() throws Exception {
- CorbaConduit conduit = setupCorbaConduit(false);
+ CorbaConduit conduit = setupCorbaConduit(false);
CorbaMessage message = control.createMock(CorbaMessage.class);
Exchange exchange = control.createMock(Exchange.class);
EasyMock.expect(message.getExchange());
- EasyMock.expectLastCall().andReturn(exchange);
+ EasyMock.expectLastCall().andReturn(exchange);
ServiceInfo service = control.createMock(ServiceInfo.class);
EasyMock.expect(exchange.get(ServiceInfo.class)).andReturn(service);
List<CorbaTypeMap> list = CastUtils.cast(control.createMock(List.class));
CorbaTypeMap typeMap = control.createMock(CorbaTypeMap.class);
- EasyMock.expect(service.getExtensors(CorbaTypeMap.class)).andReturn(list);
-
+ EasyMock.expect(service.getExtensors(CorbaTypeMap.class)).andReturn(list);
+
OperationType opType = control.createMock(OperationType.class);
conduit.getArguments(message);
- EasyMock.expectLastCall().andReturn(null);
+ EasyMock.expectLastCall().andReturn(null);
conduit.getReturn(message);
EasyMock.expectLastCall().andReturn(null);
conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap),
message,
opType);
EasyMock.expectLastCall().andReturn(null);
-
+
conduit.getRequest(message, "Hello", null, null, null);
EasyMock.expectLastCall();
}
-
+
@Test
public void testBuildArguments() throws Exception {
Message msg = new MessageImpl();
@@ -255,23 +255,23 @@ public class CorbaConduitTest extends Assert {
QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_short);
CorbaPrimitiveHandler obj1 = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
- CorbaStreamable arg = message.createStreamableObject(obj1, objName);
+ CorbaStreamable arg = message.createStreamableObject(obj1, objName);
arguments[0] = arg;
arguments[0].setMode(org.omg.CORBA.ARG_OUT.value);
-
+
CorbaConduit conduit = setupCorbaConduit(false);
NVList list = conduit.getArguments(message);
assertNotNull("list should not be null", list != null);
-
+
message.setStreamableArguments(arguments);
NVList listArgs = conduit.getArguments(message);
assertNotNull("listArgs should not be null", listArgs != null);
assertNotNull("listArgs Item should not be null", listArgs.item(0) != null);
assertEquals("Name should be equal", listArgs.item(0).name(), "object");
assertEquals("flags should be 2", listArgs.item(0).flags(), 2);
- assertNotNull("Any Value should not be null", listArgs.item(0).value() != null);
+ assertNotNull("Any Value should not be null", listArgs.item(0).value() != null);
}
-
+
@Test
public void testBuildReturn() throws Exception {
Message msg = new MessageImpl();
@@ -281,19 +281,19 @@ public class CorbaConduitTest extends Assert {
QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_short);
CorbaPrimitiveHandler obj1 = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
- CorbaStreamable arg = message.createStreamableObject(obj1, objName);
-
+ CorbaStreamable arg = message.createStreamableObject(obj1, objName);
+
CorbaConduit conduit = setupCorbaConduit(false);
NamedValue ret = conduit.getReturn(message);
assertNotNull("Return should not be null", ret != null);
assertEquals("name should be equal", ret.name(), "return");
-
+
message.setStreamableReturn(arg);
NamedValue ret2 = conduit.getReturn(message);
assertNotNull("Return2 should not be null", ret2 != null);
- assertEquals("name should be equal", ret2.name(), "returnName");
+ assertEquals("name should be equal", ret2.name(), "returnName");
}
-
+
@Test
public void testBuildExceptionListEmpty() throws Exception {
CorbaConduit conduit = setupCorbaConduit(false);
@@ -305,11 +305,11 @@ public class CorbaConduitTest extends Assert {
message,
opType);
assertNotNull("ExcepitonList is not null", exList != null);
- assertEquals("The list should be empty", exList.count(), 0);
+ assertEquals("The list should be empty", exList.count(), 0);
}
-
+
@Test
- public void testBuildExceptionListWithExceptions() throws Exception {
+ public void testBuildExceptionListWithExceptions() throws Exception {
CorbaConduit conduit = setupCorbaConduit(false);
Message msg = new MessageImpl();
CorbaMessage message = new CorbaMessage(msg);
@@ -321,24 +321,24 @@ public class CorbaConduitTest extends Assert {
OperationType opType = bInfo.getExtensor(OperationType.class);
CorbaTypeMap typeMap = null;
List<TypeMappingType> corbaTypes =
- endpointInfo2.getService().getDescription().getExtensors(TypeMappingType.class);
+ endpointInfo2.getService().getDescription().getExtensors(TypeMappingType.class);
if (corbaTypes != null) {
typeMap = CorbaUtils.createCorbaTypeMap(corbaTypes);
}
-
+
ExceptionList exList = conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap),
message,
opType);
-
+
assertNotNull("ExceptionList is not null", exList != null);
assertNotNull("TypeCode is not null", exList.item(0) != null);
assertEquals("ID should be equal", exList.item(0).id(), "IDL:BadRecord:1.0");
assertEquals("ID should be equal", exList.item(0).name(), "BadRecord");
assertEquals("ID should be equal", exList.item(0).member_count(), 2);
assertEquals("ID should be equal", exList.item(0).member_name(0), "reason");
- assertNotNull("Member type is not null", exList.item(0).member_type(0) != null);
+ assertNotNull("Member type is not null", exList.item(0).member_type(0) != null);
}
-
+
@Test
public void testInvoke() throws Exception {
CorbaConduit conduit = setupCorbaConduit(false);
@@ -346,21 +346,21 @@ public class CorbaConduitTest extends Assert {
CorbaMessage message = control.createMock(CorbaMessage.class);
/*String opName = "GreetMe";
NVList nvlist = (NVList)orb.create_list(0);
-
+
Request request = conduit.getRequest(message, "GreetMe", nvlist, null, null);
request.invoke();
- */
-
- org.omg.CORBA.Object obj = control.createMock(org.omg.CORBA.Object.class);
+ */
+
+ org.omg.CORBA.Object obj = control.createMock(org.omg.CORBA.Object.class);
EasyMock.expect(message.get(CorbaConstants.CORBA_ENDPOINT_OBJECT)).andReturn(obj);
-
- //msg.put(CorbaConstants.CORBA_ENDPOINT_OBJECT, obj);
- Request r = control.createMock(Request.class);
+
+ //msg.put(CorbaConstants.CORBA_ENDPOINT_OBJECT, obj);
+ Request r = control.createMock(Request.class);
NVList nvList = orb.create_list(0);
NamedValue ret = control.createMock(NamedValue.class);
- ExceptionList exList = control.createMock(ExceptionList.class);
-
- EasyMock.expect(obj._create_request((Context)EasyMock.anyObject(),
+ ExceptionList exList = control.createMock(ExceptionList.class);
+
+ EasyMock.expect(obj._create_request((Context)EasyMock.anyObject(),
EasyMock.eq("greetMe"),
EasyMock.isA(NVList.class),
EasyMock.isA(NamedValue.class),
@@ -369,12 +369,12 @@ public class CorbaConduitTest extends Assert {
EasyMock.expectLastCall().andReturn(r);
r.invoke();
EasyMock.expectLastCall();
-
+
control.replay();
Request request = conduit.getRequest(message, "greetMe", nvList, ret, exList);
request.invoke();
control.verify();
-
+
/* try {
ContextList ctxList = orb.create_context_list();
Context ctx = orb.get_default_context();
@@ -387,36 +387,36 @@ public class CorbaConduitTest extends Assert {
ex.printStackTrace();
}*/
}
-
+
protected CorbaConduit setupCorbaConduit(boolean send) {
- target = EasyMock.createMock(EndpointReferenceType.class);
+ target = EasyMock.createMock(EndpointReferenceType.class);
endpointInfo = EasyMock.createMock(EndpointInfo.class);
CorbaConduit corbaConduit = new CorbaConduit(endpointInfo, target, orbConfig);
-
+
if (send) {
// setMessageObserver
observer = new MessageObserver() {
- public void onMessage(Message m) {
+ public void onMessage(Message m) {
inMessage = m;
}
};
corbaConduit.setMessageObserver(observer);
}
-
- return corbaConduit;
+
+ return corbaConduit;
}
-
- protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
+
+ protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
URL wsdlUrl = getClass().getResource(wsdl);
assertNotNull(wsdlUrl);
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl.toString(), new QName(ns, serviceName));
- Service service = f.create();
+ Service service = f.create();
endpointInfo = service.getEndpointInfo(new QName(ns, portName));
-
+
}
-
-
-
+
+
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaDestinationTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaDestinationTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaDestinationTest.java
index 6598ef6..b4e0d17 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaDestinationTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaDestinationTest.java
@@ -31,38 +31,38 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-public class CorbaDestinationTest extends Assert {
-
+public class CorbaDestinationTest extends Assert {
+
protected static TestUtils testUtils;
EndpointInfo endpointInfo;
OrbConfig orbConfig;
-
-
+
+
@Before
public void setUp() throws Exception {
testUtils = new TestUtils();
orbConfig = new OrbConfig();
}
-
+
@Test
- public void testDestination() throws Exception {
+ public void testDestination() throws Exception {
endpointInfo = testUtils.setupServiceInfo("http://cxf.apache.org/bindings/corba/simple",
"/wsdl_corbabinding/simpleIdl.wsdl", "SimpleCORBAService",
"SimpleCORBAPort");
CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
-
+
EndpointReferenceType rtype = destination.getAddress();
- assertTrue("EndpointReferenceType should not be null", rtype != null);
+ assertTrue("EndpointReferenceType should not be null", rtype != null);
BindingInfo bindingInfo = destination.getBindingInfo();
- assertTrue("BindingInfo should not be null", bindingInfo != null);
+ assertTrue("BindingInfo should not be null", bindingInfo != null);
EndpointInfo e2 = destination.getEndPointInfo();
assertTrue("EndpointInfo should not be null", e2 != null);
-
+
Message m = new MessageImpl();
CorbaServerConduit serverConduit = (CorbaServerConduit)destination.getBackChannel(m);
- assertNotNull("CorbaServerConduit should not be null", serverConduit);
+ assertNotNull("CorbaServerConduit should not be null", serverConduit);
}
-
+
/*
@Test
public void testSetMessageObserverActivate() throws Exception {
@@ -71,26 +71,26 @@ public class CorbaDestinationTest extends Assert {
"SimpleCORBAPort");
CorbaDestination destination = new CorbaDestination(endpointInfo);
String addr = destination.getAddressType().getLocation();
- assertEquals(addr, "corbaloc::localhost:40000/Simple");
-
+ assertEquals(addr, "corbaloc::localhost:40000/Simple");
+
Bus bus = BusFactory.newInstance().getDefaultBus();
Service service = new ServiceImpl();
- Endpoint endpoint = new EndpointImpl(bus, service, endpointInfo);
- MessageObserver observer = new ChainInitiationObserver(endpoint, bus);
- destination.setMessageObserver(observer);
+ Endpoint endpoint = new EndpointImpl(bus, service, endpointInfo);
+ MessageObserver observer = new ChainInitiationObserver(endpoint, bus);
+ destination.setMessageObserver(observer);
assertTrue("orb should not be null", destination.getOrb() != null);
-
- try {
- File file = new File("endpoint.ior");
+
+ try {
+ File file = new File("endpoint.ior");
assertEquals(true,file.exists());
} finally {
new File("endpoint.ior").deleteOnExit();
}
-
+
addr = destination.getAddressType().getLocation();
addr = addr.substring(0,4);
- assertEquals(addr, "IOR:");
+ assertEquals(addr, "IOR:");
destination.shutdown();
- }*/
+ }*/
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaMessageTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaMessageTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaMessageTest.java
index 42c9e20..caad534 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaMessageTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaMessageTest.java
@@ -38,22 +38,22 @@ public class CorbaMessageTest extends Assert {
private static ORB orb;
private Message message;
-
+
@Before
public void setUp() throws Exception {
java.util.Properties props = System.getProperties();
-
-
+
+
props.put("yoko.orb.id", "CXF-CORBA-Server-Binding");
orb = ORB.init(new String[0], props);
IMocksControl control = EasyMock.createNiceControl();
message = control.createMock(Message.class);
}
-
+
@Test
public void testGetCorbaMessageAttributes() {
CorbaMessage msg = new CorbaMessage(message);
-
+
QName param1Name = new QName("param1");
QName param1IdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
TypeCode param1TypeCode = orb.get_primitive_tc(TCKind.tk_long);
@@ -62,7 +62,7 @@ public class CorbaMessageTest extends Assert {
param1TypeCode,
null);
CorbaStreamable p1 = msg.createStreamableObject(param1, param1Name);
-
+
QName param2Name = new QName("param2");
QName param2IdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string", CorbaConstants.NP_WSDL_CORBA);
TypeCode param2TypeCode = orb.get_primitive_tc(TCKind.tk_string);
@@ -71,15 +71,15 @@ public class CorbaMessageTest extends Assert {
param2TypeCode,
null);
CorbaStreamable p2 = msg.createStreamableObject(param2, param2Name);
-
+
msg.addStreamableArgument(p1);
msg.addStreamableArgument(p2);
-
+
CorbaStreamable[] arguments = msg.getStreamableArguments();
assertTrue(arguments.length == 2);
assertNotNull(arguments[0]);
assertNotNull(arguments[1]);
-
+
QName param3Name = new QName("param3");
QName param3IdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
TypeCode param3TypeCode = orb.get_primitive_tc(TCKind.tk_short);
@@ -88,7 +88,7 @@ public class CorbaMessageTest extends Assert {
param3TypeCode,
null);
CorbaStreamable p3 = msg.createStreamableObject(param3, param3Name);
-
+
QName param4Name = new QName("param4");
QName param4IdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "float", CorbaConstants.NP_WSDL_CORBA);
TypeCode param4TypeCode = orb.get_primitive_tc(TCKind.tk_float);
@@ -97,30 +97,30 @@ public class CorbaMessageTest extends Assert {
param4TypeCode,
null);
CorbaStreamable p4 = msg.createStreamableObject(param4, param4Name);
-
+
CorbaStreamable[] args = new CorbaStreamable[2];
args[0] = p3;
- args[1] = p4;
+ args[1] = p4;
msg.setStreamableArguments(args);
-
+
arguments = msg.getStreamableArguments();
assertTrue(arguments.length == 4);
assertNotNull(arguments[0]);
assertNotNull(arguments[1]);
assertNotNull(arguments[2]);
assertNotNull(arguments[3]);
-
- NVList list = orb.create_list(2);
+
+ NVList list = orb.create_list(2);
Any value = orb.create_any();
value.insert_Streamable(p1);
list.add_value(p1.getName(), value, p1.getMode());
value.insert_Streamable(p2);
list.add_value(p2.getName(), value, p2.getMode());
-
+
msg.setList(list);
NVList resultList = msg.getList();
- assertTrue(resultList.count() == 2);
-
+ assertTrue(resultList.count() == 2);
+
QName returnName = new QName("param2");
QName returnIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "boolean",
CorbaConstants.NP_WSDL_CORBA);
@@ -129,11 +129,11 @@ public class CorbaMessageTest extends Assert {
returnIdlType,
returnTypeCode, null);
CorbaStreamable ret = msg.createStreamableObject(returnValue, returnName);
-
+
msg.setStreamableReturn(ret);
CorbaStreamable retVal = msg.getStreamableReturn();
assertNotNull(retVal);
-
+
// NEED TO DO TEST FOR EXCEPTIONS
/*Exception ex = new CorbaBindingException("TestException");
msg.s.setException(ex);
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaServerConduitTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaServerConduitTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaServerConduitTest.java
index 6165a70..afa4059 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaServerConduitTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaServerConduitTest.java
@@ -53,9 +53,9 @@ import org.omg.CORBA.TypeCode;
public class CorbaServerConduitTest extends Assert {
protected EndpointInfo endpointInfo;
- protected EndpointReferenceType target;
+ protected EndpointReferenceType target;
protected MessageObserver observer;
-
+
IMocksControl control;
ORB orb;
Bus bus;
@@ -70,20 +70,20 @@ public class CorbaServerConduitTest extends Assert {
@Before
public void setUp() throws Exception {
control = EasyMock.createNiceControl();
-
- bus = BusFactory.getDefaultBus();
-
+
+ bus = BusFactory.getDefaultBus();
+
java.util.Properties props = System.getProperties();
-
-
+
+
props.put("yoko.orb.id", "CXF-CORBA-Server-Binding");
orb = ORB.init(new String[0], props);
orbConfig = new OrbConfig();
targetObject = EasyMock.createMock(org.omg.CORBA.Object.class);
}
-
+
@After
- public void tearDown() {
+ public void tearDown() {
bus.shutdown(true);
if (orb != null) {
try {
@@ -91,17 +91,17 @@ public class CorbaServerConduitTest extends Assert {
} catch (Exception ex) {
// Do nothing. Throw an Exception?
}
- }
+ }
}
-
+
@Test
public void testCorbaServerConduit() throws Exception {
- CorbaServerConduit conduit = setupCorbaServerConduit(false);
+ CorbaServerConduit conduit = setupCorbaServerConduit(false);
assertTrue("conduit should not be null", conduit != null);
}
-
+
@Test
- public void testPrepare() throws Exception {
+ public void testPrepare() throws Exception {
setupServiceInfo("http://cxf.apache.org/bindings/corba/simple",
"/wsdl_corbabinding/simpleIdl.wsdl", "SimpleCORBAService",
"SimpleCORBAPort");
@@ -116,22 +116,22 @@ public class CorbaServerConduitTest extends Assert {
try {
conduit.prepare(message);
} catch (Exception ex) {
- ex.printStackTrace();
+ ex.printStackTrace();
}
OutputStream os = message.getContent(OutputStream.class);
- assertTrue("OutputStream should not be null", os != null);
+ assertTrue("OutputStream should not be null", os != null);
ORB orb2 = (ORB)message.get("orb");
assertTrue("Orb should not be null", orb2 != null);
Object obj = message.get("endpoint");
assertTrue("EndpointReferenceType should not be null", obj != null);
-
- assertTrue("passed in targetObject is used",
+
+ assertTrue("passed in targetObject is used",
targetObject.equals(message.get(CorbaConstants.CORBA_ENDPOINT_OBJECT)));
-
+
destination.shutdown();
}
-
-
+
+
@Test
public void testGetTargetReference() throws Exception {
setupServiceInfo("http://cxf.apache.org/bindings/corba/simple",
@@ -145,13 +145,13 @@ public class CorbaServerConduitTest extends Assert {
null,
orbConfig,
corbaTypeMap);
-
+
EndpointReferenceType t = null;
EndpointReferenceType ref = conduit.getTargetReference(t);
assertTrue("ref should not be null", ref != null);
destination.shutdown();
}
-
+
@Test
public void testGetAddress() throws Exception {
setupServiceInfo("http://cxf.apache.org/bindings/corba/simple",
@@ -168,86 +168,86 @@ public class CorbaServerConduitTest extends Assert {
corbaTypeMap);
String address = conduit.getAddress();
assertTrue("address should not be null", address != null);
- assertEquals(address, "corbaloc::localhost:40000/Simple");
+ assertEquals(address, "corbaloc::localhost:40000/Simple");
}
-
+
@Test
- public void testClose() throws Exception {
-
- Method m = CorbaServerConduit.class.getDeclaredMethod("buildRequestResult",
+ public void testClose() throws Exception {
+
+ Method m = CorbaServerConduit.class.getDeclaredMethod("buildRequestResult",
new Class[] {CorbaMessage.class});
CorbaServerConduit conduit = EasyMock.createMockBuilder(CorbaServerConduit.class)
.addMockedMethod(m)
.createMock();
-
- CorbaMessage msg = control.createMock(CorbaMessage.class);
+
+ CorbaMessage msg = control.createMock(CorbaMessage.class);
conduit.buildRequestResult(msg);
EasyMock.expectLastCall();
OutputStream stream = control.createMock(OutputStream.class);
EasyMock.expect(msg.getContent(OutputStream.class)).andReturn(stream);
stream.close();
EasyMock.expectLastCall();
-
+
control.replay();
conduit.close(msg);
control.verify();
- }
-
+ }
+
@Test
public void testBuildRequestResult() {
- NVList list = orb.create_list(0);
- CorbaServerConduit conduit = setupCorbaServerConduit(false);
+ NVList list = orb.create_list(0);
+ CorbaServerConduit conduit = setupCorbaServerConduit(false);
CorbaMessage msg = control.createMock(CorbaMessage.class);
- Exchange exchange = control.createMock(Exchange.class);
+ Exchange exchange = control.createMock(Exchange.class);
ServerRequest request = control.createMock(ServerRequest.class);
-
+
EasyMock.expect(msg.getExchange()).andReturn(exchange);
EasyMock.expect(exchange.get(ServerRequest.class)).andReturn(request);
-
+
EasyMock.expect(exchange.isOneWay()).andReturn(false);
CorbaMessage inMsg = EasyMock.createMock(CorbaMessage.class);
EasyMock.expect(msg.getExchange()).andReturn(exchange);
EasyMock.expect(exchange.getInMessage()).andReturn(inMsg);
-
+
EasyMock.expect(inMsg.getList()).andReturn(list);
- EasyMock.expect(msg.getStreamableException()).andReturn(null);
+ EasyMock.expect(msg.getStreamableException()).andReturn(null);
EasyMock.expect(msg.getStreamableArguments()).andReturn(null);
EasyMock.expect(msg.getStreamableReturn()).andReturn(null);
-
+
control.replay();
conduit.buildRequestResult(msg);
- control.verify();
+ control.verify();
}
-
+
@Test
public void testBuildRequestResultException() {
- NVList list = orb.create_list(0);
- CorbaServerConduit conduit = setupCorbaServerConduit(false);
+ NVList list = orb.create_list(0);
+ CorbaServerConduit conduit = setupCorbaServerConduit(false);
CorbaMessage msg = control.createMock(CorbaMessage.class);
- Exchange exchange = control.createMock(Exchange.class);
+ Exchange exchange = control.createMock(Exchange.class);
ServerRequest request = control.createMock(ServerRequest.class);
-
+
EasyMock.expect(msg.getExchange()).andReturn(exchange);
EasyMock.expect(exchange.get(ServerRequest.class)).andReturn(request);
-
+
EasyMock.expect(exchange.isOneWay()).andReturn(false);
CorbaMessage inMsg = EasyMock.createMock(CorbaMessage.class);
EasyMock.expect(msg.getExchange()).andReturn(exchange);
- EasyMock.expect(exchange.getInMessage()).andReturn(inMsg);
+ EasyMock.expect(exchange.getInMessage()).andReturn(inMsg);
- EasyMock.expect(inMsg.getList()).andReturn(list);
+ EasyMock.expect(inMsg.getList()).andReturn(list);
QName objName = new QName("object");
QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_short);
CorbaPrimitiveHandler obj = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
- CorbaStreamable exception = new CorbaStreamableImpl(obj, objName);
+ CorbaStreamable exception = new CorbaStreamableImpl(obj, objName);
EasyMock.expect(msg.getStreamableException()).andReturn(exception);
EasyMock.expect(msg.getStreamableException()).andReturn(exception);
-
+
control.replay();
conduit.buildRequestResult(msg);
- control.verify();
+ control.verify();
}
@Test
@@ -257,77 +257,77 @@ public class CorbaServerConduitTest extends Assert {
QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_short);
CorbaPrimitiveHandler obj = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
- CorbaStreamable arg = new CorbaStreamableImpl(obj, objName);
+ CorbaStreamable arg = new CorbaStreamableImpl(obj, objName);
arguments[0] = arg;
- arguments[0].setMode(org.omg.CORBA.ARG_OUT.value);
-
- NVList nvlist = orb.create_list(2);
+ arguments[0].setMode(org.omg.CORBA.ARG_OUT.value);
+
+ NVList nvlist = orb.create_list(2);
Any value = orb.create_any();
value.insert_Streamable(arguments[0]);
nvlist.add_value(arguments[0].getName(), value, arguments[0].getMode());
-
- CorbaServerConduit conduit = setupCorbaServerConduit(false);
+
+ CorbaServerConduit conduit = setupCorbaServerConduit(false);
CorbaMessage msg = control.createMock(CorbaMessage.class);
- Exchange exchange = control.createMock(Exchange.class);
+ Exchange exchange = control.createMock(Exchange.class);
ServerRequest request = control.createMock(ServerRequest.class);
-
+
EasyMock.expect(msg.getExchange()).andReturn(exchange);
EasyMock.expect(exchange.get(ServerRequest.class)).andReturn(request);
-
- EasyMock.expect(exchange.isOneWay()).andReturn(false);
- EasyMock.expect(msg.getExchange()).andReturn(exchange);
+
+ EasyMock.expect(exchange.isOneWay()).andReturn(false);
+ EasyMock.expect(msg.getExchange()).andReturn(exchange);
Message message = new MessageImpl();
CorbaMessage corbaMessage = new CorbaMessage(message);
corbaMessage.setList(nvlist);
-
- EasyMock.expect(exchange.getInMessage()).andReturn(corbaMessage);
+
+ EasyMock.expect(exchange.getInMessage()).andReturn(corbaMessage);
EasyMock.expect(msg.getStreamableException()).andReturn(null);
- EasyMock.expect(msg.getStreamableArguments()).andReturn(arguments);
+ EasyMock.expect(msg.getStreamableArguments()).andReturn(arguments);
EasyMock.expect(msg.getStreamableReturn()).andReturn(arg);
-
+
control.replay();
conduit.buildRequestResult(msg);
- control.verify();
+ control.verify();
}
-
+
public void testGetTarget() {
CorbaServerConduit conduit = setupCorbaServerConduit(false);
EndpointReferenceType endpoint = conduit.getTarget();
assertTrue("EndpointReferenceType should not be null", endpoint != null);
}
-
-
+
+
protected CorbaServerConduit setupCorbaServerConduit(boolean send) {
- target = EasyMock.createMock(EndpointReferenceType.class);
+ target = EasyMock.createMock(EndpointReferenceType.class);
endpointInfo = EasyMock.createMock(EndpointInfo.class);
- CorbaServerConduit corbaServerConduit =
- new CorbaServerConduit(endpointInfo, target, targetObject,
+ CorbaServerConduit corbaServerConduit =
+ new CorbaServerConduit(endpointInfo, target, targetObject,
null, orbConfig, corbaTypeMap);
-
+
if (send) {
// setMessageObserver
observer = new MessageObserver() {
- public void onMessage(Message m) {
+ public void onMessage(Message m) {
inMessage = m;
}
};
corbaServerConduit.setMessageObserver(observer);
}
-
- return corbaServerConduit;
+
+ return corbaServerConduit;
}
-
- protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
+
+ protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
URL wsdlUrl = getClass().getResource(wsdl);
assertNotNull(wsdlUrl);
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl.toString(), new QName(ns, serviceName));
- Service service = f.create();
+ Service service = f.create();
endpointInfo = service.getEndpointInfo(new QName(ns, portName));
-
+
}
-
-
-
+
+
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaTypeMapTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaTypeMapTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaTypeMapTest.java
index 766f42e..850034e 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaTypeMapTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaTypeMapTest.java
@@ -29,21 +29,21 @@ public class CorbaTypeMapTest extends Assert {
@Test
public void testCorbaTypeMap() throws Exception {
CorbaTypeMap typeMap = new CorbaTypeMap("http://yoko.apache.org/ComplexTypes");
-
+
String targetNamespace = typeMap.getTargetNamespace();
assertEquals(targetNamespace, "http://yoko.apache.org/ComplexTypes");
-
+
QName type = new QName("http://yoko.apache.org/ComplexTypes",
"xsd1:Test.MultiPart.Colour", "");
-
+
CorbaType corbaTypeImpl = new CorbaType();
corbaTypeImpl.setType(type);
corbaTypeImpl.setName("Test.MultiPart.Colour");
typeMap.addType("Test.MultiPart.Colour", corbaTypeImpl);
-
+
CorbaType corbatype = typeMap.getType("Test.MultiPart.Colour");
assertEquals(corbatype.getName(), "Test.MultiPart.Colour");
assertEquals(corbatype.getType().getLocalPart(), "xsd1:Test.MultiPart.Colour");
}
-
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/TestUtils.java
----------------------------------------------------------------------
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/TestUtils.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/TestUtils.java
index f209d0a..e42e6fd 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/TestUtils.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/TestUtils.java
@@ -29,13 +29,13 @@ import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.wsdl11.WSDLServiceFactory;
-public class TestUtils {
-
+public class TestUtils {
+
protected static Bus bus;
protected CorbaBindingFactory factory;
protected EndpointInfo endpointInfo;
-
- public TestUtils() {
+
+ public TestUtils() {
bus = BusFactory.getDefaultBus();
BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
try {
@@ -43,35 +43,35 @@ public class TestUtils {
"http://cxf.apache.org/bindings/corba");
bfm.registerBindingFactory(CorbaConstants.NU_WSDL_CORBA, factory);
} catch (BusException ex) {
- ex.printStackTrace();
+ ex.printStackTrace();
}
- }
-
+ }
+
public EndpointInfo setupServiceInfo(String ns, String wsdl,
- String serviceName, String portName) throws Exception {
+ String serviceName, String portName) throws Exception {
URL wsdlUrl = getClass().getResource(wsdl);
WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl.toString(),
new QName(ns, serviceName));
Service service = f.create();
return service.getEndpointInfo(new QName(ns, portName));
- }
+ }
public CorbaDestination getExceptionTypesTestDestination() throws Exception {
endpointInfo = setupServiceInfo("http://schemas.apache.org/idl/except",
- "/wsdl_corbabinding/exceptions.wsdl",
+ "/wsdl_corbabinding/exceptions.wsdl",
"ExceptionTestCORBAService",
"ExceptionTestCORBAPort");
CorbaBindingFactory corbaBF = factory;
- return (CorbaDestination)corbaBF.getDestination(endpointInfo, bus);
+ return (CorbaDestination)corbaBF.getDestination(endpointInfo, bus);
}
-
+
public CorbaDestination getComplexTypesTestDestination() throws Exception {
endpointInfo = setupServiceInfo("http://cxf.apache.org/bindings/corba/ComplexTypes",
"/wsdl_corbabinding/ComplexTypes.wsdl",
"ComplexTypesCORBAService",
"ComplexTypesCORBAPort");
- CorbaBindingFactory corbaBF = factory;
+ CorbaBindingFactory corbaBF = factory;
return (CorbaDestination)corbaBF.getDestination(endpointInfo, bus);
}
public CorbaDestination getComplexTypesTestDestinationYoko() throws Exception {
@@ -79,7 +79,7 @@ public class TestUtils {
"/wsdl_corbabinding/ComplexTypesYoko.wsdl",
"ComplexTypesCORBAService",
"ComplexTypesCORBAPort");
- CorbaBindingFactory corbaBF = factory;
+ CorbaBindingFactory corbaBF = factory;
return (CorbaDestination)corbaBF.getDestination(endpointInfo, bus);
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServantTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServantTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServantTest.java
index ce972bd..e906e84 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServantTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServantTest.java
@@ -30,7 +30,7 @@ import org.apache.cxf.BusFactory;
import org.apache.cxf.binding.corba.CorbaDestination;
import org.apache.cxf.binding.corba.TestUtils;
import org.apache.cxf.message.Message;
-import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.MessageObserver;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -43,22 +43,22 @@ import org.omg.CORBA.ServerRequest;
public class CorbaDSIServantTest extends Assert {
protected static ORB orb;
protected static Bus bus;
-
+
public CorbaDSIServantTest() {
super();
}
-
+
@Before
- public void setUp() throws Exception {
+ public void setUp() throws Exception {
bus = BusFactory.getDefaultBus();
java.util.Properties props = System.getProperties();
-
-
+
+
props.put("yoko.orb.id", "CXF-CORBA-Server-Binding");
orb = ORB.init(new String[0], props);
-
+
}
-
+
@After
public void tearDown() throws Exception {
if (orb != null) {
@@ -67,15 +67,15 @@ public class CorbaDSIServantTest extends Assert {
} catch (Exception ex) {
// Do nothing. Throw an Exception?
}
- }
+ }
}
-
+
/*public void testCorbaDSIServant() throws Exception {
-
- CorbaDestination destination = testUtils.getSimpleTypesTestDestination();
+
+ CorbaDestination destination = testUtils.getSimpleTypesTestDestination();
Service service = new ServiceImpl();
- Endpoint endpoint = new EndpointImpl(bus, service, destination.getEndPointInfo());
- MessageObserver observer = new ChainInitiationObserver(endpoint, bus);
+ Endpoint endpoint = new EndpointImpl(bus, service, destination.getEndPointInfo());
+ MessageObserver observer = new ChainInitiationObserver(endpoint, bus);
destination.setMessageObserver(observer);
POA rootPOA = null;
CorbaDSIServant dsiServant = new CorbaDSIServant();
@@ -83,26 +83,26 @@ public class CorbaDSIServantTest extends Assert {
rootPOA,
destination,
observer);
-
+
assertNotNull("DSIServant should not be null", dsiServant != null);
assertNotNull("POA should not be null", dsiServant._default_POA() != null);
assertNotNull("Destination should not be null", dsiServant.getDestination() != null);
assertNotNull("ORB should not be null", dsiServant.getOrb() != null);
assertNotNull("MessageObserver should not be null", dsiServant.getObserver() != null);
-
+
byte[] objectId = new byte[10];
String[] interfaces = dsiServant._all_interfaces(rootPOA, objectId);
assertNotNull("Interfaces should not be null", interfaces != null);
assertEquals("Interface ID should be equal", interfaces[0], "IDL:Simple:1.0");
-
+
}*/
-
+
@Test
public void testInvoke() throws Exception {
-
+
CorbaDestination dest = new TestUtils().getComplexTypesTestDestination();
-
+
CorbaDSIServant dsiServant = new CorbaDSIServant();
dsiServant.init(orb, null, dest, null);
ServerRequest request = new ServerRequest() {
@@ -112,31 +112,31 @@ public class CorbaDSIServantTest extends Assert {
public Context ctx() {
return null;
}
-
+
};
-
- MessageObserver incomingObserver = new TestObserver();
+
+ MessageObserver incomingObserver = new TestObserver();
dsiServant.setObserver(incomingObserver);
-
+
Map<String, QName> map = new HashMap<String, QName>(2);
map.put("greetMe", new QName("greetMe"));
dsiServant.setOperationMapping(map);
-
+
dsiServant.invoke(request);
}
-
+
class TestObserver implements MessageObserver {
-
+
TestObserver() {
super();
- }
-
- public void onMessage(Message msg) {
- //System.out.println("Test OnMessage in TestObserver");
+ }
+
+ public void onMessage(Message msg) {
+ //System.out.println("Test OnMessage in TestObserver");
}
}
}
-
-
-
+
+
+
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
index e05cee1..6b94e5b 100644
--- a/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
+++ b/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReaderTest.java
@@ -58,16 +58,16 @@ import org.omg.CORBA.portable.OutputStream;
public class CorbaObjectReaderTest extends Assert {
private static ORB orb;
-
+
@Before
public void setUp() throws java.lang.Exception {
java.util.Properties props = System.getProperties();
-
-
+
+
props.put("yoko.orb.id", "CXF-CORBA-Binding");
orb = ORB.init(new String[0], props);
}
-
+
@After
public void tearDown() throws java.lang.Exception {
if (orb != null) {
@@ -83,176 +83,176 @@ public class CorbaObjectReaderTest extends Assert {
public void testReadBoolean() {
OutputStream oStream = orb.create_output_stream();
oStream.write_boolean(true);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Boolean boolValue = reader.readBoolean();
assertTrue(boolValue.booleanValue());
}
-
+
@Test
public void testReadChar() {
OutputStream oStream = orb.create_output_stream();
oStream.write_char('c');
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Character charValue = reader.readChar();
assertTrue(charValue.charValue() == 'c');
}
-
+
@Test
public void testReadWChar() {
OutputStream oStream = orb.create_output_stream();
oStream.write_wchar('w');
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Character wcharValue = reader.readWChar();
assertTrue(wcharValue.charValue() == 'w');
}
-
+
@Test
public void testReadOctet() {
OutputStream oStream = orb.create_output_stream();
oStream.write_octet((byte)27);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Byte octetValue = reader.readOctet();
assertTrue(octetValue.byteValue() == (byte)27);
}
-
+
@Test
public void testReadShort() {
OutputStream oStream = orb.create_output_stream();
oStream.write_short((short)-100);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Short shortValue = reader.readShort();
assertTrue(shortValue.shortValue() == (short)-100);
}
-
+
@Test
public void testReadUShort() {
OutputStream oStream = orb.create_output_stream();
oStream.write_ushort((short)100);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Integer ushortValue = reader.readUShort();
assertTrue(ushortValue.intValue() == 100);
}
-
+
@Test
public void testReadLong() {
OutputStream oStream = orb.create_output_stream();
oStream.write_long(-100000);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Integer longValue = reader.readLong();
assertTrue(longValue.intValue() == -100000);
}
-
+
@Test
public void testReadULong() {
OutputStream oStream = orb.create_output_stream();
oStream.write_ulong(100000);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
long ulongValue = reader.readULong();
assertTrue(ulongValue == 100000);
}
-
+
@Test
public void testReadLongLong() {
OutputStream oStream = orb.create_output_stream();
oStream.write_longlong(1000000000);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Long longlongValue = reader.readLongLong();
assertTrue(longlongValue.longValue() == 1000000000);
}
-
+
@Test
public void testReadULongLong() {
OutputStream oStream = orb.create_output_stream();
oStream.write_ulonglong(-1000000000L);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
BigInteger ulonglongValue = reader.readULongLong();
assertEquals(1, ulonglongValue.signum());
}
-
+
@Test
public void testReadFloat() {
OutputStream oStream = orb.create_output_stream();
oStream.write_float((float)1234.56);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Float floatValue = reader.readFloat();
assertTrue(floatValue.floatValue() == (float)1234.56);
}
-
+
@Test
public void testReadDouble() {
OutputStream oStream = orb.create_output_stream();
oStream.write_double(6543.21);
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Double doubleValue = reader.readDouble();
assertTrue(doubleValue.doubleValue() == 6543.21);
}
-
+
@Test
public void testReadString() {
OutputStream oStream = orb.create_output_stream();
oStream.write_string("String");
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
String stringValue = reader.readString();
assertTrue("String".equals(stringValue));
}
-
+
@Test
public void testReadWString() {
OutputStream oStream = orb.create_output_stream();
oStream.write_wstring("WString");
-
+
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
String wstringValue = reader.readWString();
assertTrue("WString".equals(wstringValue));
}
-
+
// need to add tests for arrays, sequences, struct, exceptions
@Test
public void testReadArray() {
-
+
int data[] = {1, 1, 2, 3, 5, 8, 13, 21};
-
+
OutputStream oStream = orb.create_output_stream();
oStream.write_long_array(data, 0, data.length);
@@ -272,23 +272,23 @@ public class CorbaObjectReaderTest extends Assert {
CorbaArrayHandler obj = new CorbaArrayHandler(new QName("Array"), arrayIdlType, arrayTC, arrayType);
for (int i = 0; i < data.length; ++i) {
CorbaObjectHandler nestedObj =
- new CorbaPrimitiveHandler(new QName("item"), longIdlType,
+ new CorbaPrimitiveHandler(new QName("item"), longIdlType,
orb.get_primitive_tc(TCKind.tk_long), null);
obj.addElement(nestedObj);
}
-
+
reader.readArray(obj);
int length = obj.getElements().size();
for (int i = 0; i < length; ++i) {
- assertTrue(new Long(((CorbaPrimitiveHandler)obj.getElement(i)).getDataFromValue()).intValue()
- == data[i]);
+ assertTrue(new Long(((CorbaPrimitiveHandler)obj.getElement(i)).getDataFromValue()).intValue()
+ == data[i]);
}
}
-
+
@Test
public void testReadSequence() {
String data[] = {"one", "one", "two", "three", "five", "eight", "thirteen", "twenty-one"};
-
+
OutputStream oStream = orb.create_output_stream();
oStream.write_long(data.length);
for (int i = 0; i < data.length; ++i) {
@@ -304,7 +304,7 @@ public class CorbaObjectReaderTest extends Assert {
Sequence seqType = new Sequence();
seqType.setBound(data.length);
- seqType.setElemtype(stringIdlType);
+ seqType.setElemtype(stringIdlType);
// name and respoitory ID of the sequence are not needed for this test
// build the object holder for a sequence.
@@ -312,20 +312,20 @@ public class CorbaObjectReaderTest extends Assert {
CorbaSequenceHandler obj = new CorbaSequenceHandler(new QName("Seq"), seqIdlType, seqTC, seqType);
for (int i = 0; i < data.length; ++i) {
CorbaPrimitiveHandler nestedObj =
- new CorbaPrimitiveHandler(new QName("item"), stringIdlType,
+ new CorbaPrimitiveHandler(new QName("item"), stringIdlType,
orb.get_primitive_tc(TCKind.tk_string), null);
obj.addElement(nestedObj);
}
-
+
reader.readSequence(obj);
int length = obj.getElements().size();
for (int i = 0; i < length; ++i) {
assertTrue(((CorbaPrimitiveHandler)obj.getElement(i)).getDataFromValue().equals(data[i]));
}
}
-
+
@Test
- public void testReadStruct() {
+ public void testReadStruct() {
OutputStream oStream = orb.create_output_stream();
// create the following struct
@@ -337,19 +337,19 @@ public class CorbaObjectReaderTest extends Assert {
int member1 = 12345;
String member2 = "54321";
boolean member3 = true;
-
+
oStream.write_long(member1);
oStream.write_string(member2);
oStream.write_boolean(member3);
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
QName structIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "struct", CorbaConstants.NP_WSDL_CORBA);
QName longIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "long", CorbaConstants.NP_WSDL_CORBA);
QName stringIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string", CorbaConstants.NP_WSDL_CORBA);
QName boolIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "boolean", CorbaConstants.NP_WSDL_CORBA);
-
+
Struct structType = new Struct();
structType.setName("TestStruct");
MemberType m1 = new MemberType();
@@ -370,9 +370,9 @@ public class CorbaObjectReaderTest extends Assert {
structMembers[0] = new StructMember("member1", orb.get_primitive_tc(TCKind.tk_long), null);
structMembers[1] = new StructMember("member2", orb.get_primitive_tc(TCKind.tk_string), null);
structMembers[2] = new StructMember("member3", orb.get_primitive_tc(TCKind.tk_boolean), null);
- TypeCode structTC = orb.create_struct_tc("IDL:org.apache.cxf.TestStruct/1.0", "TestStruct",
+ TypeCode structTC = orb.create_struct_tc("IDL:org.apache.cxf.TestStruct/1.0", "TestStruct",
structMembers);
- CorbaStructHandler obj = new CorbaStructHandler(new QName("TestStruct"), structIdlType,
+ CorbaStructHandler obj = new CorbaStructHandler(new QName("TestStruct"), structIdlType,
structTC, structType);
obj.addMember(
new CorbaPrimitiveHandler(new QName("member1"), longIdlType, structMembers[0].type, null));
@@ -380,18 +380,18 @@ public class CorbaObjectReaderTest extends Assert {
new CorbaPrimitiveHandler(new QName("member2"), stringIdlType, structMembers[1].type, null));
obj.addMember(
new CorbaPrimitiveHandler(new QName("member3"), boolIdlType, structMembers[2].type, null));
-
+
reader.readStruct(obj);
-
+
List<CorbaObjectHandler> nestedObjs = obj.getMembers();
- assertTrue(new Integer(((CorbaPrimitiveHandler)nestedObjs.get(0)).getDataFromValue()).intValue()
+ assertTrue(new Integer(((CorbaPrimitiveHandler)nestedObjs.get(0)).getDataFromValue()).intValue()
== member1);
assertTrue(((CorbaPrimitiveHandler)nestedObjs.get(1)).getDataFromValue().equals(member2));
assertTrue(Boolean.valueOf(((CorbaPrimitiveHandler)nestedObjs.get(2))
.getDataFromValue()).booleanValue()
== member3);
}
-
+
@Test
public void testReadException() {
OutputStream oStream = orb.create_output_stream();
@@ -403,21 +403,21 @@ public class CorbaObjectReaderTest extends Assert {
// }
short code = 12345;
String message = "54321";
-
+
oStream.write_string("IDL:org.apache.cxf.TestException/1.0");
oStream.write_short(code);
oStream.write_string(message);
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
QName exceptIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "exception",
CorbaConstants.NP_WSDL_CORBA);
- QName shortIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short",
+ QName shortIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short",
CorbaConstants.NP_WSDL_CORBA);
- QName stringIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string",
+ QName stringIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "string",
CorbaConstants.NP_WSDL_CORBA);
-
+
Exception exceptType = new Exception();
exceptType.setName("TestException");
MemberType m1 = new MemberType();
@@ -433,33 +433,33 @@ public class CorbaObjectReaderTest extends Assert {
StructMember[] exceptMembers = new StructMember[2];
exceptMembers[0] = new StructMember("code", orb.get_primitive_tc(TCKind.tk_short), null);
exceptMembers[1] = new StructMember("message", orb.get_primitive_tc(TCKind.tk_string), null);
- TypeCode exceptTC = orb.create_exception_tc("IDL:org.apache.cxf.TestException/1.0", "TestException",
+ TypeCode exceptTC = orb.create_exception_tc("IDL:org.apache.cxf.TestException/1.0", "TestException",
exceptMembers);
- CorbaExceptionHandler obj = new CorbaExceptionHandler(new QName("TestException"), exceptIdlType,
+ CorbaExceptionHandler obj = new CorbaExceptionHandler(new QName("TestException"), exceptIdlType,
exceptTC, exceptType);
obj.addMember(
new CorbaPrimitiveHandler(new QName("code"), shortIdlType, exceptMembers[0].type, null));
obj.addMember(
new CorbaPrimitiveHandler(new QName("message"), stringIdlType, exceptMembers[1].type, null));
-
+
reader.readException(obj);
-
+
List<CorbaObjectHandler> nestedObjs = obj.getMembers();
assertTrue(new Short(((CorbaPrimitiveHandler)nestedObjs.get(0))
.getDataFromValue()).shortValue() == code);
assertTrue(((CorbaPrimitiveHandler)nestedObjs.get(1)).getDataFromValue().equals(message));
- }
-
+ }
+
@Test
public void testReadEnum() {
OutputStream oStream = orb.create_output_stream();
-
+
// create the following enum
// enum { RED, GREEN, BLUE };
oStream.write_long(1);
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
String[] enums = {"RED", "GREEN", "BLUE" };
Enum enumType = new Enum();
Enumerator enumRed = new Enumerator();
@@ -471,17 +471,17 @@ public class CorbaObjectReaderTest extends Assert {
enumType.getEnumerator().add(enumRed);
enumType.getEnumerator().add(enumGreen);
enumType.getEnumerator().add(enumBlue);
-
+
// These values don't matter to the outcome of the test but are needed during construction
QName enumName = new QName("TestEnum");
QName enumIdlType = new QName("corbatm:TestEnum");
TypeCode enumTC = orb.create_enum_tc("IDL:TestEnum:1.0", enumName.getLocalPart(), enums);
CorbaEnumHandler obj = new CorbaEnumHandler(enumName, enumIdlType, enumTC, enumType);
-
+
reader.readEnum(obj);
assertTrue(obj.getValue().equals(enums[1]));
}
-
+
@Test
public void testReadFixed() {
if (System.getProperty("java.vendor").contains("IBM")) {
@@ -490,57 +490,57 @@ public class CorbaObjectReaderTest extends Assert {
return;
}
OutputStream oStream = orb.create_output_stream();
-
+
// create the following fixed
// fixed<5,2>
oStream.write_fixed(new java.math.BigDecimal("12345.67").movePointRight(2));
InputStream iStream = oStream.create_input_stream();
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
Fixed fixedType = new Fixed();
fixedType.setDigits(5);
fixedType.setScale(2);
-
+
// These values don't matter to the outcome of the test but are needed during construction
QName fixedName = new QName("TestFixed");
QName fixedIdlType = new QName("corbatm:TestFixed");
TypeCode fixedTC = orb.create_fixed_tc((short)fixedType.getDigits(), (short)fixedType.getScale());
CorbaFixedHandler obj = new CorbaFixedHandler(fixedName, fixedIdlType, fixedTC, fixedType);
-
+
reader.readFixed(obj);
-
+
assertTrue(obj.getValue().equals(new java.math.BigDecimal("12345.67")));
}
-
+
@Test
public void testReadObjectReference() throws IOException {
OutputStream oStream = orb.create_output_stream();
-
+
URL refUrl = getClass().getResource("/references/account.ref");
String oRef = IOUtils.toString(refUrl.openStream()).trim();
- org.omg.CORBA.Object objRef =
+ org.omg.CORBA.Object objRef =
orb.string_to_object(oRef);
-
+
assertNotNull(objRef);
oStream.write_Object(objRef);
- // we need an ORBinstance to handle reading objects so use the input stream
+ // we need an ORBinstance to handle reading objects so use the input stream
InputStream iStream = oStream.create_input_stream();
-
+
CorbaObjectReader reader = new CorbaObjectReader(iStream);
-
+
// create a test object
- org.apache.cxf.binding.corba.wsdl.Object objectType =
+ org.apache.cxf.binding.corba.wsdl.Object objectType =
new org.apache.cxf.binding.corba.wsdl.Object();
objectType.setRepositoryID("IDL:Account:1.0");
objectType.setBinding(new QName("AccountCORBABinding"));
-
+
QName objectName = new QName("TestObject");
QName objectIdlType = new QName("corbaatm:TestObject");
TypeCode objectTC = orb.create_interface_tc("IDL:Account:1.0", "TestObject");
-
- CorbaObjectReferenceHandler obj = new CorbaObjectReferenceHandler(objectName, objectIdlType,
+
+ CorbaObjectReferenceHandler obj = new CorbaObjectReferenceHandler(objectName, objectIdlType,
objectTC, objectType);
-
+
reader.readObjectReference(obj);
assertTrue(obj.getReference()._is_equivalent(objRef));
}