Commit 6c789e5b authored by Fotis Soldatos's avatar Fotis Soldatos
Browse files

Merge branch 'automation/modify-automation-proto-to-use-context-empty' into 'develop'

refactor(automation): modify automation.proto to use context.Empty

See merge request teraflow-h2020/controller!153
parents 02cc24e8 1054dcc2
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ service AutomationService {
  rpc ZtpAdd(DeviceRole) returns (DeviceRoleState) {}
  rpc ZtpUpdate(DeviceRole) returns (DeviceRoleState) {}
  rpc ZtpDelete(DeviceRole) returns (DeviceRoleState) {}
  rpc ZtpDeleteAll(Empty) returns (DeviceDeletionResult) {}
  rpc ZtpDeleteAll(context.Empty) returns (DeviceDeletionResult) {}
}

enum DeviceRoleType {
@@ -56,8 +56,6 @@ message DeviceDeletionResult {
  repeated string deleted = 1;
}

message Empty {}

enum ZtpDeviceState {
  ZTP_DEV_STATE_UNDEFINED = 0;
  ZTP_DEV_STATE_CREATED  = 1;
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ public class AutomationGatewayImpl implements AutomationGateway {
    }

    @Override
    public Uni<Automation.DeviceDeletionResult> ztpDeleteAll(Automation.Empty empty) {
    public Uni<Automation.DeviceDeletionResult> ztpDeleteAll(ContextOuterClass.Empty empty) {
        return Uni.createFrom().item(() -> Automation.DeviceDeletionResult.newBuilder().build());
    }

+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat;

import automation.Automation;
import automation.AutomationService;
import context.ContextOuterClass;
import eu.teraflow.automation.context.ContextGateway;
import eu.teraflow.automation.context.model.ConfigActionEnum;
import eu.teraflow.automation.context.model.ConfigRule;
@@ -236,7 +237,7 @@ class AutomationServiceTest {
    void shouldDeleteAllDevicesRolesByDeviceId()
            throws ExecutionException, InterruptedException, TimeoutException {
        CompletableFuture<String> message = new CompletableFuture<>();
        final var empty = Automation.Empty.newBuilder().build();
        final var empty = ContextOuterClass.Empty.newBuilder().build();

        client
                .ztpDeleteAll(empty)
+17 −446
Original line number Diff line number Diff line
@@ -3977,424 +3977,6 @@ public final class Automation {

  }

  public interface EmptyOrBuilder extends
      // @@protoc_insertion_point(interface_extends:automation.Empty)
      com.google.protobuf.MessageOrBuilder {
  }
  /**
   * Protobuf type {@code automation.Empty}
   */
  public static final class Empty extends
      com.google.protobuf.GeneratedMessageV3 implements
      // @@protoc_insertion_point(message_implements:automation.Empty)
      EmptyOrBuilder {
  private static final long serialVersionUID = 0L;
    // Use Empty.newBuilder() to construct.
    private Empty(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }
    private Empty() {
    }

    @java.lang.Override
    @SuppressWarnings({"unused"})
    protected java.lang.Object newInstance(
        UnusedPrivateParameter unused) {
      return new Empty();
    }

    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
    getUnknownFields() {
      return this.unknownFields;
    }
    private Empty(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      this();
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(
                  input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return automation.Automation.internal_static_automation_Empty_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return automation.Automation.internal_static_automation_Empty_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              automation.Automation.Empty.class, automation.Automation.Empty.Builder.class);
    }

    private byte memoizedIsInitialized = -1;
    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      unknownFields.writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      size += unknownFields.getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
       return true;
      }
      if (!(obj instanceof automation.Automation.Empty)) {
        return super.equals(obj);
      }
      automation.Automation.Empty other = (automation.Automation.Empty) obj;

      if (!unknownFields.equals(other.unknownFields)) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (29 * hash) + unknownFields.hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static automation.Automation.Empty parseFrom(
        java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static automation.Automation.Empty parseFrom(
        java.nio.ByteBuffer data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static automation.Automation.Empty parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static automation.Automation.Empty parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static automation.Automation.Empty parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static automation.Automation.Empty parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static automation.Automation.Empty parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static automation.Automation.Empty parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input, extensionRegistry);
    }
    public static automation.Automation.Empty parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseDelimitedWithIOException(PARSER, input);
    }
    public static automation.Automation.Empty parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
    }
    public static automation.Automation.Empty parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static automation.Automation.Empty parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }
    public static Builder newBuilder(automation.Automation.Empty prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }
    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE
          ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code automation.Empty}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:automation.Empty)
        automation.Automation.EmptyOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return automation.Automation.internal_static_automation_Empty_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return automation.Automation.internal_static_automation_Empty_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                automation.Automation.Empty.class, automation.Automation.Empty.Builder.class);
      }

      // Construct using automation.Automation.Empty.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessageV3
                .alwaysUseFieldBuilders) {
        }
      }
      @java.lang.Override
      public Builder clear() {
        super.clear();
        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return automation.Automation.internal_static_automation_Empty_descriptor;
      }

      @java.lang.Override
      public automation.Automation.Empty getDefaultInstanceForType() {
        return automation.Automation.Empty.getDefaultInstance();
      }

      @java.lang.Override
      public automation.Automation.Empty build() {
        automation.Automation.Empty result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public automation.Automation.Empty buildPartial() {
        automation.Automation.Empty result = new automation.Automation.Empty(this);
        onBuilt();
        return result;
      }

      @java.lang.Override
      public Builder clone() {
        return super.clone();
      }
      @java.lang.Override
      public Builder setField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          java.lang.Object value) {
        return super.setField(field, value);
      }
      @java.lang.Override
      public Builder clearField(
          com.google.protobuf.Descriptors.FieldDescriptor field) {
        return super.clearField(field);
      }
      @java.lang.Override
      public Builder clearOneof(
          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
        return super.clearOneof(oneof);
      }
      @java.lang.Override
      public Builder setRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          int index, java.lang.Object value) {
        return super.setRepeatedField(field, index, value);
      }
      @java.lang.Override
      public Builder addRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          java.lang.Object value) {
        return super.addRepeatedField(field, value);
      }
      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof automation.Automation.Empty) {
          return mergeFrom((automation.Automation.Empty)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(automation.Automation.Empty other) {
        if (other == automation.Automation.Empty.getDefaultInstance()) return this;
        this.mergeUnknownFields(other.unknownFields);
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        automation.Automation.Empty parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (automation.Automation.Empty) e.getUnfinishedMessage();
          throw e.unwrapIOException();
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      @java.lang.Override
      public final Builder setUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.setUnknownFields(unknownFields);
      }

      @java.lang.Override
      public final Builder mergeUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.mergeUnknownFields(unknownFields);
      }


      // @@protoc_insertion_point(builder_scope:automation.Empty)
    }

    // @@protoc_insertion_point(class_scope:automation.Empty)
    private static final automation.Automation.Empty DEFAULT_INSTANCE;
    static {
      DEFAULT_INSTANCE = new automation.Automation.Empty();
    }

    public static automation.Automation.Empty getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<Empty>
        PARSER = new com.google.protobuf.AbstractParser<Empty>() {
      @java.lang.Override
      public Empty parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new Empty(input, extensionRegistry);
      }
    };

    public static com.google.protobuf.Parser<Empty> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<Empty> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public automation.Automation.Empty getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }

  }

  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_automation_DeviceRoleId_descriptor;
  private static final 
