Search in sources :

Example 36 with Version

use of org.apache.geode.internal.Version in project geode by apache.

the class RemoteRemoveAllMessage method fromData.

@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
    super.fromData(in);
    this.eventId = (EventID) DataSerializer.readObject(in);
    this.callbackArg = DataSerializer.readObject(in);
    this.posDup = (flags & POS_DUP) != 0;
    if ((flags & HAS_BRIDGE_CONTEXT) != 0) {
        this.bridgeContext = DataSerializer.readObject(in);
    }
    this.removeAllDataCount = (int) InternalDataSerializer.readUnsignedVL(in);
    this.removeAllData = new RemoveAllEntryData[removeAllDataCount];
    if (this.removeAllDataCount > 0) {
        final Version version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
        final ByteArrayDataInput bytesIn = new ByteArrayDataInput();
        for (int i = 0; i < this.removeAllDataCount; i++) {
            this.removeAllData[i] = new RemoveAllEntryData(in, this.eventId, i, version, bytesIn);
        }
        boolean hasTags = in.readBoolean();
        if (hasTags) {
            EntryVersionsList versionTags = EntryVersionsList.create(in);
            for (int i = 0; i < this.removeAllDataCount; i++) {
                this.removeAllData[i].versionTag = versionTags.get(i);
            }
        }
    }
}
Also used : EntryVersionsList(org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList) Version(org.apache.geode.internal.Version) RemoveAllEntryData(org.apache.geode.internal.cache.DistributedRemoveAllOperation.RemoveAllEntryData) ByteArrayDataInput(org.apache.geode.internal.ByteArrayDataInput)

Example 37 with Version

use of org.apache.geode.internal.Version in project geode by apache.

the class DiskInitFileParser method parse.

