Examples of DbusEventFactory


Examples of com.linkedin.databus.core.DbusEventFactory

  static final long CONNECT_TIMEOUT_MS = 1000;

  @Test
  public void testClientSimpleRequestResponse()
  {
    DbusEventFactory eventFactory = new DbusEventV1Factory();

    SimpleTestServerConnection srvConn = new SimpleTestServerConnection(eventFactory.getByteOrder());
    srvConn.setPipelineFactory(new SimpleServerPipelineFactory());
    boolean serverStarted = srvConn.startSynchronously(101, CONNECT_TIMEOUT_MS);
    Assert.assertTrue(serverStarted, "server started");

    final SimpleTestClientConnection clientConn = new SimpleTestClientConnection(eventFactory.getByteOrder());
    clientConn.setPipelineFactory(new SimpleClientPipelineFactoryWithSleep(200));
    boolean clientConnected = clientConn.startSynchronously(101, CONNECT_TIMEOUT_MS);
    Assert.assertTrue(clientConnected, "client connected");

    //hook in to key places in the server pipeline
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventFactory

  {
    _schema = schema;
    _tableName = tableName;
    byte[] b = new byte[1024 * 1024];
    _buffer = ByteBuffer.wrap(b);
    DbusEventFactory eventFactory = new DbusEventV1Factory();
    _event = eventFactory.createReadOnlyDbusEventFromBuffer(_buffer, 0);
  }
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventFactory

    convertV2toV1EOP(byteKey);
  }

  public void convertV2toV1EOP(DbusEventKey dbusKey)
  {
    final DbusEventFactory eventV2Factory = new DbusEventV2Factory()// both versions share same _byteOrder var
    ByteBuffer serializationBuffer = ByteBuffer.allocate(1000).order(eventV2Factory.getByteOrder());

    try
    {
      DbusEventInfo eventInfo = new DbusEventInfo(null,
                                                  0L,
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventFactory

    assertFalse(eV2.size() == eV1.size());
  }

  public void convertV2toV1LongKey(DbusEventKey dbusKey)
  {
    final DbusEventFactory eventV2Factory = new DbusEventV2Factory()// both versions share same _byteOrder var
    String randomValue = RngUtils.randomString(100);
    ByteBuffer serializationBuffer = ByteBuffer.allocate(1000).order(eventV2Factory.getByteOrder());

    try
    {
      DbusEventInfo eventInfo = new DbusEventInfo(DbusOpcode.UPSERT, 0L, (short)0, partitionId, timeStamp, srcId,
                                                  schemaId, randomValue.getBytes(Charset.defaultCharset()), false, false);
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventFactory

      cfgBuilder.getTrace().setFilename(tmpFile.getAbsolutePath());
      cfgBuilder.getTrace().setNeedFileSuffix(true);

      //test that the first gets created
      PhysicalPartition pp = new PhysicalPartition(1, "TestPart");
      DbusEventFactory eventFactory = new DbusEventV2Factory();
      DbusEventBuffer buf1 = new DbusEventBuffer(cfgBuilder.build(), pp, eventFactory);
      buf1Trace = new File(tmpFile.getAbsolutePath() + "." + pp.getName() + "_" + pp.getId());
      Assert.assertTrue(buf1Trace.exists());

      buf1.start(1);
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventFactory

  public static DbusEventInternalReadable createReadOnlyDbusEventFromBuffer(ByteBuffer buf,
                                                                            int position,
                                                                            long seq,
                                                                            byte version)
  {
    DbusEventFactory eventFactory;
    if (version == DbusEventFactory.DBUS_EVENT_V1)
    {
      eventFactory = new DbusEventV1Factory();
    }
    else if (version == DbusEventFactory.DBUS_EVENT_V2)
    {
      eventFactory = new DbusEventV2Factory();
    }
    else
    {
      throw new UnsupportedDbusEventVersionRuntimeException(version);
    }
    DbusEventInternalWritable event = eventFactory.createWritableDbusEventFromBuffer(buf, position);
    event.setSequence(seq);
    event.applyCrc();
    return event;
  }
View Full Code Here

Examples of com.linkedin.databus.core.DbusEventFactory

                                                false,  // enable tracing
                                                true,  // auto-commit
                                                DbusEventFactory.DBUS_EVENT_V2,
                                                PAYLOAD_SCHEMA_VERSION,
                                                metadataPart);
    DbusEventFactory eventFactory = new DbusEventV2Factory();
    DbusEventKey eventKey = new DbusEventKey(LONG_KEY);
    ByteBuffer serialBuf = ByteBuffer.allocate(maxEventLen).order(eventFactory.getByteOrder());
    DbusEventFactory.serializeEvent(eventKey, serialBuf, eventInfo);

    return eventFactory.createReadOnlyDbusEventFromBuffer(serialBuf, 0);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.