• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java TestPackedExtensionsLite类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.google.protobuf.UnittestLite.TestPackedExtensionsLite的典型用法代码示例。如果您正苦于以下问题:Java TestPackedExtensionsLite类的具体用法?Java TestPackedExtensionsLite怎么用?Java TestPackedExtensionsLite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

TestPackedExtensionsLite类属于com.google.protobuf.UnittestLite包,在下文中一共展示了TestPackedExtensionsLite类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testParseDelimitedTo

点赞 3

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public void testParseDelimitedTo() throws Exception {
  // Write normal Message.
  TestAllTypes normalMessage = TestUtil.getAllSet();
  ByteArrayOutputStream output = new ByteArrayOutputStream();
  normalMessage.writeDelimitedTo(output);

  // Write MessageLite with packed extension fields.
  TestPackedExtensionsLite packedMessage =
      TestUtil.getLitePackedExtensionsSet();
  packedMessage.writeDelimitedTo(output);

  InputStream input = new ByteArrayInputStream(output.toByteArray());
  assertMessageEquals(
      normalMessage,
      normalMessage.getParserForType().parseDelimitedFrom(input));
  assertMessageEquals(
      packedMessage,
      packedMessage.getParserForType().parseDelimitedFrom(
          input, TestUtil.getExtensionRegistryLite()));
}
 

开发者ID:Microsoft,
项目名称:vsminecraft,
代码行数:21,
代码来源:ParserTest.java

示例2: testParseDelimitedToLite

点赞 3

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public void testParseDelimitedToLite() throws Exception {
  // Write MessageLite with packed extension fields.
  TestPackedExtensionsLite packedMessage = TestUtilLite.getLitePackedExtensionsSet();
  ByteArrayOutputStream output = new ByteArrayOutputStream();
  packedMessage.writeDelimitedTo(output);
  packedMessage.writeDelimitedTo(output);

  InputStream input = new ByteArrayInputStream(output.toByteArray());
  assertMessageEquals(
      packedMessage,
      packedMessage
          .getParserForType()
          .parseDelimitedFrom(input, TestUtilLite.getExtensionRegistryLite()));
  assertMessageEquals(
      packedMessage,
      packedMessage
          .getParserForType()
          .parseDelimitedFrom(input, TestUtilLite.getExtensionRegistryLite()));
}
 

开发者ID:bazelbuild,
项目名称:bazel,
代码行数:20,
代码来源:ParserTest.java

示例3: testSerializePackedExtensionsLite

