当前位置: 首页>>代码示例>>Java>>正文


Java SinglePartitionWithoutOffsetsSystemAdmin类代码示例

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


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

示例1: testCoordinatorStreamSystemConsumer

import org.apache.samza.util.SinglePartitionWithoutOffsetsSystemAdmin; //导入依赖的package包/类
@Test
public void testCoordinatorStreamSystemConsumer() {
  Map<String, String> expectedConfig = new LinkedHashMap<String, String>();
  expectedConfig.put("job.id", "1234");
  SystemStream systemStream = new SystemStream("system", "stream");
  MockSystemConsumer systemConsumer = new MockSystemConsumer(new SystemStreamPartition(systemStream, new Partition(0)));
  CoordinatorStreamSystemConsumer consumer = new CoordinatorStreamSystemConsumer(systemStream, systemConsumer, new SinglePartitionWithoutOffsetsSystemAdmin());
  assertEquals(0, systemConsumer.getRegisterCount());
  consumer.register();
  assertEquals(1, systemConsumer.getRegisterCount());
  assertFalse(systemConsumer.isStarted());
  consumer.start();
  assertTrue(systemConsumer.isStarted());
  try {
    consumer.getConfig();
    fail("Should have failed when retrieving config before bootstrapping.");
  } catch (SamzaException e) {
    // Expected.
  }
  consumer.bootstrap();
  assertEquals(expectedConfig, consumer.getConfig());
  assertFalse(systemConsumer.isStopped());
  consumer.stop();
  assertTrue(systemConsumer.isStopped());
}
 
开发者ID:apache,项目名称:samza,代码行数:26,代码来源:TestCoordinatorStreamSystemConsumer.java

示例2: testCoordinatorStreamSystemConsumerRegisterOnceOnly

import org.apache.samza.util.SinglePartitionWithoutOffsetsSystemAdmin; //导入依赖的package包/类
@Test
public void testCoordinatorStreamSystemConsumerRegisterOnceOnly() throws Exception {
  Map<String, String> expectedConfig = new LinkedHashMap<String, String>();
  expectedConfig.put("job.id", "1234");
  SystemStream systemStream = new SystemStream("system", "stream");
  MockSystemConsumer systemConsumer = new MockSystemConsumer(new SystemStreamPartition(systemStream, new Partition(0)));
  CoordinatorStreamSystemConsumer consumer = new CoordinatorStreamSystemConsumer(systemStream, systemConsumer, new SinglePartitionWithoutOffsetsSystemAdmin());
  assertEquals(0, systemConsumer.getRegisterCount());
  consumer.register();
  assertEquals(1, systemConsumer.getRegisterCount());
  assertFalse(systemConsumer.isStarted());
  consumer.start();
  assertTrue(systemConsumer.isStarted());
  consumer.register();
  assertEquals(1, systemConsumer.getRegisterCount());
}
 
开发者ID:apache,项目名称:samza,代码行数:17,代码来源:TestCoordinatorStreamSystemConsumer.java

示例3: testOrderKeyRewrite

import org.apache.samza.util.SinglePartitionWithoutOffsetsSystemAdmin; //导入依赖的package包/类
/**
 * Verify that if a particular key-value is written, then another, then the original again,
 * that the original occurs last in the set.
 */
@Test
public void testOrderKeyRewrite() throws InterruptedException {
  final SystemStream systemStream = new SystemStream("system", "stream");
  final SystemStreamPartition ssp = new SystemStreamPartition(systemStream, new Partition(0));
  final SystemConsumer systemConsumer = mock(SystemConsumer.class);

  final List<IncomingMessageEnvelope> list = new ArrayList<>();
  SetConfig setConfig1 = new SetConfig("source", "key1", "value1");
  SetConfig setConfig2 = new SetConfig("source", "key1", "value2");
  SetConfig setConfig3 = new SetConfig("source", "key1", "value1");
  list.add(createIncomingMessageEnvelope(setConfig1, ssp));
  list.add(createIncomingMessageEnvelope(setConfig2, ssp));
  list.add(createIncomingMessageEnvelope(setConfig3, ssp));
  Map<SystemStreamPartition, List<IncomingMessageEnvelope>> messages = new HashMap<SystemStreamPartition, List<IncomingMessageEnvelope>>() {
    {
      put(ssp, list);
    }
  };
  when(systemConsumer.poll(anySet(), anyLong())).thenReturn(messages, Collections.<SystemStreamPartition, List<IncomingMessageEnvelope>>emptyMap());

  CoordinatorStreamSystemConsumer consumer = new CoordinatorStreamSystemConsumer(systemStream, systemConsumer, new SinglePartitionWithoutOffsetsSystemAdmin());

  consumer.bootstrap();

  Set<CoordinatorStreamMessage> bootstrappedMessages = consumer.getBoostrappedStream();

  assertEquals(2, bootstrappedMessages.size()); // First message should have been removed as a duplicate
  CoordinatorStreamMessage[] coordinatorStreamMessages = bootstrappedMessages.toArray(new CoordinatorStreamMessage[2]);
  assertEquals(setConfig2, coordinatorStreamMessages[0]);
  assertEquals(setConfig3, coordinatorStreamMessages[1]); //Config 3 MUST be the last message, not config 2
}
 
开发者ID:apache,项目名称:samza,代码行数:36,代码来源:TestCoordinatorStreamSystemConsumer.java

示例4: getAdmin

import org.apache.samza.util.SinglePartitionWithoutOffsetsSystemAdmin; //导入依赖的package包/类
@Override
public SystemAdmin getAdmin(String systemName, Config config) {
  return new SinglePartitionWithoutOffsetsSystemAdmin();
}
 
开发者ID:yoloanalytics,项目名称:bigdata-swamp,代码行数:5,代码来源:WikipediaSystemFactory.java

示例5: getAdmin

import org.apache.samza.util.SinglePartitionWithoutOffsetsSystemAdmin; //导入依赖的package包/类
public SystemAdmin getAdmin(String systemName, Config config) {
  return new SinglePartitionWithoutOffsetsSystemAdmin();
}
 
开发者ID:ept,项目名称:newsfeed,代码行数:4,代码来源:NullSystemFactory.java

示例6: getAdmin

import org.apache.samza.util.SinglePartitionWithoutOffsetsSystemAdmin; //导入依赖的package包/类
@Override
public SystemAdmin getAdmin(String systemName, Config config) {
	return new SinglePartitionWithoutOffsetsSystemAdmin();
}
 
开发者ID:YahooArchive,项目名称:samoa,代码行数:5,代码来源:SamoaSystemFactory.java


注:本文中的org.apache.samza.util.SinglePartitionWithoutOffsetsSystemAdmin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。