コード例 #1
0
  /**
   * multiple records.
   *
   * @throws Exception if occur
   */
  @Test
  public void multiple() throws Exception {
    context.put("provider", "provider");

    Simple s1 = new Simple();
    s1.number = 100;
    s1.text = "Hello, world!";
    insert(s1, SIMPLE, "SIMPLE");

    Simple s2 = new Simple();
    s2.number = 200;
    s2.text = "Hello, world!!!!";
    insert(s2, SIMPLE, "SIMPLE");

    TableSourceProvider provider = new TableSourceProvider();
    DataModelSource source =
        provider.open(SIMPLE, new URI("bulkloader:provider:SIMPLE"), new TestContext.Empty());

    try {
      assertThat(next(source), is(s1));
      assertThat(next(source), is(s2));
      assertThat(next(source), is(nullValue()));
    } finally {
      source.close();
    }
  }
コード例 #2
0
  /**
   * invalid_scheme.
   *
   * @throws Exception if occur
   */
  @Test
  public void invalid_scheme() throws Exception {
    context.put("provider", "provider");

    TableSourceProvider provider = new TableSourceProvider();
    DataModelSource source =
        provider.open(SIMPLE, new URI("hoge:provider:SIMPLE"), new TestContext.Empty());
    assertThat(source, is(nullValue()));
  }
コード例 #3
0
  /**
   * zero record.
   *
   * @throws Exception if occur
   */
  @Test
  public void zero() throws Exception {
    context.put("provider", "provider");

    TableSourceProvider provider = new TableSourceProvider();
    DataModelSource source =
        provider.open(SIMPLE, new URI("bulkloader:provider:SIMPLE"), new TestContext.Empty());
    try {
      assertThat(next(source), is(nullValue()));
    } finally {
      source.close();
    }
  }