点赞 2

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public void testSerializePackedExtensionsLite() throws Exception {
  // TestPackedTypes and TestPackedExtensions should have compatible wire
  // formats; check that they serialize to the same string.
  TestPackedExtensionsLite message = TestUtil.getLitePackedExtensionsSet();
  ByteString rawBytes = message.toByteString();

  TestPackedTypes message2 = TestUtil.getPackedSet();
  ByteString rawBytes2 = message2.toByteString();

  assertEquals(rawBytes, rawBytes2);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:12,
代码来源:WireFormatTest.java

示例4: testParsePackedExtensionsLite

点赞 2

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public void testParsePackedExtensionsLite() throws Exception {
  // Ensure that packed extensions can be properly parsed.
  TestPackedExtensionsLite message = TestUtil.getLitePackedExtensionsSet();
  ByteString rawBytes = message.toByteString();

  ExtensionRegistryLite registry = TestUtil.getExtensionRegistryLite();

  TestPackedExtensionsLite message2 =
      TestPackedExtensionsLite.parseFrom(rawBytes, registry);

  TestUtil.assertPackedExtensionsSet(message2);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:13,
代码来源:WireFormatTest.java

示例5: setPackedExtensions

点赞 2

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public static void setPackedExtensions(TestPackedExtensionsLite.Builder message) {
  message.addExtension(packedInt32ExtensionLite   , 601);
  message.addExtension(packedInt64ExtensionLite   , 602L);
  message.addExtension(packedUint32ExtensionLite  , 603);
  message.addExtension(packedUint64ExtensionLite  , 604L);
  message.addExtension(packedSint32ExtensionLite  , 605);
  message.addExtension(packedSint64ExtensionLite  , 606L);
  message.addExtension(packedFixed32ExtensionLite , 607);
  message.addExtension(packedFixed64ExtensionLite , 608L);
  message.addExtension(packedSfixed32ExtensionLite, 609);
  message.addExtension(packedSfixed64ExtensionLite, 610L);
  message.addExtension(packedFloatExtensionLite   , 611F);
  message.addExtension(packedDoubleExtensionLite  , 612D);
  message.addExtension(packedBoolExtensionLite    , true);
  message.addExtension(packedEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAR);
  // Add a second one of each field.
  message.addExtension(packedInt32ExtensionLite   , 701);
  message.addExtension(packedInt64ExtensionLite   , 702L);
  message.addExtension(packedUint32ExtensionLite  , 703);
  message.addExtension(packedUint64ExtensionLite  , 704L);
  message.addExtension(packedSint32ExtensionLite  , 705);
  message.addExtension(packedSint64ExtensionLite  , 706L);
  message.addExtension(packedFixed32ExtensionLite , 707);
  message.addExtension(packedFixed64ExtensionLite , 708L);
  message.addExtension(packedSfixed32ExtensionLite, 709);
  message.addExtension(packedSfixed64ExtensionLite, 710L);
  message.addExtension(packedFloatExtensionLite   , 711F);
  message.addExtension(packedDoubleExtensionLite  , 712D);
  message.addExtension(packedBoolExtensionLite    , false);
  message.addExtension(packedEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ);
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:32,
代码来源:TestUtil.java

示例6: testSerializePackedExtensionsLite

点赞 2

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public void testSerializePackedExtensionsLite() throws Exception {
  // TestPackedTypes and TestPackedExtensions should have compatible wire
  // formats; check that they serialize to the same string.
  TestPackedExtensionsLite message = TestUtilLite.getLitePackedExtensionsSet();
  ByteString rawBytes = message.toByteString();

  TestPackedTypes message2 = TestUtil.getPackedSet();
  ByteString rawBytes2 = message2.toByteString();

  assertEquals(rawBytes, rawBytes2);
}
 

开发者ID:bazelbuild,
项目名称:bazel,
代码行数:12,
代码来源:WireFormatTest.java

示例7: testParsePackedExtensionsLite

点赞 2

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public void testParsePackedExtensionsLite() throws Exception {
  // Ensure that packed extensions can be properly parsed.
  TestPackedExtensionsLite message = TestUtilLite.getLitePackedExtensionsSet();
  ByteString rawBytes = message.toByteString();

  ExtensionRegistryLite registry = TestUtilLite.getExtensionRegistryLite();

  TestPackedExtensionsLite message2 =
      TestPackedExtensionsLite.parseFrom(rawBytes, registry);

  TestUtil.assertPackedExtensionsSet(message2);
}
 

开发者ID:bazelbuild,
项目名称:bazel,
代码行数:13,
代码来源:WireFormatTest.java

示例8: getLitePackedExtensionsSet

点赞 2

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public static TestPackedExtensionsLite getLitePackedExtensionsSet() {
  TestPackedExtensionsLite.Builder builder =
      TestPackedExtensionsLite.newBuilder();
  setPackedExtensions(builder);
  return builder.build();
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:7,
代码来源:TestUtil.java

示例9: assertPackedExtensionsSet

点赞 2

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public static void assertPackedExtensionsSet(TestPackedExtensionsLite message) {
  Assert.assertEquals(2, message.getExtensionCount(packedInt32ExtensionLite   ));
  Assert.assertEquals(2, message.getExtensionCount(packedInt64ExtensionLite   ));
  Assert.assertEquals(2, message.getExtensionCount(packedUint32ExtensionLite  ));
  Assert.assertEquals(2, message.getExtensionCount(packedUint64ExtensionLite  ));
  Assert.assertEquals(2, message.getExtensionCount(packedSint32ExtensionLite  ));
  Assert.assertEquals(2, message.getExtensionCount(packedSint64ExtensionLite  ));
  Assert.assertEquals(2, message.getExtensionCount(packedFixed32ExtensionLite ));
  Assert.assertEquals(2, message.getExtensionCount(packedFixed64ExtensionLite ));
  Assert.assertEquals(2, message.getExtensionCount(packedSfixed32ExtensionLite));
  Assert.assertEquals(2, message.getExtensionCount(packedSfixed64ExtensionLite));
  Assert.assertEquals(2, message.getExtensionCount(packedFloatExtensionLite   ));
  Assert.assertEquals(2, message.getExtensionCount(packedDoubleExtensionLite  ));
  Assert.assertEquals(2, message.getExtensionCount(packedBoolExtensionLite    ));
  Assert.assertEquals(2, message.getExtensionCount(packedEnumExtensionLite));
  assertEqualsExactType(601  , message.getExtension(packedInt32ExtensionLite   , 0));
  assertEqualsExactType(602L , message.getExtension(packedInt64ExtensionLite   , 0));
  assertEqualsExactType(603  , message.getExtension(packedUint32ExtensionLite  , 0));
  assertEqualsExactType(604L , message.getExtension(packedUint64ExtensionLite  , 0));
  assertEqualsExactType(605  , message.getExtension(packedSint32ExtensionLite  , 0));
  assertEqualsExactType(606L , message.getExtension(packedSint64ExtensionLite  , 0));
  assertEqualsExactType(607  , message.getExtension(packedFixed32ExtensionLite , 0));
  assertEqualsExactType(608L , message.getExtension(packedFixed64ExtensionLite , 0));
  assertEqualsExactType(609  , message.getExtension(packedSfixed32ExtensionLite, 0));
  assertEqualsExactType(610L , message.getExtension(packedSfixed64ExtensionLite, 0));
  assertEqualsExactType(611F , message.getExtension(packedFloatExtensionLite   , 0));
  assertEqualsExactType(612D , message.getExtension(packedDoubleExtensionLite  , 0));
  assertEqualsExactType(true , message.getExtension(packedBoolExtensionLite    , 0));
  assertEqualsExactType(ForeignEnumLite.FOREIGN_LITE_BAR,
                        message.getExtension(packedEnumExtensionLite, 0));
  assertEqualsExactType(701  , message.getExtension(packedInt32ExtensionLite   , 1));
  assertEqualsExactType(702L , message.getExtension(packedInt64ExtensionLite   , 1));
  assertEqualsExactType(703  , message.getExtension(packedUint32ExtensionLite  , 1));
  assertEqualsExactType(704L , message.getExtension(packedUint64ExtensionLite  , 1));
  assertEqualsExactType(705  , message.getExtension(packedSint32ExtensionLite  , 1));
  assertEqualsExactType(706L , message.getExtension(packedSint64ExtensionLite  , 1));
  assertEqualsExactType(707  , message.getExtension(packedFixed32ExtensionLite , 1));
  assertEqualsExactType(708L , message.getExtension(packedFixed64ExtensionLite , 1));
  assertEqualsExactType(709  , message.getExtension(packedSfixed32ExtensionLite, 1));
  assertEqualsExactType(710L , message.getExtension(packedSfixed64ExtensionLite, 1));
  assertEqualsExactType(711F , message.getExtension(packedFloatExtensionLite   , 1));
  assertEqualsExactType(712D , message.getExtension(packedDoubleExtensionLite  , 1));
  assertEqualsExactType(false, message.getExtension(packedBoolExtensionLite    , 1));
  assertEqualsExactType(ForeignEnumLite.FOREIGN_LITE_BAZ,
                        message.getExtension(packedEnumExtensionLite, 1));
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:47,
代码来源:TestUtil.java

示例10: getLitePackedExtensionsSet

点赞 2

import com.google.protobuf.UnittestLite.TestPackedExtensionsLite; //导入依赖的package包/类
public static TestPackedExtensionsLite getLitePackedExtensionsSet() {
  TestPackedExtensionsLite.Builder builder = TestPackedExtensionsLite.newBuilder();
  setPackedExtensions(builder);
  return builder.build();
}
 

开发者ID:bazelbuild,
项目名称:bazel,
代码行数:6,
代码来源:TestUtilLite.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)