@@ -4420,11 +4002,6 @@ public final class Automation {
  private static final 
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_automation_DeviceDeletionResult_fieldAccessorTable;
  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_automation_Empty_descriptor;
  private static final 
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_automation_Empty_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
@@ -4445,23 +4022,23 @@ public final class Automation {
      "evRoleId\030\001 \001(\0132\030.automation.DeviceRoleId" +
      "\0220\n\014devRoleState\030\002 \001(\0162\032.automation.ZtpD" +
      "eviceState\"\'\n\024DeviceDeletionResult\022\017\n\007de" +
      "leted\030\001 \003(\t\"\007\n\005Empty*H\n\016DeviceRoleType\022\010" +
      "\n\004NONE\020\000\022\013\n\007DEV_OPS\020\001\022\014\n\010DEV_CONF\020\002\022\021\n\rP" +
      "IPELINE_CONF\020\003*~\n\016ZtpDeviceState\022\033\n\027ZTP_" +
      "DEV_STATE_UNDEFINED\020\000\022\031\n\025ZTP_DEV_STATE_C" +
      "REATED\020\001\022\031\n\025ZTP_DEV_STATE_UPDATED\020\002\022\031\n\025Z" +
      "TP_DEV_STATE_DELETED\020\0032\273\003\n\021AutomationSer" +
      "vice\022F\n\020ZtpGetDeviceRole\022\030.automation.De" +
      "viceRoleId\032\026.automation.DeviceRole\"\000\022N\n\033" +
      "ZtpGetDeviceRolesByDeviceId\022\021.context.De" +
      "viceId\032\032.automation.DeviceRoleList\"\000\022?\n\006" +
      "ZtpAdd\022\026.automation.DeviceRole\032\033.automat" +
      "ion.DeviceRoleState\"\000\022B\n\tZtpUpdate\022\026.aut" +
      "omation.DeviceRole\032\033.automation.DeviceRo" +
      "leState\"\000\022B\n\tZtpDelete\022\026.automation.Devi" +
      "ceRole\032\033.automation.DeviceRoleState\"\000\022E\n" +
      "\014ZtpDeleteAll\022\021.automation.Empty\032 .autom" +
      "ation.DeviceDeletionResult\"\000b\006proto3"
      "leted\030\001 \003(\t*H\n\016DeviceRoleType\022\010\n\004NONE\020\000\022" +
      "\013\n\007DEV_OPS\020\001\022\014\n\010DEV_CONF\020\002\022\021\n\rPIPELINE_C" +
      "ONF\020\003*~\n\016ZtpDeviceState\022\033\n\027ZTP_DEV_STATE" +
      "_UNDEFINED\020\000\022\031\n\025ZTP_DEV_STATE_CREATED\020\001\022" +
      "\031\n\025ZTP_DEV_STATE_UPDATED\020\002\022\031\n\025ZTP_DEV_ST" +
      "ATE_DELETED\020\0032\270\003\n\021AutomationService\022F\n\020Z" +
      "tpGetDeviceRole\022\030.automation.DeviceRoleI" +
      "d\032\026.automation.DeviceRole\"\000\022N\n\033ZtpGetDev" +
      "iceRolesByDeviceId\022\021.context.DeviceId\032\032." +
      "automation.DeviceRoleList\"\000\022?\n\006ZtpAdd\022\026." +
      "automation.DeviceRole\032\033.automation.Devic" +
      "eRoleState\"\000\022B\n\tZtpUpdate\022\026.automation.D" +
      "eviceRole\032\033.automation.DeviceRoleState\"\000" +
      "\022B\n\tZtpDelete\022\026.automation.DeviceRole\032\033." +
      "automation.DeviceRoleState\"\000\022B\n\014ZtpDelet" +
      "eAll\022\016.context.Empty\032 .automation.Device" +
      "DeletionResult\"\000b\006proto3"
    };
    descriptor = com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
@@ -4498,12 +4075,6 @@ public final class Automation {
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_automation_DeviceDeletionResult_descriptor,
        new java.lang.String[] { "Deleted", });
    internal_static_automation_Empty_descriptor =
      getDescriptor().getMessageTypes().get(5);
    internal_static_automation_Empty_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_automation_Empty_descriptor,
        new java.lang.String[] { });
    context.ContextOuterClass.getDescriptor();
  }

+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ public interface AutomationService extends MutinyService {
    
    io.smallrye.mutiny.Uni<automation.Automation.DeviceRoleState> ztpDelete(automation.Automation.DeviceRole request);
    
    io.smallrye.mutiny.Uni<automation.Automation.DeviceDeletionResult> ztpDeleteAll(automation.Automation.Empty request);
    io.smallrye.mutiny.Uni<automation.Automation.DeviceDeletionResult> ztpDeleteAll(context.ContextOuterClass.Empty request);
    
    
    
Loading