hammant 2004/06/06 18:19:44
Added: client/impl/src/test/org/apache/altrmi/client/impl/direct
DirectMarshalledHostContextTestCase.java
Log:
marshalled hostcontext tested
Revision Changes Path
1.1
incubator-altrmi/client/impl/src/test/org/apache/altrmi/client/impl/direct/DirectMarshalledHostContextTestCase.java
Index: DirectMarshalledHostContextTestCase.java
===================================================================
/* ====================================================================
* Copyright 2001 - 2004
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.altrmi.client.impl.direct;
import junit.framework.TestCase;
import org.apache.altrmi.server.ServerInvocationHandler;
import org.apache.altrmi.server.ServerMarshalledInvocationHandler;
import org.apache.altrmi.common.Reply;
import org.apache.altrmi.common.Request;
import org.apache.altrmi.common.GarbageCollectionReply;
import org.apache.altrmi.common.GarbageCollectionRequest;
import org.apache.altrmi.common.SerializationHelper;
import org.apache.altrmi.client.ClientInvocationHandler;
import java.util.Vector;
public class DirectMarshalledHostContextTestCase extends TestCase {
public void testBasicPassingOfRequests() throws ClassNotFoundException {
final Vector vec = new Vector();
DirectMarshalledHostContext dmhc = new
DirectMarshalledHostContext.WithSimpleDefaults(new
ServerMarshalledInvocationHandler() {
public byte[] handleInvocation(byte[] request, Object
connectionDetails) {
vec.add(request);
return SerializationHelper.getBytesFromInstance(new
GarbageCollectionReply());
}
});
ClientInvocationHandler cih = dmhc.getInvocationHandler();
assertTrue(cih.handleInvocation(new GarbageCollectionRequest())
instanceof GarbageCollectionReply);
assertTrue(SerializationHelper.getInstanceFromBytes((byte[])vec.get(0))
instanceof GarbageCollectionRequest);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]