Package com.google.eclipse.protobuf.protobuf

Examples of com.google.eclipse.protobuf.protobuf.MessageField


  //
  // message Summary {
  //   repeated base.shared.Type type = 1;
  // }
  @Test public void should_include_package_intersection() {
    MessageField field = xtext.find("type", " =", MessageField.class);
    IScope scope = scopeProvider.scope_ComplexTypeLink_target((ComplexTypeLink) field.getType(), reference);
    assertThat(descriptionsIn(scope), contain("base.shared.Type", "proto.base.shared.Type",
                                              "google.proto.base.shared.Type", "com.google.proto.base.shared.Type"));
  }
View Full Code Here


  //   message NestedMessage {
  //     optional MyGroup mygroup = 2207766;
  //   }
  // }
  @Test public void should_treat_groups_as_types() {
    MessageField field = xtext.find("mygroup", MessageField.class);
    IScope scope = scopeProvider.scope_ComplexTypeLink_target((ComplexTypeLink) field.getType(), reference);
    assertThat(descriptionsIn(scope), contain("Root.MyGroup", "MyGroup"));
  }
View Full Code Here

  //   DRAFT = 0;
  //   READY = 1;
  // }
  @Test public void should_find_closest_type_possible() {
    Literal active = xtext.find("ACTIVE", " = 0", Literal.class);
    MessageField field = xtext.find("status", MessageField.class);
    ComplexTypeLink link = (ComplexTypeLink) field.getType();
    IScope scope = scopeProvider.scope_ComplexTypeLink_target(link, reference);
    EObject status = descriptionsIn(scope).objectDescribedAs("Status");
    assertSame(active.eContainer(), status);
  }
View Full Code Here

  // message Person {
  //   optional boolean active = 1 [(encoding) = 'UTF-8'];
  // }
  @Test public void should_return_source_of_field_option() {
    CustomFieldOption option = xtext.find("encoding", ")", CustomFieldOption.class);
    MessageField field = (MessageField) options.sourceOf(option);
    assertThat(field.getName(), equalTo("encoding"));
  }
View Full Code Here

  // message Person {
  //   optional boolean active = 1 [(custom).count = 6];
  // }
  @Test public void should_return_source_of_field_in_field_option() {
    CustomFieldOption option = xtext.find("custom", ").", CustomFieldOption.class);
    MessageField field = (MessageField) options.sourceOf(option);
    assertThat(field.getName(), equalTo("count"));
  }
View Full Code Here

  //
  // message Summary {
  //   repeated base.shared.Outer.Type type = 1;
  // }
  @Test public void should_include_package_intersection() {
    MessageField field = xtext.find("type", " =", MessageField.class);
    IScope scope = scopeProvider.scope_ComplexTypeLink_target((ComplexTypeLink) field.getType(), reference);
    assertThat(descriptionsIn(scope), contain("base.shared.Outer.Type", "proto.base.shared.Outer.Type",
                                              "google.proto.base.shared.Outer.Type",
                                              "com.google.proto.base.shared.Outer.Type"));
  }
View Full Code Here

  // }
  //
  // option (encoding) = 'UTF-8';
  @Test public void should_return_source_of_custom_option() {
    CustomOption option = xtext.find("encoding", ")", CustomOption.class);
    MessageField p = (MessageField) options.sourceOf(option);
    assertThat(p.getName(), equalTo("encoding"));
  }
View Full Code Here

  // }
  //
  // option (custom).count = 6;
  @Test public void should_return_source_of_field_in_option() {
    CustomOption option = xtext.find("custom", ")", CustomOption.class);
    MessageField p = (MessageField) options.sourceOf(option);
    assertThat(p.getName(), equalTo("count"));
  }
View Full Code Here

  //
  // message FieldType {
  //   optional google.protobuf.FieldDescriptorProto.Type type = 1;
  // }
  @Test public void should_see_types_from_descriptor_other_than_Messages() {
    MessageField field = xtext.find("type", MessageField.class);
    TypeLink type = field.getType();
    IScope scope = scopeProvider.scope_ComplexTypeLink_target((ComplexTypeLink) type, reference);
    assertThat(descriptionsIn(scope), contain("google.protobuf.FieldDescriptorProto.Type"));
  }
View Full Code Here

  //
  // message Person {
  //   optional Type type = 1;
  // }
  @Test public void should_return_label_for_field() {
    MessageField field = xtext.find("type", MessageField.class);
    Object label = labels.labelFor(field);
    assertThat(label, instanceOf(StyledString.class));
    StyledString labelText = (StyledString) label;
    assertThat(labelText.getString(), equalTo("type [1] : Type"));
  }
View Full Code Here

TOP

Related Classes of com.google.eclipse.protobuf.protobuf.MessageField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.