Package org.apache.samza

Examples of org.apache.samza.Partition


    ObjectMapper mapper = SamzaObjectMapper.getObjectMapper();
    Map<String, String> configMap = new HashMap<String, String>();
    configMap.put("a", "b");
    Config config = new MapConfig(configMap);
    Set<SystemStreamPartition> inputSystemStreamPartitions = new HashSet<SystemStreamPartition>();
    inputSystemStreamPartitions.add(new SystemStreamPartition("foo", "bar", new Partition(1)));
    TaskName taskName = new TaskName("test");
    TaskModel taskModel = new TaskModel(taskName, inputSystemStreamPartitions, new Partition(2));
    Map<TaskName, TaskModel> tasks = new HashMap<TaskName, TaskModel>();
    tasks.put(taskName, taskModel);
    ContainerModel containerModel = new ContainerModel(1, tasks);
    Map<Integer, ContainerModel> containerMap = new HashMap<Integer, ContainerModel>();
    containerMap.put(Integer.valueOf(1), containerModel);
View Full Code Here


    SystemStreamMetadata metadata1 = metadata.get("a");
    SystemStreamMetadata metadata2 = metadata.get("b");

    assertEquals(1, metadata1.getSystemStreamPartitionMetadata().size());
    assertEquals(1, metadata2.getSystemStreamPartitionMetadata().size());
    assertNull(metadata.get(new SystemStreamPartition("test-system", "c", new Partition(0))));
  }
View Full Code Here

  public static class PartitionDeserializer extends JsonDeserializer<Partition> {
    @Override
    public Partition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      return new Partition(node.getIntValue());
    }
View Full Code Here

    public SystemStreamPartition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      String system = node.get("system").getTextValue();
      String stream = node.get("stream").getTextValue();
      Partition partition = new Partition(node.get("partition").getIntValue());
      return new SystemStreamPartition(system, stream, partition);
    }
View Full Code Here

  public MockSystemAdmin(int partitionCount) {
    this.systemStreamPartitionMetadata = new HashMap<Partition, SystemStreamPartitionMetadata>();

    for (int i = 0; i < partitionCount; ++i) {
      systemStreamPartitionMetadata.put(new Partition(i), new SystemStreamPartitionMetadata(null, null, null));
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.samza.Partition

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.