package org.opendaylight.controller.protobuff.messages.cohort3pc;
+@Deprecated
public final class ThreePhaseCommitCohortMessages {
private ThreePhaseCommitCohortMessages() {}
public static void registerAllExtensions(
return defaultInstance;
}
+ @Override
public CanCommitTransaction getDefaultInstanceForType() {
return defaultInstance;
}
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
}
+ @Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable
public static com.google.protobuf.Parser<CanCommitTransaction> PARSER =
new com.google.protobuf.AbstractParser<CanCommitTransaction>() {
- public CanCommitTransaction parsePartialFrom(
+ @Override
+ public CanCommitTransaction parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
/**
* <code>optional string transactionId = 1;</code>
*/
+ @Override
public boolean hasTransactionId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional string transactionId = 1;</code>
*/
+ @Override
public java.lang.String getTransactionId() {
java.lang.Object ref = transactionId_;
if (ref instanceof java.lang.String) {
/**
* <code>optional string transactionId = 1;</code>
*/
+ @Override
public com.google.protobuf.ByteString
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
transactionId_ = "";
}
private byte memoizedIsInitialized = -1;
+ @Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
+ if (isInitialized != -1) {
+ return isInitialized == 1;
+ }
memoizedIsInitialized = 1;
return true;
}
+ @Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
}
private int memoizedSerializedSize = -1;
+ @Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
- if (size != -1) return size;
+ if (size != -1) {
+ return size;
+ }
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
}
public static Builder newBuilder() { return Builder.create(); }
+ @Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction prototype) {
return newBuilder().mergeFrom(prototype);
}
+ @Override
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @Override
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_fieldAccessorTable
.ensureFieldAccessorsInitialized(
return new Builder();
}
- public Builder clear() {
+ @Override
+ public Builder clear() {
super.clear();
transactionId_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
- public Builder clone() {
+ @Override
+ public Builder clone() {
return create().mergeFrom(buildPartial());
}
- public com.google.protobuf.Descriptors.Descriptor
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransaction_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction getDefaultInstanceForType() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction getDefaultInstanceForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction build() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction build() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
return result;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction buildPartial() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction buildPartial() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
return result;
}
- public Builder mergeFrom(com.google.protobuf.Message other) {
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction) {
return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction)other);
} else {
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction other) {
- if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.getDefaultInstance()) return this;
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransaction.getDefaultInstance()) {
+ return this;
+ }
if (other.hasTransactionId()) {
bitField0_ |= 0x00000001;
transactionId_ = other.transactionId_;
return this;
}
- public final boolean isInitialized() {
+ @Override
+ public final boolean isInitialized() {
return true;
}
- public Builder mergeFrom(
+ @Override
+ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
/**
* <code>optional string transactionId = 1;</code>
*/
- public boolean hasTransactionId() {
+ @Override
+ public boolean hasTransactionId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional string transactionId = 1;</code>
*/
- public java.lang.String getTransactionId() {
+ @Override
+ public java.lang.String getTransactionId() {
java.lang.Object ref = transactionId_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
/**
* <code>optional string transactionId = 1;</code>
*/
- public com.google.protobuf.ByteString
+ @Override
+ public com.google.protobuf.ByteString
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
if (ref instanceof String) {
return defaultInstance;
}
+ @Override
public CanCommitTransactionReply getDefaultInstanceForType() {
return defaultInstance;
}
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
}
+ @Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable
public static com.google.protobuf.Parser<CanCommitTransactionReply> PARSER =
new com.google.protobuf.AbstractParser<CanCommitTransactionReply>() {
- public CanCommitTransactionReply parsePartialFrom(
+ @Override
+ public CanCommitTransactionReply parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
/**
* <code>required bool canCommit = 1;</code>
*/
+ @Override
public boolean hasCanCommit() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bool canCommit = 1;</code>
*/
+ @Override
public boolean getCanCommit() {
return canCommit_;
}
canCommit_ = false;
}
private byte memoizedIsInitialized = -1;
+ @Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
+ if (isInitialized != -1) {
+ return isInitialized == 1;
+ }
if (!hasCanCommit()) {
memoizedIsInitialized = 0;
return true;
}
+ @Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
}
private int memoizedSerializedSize = -1;
+ @Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
- if (size != -1) return size;
+ if (size != -1) {
+ return size;
+ }
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
}
public static Builder newBuilder() { return Builder.create(); }
+ @Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply prototype) {
return newBuilder().mergeFrom(prototype);
}
+ @Override
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @Override
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
return new Builder();
}
- public Builder clear() {
+ @Override
+ public Builder clear() {
super.clear();
canCommit_ = false;
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
- public Builder clone() {
+ @Override
+ public Builder clone() {
return create().mergeFrom(buildPartial());
}
- public com.google.protobuf.Descriptors.Descriptor
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CanCommitTransactionReply_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply getDefaultInstanceForType() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply getDefaultInstanceForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply build() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply build() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
return result;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply buildPartial() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply buildPartial() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
return result;
}
- public Builder mergeFrom(com.google.protobuf.Message other) {
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply) {
return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply)other);
} else {
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply other) {
- if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.getDefaultInstance()) return this;
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CanCommitTransactionReply.getDefaultInstance()) {
+ return this;
+ }
if (other.hasCanCommit()) {
setCanCommit(other.getCanCommit());
}
return this;
}
- public final boolean isInitialized() {
+ @Override
+ public final boolean isInitialized() {
if (!hasCanCommit()) {
return false;
return true;
}
- public Builder mergeFrom(
+ @Override
+ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
/**
* <code>required bool canCommit = 1;</code>
*/
- public boolean hasCanCommit() {
+ @Override
+ public boolean hasCanCommit() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>required bool canCommit = 1;</code>
*/
- public boolean getCanCommit() {
+ @Override
+ public boolean getCanCommit() {
return canCommit_;
}
/**
return defaultInstance;
}
+ @Override
public AbortTransaction getDefaultInstanceForType() {
return defaultInstance;
}
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
}
+ @Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable
public static com.google.protobuf.Parser<AbortTransaction> PARSER =
new com.google.protobuf.AbstractParser<AbortTransaction>() {
- public AbortTransaction parsePartialFrom(
+ @Override
+ public AbortTransaction parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
/**
* <code>optional string transactionId = 1;</code>
*/
+ @Override
public boolean hasTransactionId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional string transactionId = 1;</code>
*/
+ @Override
public java.lang.String getTransactionId() {
java.lang.Object ref = transactionId_;
if (ref instanceof java.lang.String) {
/**
* <code>optional string transactionId = 1;</code>
*/
+ @Override
public com.google.protobuf.ByteString
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
transactionId_ = "";
}
private byte memoizedIsInitialized = -1;
+ @Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
+ if (isInitialized != -1) {
+ return isInitialized == 1;
+ }
memoizedIsInitialized = 1;
return true;
}
+ @Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
}
private int memoizedSerializedSize = -1;
+ @Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
- if (size != -1) return size;
+ if (size != -1) {
+ return size;
+ }
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
}
public static Builder newBuilder() { return Builder.create(); }
+ @Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction prototype) {
return newBuilder().mergeFrom(prototype);
}
+ @Override
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @Override
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_fieldAccessorTable
.ensureFieldAccessorsInitialized(
return new Builder();
}
- public Builder clear() {
+ @Override
+ public Builder clear() {
super.clear();
transactionId_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
- public Builder clone() {
+ @Override
+ public Builder clone() {
return create().mergeFrom(buildPartial());
}
- public com.google.protobuf.Descriptors.Descriptor
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransaction_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction getDefaultInstanceForType() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction getDefaultInstanceForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction build() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction build() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
return result;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction buildPartial() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction buildPartial() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
return result;
}
- public Builder mergeFrom(com.google.protobuf.Message other) {
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction) {
return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction)other);
} else {
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction other) {
- if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.getDefaultInstance()) return this;
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransaction.getDefaultInstance()) {
+ return this;
+ }
if (other.hasTransactionId()) {
bitField0_ |= 0x00000001;
transactionId_ = other.transactionId_;
return this;
}
- public final boolean isInitialized() {
+ @Override
+ public final boolean isInitialized() {
return true;
}
- public Builder mergeFrom(
+ @Override
+ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
/**
* <code>optional string transactionId = 1;</code>
*/
- public boolean hasTransactionId() {
+ @Override
+ public boolean hasTransactionId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional string transactionId = 1;</code>
*/
- public java.lang.String getTransactionId() {
+ @Override
+ public java.lang.String getTransactionId() {
java.lang.Object ref = transactionId_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
/**
* <code>optional string transactionId = 1;</code>
*/
- public com.google.protobuf.ByteString
+ @Override
+ public com.google.protobuf.ByteString
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
if (ref instanceof String) {
return defaultInstance;
}
+ @Override
public AbortTransactionReply getDefaultInstanceForType() {
return defaultInstance;
}
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
}
+ @Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable
public static com.google.protobuf.Parser<AbortTransactionReply> PARSER =
new com.google.protobuf.AbstractParser<AbortTransactionReply>() {
- public AbortTransactionReply parsePartialFrom(
+ @Override
+ public AbortTransactionReply parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
private void initFields() {
}
private byte memoizedIsInitialized = -1;
+ @Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
+ if (isInitialized != -1) {
+ return isInitialized == 1;
+ }
memoizedIsInitialized = 1;
return true;
}
+ @Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
}
private int memoizedSerializedSize = -1;
+ @Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
- if (size != -1) return size;
+ if (size != -1) {
+ return size;
+ }
size = 0;
size += getUnknownFields().getSerializedSize();
}
public static Builder newBuilder() { return Builder.create(); }
+ @Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply prototype) {
return newBuilder().mergeFrom(prototype);
}
+ @Override
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @Override
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
return new Builder();
}
- public Builder clear() {
+ @Override
+ public Builder clear() {
super.clear();
return this;
}
- public Builder clone() {
+ @Override
+ public Builder clone() {
return create().mergeFrom(buildPartial());
}
- public com.google.protobuf.Descriptors.Descriptor
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_AbortTransactionReply_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply getDefaultInstanceForType() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply getDefaultInstanceForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply build() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply build() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
return result;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply buildPartial() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply buildPartial() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply(this);
onBuilt();
return result;
}
- public Builder mergeFrom(com.google.protobuf.Message other) {
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply) {
return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply)other);
} else {
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply other) {
- if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.getDefaultInstance()) return this;
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.AbortTransactionReply.getDefaultInstance()) {
+ return this;
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
- public final boolean isInitialized() {
+ @Override
+ public final boolean isInitialized() {
return true;
}
- public Builder mergeFrom(
+ @Override
+ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return defaultInstance;
}
+ @Override
public CommitTransaction getDefaultInstanceForType() {
return defaultInstance;
}
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
}
+ @Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable
public static com.google.protobuf.Parser<CommitTransaction> PARSER =
new com.google.protobuf.AbstractParser<CommitTransaction>() {
- public CommitTransaction parsePartialFrom(
+ @Override
+ public CommitTransaction parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
/**
* <code>optional string transactionId = 1;</code>
*/
+ @Override
public boolean hasTransactionId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional string transactionId = 1;</code>
*/
+ @Override
public java.lang.String getTransactionId() {
java.lang.Object ref = transactionId_;
if (ref instanceof java.lang.String) {
/**
* <code>optional string transactionId = 1;</code>
*/
+ @Override
public com.google.protobuf.ByteString
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
transactionId_ = "";
}
private byte memoizedIsInitialized = -1;
+ @Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
+ if (isInitialized != -1) {
+ return isInitialized == 1;
+ }
memoizedIsInitialized = 1;
return true;
}
+ @Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
}
private int memoizedSerializedSize = -1;
+ @Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
- if (size != -1) return size;
+ if (size != -1) {
+ return size;
+ }
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
}
public static Builder newBuilder() { return Builder.create(); }
+ @Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction prototype) {
return newBuilder().mergeFrom(prototype);
}
+ @Override
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @Override
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_fieldAccessorTable
.ensureFieldAccessorsInitialized(
return new Builder();
}
- public Builder clear() {
+ @Override
+ public Builder clear() {
super.clear();
transactionId_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
- public Builder clone() {
+ @Override
+ public Builder clone() {
return create().mergeFrom(buildPartial());
}
- public com.google.protobuf.Descriptors.Descriptor
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransaction_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction getDefaultInstanceForType() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction getDefaultInstanceForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction build() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction build() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
return result;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction buildPartial() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction buildPartial() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
return result;
}
- public Builder mergeFrom(com.google.protobuf.Message other) {
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction) {
return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction)other);
} else {
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction other) {
- if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.getDefaultInstance()) return this;
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransaction.getDefaultInstance()) {
+ return this;
+ }
if (other.hasTransactionId()) {
bitField0_ |= 0x00000001;
transactionId_ = other.transactionId_;
return this;
}
- public final boolean isInitialized() {
+ @Override
+ public final boolean isInitialized() {
return true;
}
- public Builder mergeFrom(
+ @Override
+ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
/**
* <code>optional string transactionId = 1;</code>
*/
- public boolean hasTransactionId() {
+ @Override
+ public boolean hasTransactionId() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* <code>optional string transactionId = 1;</code>
*/
- public java.lang.String getTransactionId() {
+ @Override
+ public java.lang.String getTransactionId() {
java.lang.Object ref = transactionId_;
if (!(ref instanceof java.lang.String)) {
java.lang.String s = ((com.google.protobuf.ByteString) ref)
/**
* <code>optional string transactionId = 1;</code>
*/
- public com.google.protobuf.ByteString
+ @Override
+ public com.google.protobuf.ByteString
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
if (ref instanceof String) {
return defaultInstance;
}
+ @Override
public CommitTransactionReply getDefaultInstanceForType() {
return defaultInstance;
}
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
}
+ @Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable
public static com.google.protobuf.Parser<CommitTransactionReply> PARSER =
new com.google.protobuf.AbstractParser<CommitTransactionReply>() {
- public CommitTransactionReply parsePartialFrom(
+ @Override
+ public CommitTransactionReply parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
private void initFields() {
}
private byte memoizedIsInitialized = -1;
+ @Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
+ if (isInitialized != -1) {
+ return isInitialized == 1;
+ }
memoizedIsInitialized = 1;
return true;
}
+ @Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
}
private int memoizedSerializedSize = -1;
+ @Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
- if (size != -1) return size;
+ if (size != -1) {
+ return size;
+ }
size = 0;
size += getUnknownFields().getSerializedSize();
}
public static Builder newBuilder() { return Builder.create(); }
+ @Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply prototype) {
return newBuilder().mergeFrom(prototype);
}
+ @Override
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @Override
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
return new Builder();
}
- public Builder clear() {
+ @Override
+ public Builder clear() {
super.clear();
return this;
}
- public Builder clone() {
+ @Override
+ public Builder clone() {
return create().mergeFrom(buildPartial());
}
- public com.google.protobuf.Descriptors.Descriptor
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_CommitTransactionReply_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply getDefaultInstanceForType() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply getDefaultInstanceForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply build() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply build() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
return result;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply buildPartial() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply buildPartial() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply(this);
onBuilt();
return result;
}
- public Builder mergeFrom(com.google.protobuf.Message other) {
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply) {
return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply)other);
} else {
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply other) {
- if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.getDefaultInstance()) return this;
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.CommitTransactionReply.getDefaultInstance()) {
+ return this;
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
- public final boolean isInitialized() {
+ @Override
+ public final boolean isInitialized() {
return true;
}
- public Builder mergeFrom(
+ @Override
+ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return defaultInstance;
}
+ @Override
public PreCommitTransaction getDefaultInstanceForType() {
return defaultInstance;
}
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
}
+ @Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable
public static com.google.protobuf.Parser<PreCommitTransaction> PARSER =
new com.google.protobuf.AbstractParser<PreCommitTransaction>() {
- public PreCommitTransaction parsePartialFrom(
+ @Override
+ public PreCommitTransaction parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
private void initFields() {
}
private byte memoizedIsInitialized = -1;
+ @Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
+ if (isInitialized != -1) {
+ return isInitialized == 1;
+ }
memoizedIsInitialized = 1;
return true;
}
+ @Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
}
private int memoizedSerializedSize = -1;
+ @Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
- if (size != -1) return size;
+ if (size != -1) {
+ return size;
+ }
size = 0;
size += getUnknownFields().getSerializedSize();
}
public static Builder newBuilder() { return Builder.create(); }
+ @Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction prototype) {
return newBuilder().mergeFrom(prototype);
}
+ @Override
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @Override
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_fieldAccessorTable
.ensureFieldAccessorsInitialized(
return new Builder();
}
- public Builder clear() {
+ @Override
+ public Builder clear() {
super.clear();
return this;
}
- public Builder clone() {
+ @Override
+ public Builder clone() {
return create().mergeFrom(buildPartial());
}
- public com.google.protobuf.Descriptors.Descriptor
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransaction_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction getDefaultInstanceForType() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction getDefaultInstanceForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction build() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction build() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
return result;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction buildPartial() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction buildPartial() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction(this);
onBuilt();
return result;
}
- public Builder mergeFrom(com.google.protobuf.Message other) {
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction) {
return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction)other);
} else {
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction other) {
- if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.getDefaultInstance()) return this;
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransaction.getDefaultInstance()) {
+ return this;
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
- public final boolean isInitialized() {
+ @Override
+ public final boolean isInitialized() {
return true;
}
- public Builder mergeFrom(
+ @Override
+ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return defaultInstance;
}
+ @Override
public PreCommitTransactionReply getDefaultInstanceForType() {
return defaultInstance;
}
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
}
+ @Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable
public static com.google.protobuf.Parser<PreCommitTransactionReply> PARSER =
new com.google.protobuf.AbstractParser<PreCommitTransactionReply>() {
- public PreCommitTransactionReply parsePartialFrom(
+ @Override
+ public PreCommitTransactionReply parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
private void initFields() {
}
private byte memoizedIsInitialized = -1;
+ @Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
+ if (isInitialized != -1) {
+ return isInitialized == 1;
+ }
memoizedIsInitialized = 1;
return true;
}
+ @Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
}
private int memoizedSerializedSize = -1;
+ @Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
- if (size != -1) return size;
+ if (size != -1) {
+ return size;
+ }
size = 0;
size += getUnknownFields().getSerializedSize();
}
public static Builder newBuilder() { return Builder.create(); }
+ @Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply prototype) {
return newBuilder().mergeFrom(prototype);
}
+ @Override
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
}
- protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ @Override
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_fieldAccessorTable
.ensureFieldAccessorsInitialized(
return new Builder();
}
- public Builder clear() {
+ @Override
+ public Builder clear() {
super.clear();
return this;
}
- public Builder clone() {
+ @Override
+ public Builder clone() {
return create().mergeFrom(buildPartial());
}
- public com.google.protobuf.Descriptors.Descriptor
+ @Override
+ public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.internal_static_org_opendaylight_controller_mdsal_PreCommitTransactionReply_descriptor;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply getDefaultInstanceForType() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply getDefaultInstanceForType() {
return org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.getDefaultInstance();
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply build() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply build() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
return result;
}
- public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply buildPartial() {
+ @Override
+ public org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply buildPartial() {
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply result = new org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply(this);
onBuilt();
return result;
}
- public Builder mergeFrom(com.google.protobuf.Message other) {
+ @Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply) {
return mergeFrom((org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply)other);
} else {
}
public Builder mergeFrom(org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply other) {
- if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.getDefaultInstance()) return this;
+ if (other == org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages.PreCommitTransactionReply.getDefaultInstance()) {
+ return this;
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
- public final boolean isInitialized() {
+ @Override
+ public final boolean isInitialized() {
return true;
}
- public Builder mergeFrom(
+ @Override
+ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
+ @Override
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
if (failure != null) {
LOG.error("Failed to prepare transaction {} on backend", transaction.getIdentifier(), failure);
transactionAborted(transaction);
- } else if (CommitTransactionReply.SERIALIZABLE_CLASS.isInstance(message)) {
+ } else if (CommitTransactionReply.isSerializedType(message)) {
LOG.debug("Transaction {} committed successfully", transaction.getIdentifier());
transactionCommitted(transaction);
} else {
handleForwardedReadyTransaction((ForwardedReadyTransaction) message);
} else if (message instanceof ReadyLocalTransaction) {
handleReadyLocalTransaction((ReadyLocalTransaction)message);
- } else if (CanCommitTransaction.SERIALIZABLE_CLASS.isInstance(message)) {
+ } else if (CanCommitTransaction.isSerializedType(message)) {
handleCanCommitTransaction(CanCommitTransaction.fromSerializable(message));
- } else if (CommitTransaction.SERIALIZABLE_CLASS.isInstance(message)) {
+ } else if (CommitTransaction.isSerializedType(message)) {
handleCommitTransaction(CommitTransaction.fromSerializable(message));
- } else if (AbortTransaction.SERIALIZABLE_CLASS.isInstance(message)) {
+ } else if (AbortTransaction.isSerializedType(message)) {
handleAbortTransaction(AbortTransaction.fromSerializable(message));
} else if (CloseTransactionChain.SERIALIZABLE_CLASS.isInstance(message)) {
closeTransactionChain(CloseTransactionChain.fromSerializable(message));
try {
cohortEntry.commit();
- sender.tell(CommitTransactionReply.INSTANCE.toSerializable(), getSelf());
+ sender.tell(CommitTransactionReply.instance(DataStoreVersions.CURRENT_VERSION).toSerializable(), getSelf());
shardMBean.incrementCommittedTransactionCount();
shardMBean.setLastCommittedTransactionTime(System.currentTimeMillis());
LOG.error("{}: Failed to re-apply transaction {}", persistenceId(), transactionID, e);
}
- sender.tell(CommitTransactionReply.INSTANCE.toSerializable(), getSelf());
+ sender.tell(CommitTransactionReply.instance(DataStoreVersions.CURRENT_VERSION).toSerializable(), getSelf());
} else {
// This really shouldn't happen - it likely means that persistence or replication
// took so long to complete such that the cohort entry was expired from the cache.
"Can Commit failed, no detailed cause available.")), cohortEntry.getShard().self());
}
} else {
+ // FIXME - use caller's version
cohortEntry.getReplySender().tell(
- canCommit ? CanCommitTransactionReply.YES.toSerializable() :
- CanCommitTransactionReply.NO.toSerializable(), cohortEntry.getShard().self());
+ canCommit ? CanCommitTransactionReply.yes(DataStoreVersions.CURRENT_VERSION).toSerializable() :
+ CanCommitTransactionReply.no(DataStoreVersions.CURRENT_VERSION).toSerializable(), cohortEntry.getShard().self());
}
} catch (Exception e) {
log.debug("{}: An exception occurred during canCommit", name, e);
commitOperationCallback.run();
- final Object message = new CanCommitTransaction(transactionId).toSerializable();
+ final Object message = new CanCommitTransaction(transactionId, DataStoreVersions.CURRENT_VERSION).toSerializable();
final Iterator<ActorSelection> iterator = cohorts.iterator();
commitOperationCallback.pause();
boolean result = true;
- if (response.getClass().equals(CanCommitTransactionReply.SERIALIZABLE_CLASS)) {
+ if (CanCommitTransactionReply.isSerializedType(response)) {
CanCommitTransactionReply reply =
CanCommitTransactionReply.fromSerializable(response);
if (!reply.getCanCommit()) {
// exception then that exception will supersede and suppress the original exception. But
// it's the original exception that is the root cause and of more interest to the client.
- return voidOperation("abort", new AbortTransaction(transactionId).toSerializable(),
- AbortTransactionReply.SERIALIZABLE_CLASS, false);
+ return voidOperation("abort", new AbortTransaction(transactionId, DataStoreVersions.CURRENT_VERSION).toSerializable(),
+ AbortTransactionReply.class, false);
}
@Override
OperationCallback operationCallback = commitOperationCallback != null ? commitOperationCallback :
OperationCallback.NO_OP_CALLBACK;
- return voidOperation("commit", new CommitTransaction(transactionId).toSerializable(),
- CommitTransactionReply.SERIALIZABLE_CLASS, true, operationCallback);
+ return voidOperation("commit", new CommitTransaction(transactionId, DataStoreVersions.CURRENT_VERSION).toSerializable(),
+ CommitTransactionReply.class, true, operationCallback);
}
private ListenableFuture<Void> voidOperation(final String operationName, final Object message,
boolean handleMessage(Object message, EntityOwnershipShard shard) {
boolean handled = true;
- if(CommitTransactionReply.SERIALIZABLE_CLASS.isInstance(message)) {
+ if(CommitTransactionReply.isSerializedType(message)) {
// Successful reply from a local commit.
inflightCommitSucceeded(shard);
} else if(message instanceof akka.actor.Status.Failure) {
package org.opendaylight.controller.cluster.datastore.messages;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
-public class AbortTransaction implements SerializableMessage {
- public static final Class<ThreePhaseCommitCohortMessages.AbortTransaction> SERIALIZABLE_CLASS =
- ThreePhaseCommitCohortMessages.AbortTransaction.class;
+public class AbortTransaction extends AbstractThreePhaseCommitMessage {
+ private static final long serialVersionUID = 1L;
- private final String transactionID;
-
- public AbortTransaction(String transactionID) {
- this.transactionID = transactionID;
+ public AbortTransaction() {
}
- public String getTransactionID() {
- return transactionID;
+ public AbortTransaction(String transactionID, final short version) {
+ super(transactionID, version);
}
@Override
- public Object toSerializable() {
+ protected Object newLegacySerializedInstance() {
return ThreePhaseCommitCohortMessages.AbortTransaction.newBuilder().
- setTransactionId(transactionID).build();
+ setTransactionId(getTransactionID()).build();
+ }
+
+ public static AbortTransaction fromSerializable(Object serializable) {
+ if(serializable instanceof AbortTransaction) {
+ return (AbortTransaction)serializable;
+ } else {
+ return new AbortTransaction(((ThreePhaseCommitCohortMessages.AbortTransaction)serializable).
+ getTransactionId(), DataStoreVersions.LITHIUM_VERSION);
+ }
}
- public static AbortTransaction fromSerializable(Object message) {
- return new AbortTransaction(((ThreePhaseCommitCohortMessages.AbortTransaction)message).
- getTransactionId());
+ public static boolean isSerializedType(Object message) {
+ return message instanceof AbortTransaction ||
+ message instanceof ThreePhaseCommitCohortMessages.AbortTransaction;
}
}
package org.opendaylight.controller.cluster.datastore.messages;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
-public class AbortTransactionReply implements SerializableMessage {
- public static final Class<ThreePhaseCommitCohortMessages.AbortTransactionReply> SERIALIZABLE_CLASS =
- ThreePhaseCommitCohortMessages.AbortTransactionReply.class;
-
+public class AbortTransactionReply extends EmptyReply {
private static final Object SERIALIZED_INSTANCE =
ThreePhaseCommitCohortMessages.AbortTransactionReply.newBuilder().build();
- public static final AbortTransactionReply INSTANCE = new AbortTransactionReply();
+ private static final AbortTransactionReply INSTANCE = new AbortTransactionReply();
+
+ public AbortTransactionReply() {
+ }
+
+ private AbortTransactionReply(short version) {
+ super(version);
+ }
@Override
- public Object toSerializable() {
+ protected Object newLegacySerializedInstance() {
return SERIALIZED_INSTANCE;
}
+
+ public static AbortTransactionReply instance(short version) {
+ return version == DataStoreVersions.CURRENT_VERSION ? INSTANCE : new AbortTransactionReply(version);
+ }
+
+ public static boolean isSerializedType(Object message) {
+ return message instanceof AbortTransactionReply ||
+ message instanceof ThreePhaseCommitCohortMessages.AbortTransactionReply;
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.datastore.messages;
+
+import com.google.common.base.Preconditions;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
+
+/**
+ * Base class for a 3PC message.
+ *
+ * @author Thomas Pantelis
+ */
+public abstract class AbstractThreePhaseCommitMessage extends VersionedExternalizableMessage {
+ private static final long serialVersionUID = 1L;
+
+ private String transactionID;
+
+ protected AbstractThreePhaseCommitMessage() {
+ }
+
+ protected AbstractThreePhaseCommitMessage(final String transactionID, final short version) {
+ super(version);
+ this.transactionID = Preconditions.checkNotNull(transactionID);
+ }
+
+ protected abstract Object newLegacySerializedInstance();
+
+ public String getTransactionID() {
+ return transactionID;
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ transactionID = in.readUTF();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeUTF(transactionID);
+ }
+
+ @Override
+ public Object toSerializable() {
+ return getVersion() >= DataStoreVersions.BORON_VERSION ? this : newLegacySerializedInstance();
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " [transactionID=" + transactionID + ", version=" + getVersion()
+ + "]";
+ }
+}
package org.opendaylight.controller.cluster.datastore.messages;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
-public class CanCommitTransaction implements SerializableMessage {
- public static final Class<?> SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CanCommitTransaction.class;
+public class CanCommitTransaction extends AbstractThreePhaseCommitMessage {
+ private static final long serialVersionUID = 1L;
- private final String transactionID;
-
- public CanCommitTransaction(String transactionID) {
- this.transactionID = transactionID;
+ public CanCommitTransaction() {
}
- public String getTransactionID() {
- return transactionID;
+ public CanCommitTransaction(String transactionID, final short version) {
+ super(transactionID, version);
}
@Override
- public Object toSerializable() {
+ protected Object newLegacySerializedInstance() {
return ThreePhaseCommitCohortMessages.CanCommitTransaction.newBuilder().
- setTransactionId(transactionID).build();
+ setTransactionId(getTransactionID()).build();
+ }
+
+ public static CanCommitTransaction fromSerializable(Object serializable) {
+ if(serializable instanceof CanCommitTransaction) {
+ return (CanCommitTransaction)serializable;
+ } else {
+ return new CanCommitTransaction(((ThreePhaseCommitCohortMessages.CanCommitTransaction)serializable).
+ getTransactionId(), DataStoreVersions.LITHIUM_VERSION);
+ }
}
- public static CanCommitTransaction fromSerializable(Object message) {
- return new CanCommitTransaction(((ThreePhaseCommitCohortMessages.CanCommitTransaction)message).
- getTransactionId());
+ public static boolean isSerializedType(Object message) {
+ return message instanceof CanCommitTransaction ||
+ message instanceof ThreePhaseCommitCohortMessages.CanCommitTransaction;
}
}
package org.opendaylight.controller.cluster.datastore.messages;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
-public class CanCommitTransactionReply implements SerializableMessage {
- public static final Class<ThreePhaseCommitCohortMessages.CanCommitTransactionReply> SERIALIZABLE_CLASS =
- ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class;
-
- public static final CanCommitTransactionReply YES = new CanCommitTransactionReply(true);
- public static final CanCommitTransactionReply NO = new CanCommitTransactionReply(false);
+public class CanCommitTransactionReply extends VersionedExternalizableMessage {
+ private static final CanCommitTransactionReply YES =
+ new CanCommitTransactionReply(true, DataStoreVersions.CURRENT_VERSION);
+ private static final CanCommitTransactionReply NO =
+ new CanCommitTransactionReply(false, DataStoreVersions.CURRENT_VERSION);
private static final ThreePhaseCommitCohortMessages.CanCommitTransactionReply YES_SERIALIZED =
ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder().setCanCommit(true).build();
private static final ThreePhaseCommitCohortMessages.CanCommitTransactionReply NO_SERIALIZED =
ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder().setCanCommit(false).build();
- private final boolean canCommit;
+ private boolean canCommit;
+
+ public CanCommitTransactionReply() {
+ }
- private CanCommitTransactionReply(final boolean canCommit) {
+ private CanCommitTransactionReply(final boolean canCommit, final short version) {
+ super(version);
this.canCommit = canCommit;
}
return canCommit;
}
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ canCommit = in.readBoolean();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeBoolean(canCommit);
+ }
+
@Override
public Object toSerializable() {
- return canCommit ? YES_SERIALIZED : NO_SERIALIZED;
+ if(getVersion() >= DataStoreVersions.BORON_VERSION) {
+ return this;
+ } else {
+ return canCommit ? YES_SERIALIZED : NO_SERIALIZED;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "CanCommitTransactionReply [canCommit=" + canCommit + ", version=" + getVersion() + "]";
+ }
+
+ public static CanCommitTransactionReply yes(short version) {
+ return version == DataStoreVersions.CURRENT_VERSION ? YES : new CanCommitTransactionReply(true, version);
+ }
+
+ public static CanCommitTransactionReply no(short version) {
+ return version == DataStoreVersions.CURRENT_VERSION ? NO : new CanCommitTransactionReply(false, version);
+ }
+
+ public static CanCommitTransactionReply fromSerializable(final Object serializable) {
+ if(serializable instanceof CanCommitTransactionReply) {
+ return (CanCommitTransactionReply)serializable;
+ } else {
+ ThreePhaseCommitCohortMessages.CanCommitTransactionReply serialized =
+ (ThreePhaseCommitCohortMessages.CanCommitTransactionReply) serializable;
+ return serialized.getCanCommit() ? YES : NO;
+ }
}
- public static CanCommitTransactionReply fromSerializable(final Object message) {
- ThreePhaseCommitCohortMessages.CanCommitTransactionReply serialized =
- (ThreePhaseCommitCohortMessages.CanCommitTransactionReply) message;
- return serialized.getCanCommit() ? YES : NO;
+ public static boolean isSerializedType(Object message) {
+ return message instanceof CanCommitTransactionReply ||
+ message instanceof ThreePhaseCommitCohortMessages.CanCommitTransactionReply;
}
}
package org.opendaylight.controller.cluster.datastore.messages;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
-public class CommitTransaction implements SerializableMessage {
- public static final Class<ThreePhaseCommitCohortMessages.CommitTransaction> SERIALIZABLE_CLASS =
- ThreePhaseCommitCohortMessages.CommitTransaction.class;
+public class CommitTransaction extends AbstractThreePhaseCommitMessage {
+ private static final long serialVersionUID = 1L;
- private final String transactionID;
-
- public CommitTransaction(String transactionID) {
- this.transactionID = transactionID;
+ public CommitTransaction() {
}
- public String getTransactionID() {
- return transactionID;
+ public CommitTransaction(String transactionID, final short version) {
+ super(transactionID, version);
}
@Override
- public Object toSerializable() {
+ protected Object newLegacySerializedInstance() {
return ThreePhaseCommitCohortMessages.CommitTransaction.newBuilder().setTransactionId(
- transactionID).build();
+ getTransactionID()).build();
+ }
+
+ public static CommitTransaction fromSerializable(Object serializable) {
+ if(serializable instanceof CommitTransaction) {
+ return (CommitTransaction)serializable;
+ } else {
+ return new CommitTransaction(((ThreePhaseCommitCohortMessages.CommitTransaction)serializable).
+ getTransactionId(), DataStoreVersions.LITHIUM_VERSION);
+ }
}
- public static CommitTransaction fromSerializable(Object message) {
- return new CommitTransaction(((ThreePhaseCommitCohortMessages.
- CommitTransaction)message).getTransactionId());
+ public static boolean isSerializedType(Object message) {
+ return message instanceof CommitTransaction ||
+ message instanceof ThreePhaseCommitCohortMessages.CommitTransaction;
}
}
package org.opendaylight.controller.cluster.datastore.messages;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
-public class CommitTransactionReply implements SerializableMessage {
- public static final Class<ThreePhaseCommitCohortMessages.CommitTransactionReply> SERIALIZABLE_CLASS =
- ThreePhaseCommitCohortMessages.CommitTransactionReply.class;
-
+public class CommitTransactionReply extends EmptyReply {
private static final Object SERIALIZED_INSTANCE =
ThreePhaseCommitCohortMessages.CommitTransactionReply.newBuilder().build();
public static final CommitTransactionReply INSTANCE = new CommitTransactionReply();
+ public CommitTransactionReply() {
+ }
+
+ private CommitTransactionReply(short version) {
+ super(version);
+ }
+
@Override
- public Object toSerializable() {
+ protected Object newLegacySerializedInstance() {
return SERIALIZED_INSTANCE;
}
+
+ public static CommitTransactionReply instance(short version) {
+ return version == DataStoreVersions.CURRENT_VERSION ? INSTANCE : new CommitTransactionReply(version);
+ }
+
+ public static boolean isSerializedType(Object message) {
+ return message instanceof CommitTransactionReply ||
+ message instanceof ThreePhaseCommitCohortMessages.CommitTransactionReply;
+ }
}
*
* @author Thomas Pantelis
*/
-public abstract class EmptyReply extends EmptyExternalizable {
+public abstract class EmptyReply extends VersionedExternalizableMessage {
+ protected EmptyReply() {
+ }
+
+ protected EmptyReply(short version) {
+ super(version);
+ }
- private final Object legacySerializedInstance;
+ protected abstract Object newLegacySerializedInstance();
- protected EmptyReply(Object legacySerializedInstance) {
- super();
- this.legacySerializedInstance = legacySerializedInstance;
+ @Override
+ public Object toSerializable() {
+ return getVersion() >= DataStoreVersions.BORON_VERSION ? this : newLegacySerializedInstance();
}
- public Object toSerializable(short toVersion) {
- return toVersion >= DataStoreVersions.LITHIUM_VERSION ? this : legacySerializedInstance;
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " [version=" + getVersion() + "]";
}
}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.cluster.datastore.messages;
-
-import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
-
-public class PreCommitTransaction implements SerializableMessage{
-
- public static final Class<ThreePhaseCommitCohortMessages.PreCommitTransaction> SERIALIZABLE_CLASS =
- ThreePhaseCommitCohortMessages.PreCommitTransaction.class;
-
- @Override
- public Object toSerializable() {
- return ThreePhaseCommitCohortMessages.PreCommitTransaction.newBuilder().build();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.cluster.datastore.messages;
-
-import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
-
-public class PreCommitTransactionReply implements SerializableMessage{
-
- public static final Class<ThreePhaseCommitCohortMessages.PreCommitTransactionReply> SERIALIZABLE_CLASS =
- ThreePhaseCommitCohortMessages.PreCommitTransactionReply.class;
-
- @Override
- public Object toSerializable() {
- return ThreePhaseCommitCohortMessages.PreCommitTransactionReply.newBuilder().build();
- }
-}
Iterator<?> iter = futureResults.iterator();
while(iter.hasNext()) {
Object actual = iter.next();
- if(CommitTransactionReply.SERIALIZABLE_CLASS.isInstance(expReply) &&
- CommitTransactionReply.SERIALIZABLE_CLASS.isInstance(actual)) {
+ if(CommitTransactionReply.isSerializedType(expReply) &&
+ CommitTransactionReply.isSerializedType(actual)) {
found = true;
} else if(expReply instanceof ActorSelection && Objects.equal(expReply, actual)) {
found = true;
throw new AssertionError("Unexpected failure response", ((akka.actor.Status.Failure)resp).cause());
}
- assertEquals("Response type", CommitTransactionReply.SERIALIZABLE_CLASS, resp.getClass());
+ assertEquals("Response type", CommitTransactionReply.class, resp.getClass());
verifyCars(leaderDistributedDataStore.newReadOnlyTransaction(), car1);
throw new AssertionError("Unexpected failure response", ((akka.actor.Status.Failure)resp).cause());
}
- assertEquals("Response type", CommitTransactionReply.SERIALIZABLE_CLASS, resp.getClass());
+ assertEquals("Response type", CommitTransactionReply.class, resp.getClass());
verifyCars(leaderDistributedDataStore.newReadOnlyTransaction(), car1);
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
-import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
// Send the CanCommitTransaction message for the first Tx.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
shard.tell(prepareReadyTransactionMessage(false, shard.underlyingActor(), cohort2, transactionID2, modification2), getRef());
// processed after the first Tx completes.
final Future<Object> canCommitFuture1 = Patterns.ask(shard,
- new CanCommitTransaction(transactionID2).toSerializable(), timeout);
+ new CanCommitTransaction(transactionID2, CURRENT_VERSION).toSerializable(), timeout);
final Future<Object> canCommitFuture2 = Patterns.ask(shard,
- new CanCommitTransaction(transactionID3).toSerializable(), timeout);
+ new CanCommitTransaction(transactionID3, CURRENT_VERSION).toSerializable(), timeout);
// Send the CommitTransaction message for the first Tx. After it completes, it should
// trigger the 2nd Tx to proceed which should in turn then trigger the 3rd.
- shard.tell(new CommitTransaction(transactionID1).toSerializable(), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CommitTransactionReply.class);
// Wait for the next 2 Tx's to complete.
class OnCommitFutureComplete extends OnFutureComplete {
OnCommitFutureComplete() {
- super(CommitTransactionReply.SERIALIZABLE_CLASS);
+ super(CommitTransactionReply.class);
}
@Override
private final String transactionID;
OnCanCommitFutureComplete(final String transactionID) {
- super(CanCommitTransactionReply.SERIALIZABLE_CLASS);
+ super(CanCommitTransactionReply.class);
this.transactionID = transactionID;
}
assertEquals("Can commit", true, canCommitReply.getCanCommit());
final Future<Object> commitFuture = Patterns.ask(shard,
- new CommitTransaction(transactionID).toSerializable(), timeout);
+ new CommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), timeout);
commitFuture.onComplete(new OnCommitFutureComplete(), getSystem().dispatcher());
}
}
// Send the CanCommitTransaction message.
- shard.tell(new CanCommitTransaction(transactionID).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
// Send the CanCommitTransaction message.
- shard.tell(new CommitTransaction(transactionID).toSerializable(), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CommitTransactionReply.class);
final InOrder inOrder = inOrder(mockCohort.get());
inOrder.verify(mockCohort.get()).canCommit();
TestModel.OUTER_LIST_PATH).nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1).build(),
ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1), true, true, 3), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ expectMsgClass(duration, CommitTransactionReply.class);
final InOrder inOrder = inOrder(mockCohort.get());
inOrder.verify(mockCohort.get()).canCommit();
// Commit the write transaction.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
- shard.tell(new CommitTransaction(transactionID1).toSerializable(), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CommitTransactionReply.class);
// Verify data in the data store.
shard.tell(prepareReadyTransactionMessage(readWrite, shard.underlyingActor(), cohort, transactionID, modification, true), getRef());
- expectMsgClass(duration, ThreePhaseCommitCohortMessages.CommitTransactionReply.class);
+ expectMsgClass(duration, CommitTransactionReply.class);
final InOrder inOrder = inOrder(cohort);
inOrder.verify(cohort).canCommit();
shard.tell(readyMessage, getRef());
- expectMsgClass(CommitTransactionReply.SERIALIZABLE_CLASS);
+ expectMsgClass(CommitTransactionReply.class);
final NormalizedNode<?, ?> actualNode = readStore(shard, TestModel.OUTER_LIST_PATH);
assertEquals(TestModel.OUTER_LIST_QNAME.getLocalName(), mergeData, actualNode);
// Send the CanCommitTransaction message.
- shard.tell(new CanCommitTransaction(txId).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(txId, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
// Send the CanCommitTransaction message.
- shard.tell(new CommitTransaction(txId).toSerializable(), getRef());
- expectMsgClass(CommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CommitTransaction(txId, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(CommitTransactionReply.class);
final NormalizedNode<?, ?> actualNode = readStore(shard, TestModel.OUTER_LIST_PATH);
assertEquals(TestModel.OUTER_LIST_QNAME.getLocalName(), mergeData, actualNode);
// Send the CanCommitTransaction message.
- shard.tell(new CanCommitTransaction(transactionID).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
// Send the CanCommitTransaction message.
- shard.tell(new CommitTransaction(transactionID).toSerializable(), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CommitTransactionReply.class);
final InOrder inOrder = inOrder(cohort);
inOrder.verify(cohort).canCommit();
// Send the CanCommitTransaction message.
- shard.tell(new CanCommitTransaction(transactionID).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
- shard.tell(new CommitTransaction(transactionID).toSerializable(), getRef());
- expectMsgClass(duration, ThreePhaseCommitCohortMessages.CommitTransactionReply.class);
+ shard.tell(new CommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CommitTransactionReply.class);
final InOrder inOrder = inOrder(cohort);
inOrder.verify(cohort).canCommit();
// Send the CanCommitTransaction message.
- shard.tell(new CanCommitTransaction(transactionID).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
- shard.tell(new CommitTransaction(transactionID).toSerializable(), getRef());
- expectMsgClass(duration, ThreePhaseCommitCohortMessages.CommitTransactionReply.class);
+ shard.tell(new CommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CommitTransactionReply.class);
final InOrder inOrder = inOrder(cohort);
inOrder.verify(cohort).canCommit();
// Send the CanCommitTransaction message for the first Tx.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
// Send the CanCommitTransaction message for the 2nd Tx. This should get queued and
// processed after the first Tx completes.
final Future<Object> canCommitFuture = Patterns.ask(shard,
- new CanCommitTransaction(transactionID2).toSerializable(), timeout);
+ new CanCommitTransaction(transactionID2, CURRENT_VERSION).toSerializable(), timeout);
// Send the CommitTransaction message for the first Tx. This should send back an error
// and trigger the 2nd Tx to proceed.
- shard.tell(new CommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
expectMsgClass(duration, akka.actor.Status.Failure.class);
// Wait for the 2nd Tx to complete the canCommit phase.
// Send the CanCommitTransaction message for the first Tx.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
// Send the CanCommitTransaction message for the 2nd Tx. This should get queued and
// processed after the first Tx completes.
final Future<Object> canCommitFuture = Patterns.ask(shard,
- new CanCommitTransaction(transactionID2).toSerializable(), timeout);
+ new CanCommitTransaction(transactionID2, CURRENT_VERSION).toSerializable(), timeout);
// Send the CommitTransaction message for the first Tx. This should send back an error
// and trigger the 2nd Tx to proceed.
- shard.tell(new CommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
expectMsgClass(duration, akka.actor.Status.Failure.class);
// Wait for the 2nd Tx to complete the canCommit phase.
// Send the CanCommitTransaction message.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
expectMsgClass(duration, akka.actor.Status.Failure.class);
// Send another can commit to ensure the failed one got cleaned up.
shard.tell(prepareReadyTransactionMessage(readWrite, shard.underlyingActor(), cohort, transactionID2, modification), getRef());
expectMsgClass(duration, ReadyTransactionReply.class);
- shard.tell(new CanCommitTransaction(transactionID2).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID2, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply reply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(CanCommitTransactionReply.class));
assertEquals("getCanCommit", true, reply.getCanCommit());
}};
}
// Send the CanCommitTransaction message.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
CanCommitTransactionReply reply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(CanCommitTransactionReply.class));
assertEquals("getCanCommit", false, reply.getCanCommit());
// Send another can commit to ensure the failed one got cleaned up.
shard.tell(prepareReadyTransactionMessage(readWrite, shard.underlyingActor(), cohort, transactionID2, modification), getRef());
expectMsgClass(duration, ReadyTransactionReply.class);
- shard.tell(new CanCommitTransaction(transactionID2).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID2, CURRENT_VERSION).toSerializable(), getRef());
reply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(CanCommitTransactionReply.class));
assertEquals("getCanCommit", true, reply.getCanCommit());
}};
}
shard.tell(prepareReadyTransactionMessage(readWrite, shard.underlyingActor(), cohort, transactionID2, modification, true), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ expectMsgClass(duration, CommitTransactionReply.class);
}};
}
shard.tell(prepareReadyTransactionMessage(readWrite, shard.underlyingActor(), cohort, transactionID2, modification, true), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ expectMsgClass(duration, CommitTransactionReply.class);
}};
}
shard.tell(prepareReadyTransactionMessage(readWrite, shard.underlyingActor(), cohort, transactionID, modification), getRef());
expectMsgClass(duration, ReadyTransactionReply.class);
- shard.tell(new CanCommitTransaction(transactionID).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
- shard.tell(new CommitTransaction(transactionID).toSerializable(), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CommitTransactionReply.class);
final NormalizedNode<?, ?> node = readStore(shard, TestModel.TEST_PATH);
// canCommit 1st Tx. We don't send the commit so it should timeout.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CanCommitTransactionReply.class);
// canCommit the 2nd Tx - it should complete after the 1st Tx times out.
- shard.tell(new CanCommitTransaction(transactionID2).toSerializable(), getRef());
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CanCommitTransaction(transactionID2, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CanCommitTransactionReply.class);
// Try to commit the 1st Tx - should fail as it's not the current Tx.
- shard.tell(new CommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
expectMsgClass(duration, akka.actor.Status.Failure.class);
// Commit the 2nd Tx.
- shard.tell(new CommitTransaction(transactionID2).toSerializable(), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CommitTransaction(transactionID2, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CommitTransactionReply.class);
final NormalizedNode<?, ?> node = readStore(shard, listNodePath);
assertNotNull(listNodePath + " not found", node);
// canCommit 1st Tx.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CanCommitTransactionReply.class);
// canCommit the 2nd Tx - it should get queued.
- shard.tell(new CanCommitTransaction(transactionID2).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID2, CURRENT_VERSION).toSerializable(), getRef());
// canCommit the 3rd Tx - should exceed queue capacity and fail.
- shard.tell(new CanCommitTransaction(transactionID3).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID3, CURRENT_VERSION).toSerializable(), getRef());
expectMsgClass(duration, akka.actor.Status.Failure.class);
}};
}
// All Tx's are readied. We'll send canCommit for the last one but not the others. The others
// should expire from the queue and the last one should be processed.
- shard.tell(new CanCommitTransaction(transactionID3).toSerializable(), getRef());
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CanCommitTransaction(transactionID3, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CanCommitTransactionReply.class);
}};
}
// CanCommit the first one so it's the current in-progress CohortEntry.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CanCommitTransactionReply.class);
// Ready the second Tx.
// Commit the first Tx. After completing, the second should expire from the queue and the third
// Tx committed.
- shard.tell(new CommitTransaction(transactionID1).toSerializable(), getRef());
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new CommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, CommitTransactionReply.class);
// Expect commit reply from the third Tx.
- expectMsgClass(duration, CommitTransactionReply.SERIALIZABLE_CLASS);
+ expectMsgClass(duration, CommitTransactionReply.class);
final NormalizedNode<?, ?> node = readStore(shard, TestModel.TEST2_PATH);
assertNotNull(TestModel.TEST2_PATH + " not found", node);
newShardProps().withDispatcher(Dispatchers.DefaultDispatcherId()),
"testCanCommitBeforeReadyFailure");
- shard.tell(new CanCommitTransaction("tx").toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction("tx", CURRENT_VERSION).toSerializable(), getRef());
expectMsgClass(duration("5 seconds"), akka.actor.Status.Failure.class);
}};
}
// Send the CanCommitTransaction message for the first Tx.
- shard.tell(new CanCommitTransaction(transactionID1).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
final CanCommitTransactionReply canCommitReply = CanCommitTransactionReply.fromSerializable(
- expectMsgClass(duration, CanCommitTransactionReply.SERIALIZABLE_CLASS));
+ expectMsgClass(duration, CanCommitTransactionReply.class));
assertEquals("Can commit", true, canCommitReply.getCanCommit());
// Send the CanCommitTransaction message for the 2nd Tx. This should get queued and
// processed after the first Tx completes.
final Future<Object> canCommitFuture = Patterns.ask(shard,
- new CanCommitTransaction(transactionID2).toSerializable(), timeout);
+ new CanCommitTransaction(transactionID2, CURRENT_VERSION).toSerializable(), timeout);
// Send the AbortTransaction message for the first Tx. This should trigger the 2nd
// Tx to proceed.
- shard.tell(new AbortTransaction(transactionID1).toSerializable(), getRef());
- expectMsgClass(duration, AbortTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new AbortTransaction(transactionID1, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, AbortTransactionReply.class);
// Wait for the 2nd Tx to complete the canCommit phase.
// Send the AbortTransaction message.
- shard.tell(new AbortTransaction(transactionID).toSerializable(), getRef());
- expectMsgClass(duration, AbortTransactionReply.SERIALIZABLE_CLASS);
+ shard.tell(new AbortTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
+ expectMsgClass(duration, AbortTransactionReply.class);
verify(cohort).abort();
// Now send CanCommitTransaction - should fail.
- shard.tell(new CanCommitTransaction(transactionID).toSerializable(), getRef());
+ shard.tell(new CanCommitTransaction(transactionID, CURRENT_VERSION).toSerializable(), getRef());
Throwable failure = expectMsgClass(duration, akka.actor.Status.Failure.class).cause();
assertTrue("Failure type", failure instanceof IllegalStateException);
batched.setTotalMessagesSent(1);
transaction.tell(batched, getRef());
- expectMsgClass(duration("5 seconds"), CommitTransactionReply.SERIALIZABLE_CLASS);
+ expectMsgClass(duration("5 seconds"), CommitTransactionReply.class);
watcher.expectMsgClass(duration("5 seconds"), Terminated.class);
}};
}
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.opendaylight.controller.cluster.datastore.DataStoreVersions.CURRENT_VERSION;
import akka.actor.ActorPath;
import akka.actor.ActorSelection;
import akka.actor.Props;
import org.opendaylight.controller.cluster.datastore.messages.CanCommitTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.CommitTransaction;
import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply;
-import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransaction;
-import org.opendaylight.controller.cluster.datastore.messages.PreCommitTransactionReply;
import org.opendaylight.controller.cluster.datastore.messages.SerializableMessage;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
ThreePhaseCommitCohortProxy proxy = setupProxy(1);
- setupMockActorContext(CanCommitTransaction.SERIALIZABLE_CLASS,
- CanCommitTransactionReply.YES);
+ setupMockActorContext(CanCommitTransaction.class, CanCommitTransactionReply.yes(CURRENT_VERSION));
ListenableFuture<Boolean> future = proxy.canCommit();
assertEquals("canCommit", true, future.get(5, TimeUnit.SECONDS));
- setupMockActorContext(CanCommitTransaction.SERIALIZABLE_CLASS,
- CanCommitTransactionReply.NO);
+ setupMockActorContext(CanCommitTransaction.class, CanCommitTransactionReply.no(CURRENT_VERSION));
future = proxy.canCommit();
assertEquals("canCommit", false, future.get(5, TimeUnit.SECONDS));
- verifyCohortInvocations(2, CanCommitTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(2, CanCommitTransaction.class);
}
@Test
ThreePhaseCommitCohortProxy proxy = setupProxy(2);
- setupMockActorContext(CanCommitTransaction.SERIALIZABLE_CLASS,
- CanCommitTransactionReply.YES, CanCommitTransactionReply.YES);
+ setupMockActorContext(CanCommitTransaction.class,
+ CanCommitTransactionReply.yes(CURRENT_VERSION), CanCommitTransactionReply.yes(CURRENT_VERSION));
ListenableFuture<Boolean> future = proxy.canCommit();
assertEquals("canCommit", true, future.get(5, TimeUnit.SECONDS));
- verifyCohortInvocations(2, CanCommitTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(2, CanCommitTransaction.class);
}
@Test
ThreePhaseCommitCohortProxy proxy = setupProxy(3);
- setupMockActorContext(CanCommitTransaction.SERIALIZABLE_CLASS,
- CanCommitTransactionReply.YES, CanCommitTransactionReply.NO, CanCommitTransactionReply.YES);
+ setupMockActorContext(CanCommitTransaction.class,
+ CanCommitTransactionReply.yes(CURRENT_VERSION), CanCommitTransactionReply.no(CURRENT_VERSION),
+ CanCommitTransactionReply.yes(CURRENT_VERSION));
ListenableFuture<Boolean> future = proxy.canCommit();
assertEquals("canCommit", false, actual);
- verifyCohortInvocations(2, CanCommitTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(2, CanCommitTransaction.class);
}
@Test(expected = TestException.class)
ThreePhaseCommitCohortProxy proxy = setupProxy(1);
- setupMockActorContext(CanCommitTransaction.SERIALIZABLE_CLASS, new TestException());
+ setupMockActorContext(CanCommitTransaction.class, new TestException());
propagateExecutionExceptionCause(proxy.canCommit());
}
ThreePhaseCommitCohortProxy proxy = setupProxy(1);
- setupMockActorContext(CanCommitTransaction.SERIALIZABLE_CLASS,
- new PreCommitTransactionReply());
+ setupMockActorContext(CanCommitTransaction.class,
+ new CommitTransactionReply());
proxy.canCommit().get(5, TimeUnit.SECONDS);
}
try {
propagateExecutionExceptionCause(proxy.canCommit());
} finally {
- verifyCohortInvocations(0, CanCommitTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(0, CanCommitTransaction.class);
}
}
// Precommit is currently a no-op
ThreePhaseCommitCohortProxy proxy = setupProxy(1);
- setupMockActorContext(PreCommitTransaction.SERIALIZABLE_CLASS,
- new PreCommitTransactionReply());
-
proxy.preCommit().get(5, TimeUnit.SECONDS);
}
public void testAbort() throws Exception {
ThreePhaseCommitCohortProxy proxy = setupProxy(1);
- setupMockActorContext(AbortTransaction.SERIALIZABLE_CLASS, new AbortTransactionReply());
+ setupMockActorContext(AbortTransaction.class, new AbortTransactionReply());
proxy.abort().get(5, TimeUnit.SECONDS);
- verifyCohortInvocations(1, AbortTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(1, AbortTransaction.class);
}
@Test
public void testAbortWithFailure() throws Exception {
ThreePhaseCommitCohortProxy proxy = setupProxy(1);
- setupMockActorContext(AbortTransaction.SERIALIZABLE_CLASS, new RuntimeException("mock"));
+ setupMockActorContext(AbortTransaction.class, new RuntimeException("mock"));
// The exception should not get propagated.
proxy.abort().get(5, TimeUnit.SECONDS);
- verifyCohortInvocations(1, AbortTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(1, AbortTransaction.class);
}
@Test
// The exception should not get propagated.
proxy.abort().get(5, TimeUnit.SECONDS);
- verifyCohortInvocations(0, AbortTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(0, AbortTransaction.class);
}
@Test
ThreePhaseCommitCohortProxy proxy = setupProxy(2);
- setupMockActorContext(CommitTransaction.SERIALIZABLE_CLASS, new CommitTransactionReply(),
+ setupMockActorContext(CommitTransaction.class, new CommitTransactionReply(),
new CommitTransactionReply());
proxy.commit().get(5, TimeUnit.SECONDS);
- verifyCohortInvocations(2, CommitTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(2, CommitTransaction.class);
}
@Test(expected = TestException.class)
ThreePhaseCommitCohortProxy proxy = setupProxy(2);
- setupMockActorContext(CommitTransaction.SERIALIZABLE_CLASS, new CommitTransactionReply(),
+ setupMockActorContext(CommitTransaction.class, new CommitTransactionReply(),
new TestException());
propagateExecutionExceptionCause(proxy.commit());
ThreePhaseCommitCohortProxy proxy = setupProxy(1);
- setupMockActorContext(CommitTransaction.SERIALIZABLE_CLASS, new PreCommitTransactionReply());
+ setupMockActorContext(CommitTransaction.class, new AbortTransactionReply());
proxy.commit().get(5, TimeUnit.SECONDS);
}
propagateExecutionExceptionCause(proxy.commit());
} finally {
- verifyCohortInvocations(0, CommitTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(0, CommitTransaction.class);
}
}
ThreePhaseCommitCohortProxy proxy = setupProxy(2);
- setupMockActorContext(CanCommitTransaction.SERIALIZABLE_CLASS,
- CanCommitTransactionReply.YES, CanCommitTransactionReply.YES);
-
- setupMockActorContext(PreCommitTransaction.SERIALIZABLE_CLASS,
- new PreCommitTransactionReply(), new PreCommitTransactionReply());
+ setupMockActorContext(CanCommitTransaction.class,
+ CanCommitTransactionReply.yes(CURRENT_VERSION), CanCommitTransactionReply.yes(CURRENT_VERSION));
- setupMockActorContext(CommitTransaction.SERIALIZABLE_CLASS,
+ setupMockActorContext(CommitTransaction.class,
new CommitTransactionReply(), new CommitTransactionReply());
assertEquals(10.0, actorContext.getTxCreationLimit(), 1e-15);
proxy.preCommit().get(5, TimeUnit.SECONDS);
proxy.commit().get(5, TimeUnit.SECONDS);
- verifyCohortInvocations(2, CanCommitTransaction.SERIALIZABLE_CLASS);
- verifyCohortInvocations(2, CommitTransaction.SERIALIZABLE_CLASS);
+ verifyCohortInvocations(2, CanCommitTransaction.class);
+ verifyCohortInvocations(2, CommitTransaction.class);
}
modifications.addModification(new MergeModification(ENTITY_OWNERS_PATH, node));
shard.tell(modifications, sender.getRef());
- sender.expectMsgClass(CommitTransactionReply.SERIALIZABLE_CLASS);
+ sender.expectMsgClass(CommitTransactionReply.class);
}
private static BatchedModifications newBatchedModifications() {
}
}
- getSender().tell(CommitTransactionReply.INSTANCE.toSerializable(), getSelf());
+ getSender().tell(CommitTransactionReply.instance(DataStoreVersions.CURRENT_VERSION).
+ toSerializable(), getSelf());
} else {
sendReply = true;
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.datastore.messages;
+
+import static org.junit.Assert.assertEquals;
+import java.io.Serializable;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+/**
+ * Unit tests for AbortTransactionReply.
+ *
+ * @author Thomas Pantelis
+ */
+public class AbortTransactionReplyTest {
+
+ @Test
+ public void testSerialization() {
+ AbortTransactionReply expected = AbortTransactionReply.instance(DataStoreVersions.CURRENT_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", AbortTransactionReply.class, serialized.getClass());
+
+ AbortTransactionReply actual = (AbortTransactionReply)SerializationUtils.clone((Serializable) serialized);
+ assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
+ }
+
+ @Test
+ public void testSerializationWithPreBoronVersion() {
+ AbortTransactionReply expected = AbortTransactionReply.instance(DataStoreVersions.LITHIUM_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", ThreePhaseCommitCohortMessages.AbortTransactionReply.class, serialized.getClass());
+ }
+
+ @Test
+ public void testIsSerializedType() {
+ assertEquals("isSerializedType", true, AbortTransactionReply.isSerializedType(
+ ThreePhaseCommitCohortMessages.AbortTransactionReply.newBuilder().build()));
+
+ assertEquals("isSerializedType", true, AbortTransactionReply.isSerializedType(new AbortTransactionReply()));
+ assertEquals("isSerializedType", false, AbortTransactionReply.isSerializedType(new Object()));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.datastore.messages;
+
+import static org.junit.Assert.assertEquals;
+import java.io.Serializable;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+/**
+ * Unit tests for AbortTransaction.
+ *
+ * @author Thomas Pantelis
+ */
+public class AbortTransactionTest {
+
+ @Test
+ public void testSerialization() {
+ AbortTransaction expected = new AbortTransaction("txId", DataStoreVersions.CURRENT_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", AbortTransaction.class, serialized.getClass());
+
+ AbortTransaction actual = AbortTransaction.fromSerializable(
+ SerializationUtils.clone((Serializable) serialized));
+ assertEquals("getTransactionID", expected.getTransactionID(), actual.getTransactionID());
+ assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
+ }
+
+ @Test
+ public void testSerializationWithPreBoronVersion() {
+ AbortTransaction expected = new AbortTransaction("txId", DataStoreVersions.LITHIUM_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", ThreePhaseCommitCohortMessages.AbortTransaction.class, serialized.getClass());
+
+ AbortTransaction actual = AbortTransaction.fromSerializable(
+ SerializationUtils.clone((Serializable) serialized));
+ assertEquals("getTransactionID", expected.getTransactionID(), actual.getTransactionID());
+ assertEquals("getVersion", DataStoreVersions.LITHIUM_VERSION, actual.getVersion());
+ }
+
+ @Test
+ public void testIsSerializedType() {
+ assertEquals("isSerializedType", true, AbortTransaction.isSerializedType(
+ ThreePhaseCommitCohortMessages.AbortTransaction.newBuilder().setTransactionId("").build()));
+
+ assertEquals("isSerializedType", true, AbortTransaction.isSerializedType(new AbortTransaction()));
+ assertEquals("isSerializedType", false, AbortTransaction.isSerializedType(new Object()));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.datastore.messages;
+
+import static org.junit.Assert.assertEquals;
+import java.io.Serializable;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+/**
+ * Unit tests for CanCommitTransactionReply.
+ *
+ * @author Thomas Pantelis
+ */
+public class CanCommitTransactionReplyTest {
+
+ @Test
+ public void testSerialization() {
+ testSerialization(CanCommitTransactionReply.yes(DataStoreVersions.CURRENT_VERSION),
+ CanCommitTransactionReply.class);
+ testSerialization(CanCommitTransactionReply.no(DataStoreVersions.CURRENT_VERSION),
+ CanCommitTransactionReply.class);
+ }
+
+ private void testSerialization(CanCommitTransactionReply expected, Class<?> expSerialized) {
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", expSerialized, serialized.getClass());
+
+ CanCommitTransactionReply actual = CanCommitTransactionReply.fromSerializable(
+ SerializationUtils.clone((Serializable) serialized));
+ assertEquals("getCanCommit", expected.getCanCommit(), actual.getCanCommit());
+ assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
+ }
+
+ @Test
+ public void testSerializationWithPreBoronVersion() {
+ testSerialization(CanCommitTransactionReply.yes(DataStoreVersions.LITHIUM_VERSION),
+ ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class);
+ testSerialization(CanCommitTransactionReply.no(DataStoreVersions.LITHIUM_VERSION),
+ ThreePhaseCommitCohortMessages.CanCommitTransactionReply.class);
+ }
+
+ @Test
+ public void testIsSerializedType() {
+ assertEquals("isSerializedType", true, CanCommitTransactionReply.isSerializedType(
+ ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder().setCanCommit(true).build()));
+
+ assertEquals("isSerializedType", true, CanCommitTransactionReply.isSerializedType(
+ new CanCommitTransactionReply()));
+ assertEquals("isSerializedType", false, CanCommitTransactionReply.isSerializedType(new Object()));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.datastore.messages;
+
+import static org.junit.Assert.assertEquals;
+import java.io.Serializable;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+/**
+ * Unit tests for CanCommitTransaction.
+ *
+ * @author Thomas Pantelis
+ */
+public class CanCommitTransactionTest {
+
+ @Test
+ public void testSerialization() {
+ CanCommitTransaction expected = new CanCommitTransaction("txId", DataStoreVersions.CURRENT_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", CanCommitTransaction.class, serialized.getClass());
+
+ CanCommitTransaction actual = CanCommitTransaction.fromSerializable(
+ SerializationUtils.clone((Serializable) serialized));
+ assertEquals("getTransactionID", expected.getTransactionID(), actual.getTransactionID());
+ assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
+ }
+
+ @Test
+ public void testSerializationWithPreBoronVersion() {
+ CanCommitTransaction expected = new CanCommitTransaction("txId", DataStoreVersions.LITHIUM_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", ThreePhaseCommitCohortMessages.CanCommitTransaction.class, serialized.getClass());
+
+ CanCommitTransaction actual = CanCommitTransaction.fromSerializable(
+ SerializationUtils.clone((Serializable) serialized));
+ assertEquals("getTransactionID", expected.getTransactionID(), actual.getTransactionID());
+ assertEquals("getVersion", DataStoreVersions.LITHIUM_VERSION, actual.getVersion());
+ }
+
+ @Test
+ public void testIsSerializedType() {
+ assertEquals("isSerializedType", true, CanCommitTransaction.isSerializedType(
+ ThreePhaseCommitCohortMessages.CanCommitTransaction.newBuilder().
+ setTransactionId("").build()));
+
+ assertEquals("isSerializedType", true, CanCommitTransaction.isSerializedType(new CanCommitTransaction()));
+ assertEquals("isSerializedType", false, CanCommitTransaction.isSerializedType(new Object()));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.datastore.messages;
+
+import static org.junit.Assert.assertEquals;
+import java.io.Serializable;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+/**
+ * Unit tests for CommitTransactionReply.
+ *
+ * @author Thomas Pantelis
+ */
+public class CommitTransactionReplyTest {
+
+ @Test
+ public void testSerialization() {
+ CommitTransactionReply expected = CommitTransactionReply.instance(DataStoreVersions.CURRENT_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", CommitTransactionReply.class, serialized.getClass());
+
+ CommitTransactionReply actual = (CommitTransactionReply)SerializationUtils.clone((Serializable) serialized);
+ assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
+ }
+
+ @Test
+ public void testSerializationWithPreBoronVersion() {
+ CommitTransactionReply expected = CommitTransactionReply.instance(DataStoreVersions.LITHIUM_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", ThreePhaseCommitCohortMessages.CommitTransactionReply.class, serialized.getClass());
+ }
+
+ @Test
+ public void testIsSerializedType() {
+ assertEquals("isSerializedType", true, CommitTransactionReply.isSerializedType(
+ ThreePhaseCommitCohortMessages.CommitTransactionReply.newBuilder().build()));
+
+ assertEquals("isSerializedType", true, CommitTransactionReply.isSerializedType(new CommitTransactionReply()));
+ assertEquals("isSerializedType", false, CommitTransactionReply.isSerializedType(new Object()));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.cluster.datastore.messages;
+
+import static org.junit.Assert.assertEquals;
+import java.io.Serializable;
+import org.apache.commons.lang.SerializationUtils;
+import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
+import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
+
+/**
+ * Unit tests for CommitTransaction.
+ *
+ * @author Thomas Pantelis
+ */
+public class CommitTransactionTest {
+
+ @Test
+ public void testSerialization() {
+ CommitTransaction expected = new CommitTransaction("txId", DataStoreVersions.CURRENT_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", CommitTransaction.class, serialized.getClass());
+
+ CommitTransaction actual = CommitTransaction.fromSerializable(
+ SerializationUtils.clone((Serializable) serialized));
+ assertEquals("getTransactionID", expected.getTransactionID(), actual.getTransactionID());
+ assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
+ }
+
+ @Test
+ public void testSerializationWithPreBoronVersion() {
+ CommitTransaction expected = new CommitTransaction("txId", DataStoreVersions.LITHIUM_VERSION);
+
+ Object serialized = expected.toSerializable();
+ assertEquals("Serialized type", ThreePhaseCommitCohortMessages.CommitTransaction.class, serialized.getClass());
+
+ CommitTransaction actual = CommitTransaction.fromSerializable(
+ SerializationUtils.clone((Serializable) serialized));
+ assertEquals("getTransactionID", expected.getTransactionID(), actual.getTransactionID());
+ assertEquals("getVersion", DataStoreVersions.LITHIUM_VERSION, actual.getVersion());
+ }
+
+ @Test
+ public void testIsSerializedType() {
+ assertEquals("isSerializedType", true, CommitTransaction.isSerializedType(
+ ThreePhaseCommitCohortMessages.CommitTransaction.newBuilder().setTransactionId("").build()));
+
+ assertEquals("isSerializedType", true, CommitTransaction.isSerializedType(new CommitTransaction()));
+ assertEquals("isSerializedType", false, CommitTransaction.isSerializedType(new Object()));
+ }
+}