public DiskStoreID parse() throws IOException, ClassNotFoundException {
    Version gfversion = Version.GFE_662;
    DiskStoreID result = null;
    boolean endOfFile = false;
    while (!endOfFile) {
        if (dis.atEndOfFile()) {
            endOfFile = true;
            break;
        }
        byte opCode = dis.readByte();
        if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
            logger.trace(LogMarker.PERSIST_RECOVERY, "DiskInitFile opcode={}", opCode);
        }
        switch(opCode) {
            case DiskInitFile.IF_EOF_ID:
                endOfFile = true;
                gotEOF = true;
                break;
            case DiskInitFile.IFREC_INSTANTIATOR_ID:
                {
                    int id = dis.readInt();
                    String cn = readClassName(dis);
                    String icn = readClassName(dis);
                    readEndOfRecord(dis);
                    interpreter.cmnInstantiatorId(id, cn, icn);
                }
                break;
            case DiskInitFile.IFREC_DATA_SERIALIZER_ID:
                {
                    Class<?> dsc = readClass(dis);
                    readEndOfRecord(dis);
                    interpreter.cmnDataSerializerId(dsc);
                }
                break;
            case DiskInitFile.IFREC_ONLINE_MEMBER_ID:
                {
                    long drId = readDiskRegionID(dis);
                    PersistentMemberID pmid = readPMID(dis, gfversion);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_ONLINE_MEMBER_ID drId={} omid={}", drId, pmid);
                    }
                    interpreter.cmnOnlineMemberId(drId, pmid);
                }
                break;
            case DiskInitFile.IFREC_OFFLINE_MEMBER_ID:
                {
                    long drId = readDiskRegionID(dis);
                    PersistentMemberID pmid = readPMID(dis, gfversion);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_OFFLINE_MEMBER_ID drId={} pmid={}", drId, pmid);
                    }
                    interpreter.cmnOfflineMemberId(drId, pmid);
                }
                break;
            case DiskInitFile.IFREC_RM_MEMBER_ID:
                {
                    long drId = readDiskRegionID(dis);
                    PersistentMemberID pmid = readPMID(dis, gfversion);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_RM_MEMBER_ID drId={} pmid={}", drId, pmid);
                    }
                    interpreter.cmnRmMemberId(drId, pmid);
                }
                break;
            case DiskInitFile.IFREC_MY_MEMBER_INITIALIZING_ID:
                {
                    long drId = readDiskRegionID(dis);
                    PersistentMemberID pmid = readPMID(dis, gfversion);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_MY_MEMBER_INITIALIZING_ID drId={} pmid={}", drId, pmid);
                    }
                    interpreter.cmnAddMyInitializingPMID(drId, pmid);
                }
                break;
            case DiskInitFile.IFREC_MY_MEMBER_INITIALIZED_ID:
                {
                    long drId = readDiskRegionID(dis);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_MY_MEMBER_INITIALIZED_ID drId={}", drId);
                    }
                    interpreter.cmnMarkInitialized(drId);
                }
                break;
            case DiskInitFile.IFREC_CREATE_REGION_ID:
                {
                    long drId = readDiskRegionID(dis);
                    String regName = dis.readUTF();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CREATE_REGION_ID drId= name={}", drId, regName);
                    }
                    interpreter.cmnCreateRegion(drId, regName);
                }
                break;
            case DiskInitFile.IFREC_BEGIN_DESTROY_REGION_ID:
                {
                    long drId = readDiskRegionID(dis);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_BEGIN_DESTROY_REGION_ID drId={}", drId);
                    }
                    interpreter.cmnBeginDestroyRegion(drId);
                }
                break;
            case DiskInitFile.IFREC_END_DESTROY_REGION_ID:
                {
                    long drId = readDiskRegionID(dis);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_END_DESTROY_REGION_ID drId={}", drId);
                    }
                    interpreter.cmnEndDestroyRegion(drId);
                }
                break;
            case DiskInitFile.IFREC_BEGIN_PARTIAL_DESTROY_REGION_ID:
                {
                    long drId = readDiskRegionID(dis);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_BEGIN_PARTIAL_DESTROY_REGION_ID drId={}", drId);
                    }
                    interpreter.cmnBeginPartialDestroyRegion(drId);
                }
                break;
            case DiskInitFile.IFREC_END_PARTIAL_DESTROY_REGION_ID:
                {
                    long drId = readDiskRegionID(dis);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_END_PARTIAL_DESTROY_REGION_ID drId={}", drId);
                    }
                    interpreter.cmnEndPartialDestroyRegion(drId);
                }
                break;
            case DiskInitFile.IFREC_CLEAR_REGION_ID:
                {
                    long drId = readDiskRegionID(dis);
                    long clearOplogEntryId = dis.readLong();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CLEAR_REGION_ID drId={} oplogEntryId={}", drId, clearOplogEntryId);
                    }
                    interpreter.cmnClearRegion(drId, clearOplogEntryId);
                }
                break;
            case DiskInitFile.IFREC_CLEAR_REGION_WITH_RVV_ID:
                {
                    long drId = readDiskRegionID(dis);
                    int size = dis.readInt();
                    ConcurrentHashMap<DiskStoreID, RegionVersionHolder<DiskStoreID>> memberToVersion = new ConcurrentHashMap<DiskStoreID, RegionVersionHolder<DiskStoreID>>(size);
                    for (int i = 0; i < size; i++) {
                        DiskStoreID id = new DiskStoreID();
                        InternalDataSerializer.invokeFromData(id, dis);
                        RegionVersionHolder holder = new RegionVersionHolder(dis);
                        memberToVersion.put(id, holder);
                    }
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CLEAR_REGION_WITH_RVV_ID drId={} memberToVersion={}", drId, memberToVersion);
                    }
                    interpreter.cmnClearRegion(drId, memberToVersion);
                }
                break;
            case DiskInitFile.IFREC_CRF_CREATE:
                {
                    long oplogId = dis.readLong();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CRF_CREATE oplogId={}", oplogId);
                    }
                    interpreter.cmnCrfCreate(oplogId);
                }
                break;
            case DiskInitFile.IFREC_DRF_CREATE:
                {
                    long oplogId = dis.readLong();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_DRF_CREATE oplogId={}", oplogId);
                    }
                    interpreter.cmnDrfCreate(oplogId);
                }
                break;
            case DiskInitFile.IFREC_KRF_CREATE:
                {
                    long oplogId = dis.readLong();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_KRF_CREATE oplogId={}", oplogId);
                    }
                    interpreter.cmnKrfCreate(oplogId);
                }
                break;
            case DiskInitFile.IFREC_CRF_DELETE:
                {
                    long oplogId = dis.readLong();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CRF_DELETE oplogId={}", oplogId);
                    }
                    interpreter.cmnCrfDelete(oplogId);
                }
                break;
            case DiskInitFile.IFREC_DRF_DELETE:
                {
                    long oplogId = dis.readLong();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_DRF_DELETE oplogId={}", oplogId);
                    }
                    interpreter.cmnDrfDelete(oplogId);
                }
                break;
            case DiskInitFile.IFREC_REGION_CONFIG_ID:
                {
                    long drId = readDiskRegionID(dis);
                    byte lruAlgorithm = dis.readByte();
                    byte lruAction = dis.readByte();
                    int lruLimit = dis.readInt();
                    int concurrencyLevel = dis.readInt();
                    int initialCapacity = dis.readInt();
                    float loadFactor = dis.readFloat();
                    boolean statisticsEnabled = dis.readBoolean();
                    boolean isBucket = dis.readBoolean();
                    EnumSet<DiskRegionFlag> flags = EnumSet.noneOf(DiskRegionFlag.class);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REGION_CONFIG_ID drId={}", drId);
                    }
                    interpreter.cmnRegionConfig(drId, lruAlgorithm, lruAction, lruLimit, concurrencyLevel, initialCapacity, loadFactor, statisticsEnabled, isBucket, flags, // fixes bug 43910
                    ProxyBucketRegion.NO_FIXED_PARTITION_NAME, -1, null, false);
                }
                break;
            case DiskInitFile.IFREC_REGION_CONFIG_ID_66:
                {
                    long drId = readDiskRegionID(dis);
                    byte lruAlgorithm = dis.readByte();
                    byte lruAction = dis.readByte();
                    int lruLimit = dis.readInt();
                    int concurrencyLevel = dis.readInt();
                    int initialCapacity = dis.readInt();
                    float loadFactor = dis.readFloat();
                    boolean statisticsEnabled = dis.readBoolean();
                    boolean isBucket = dis.readBoolean();
                    EnumSet<DiskRegionFlag> flags = EnumSet.noneOf(DiskRegionFlag.class);
                    String partitionName = dis.readUTF();
                    int startingBucketId = dis.readInt();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REGION_CONFIG_ID drId={}", drId);
                    }
                    interpreter.cmnRegionConfig(drId, lruAlgorithm, lruAction, lruLimit, concurrencyLevel, initialCapacity, loadFactor, statisticsEnabled, isBucket, flags, partitionName, startingBucketId, null, false);
                }
                break;
            case DiskInitFile.IFREC_REGION_CONFIG_ID_80:
                {
                    long drId = readDiskRegionID(dis);
                    byte lruAlgorithm = dis.readByte();
                    byte lruAction = dis.readByte();
                    int lruLimit = dis.readInt();
                    int concurrencyLevel = dis.readInt();
                    int initialCapacity = dis.readInt();
                    float loadFactor = dis.readFloat();
                    boolean statisticsEnabled = dis.readBoolean();
                    boolean isBucket = dis.readBoolean();
                    EnumSet<DiskRegionFlag> flags = EnumSet.noneOf(DiskRegionFlag.class);
                    String partitionName = dis.readUTF();
                    int startingBucketId = dis.readInt();
                    String compressorClassName = dis.readUTF();
                    if ("".equals(compressorClassName)) {
                        compressorClassName = null;
                    }
                    if (dis.readBoolean()) {
                        flags.add(DiskRegionFlag.IS_WITH_VERSIONING);
                    }
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REGION_CONFIG_ID drId={}", drId);
                    }
                    interpreter.cmnRegionConfig(drId, lruAlgorithm, lruAction, lruLimit, concurrencyLevel, initialCapacity, loadFactor, statisticsEnabled, isBucket, flags, partitionName, startingBucketId, compressorClassName, false);
                }
                break;
            case DiskInitFile.IFREC_REGION_CONFIG_ID_90:
                {
                    long drId = readDiskRegionID(dis);
                    byte lruAlgorithm = dis.readByte();
                    byte lruAction = dis.readByte();
                    int lruLimit = dis.readInt();
                    int concurrencyLevel = dis.readInt();
                    int initialCapacity = dis.readInt();
                    float loadFactor = dis.readFloat();
                    boolean statisticsEnabled = dis.readBoolean();
                    boolean isBucket = dis.readBoolean();
                    EnumSet<DiskRegionFlag> flags = EnumSet.noneOf(DiskRegionFlag.class);
                    String partitionName = dis.readUTF();
                    int startingBucketId = dis.readInt();
                    String compressorClassName = dis.readUTF();
                    if ("".equals(compressorClassName)) {
                        compressorClassName = null;
                    }
                    if (dis.readBoolean()) {
                        flags.add(DiskRegionFlag.IS_WITH_VERSIONING);
                    }
                    boolean offHeap = dis.readBoolean();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REGION_CONFIG_ID drId={}", drId);
                    }
                    interpreter.cmnRegionConfig(drId, lruAlgorithm, lruAction, lruLimit, concurrencyLevel, initialCapacity, loadFactor, statisticsEnabled, isBucket, flags, partitionName, startingBucketId, compressorClassName, offHeap);
                }
                break;
            case DiskInitFile.IFREC_OFFLINE_AND_EQUAL_MEMBER_ID:
                {
                    long drId = readDiskRegionID(dis);
                    PersistentMemberID pmid = readPMID(dis, gfversion);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_OFFLINE_AND_EQUAL_MEMBER_ID drId={} pmid={}", drId, pmid);
                    }
                    interpreter.cmdOfflineAndEqualMemberId(drId, pmid);
                }
                break;
            case DiskInitFile.IFREC_DISKSTORE_ID:
                {
                    long leastSigBits = dis.readLong();
                    long mostSigBits = dis.readLong();
                    readEndOfRecord(dis);
                    result = new DiskStoreID(mostSigBits, leastSigBits);
                    interpreter.cmnDiskStoreID(result);
                }
                break;
            case DiskInitFile.OPLOG_MAGIC_SEQ_ID:
                readOplogMagicSeqRecord(dis, OPLOG_TYPE.IF);
                break;
            case DiskInitFile.IFREC_PR_CREATE:
                {
                    String name = dis.readUTF();
                    int numBuckets = dis.readInt();
                    String colocatedWith = dis.readUTF();
                    readEndOfRecord(dis);
                    PRPersistentConfig config = new PRPersistentConfig(numBuckets, colocatedWith);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_PR_CREATE name={}, config={}", name, config);
                    }
                    interpreter.cmnPRCreate(name, config);
                }
                break;
            case DiskInitFile.IFREC_GEMFIRE_VERSION:
                {
                    short ver = Version.readOrdinal(dis);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_GEMFIRE_VERSION version={}", ver);
                    }
                    try {
                        gfversion = Version.fromOrdinal(ver, false);
                    } catch (UnsupportedVersionException e) {
                        throw new DiskAccessException(LocalizedStrings.Oplog_UNEXPECTED_PRODUCT_VERSION_0.toLocalizedString(ver), e, this.interpreter.getNameForError());
                    }
                    interpreter.cmnGemfireVersion(gfversion);
                    break;
                }
            case DiskInitFile.IFREC_PR_DESTROY:
                {
                    String name = dis.readUTF();
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_PR_DESTROY name={}", name);
                    }
                    interpreter.cmnPRDestroy(name);
                }
                break;
            case DiskInitFile.IFREC_ADD_CANONICAL_MEMBER_ID:
                {
                    int id = dis.readInt();
                    Object object = DataSerializer.readObject(dis);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_ADD_CANONICAL_MEMBER_ID id={} name={}", id, object);
                    }
                    interpreter.cmnAddCanonicalMemberId(id, object);
                    break;
                }
            case DiskInitFile.IFREC_REVOKE_DISK_STORE_ID:
                {
                    PersistentMemberPattern pattern = new PersistentMemberPattern();
                    InternalDataSerializer.invokeFromData(pattern, dis);
                    readEndOfRecord(dis);
                    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
                        logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REVOKE_DISK_STORE_ID id={}" + pattern);
                    }
                    interpreter.cmnRevokeDiskStoreId(pattern);
                }
                break;
            default:
                throw new DiskAccessException(LocalizedStrings.DiskInitFile_UNKNOWN_OPCODE_0_FOUND.toLocalizedString(opCode), this.interpreter.getNameForError());
        }
        if (interpreter.isClosing()) {
            break;
        }
    }
    return result;
}
Also used : EnumSet(java.util.EnumSet) RegionVersionHolder(org.apache.geode.internal.cache.versions.RegionVersionHolder) DiskRegionFlag(org.apache.geode.internal.cache.DiskInitFile.DiskRegionFlag) Version(org.apache.geode.internal.Version) DiskAccessException(org.apache.geode.cache.DiskAccessException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) UnsupportedVersionException(org.apache.geode.cache.UnsupportedVersionException)

