gpt4 book ai didi

uk.co.real_logic.sbe.xml.XmlSchemaParser.parse()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 03:45:05 36 4
gpt4 key购买 nike

本文整理了Java中uk.co.real_logic.sbe.xml.XmlSchemaParser.parse()方法的一些代码示例,展示了XmlSchemaParser.parse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlSchemaParser.parse()方法的具体详情如下:
包路径:uk.co.real_logic.sbe.xml.XmlSchemaParser
类名称:XmlSchemaParser
方法名:parse

XmlSchemaParser.parse介绍

[英]Take an InputStream and parse it generating map of template ID to Message objects, types, and schema.

Exceptions are passed back up for any problems.
[中]获取一个InputStream并对其进行解析,生成模板ID到消息对象、类型和模式的映射。
任何问题的异常都会被传回。

代码示例

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldHandleBasicFileWithGroup()
  throws Exception
{
  parse(TestUtil.getLocalResource("basic-group-schema.xml"), ParserOptions.DEFAULT);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldHandleBasicFileWithVariableLengthData()
  throws Exception
{
  parse(TestUtil.getLocalResource("basic-variable-length-schema.xml"), ParserOptions.DEFAULT);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
  public void shouldHandleEmbeddedLengthForData()
    throws Exception
  {
    parse(TestUtil.getLocalResource("embedded-length-and-count-schema.xml"), ParserOptions.DEFAULT);
    /* should parse correctly */
  }
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldHandleBasicFile()
  throws Exception
{
  parse(TestUtil.getLocalResource("basic-schema.xml"), ParserOptions.DEFAULT);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldHandleConstantHeaderField()
  throws Exception
{
  parse(TestUtil.getLocalResource("basic-schema-constant-header-field.xml"), ParserOptions.DEFAULT);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldCalculateDataOffsetWithPaddingFromBlockLength()
  throws Exception
{
  final MessageSchema schema = parse(TestUtil.getLocalResource(
    "block-length-schema.xml"), ParserOptions.DEFAULT);
  final List<Field> fields = schema.getMessage(4).fields();
  assertThat(valueOf(fields.get(0).computedOffset()), is(valueOf(0)));
  assertThat(valueOf(fields.get(0).type().encodedLength()), is(valueOf(8)));
  assertThat(valueOf(fields.get(1).computedOffset()), is(valueOf(64)));
  assertThat(valueOf(fields.get(1).type().encodedLength()), is(valueOf(-1)));
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldCalculateCompositeSizeWithOffsetsSpecified()
  throws Exception
{
  final MessageSchema schema = parse(TestUtil.getLocalResource(
    "composite-offsets-schema.xml"), ParserOptions.DEFAULT);
  final CompositeType header = schema.messageHeader();
  assertThat(valueOf(header.encodedLength()), is(valueOf(12)));
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
  public void shouldCalculateDimensionSizeWithOffsetsSpecified()
    throws Exception
  {
    final MessageSchema schema = parse(TestUtil.getLocalResource(
      "composite-offsets-schema.xml"), ParserOptions.DEFAULT);
    final CompositeType dimensions = schema.getMessage(1).fields().get(0).dimensionType();

    assertThat(valueOf(dimensions.encodedLength()), is(valueOf(8)));
  }
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldEncodeIr()
  throws Exception
{
  final MessageSchema schema = parse(TestUtil.getLocalResource("basic-schema.xml"), ParserOptions.DEFAULT);
  final IrGenerator irg = new IrGenerator();
  final Ir ir = irg.generate(schema);
  final ByteBuffer buffer = ByteBuffer.allocateDirect(CAPACITY);
  final IrEncoder irEncoder = new IrEncoder(buffer, ir);
  irEncoder.encode();
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldExitAfterTypes()
  throws Exception
{
  exceptionRule.expect(IllegalStateException.class);
  exceptionRule.expectMessage("had 2 errors");
  final ParserOptions options = ParserOptions.builder().suppressOutput(true).build();
  parse(TestUtil.getLocalResource("error-handler-types-schema.xml"), options);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldExitAfterMessage()
  throws Exception
{
  exceptionRule.expect(IllegalStateException.class);
  exceptionRule.expectMessage("had 13 errors");
  final ParserOptions options = ParserOptions.builder().suppressOutput(true).warningsFatal(true).build();
  parse(TestUtil.getLocalResource("error-handler-message-schema.xml"), options);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldExitAfterMessageWhenGroupDimensionsNotComposite()
  throws Exception
{
  exceptionRule.expect(IllegalStateException.class);
  exceptionRule.expectMessage("had 1 errors");
  final ParserOptions options = ParserOptions.builder().suppressOutput(true).warningsFatal(true).build();
  parse(TestUtil.getLocalResource("error-handler-group-dimensions-schema.xml"), options);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
  public void shouldTestForCyclicRefs()
    throws Exception
  {
    exceptionRule.expect(IllegalStateException.class);
    exceptionRule.expectMessage("ref types cannot create circular dependencies");

    final ParserOptions options = ParserOptions.builder().suppressOutput(true).warningsFatal(true).build();

    parse(TestUtil.getLocalResource("cyclic-refs-schema.xml"), options);
  }
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldExitAfterTypesWhenDupTypesDefined()
  throws Exception
{
  exceptionRule.expect(IllegalStateException.class);
  exceptionRule.expectMessage("had 1 warnings");
  final ParserOptions options = ParserOptions.builder().suppressOutput(true).warningsFatal(true).build();
  parse(TestUtil.getLocalResource("error-handler-types-dup-schema.xml"), options);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldExitInvalidFieldNames()
  throws Exception
{
  exceptionRule.expect(IllegalStateException.class);
  exceptionRule.expectMessage("had 16 warnings");
  final ParserOptions options = ParserOptions.builder().suppressOutput(true).warningsFatal(true).build();
  parse(TestUtil.getLocalResource("error-handler-invalid-name.xml"), options);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldExitAfterMessageWhenDupMessageIdsDefined()
  throws Exception
{
  exceptionRule.expect(IllegalStateException.class);
  exceptionRule.expectMessage("had 1 errors");
  final ParserOptions options = ParserOptions.builder().suppressOutput(true).warningsFatal(true).build();
  parse(TestUtil.getLocalResource("error-handler-dup-message-schema.xml"), options);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
public void shouldExitAfterTypesWhenCompositeOffsetsIncorrect()
  throws Exception
{
  exceptionRule.expect(IllegalStateException.class);
  exceptionRule.expectMessage("had 2 errors");
  final ParserOptions options = ParserOptions.builder().suppressOutput(true).warningsFatal(true).build();
  parse(TestUtil.getLocalResource("error-handler-invalid-composite-offsets-schema.xml"), options);
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Test
  public void shouldGenerateCorrectIrForCompositeRefs()
    throws Exception
  {
    final MessageSchema schema = parse(getLocalResource("issue496.xml"), ParserOptions.DEFAULT);
    final IrGenerator irg = new IrGenerator();
    final Ir ir = irg.generate(schema);

    assertNotNull(ir.getType("compositeOne"));
    assertNotNull(ir.getType("compositeTwo"));
    assertNotNull(ir.getType("compositeThree"));
  }
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Before
public void setUp() throws Exception
{
  final ParserOptions options = ParserOptions.builder().stopOnError(true).build();
  final MessageSchema schema = parse(TestUtil.getLocalResource("code-generation-schema.xml"), options);
  final IrGenerator irg = new IrGenerator();
  ir = irg.generate(schema);
  outputManager.clear();
  outputManager.setPackageName(ir.applicableNamespace());
}

代码示例来源:origin: real-logic/simple-binary-encoding

@Before
public void setup() throws Exception
{
  final ParserOptions options = ParserOptions.builder().stopOnError(true).build();
  final MessageSchema schema = parse(TestUtil.getLocalResource("extension-schema.xml"), options);
  final IrGenerator irg = new IrGenerator();
  ir = irg.generate(schema);
  outputManager.clear();
  outputManager.setPackageName(ir.applicableNamespace());
  generator().generate();
}

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com