Package org.kitesdk.data.spi

Examples of org.kitesdk.data.spi.Constraints


  @Test
  public void testCreateView() throws Exception {
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schemaUri("resource:schema/user.avsc")
        .build();
    Constraints constraints = new Constraints(descriptor.getSchema(), null)
        .with("username", "user1")
        .with("email", "user1@example.com");

    AbstractDataset<Object> ds = mock(AbstractDataset.class);
    when(repo.create("ns", "test", descriptor, Object.class)).thenReturn(ds);
View Full Code Here


  @Test
  public void testCreateViewWithoutType() throws Exception {
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schemaUri("resource:schema/user.avsc")
        .build();
    Constraints constraints = new Constraints(descriptor.getSchema(), null)
        .with("username", "user1")
        .with("email", "user1@example.com");

    AbstractDataset<GenericRecord> ds = mock(AbstractDataset.class);
    when(repo.create("ns", "test", descriptor, GenericRecord.class)).thenReturn(ds);
View Full Code Here

  @Test
  public void testCreateViewStringUri() throws Exception {
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schemaUri("resource:schema/user.avsc")
        .build();
    Constraints constraints = new Constraints(descriptor.getSchema(), null)
        .with("username", "user1")
        .with("email", "user1@example.com");

    AbstractDataset<Object> ds = mock(AbstractDataset.class);
    when(repo.create("ns", "test", descriptor, Object.class)).thenReturn(ds);
View Full Code Here

  @Test
  public void testCreateViewStringUriWithoutType() throws Exception {
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schemaUri("resource:schema/user.avsc")
        .build();
    Constraints constraints = new Constraints(descriptor.getSchema(), null)
        .with("username", "user1")
        .with("email", "user1@example.com");

    AbstractDataset<GenericRecord> ds = mock(AbstractDataset.class);
    when(repo.create("ns", "test", descriptor, GenericRecord.class)).thenReturn(ds);
View Full Code Here

  @Test
  public void testLoadView() throws Exception {
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schemaUri("resource:schema/user.avsc")
        .build();
    Constraints constraints = new Constraints(descriptor.getSchema(), null)
        .with("username", "user1")
        .with("email", "user1@example.com");

    AbstractDataset<Object> ds = mock(AbstractDataset.class);
    when(repo.load("ns", "test", Object.class)).thenReturn(ds);
View Full Code Here

  @Test
  public void testLoadViewWithoutType() throws Exception {
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schemaUri("resource:schema/user.avsc")
        .build();
    Constraints constraints = new Constraints(descriptor.getSchema(), null)
        .with("username", "user1")
        .with("email", "user1@example.com");

    AbstractDataset<GenericRecord> ds = mock(AbstractDataset.class);
    when(repo.load("ns", "test", GenericRecord.class)).thenReturn(ds);
View Full Code Here

  @Test
  public void testLoadViewStringUri() throws Exception {
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schemaUri("resource:schema/user.avsc")
        .build();
    Constraints constraints = new Constraints(descriptor.getSchema(), null)
        .with("username", "user1")
        .with("email", "user1@example.com");

    AbstractDataset<Object> ds = mock(AbstractDataset.class);
    when(repo.load("ns", "test", Object.class)).thenReturn(ds);
View Full Code Here

  @Test
  public void testLoadViewStringUriWithoutType() throws Exception {
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schemaUri("resource:schema/user.avsc")
        .build();
    Constraints constraints = new Constraints(descriptor.getSchema(), null)
        .with("username", "user1")
        .with("email", "user1@example.com");

    AbstractDataset<GenericRecord> ds = mock(AbstractDataset.class);
    when(repo.load("ns", "test", GenericRecord.class)).thenReturn(ds);
View Full Code Here

      Schema schema = descriptor.getSchema();
      PartitionStrategy strategy = null;
      if (descriptor.isPartitioned()) {
        strategy = descriptor.getPartitionStrategy();
      }
      Constraints constraints = Constraints.fromQueryMap(
          schema, strategy, uriOptions);
      return (V) ((AbstractDataset) dataset).filter(constraints);
    } else {
      return (V) dataset;
    }
View Full Code Here

    Assert.assertEquals("Should report correct namespace",
        "ns", v.getDataset().getNamespace());
    Assert.assertEquals("Should report correct name",
        "test", v.getDataset().getName());

    Constraints withUser = new Constraints(loaded.getSchema())
        .with("username", new Utf8("user"));
    Assert.assertEquals("Constraints should be username=user",
        withUser, ((FileSystemView) v).getConstraints());

    repo.delete("ns", "test");
View Full Code Here

TOP

Related Classes of org.kitesdk.data.spi.Constraints

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.