Example 38 with Version

use of org.apache.geode.internal.Version in project geode by apache.

the class ByteSourceJUnitTest method testSendToDataOutput.

@Test
public void testSendToDataOutput() throws IOException {
    HeapDataOutputStream hdos = new HeapDataOutputStream((Version) null);
    ByteSource bs = createByteSource(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 });
    bs.sendTo(hdos);
    assertEquals(0, bs.remaining());
    ByteBuffer bb = hdos.toByteBuffer();
    assertEquals(10, bb.limit());
    assertEquals(ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }), bb);
    bs.position(1);
    bs.limit(9);
    hdos = new HeapDataOutputStream((Version) null);
    bs.sendTo(hdos);
    assertEquals(0, bs.remaining());
    bb = hdos.toByteBuffer();
    assertEquals(8, bb.limit());
    assertEquals(ByteBuffer.wrap(new byte[] { 2, 3, 4, 5, 6, 7, 8, 9 }), bb);
}
Also used : Version(org.apache.geode.internal.Version) HeapDataOutputStream(org.apache.geode.internal.HeapDataOutputStream) ByteSource(org.apache.geode.internal.tcp.ByteBufferInputStream.ByteSource) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test) SerializationTest(org.apache.geode.test.junit.categories.SerializationTest) UnitTest(org.apache.geode.test.junit.categories.UnitTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 39 with Version

use of org.apache.geode.internal.Version 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);
    }
}
Also used : Version(org.apache.geode.internal.Version) ByteArrayInputStream(java.io.ByteArrayInputStream) HeapDataOutputStream(org.apache.geode.internal.HeapDataOutputStream) VersionedDataOutputStream(org.apache.geode.internal.VersionedDataOutputStream) OldClientSupportService(org.apache.geode.internal.cache.tier.sockets.OldClientSupportService) DataInputStream(java.io.DataInputStream) VersionedDataInputStream(org.apache.geode.internal.VersionedDataInputStream) VersionedDataInputStream(org.apache.geode.internal.VersionedDataInputStream) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 40 with Version

