Skip to content

Commit

Permalink
GEODE-8337: git mv Version.java->KnownVersion.java
Browse files Browse the repository at this point in the history
(cherry picked from commit 17d6679)
  • Loading branch information
Bill committed Aug 12, 2020
1 parent cf27a6a commit 068a467
Show file tree
Hide file tree
Showing 390 changed files with 1,615 additions and 1,561 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.apache.geode.DataSerializer;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.serialization.DeserializationContext;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.serialization.SerializationContext;
import org.apache.geode.internal.serialization.Version;

/**
* This message simply contains a date
Expand All @@ -38,7 +38,7 @@ public class DateMessage extends SerialDistributionMessage {
/** The date being distributed */
private Date date;
/** The versions in which this message was modified */
private static final Version[] dsfidVersions = new Version[] {};
private static final KnownVersion[] dsfidVersions = new KnownVersion[] {};

///////////////////// Instance Methods /////////////////////

Expand Down Expand Up @@ -99,7 +99,7 @@ public String toString() {
}

@Override
public Version[] getSerializationVersions() {
public KnownVersion[] getSerializationVersions() {
return dsfidVersions;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
import org.apache.geode.internal.cache.DistributedPutAllOperation.EntryVersionsList;
import org.apache.geode.internal.serialization.DataSerializableFixedID;
import org.apache.geode.internal.serialization.DeserializationContext;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.serialization.SerializationContext;
import org.apache.geode.internal.serialization.SerializationVersions;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.VersionedDataInputStream;
import org.apache.geode.internal.serialization.VersionedDataOutputStream;
import org.apache.geode.internal.serialization.internal.DSFIDSerializerImpl;
Expand Down Expand Up @@ -98,7 +98,7 @@ public final void preTearDownCacheTestCase() {
@Test
public void testToDataFromHigherVersionToLower() throws Exception {
DataOutputStream dos =
new VersionedDataOutputStream(new DataOutputStream(baos), Version.GFE_56);
new VersionedDataOutputStream(new DataOutputStream(baos), KnownVersion.GFE_56);
InternalDataSerializer.writeDSFID(msg, dos);
assertTrue(toDataPre66Called);
assertFalse(toDataCalled);
Expand All @@ -112,7 +112,7 @@ public void testToDataFromHigherVersionToLower() throws Exception {
@Test
public void testToDataFromLowerVersionToHigher() throws Exception {
DataOutputStream dos =
new VersionedDataOutputStream(new DataOutputStream(baos), Version.GFE_701);
new VersionedDataOutputStream(new DataOutputStream(baos), KnownVersion.GFE_701);
InternalDataSerializer.writeDSFID(msg, dos);
assertTrue(toDataCalled);
}
Expand All @@ -128,7 +128,7 @@ public void testFromDataFromHigherVersionToLower() throws Exception {
this.bais = new ByteArrayInputStream(baos.toByteArray());

DataInputStream dis =
new VersionedDataInputStream(new DataInputStream(bais), Version.GFE_701);
new VersionedDataInputStream(new DataInputStream(bais), KnownVersion.GFE_701);
Object o = InternalDataSerializer.basicReadObject(dis);
assertTrue(o instanceof TestMessage);
assertTrue(fromDataCalled);
Expand All @@ -145,7 +145,7 @@ public void testFromDataFromLowerVersionToHigher() throws Exception {
this.bais = new ByteArrayInputStream(baos.toByteArray());

DataInputStream dis =
new VersionedDataInputStream(new DataInputStream(bais), Version.GFE_56);
new VersionedDataInputStream(new DataInputStream(bais), KnownVersion.GFE_56);
Object o = InternalDataSerializer.basicReadObject(dis);
assertTrue(o instanceof TestMessage);
assertTrue(fromDataPre66Called);
Expand Down Expand Up @@ -199,7 +199,7 @@ public void testAllMessages() throws Exception {
}

private void checkSupportForRollingUpgrade(Object ds) {
Version[] versions = null;
KnownVersion[] versions = null;
if (ds instanceof SerializationVersions) {
versions = ((SerializationVersions) ds).getSerializationVersions();
}
Expand Down Expand Up @@ -257,12 +257,13 @@ private void resetFlags() {

public static class TestMessage implements DataSerializableFixedID {
/** The versions in which this message was modified */
private static final Version[] dsfidVersions = new Version[] {Version.GFE_66, Version.GFE_70};
private static final KnownVersion[] dsfidVersions =
new KnownVersion[] {KnownVersion.GFE_66, KnownVersion.GFE_70};

public TestMessage() {}

@Override
public Version[] getSerializationVersions() {
public KnownVersion[] getSerializationVersions() {
return dsfidVersions;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.MessageDispatcher;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.statistics.StatisticsClock;
import org.apache.geode.internal.tcp.ConnectionTable;
import org.apache.geode.test.dunit.VM;
Expand Down Expand Up @@ -1593,7 +1593,7 @@ public static class CustomCacheClientProxyFactory implements InternalCacheClient
@Override
public CacheClientProxy create(CacheClientNotifier notifier, Socket socket,
ClientProxyMembershipID proxyId, boolean isPrimary, byte clientConflation,
Version clientVersion, long acceptorId, boolean notifyBySubscription,
KnownVersion clientVersion, long acceptorId, boolean notifyBySubscription,
SecurityService securityService, Subject subject, StatisticsClock statisticsClock)
throws CacheException {
return new CustomCacheClientProxy(notifier, socket, proxyId, isPrimary, clientConflation,
Expand All @@ -1606,7 +1606,7 @@ private static class CustomCacheClientProxy extends CacheClientProxy {

private CustomCacheClientProxy(CacheClientNotifier notifier, Socket socket,
ClientProxyMembershipID proxyId, boolean isPrimary, byte clientConflation,
Version clientVersion, long acceptorId, boolean notifyBySubscription,
KnownVersion clientVersion, long acceptorId, boolean notifyBySubscription,
SecurityService securityService, Subject subject, StatisticsClock statisticsClock)
throws CacheException {
super(notifier.getCache(), notifier, socket, proxyId, isPrimary, clientConflation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
import org.apache.geode.internal.cache.persistence.DiskStoreID;
import org.apache.geode.internal.cache.versions.RegionVersionVector;
import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.test.awaitility.GeodeAwaitility;
import org.apache.geode.test.dunit.Assert;
import org.apache.geode.test.dunit.AsyncInvocation;
Expand Down Expand Up @@ -2527,7 +2527,7 @@ public Object call() throws Exception {
LocalRegion region = (LocalRegion) cache.getRegion(regionName);
RegionVersionVector rvv = region.getVersionVector();
rvv = rvv.getCloneForTransmission();
HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
HeapDataOutputStream hdos = new HeapDataOutputStream(KnownVersion.CURRENT);

// Using gemfire serialization because
// RegionVersionVector is not java serializable
Expand All @@ -2554,7 +2554,7 @@ public Object call() throws Exception {
LocalRegion region = (LocalRegion) cache.getRegion(REGION_NAME);
RegionVersionVector rvv = region.getDiskRegion().getRegionVersionVector();
rvv = rvv.getCloneForTransmission();
HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
HeapDataOutputStream hdos = new HeapDataOutputStream(KnownVersion.CURRENT);

// Using gemfire serialization because
// RegionVersionVector is not java serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.apache.geode.cache.asyncqueue.AsyncEventListener;
import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
import org.apache.geode.internal.HeapDataOutputStream;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.test.dunit.Host;
import org.apache.geode.test.dunit.SerializableCallable;
import org.apache.geode.test.dunit.VM;
Expand Down Expand Up @@ -150,7 +150,7 @@ public Object call() throws Exception {
// Make sure the cache exists
getCache();
DataSerializer.writeObject(new SimpleClass(value, (byte) value),
new HeapDataOutputStream(Version.CURRENT));
new HeapDataOutputStream(KnownVersion.CURRENT));
return null;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.apache.geode.internal.AvailablePortHelper;
import org.apache.geode.internal.HeapDataOutputStream;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.pdx.SimpleClass.SimpleEnum;
import org.apache.geode.pdx.internal.EnumId;
import org.apache.geode.pdx.internal.EnumInfo;
Expand Down Expand Up @@ -396,13 +396,13 @@ public void testLazyLoner() throws Exception {

private void defineAType() throws IOException {
SimpleClass sc = new SimpleClass(1, (byte) 2);
HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT);
HeapDataOutputStream out = new HeapDataOutputStream(KnownVersion.CURRENT);
DataSerializer.writeObject(sc, out);
}

private void defineATypeNoEnum() throws /* IO */ Exception {
SimpleClass sc = new SimpleClass(1, (byte) 2, null);
HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT);
HeapDataOutputStream out = new HeapDataOutputStream(KnownVersion.CURRENT);
DataSerializer.writeObject(sc, out);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import org.apache.geode.internal.AvailablePortHelper;
import org.apache.geode.internal.HeapDataOutputStream;
import org.apache.geode.internal.PdxSerializerObject;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.pdx.internal.AutoSerializableManager;
import org.apache.geode.test.dunit.Host;
import org.apache.geode.test.dunit.Invoke;
Expand Down Expand Up @@ -390,7 +390,7 @@ public Object call() throws Exception {
// Serialize an object and put it in both regions, sending
// the event to each pool
vm2.invoke(() -> {
HeapDataOutputStream bytes = new HeapDataOutputStream(Version.CURRENT);
HeapDataOutputStream bytes = new HeapDataOutputStream(KnownVersion.CURRENT);
Region r1 = getRootRegion("region1");
r1.put(1, new SimpleClass(57, (byte) 3));
Region r2 = getRootRegion("region2");
Expand Down Expand Up @@ -422,7 +422,7 @@ public void testUserSerializesObject() {
createClientRegion(vm2, port);

vm1.invoke(() -> {
HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT);
HeapDataOutputStream out = new HeapDataOutputStream(KnownVersion.CURRENT);
DataSerializer.writeObject(new SimpleClass(57, (byte) 3), out);
byte[] bytes = out.toByteArray();
Region r = getRootRegion("testSimplePdx");
Expand Down Expand Up @@ -515,7 +515,7 @@ public Object call() throws Exception {
props.setProperty(LOCATORS, "");
getSystem(props);
Cache cache = getCache();
HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT);
HeapDataOutputStream out = new HeapDataOutputStream(KnownVersion.CURRENT);
DataSerializer.writeObject(new SimpleClass(57, (byte) 3), out);

PoolFactory pf = PoolManager.createFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.xmlcache.CacheXmlGenerator;
import org.apache.geode.internal.cache.xmlcache.ClientCacheCreation;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.serialization.VersionedDataInputStream;
import org.apache.geode.pdx.ReflectionBasedAutoSerializer;
import org.apache.geode.test.junit.categories.ClientServerTest;
Expand Down Expand Up @@ -354,37 +354,37 @@ public void testOldClientIDDeserialization() throws Exception {
InternalDistributedMember memberID =
(InternalDistributedMember) clientCache.getDistributedSystem().getDistributedMember();
MemberIdentifier gmsID = memberID;
memberID.setVersionObjectForTest(Version.GFE_82);
assertThat(memberID.getVersionOrdinalObject()).isEqualTo(Version.GFE_82);
memberID.setVersionObjectForTest(KnownVersion.GFE_82);
assertThat(memberID.getVersionOrdinalObject()).isEqualTo(KnownVersion.GFE_82);

ClientProxyMembershipID clientID = ClientProxyMembershipID.getClientId(memberID);
HeapDataOutputStream out = new HeapDataOutputStream(Version.GFE_82);
HeapDataOutputStream out = new HeapDataOutputStream(KnownVersion.GFE_82);
DataSerializer.writeObject(clientID, out);

DataInputStream in =
new VersionedDataInputStream(new ByteArrayInputStream(out.toByteArray()),
Version.CURRENT);
KnownVersion.CURRENT);
ClientProxyMembershipID newID = DataSerializer.readObject(in);
InternalDistributedMember newMemberID =
(InternalDistributedMember) newID.getDistributedMember();
assertThat(newMemberID.getVersionOrdinalObject()).isEqualTo(Version.GFE_82);
assertThat(newID.getClientVersion()).isEqualTo(Version.GFE_82);
assertThat(newMemberID.getVersionOrdinalObject()).isEqualTo(KnownVersion.GFE_82);
assertThat(newID.getClientVersion()).isEqualTo(KnownVersion.GFE_82);

assertThat(newMemberID.getUuidLeastSignificantBits()).isEqualTo(0);
assertThat(newMemberID.getUuidMostSignificantBits()).isEqualTo(0);

gmsID.setUUID(new UUID(1234L, 5678L));
memberID.setVersionObjectForTest(Version.CURRENT);
memberID.setVersionObjectForTest(KnownVersion.CURRENT);
clientID = ClientProxyMembershipID.getClientId(memberID);
out = new HeapDataOutputStream(Version.CURRENT);
out = new HeapDataOutputStream(KnownVersion.CURRENT);
DataSerializer.writeObject(clientID, out);

in = new VersionedDataInputStream(new ByteArrayInputStream(out.toByteArray()),
Version.CURRENT);
KnownVersion.CURRENT);
newID = DataSerializer.readObject(in);
newMemberID = (InternalDistributedMember) newID.getDistributedMember();
assertThat(newMemberID.getVersionOrdinalObject()).isEqualTo(Version.CURRENT);
assertThat(newID.getClientVersion()).isEqualTo(Version.CURRENT);
assertThat(newMemberID.getVersionOrdinalObject()).isEqualTo(KnownVersion.CURRENT);
assertThat(newID.getClientVersion()).isEqualTo(KnownVersion.CURRENT);

assertThat(newMemberID.getUuidLeastSignificantBits())
.isEqualTo(gmsID.getUuidLeastSignificantBits());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.apache.geode.internal.HeapDataOutputStream;
import org.apache.geode.internal.InternalDataSerializer;
import org.apache.geode.internal.cache.versions.RegionVersionHolder;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;

/**
* Tests offline compaction
Expand Down Expand Up @@ -831,7 +831,7 @@ static int getRVVSize(int drMapSize, int[] numOfMemberPerDR, boolean gcRVV) {
// 0: OPLOG_RVV. 1: drMap.size()==1, 2: disRegionId, 3: getRVVTrusted
// 4: memberToVersion.size()==1, 5: memberid, 6-7: versionHolder 8: END_OF_RECORD_ID
// but not every diskRegion has a member in RVV
HeapDataOutputStream out = new HeapDataOutputStream(Version.CURRENT);
HeapDataOutputStream out = new HeapDataOutputStream(KnownVersion.CURRENT);
RegionVersionHolder dummyHolder = new RegionVersionHolder(1);
try {
dummyHolder.toData(out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.tier.InterestType;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.util.BlobHelper;
import org.apache.geode.test.concurrency.ConcurrentTestRunner;
import org.apache.geode.test.concurrency.ParallelExecutor;
Expand Down Expand Up @@ -57,7 +57,7 @@ public void serializationOfFilterProfileWithConcurrentUpdateShouldSucceed(
}

private Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
return BlobHelper.deserializeBlob(bytes, Version.CURRENT, null);
return BlobHelper.deserializeBlob(bytes, KnownVersion.CURRENT, null);
}

private FilterProfile createFilterProfile() throws UnknownHostException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
import org.apache.geode.internal.cache.versions.VersionStamp;
import org.apache.geode.internal.cache.versions.VersionTag;
import org.apache.geode.internal.serialization.ByteArrayDataInput;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;

/**
* This is a test verifies region is LIFO enabled by MEMORY verifies correct stats updating and
Expand Down Expand Up @@ -649,7 +649,7 @@ public boolean isTombstone() {
@Override
public boolean fillInValue(final InternalRegion region, final Entry entry,
final ByteArrayDataInput in, final DistributionManager distributionManager,
final Version version) {
final KnownVersion version) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
import org.apache.geode.internal.cache.tier.sockets.ClientUpdateMessageImpl;
import org.apache.geode.internal.cache.tier.sockets.ConnectionListener;
import org.apache.geode.internal.cache.tier.sockets.HAEventWrapper;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.statistics.StatisticsClock;
import org.apache.geode.internal.util.BlobHelper;
import org.apache.geode.internal.util.concurrent.StoppableReentrantReadWriteLock;
Expand Down Expand Up @@ -509,7 +509,7 @@ private CacheClientNotifier createCacheClientNotifier() {
private InternalDistributedMember createMember() {
// Create an InternalDistributedMember
InternalDistributedMember member = mock(InternalDistributedMember.class);
when(member.getVersionOrdinalObject()).thenReturn(Version.CURRENT);
when(member.getVersionOrdinalObject()).thenReturn(KnownVersion.CURRENT);
return member;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.net.SocketCloser;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.statistics.StatisticsClock;
import org.apache.geode.test.junit.rules.ExecutorServiceRule;
import org.apache.geode.test.junit.rules.ServerStarterRule;
Expand Down Expand Up @@ -72,7 +72,7 @@ public void closeSocketShouldBeAtomic() {
when(proxyID.getDistributedMember()).thenReturn(member);

CacheClientProxy proxy = new CacheClientProxy(ccn, socket, proxyID, true,
Handshake.CONFLATION_DEFAULT, Version.CURRENT, 1L, true,
Handshake.CONFLATION_DEFAULT, KnownVersion.CURRENT, 1L, true,
null, null, mock(StatisticsClock.class));

CompletableFuture<Void> result1 = executorServiceRule.runAsync(() -> proxy.close());
Expand Down
Loading

0 comments on commit 068a467

Please sign in to comment.