use of org.apache.geode.internal.cache.tier.sockets.OldClientSupportService in project geode by apache.
the class InternalDataSerializer method processIncomingClassName.
/**
* For backward compatibility we must swizzle the package of some classes that had to be moved
* when GemFire was open- sourced. This preserves backward-compatibility.
*
* @param name the fully qualified class name
* @return the name of the class in this implementation
*/
public static String processIncomingClassName(String name) {
// TCPServer classes are used before a cache exists and support for old clients has been
// initialized
String oldPackage = "com.gemstone.org.jgroups.stack.tcpserver";
String newPackage = "org.apache.geode.distributed.internal.tcpserver";
if (name.startsWith(oldPackage)) {
return newPackage + name.substring(oldPackage.length());
}
OldClientSupportService svc = getOldClientSupportService();
if (svc != null) {
return svc.processIncomingClassName(name);
}
return name;
}
use of org.apache.geode.internal.cache.tier.sockets.OldClientSupportService in project geode by apache.
the class InternalDataSerializer method processOutgoingClassName.
/**
* For backward compatibility we must swizzle the package of some classes that had to be moved
* when GemFire was open- sourced. This preserves backward-compatibility.
*
* @param name the fully qualified class name
* @param out the consumer of the serialized object
* @return the name of the class in this implementation
*/
public static String processOutgoingClassName(String name, DataOutput out) {
// TCPServer classes are used before a cache exists and support for old clients has been
// initialized
String oldPackage = "com.gemstone.org.jgroups.stack.tcpserver";
String newPackage = "org.apache.geode.distributed.internal.tcpserver";
if (name.startsWith(newPackage)) {
return oldPackage + name.substring(newPackage.length());
}
OldClientSupportService svc = getOldClientSupportService();
if (svc != null) {
return svc.processOutgoingClassName(name, out);
}
return name;
}
use of org.apache.geode.internal.cache.tier.sockets.OldClientSupportService in project geode by apache.
the class OldClientSupportDUnitTest method testConversionOfArrayTypes.
@Test
public void testConversionOfArrayTypes() throws Exception {
OldClientSupportService oldClientSupport = OldClientSupportProvider.getService(myCache);
Version oldClientVersion = Version.GFE_82;
VersionedDataOutputStream dout = new VersionedDataOutputStream(new HeapDataOutputStream(10, oldClientVersion), oldClientVersion);
for (String geodeClassName : newArrayClassNames) {
String newName = oldClientSupport.processOutgoingClassName(geodeClassName, dout);
Assert.assertNotEquals(geodeClassName, newName);
}
for (String className : allNonconformingArrayClassNames) {
String newName = oldClientSupport.processOutgoingClassName(className, dout);
Assert.assertEquals(className, newName);
}
VersionedDataInputStream din = new VersionedDataInputStream(new DataInputStream(new ByteArrayInputStream(new byte[10])), oldClientVersion);
for (String oldClassName : oldArrayClassNames) {
String newName = oldClientSupport.processIncomingClassName(oldClassName, din);
Assert.assertNotEquals(oldClassName, newName);
}
}
use of org.apache.geode.internal.cache.tier.sockets.OldClientSupportService in project geode by apache.
the class OldClientSupportDUnitTest method convertThrowable.
private void convertThrowable(String geodeClassName) throws Exception {
Version oldClientVersion = Version.GFE_82;
final String comGemstoneGemFire = "com.gemstone.gemfire";
final int comGemstoneGemFireLength = comGemstoneGemFire.length();
OldClientSupportService oldClientSupport = OldClientSupportProvider.getService(myCache);
System.out.println("checking " + geodeClassName);
Class geodeClass = Class.forName(geodeClassName);
Object geodeObject = instantiate(geodeClass);
if (geodeObject instanceof Throwable) {
Throwable geodeThrowable = (Throwable) instantiate(geodeClass);
Throwable gemfireThrowable = oldClientSupport.getThrowable(geodeThrowable, oldClientVersion);
Assert.assertEquals("Failed to convert " + geodeClassName + ". Throwable class is " + gemfireThrowable.getClass().getName(), comGemstoneGemFire, gemfireThrowable.getClass().getName().substring(0, comGemstoneGemFireLength));
}
}
Aggregations