use of org.apache.geode.internal.Version 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));
    }
}
Also used : Version(org.apache.geode.internal.Version) OldClientSupportService(org.apache.geode.internal.cache.tier.sockets.OldClientSupportService)

Aggregations

Version (org.apache.geode.internal.Version)40 IOException (java.io.IOException)16 HeapDataOutputStream (org.apache.geode.internal.HeapDataOutputStream)10 ByteArrayDataInput (org.apache.geode.internal.ByteArrayDataInput)8 UnsupportedVersionException (org.apache.geode.cache.UnsupportedVersionException)6 EntryVersionsList (org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList)6 DiskAccessException (org.apache.geode.cache.DiskAccessException)5 DataInputStream (java.io.DataInputStream)4 EOFException (java.io.EOFException)4 InterruptedIOException (java.io.InterruptedIOException)4 DataOutputStream (java.io.DataOutputStream)3 FileInputStream (java.io.FileInputStream)3 CancelException (org.apache.geode.CancelException)3 VersionedDataInputStream (org.apache.geode.internal.VersionedDataInputStream)3 VersionedDataOutputStream (org.apache.geode.internal.VersionedDataOutputStream)3 PutAllEntryData (org.apache.geode.internal.cache.DistributedPutAllOperation.PutAllEntryData)3 BufferedInputStream (java.io.BufferedInputStream)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 File (java.io.File)2 SocketAddress (java.net.SocketAddress)2