コード例 #1
0
  @Test
  public void testSameDataVersionOnInvalidPathEvent() throws Exception {
    String dataVersion1 = underTest.getDataVersion(VALID_PATH_1);
    assertNotNull(dataVersion1);

    // make sure generate data version timestamp does not clash
    Thread.sleep(5);

    underTest.handleDamEvent(DamEvent.assetCreated(INVALID_PATH + "/asset1.jpg", null));

    String dataVersion2 = underTest.getDataVersion(VALID_PATH_1);
    assertNotNull(dataVersion2);
    assertEquals("data version", dataVersion1, dataVersion2);
  }
コード例 #2
0
  @Test
  public void testNewDataVersionOnValidPathEvent() throws Exception {
    String dataVersion1 = underTest.getDataVersion(VALID_PATH_1);
    String dataVersion2 = underTest.getDataVersion(VALID_PATH_2);
    assertNotNull(dataVersion1);

    // make sure generate data version timestamp does not clash
    Thread.sleep(5);

    underTest.handleDamEvent(DamEvent.assetCreated(VALID_PATH_1 + "/asset1.jpg", null));

    // data version for path 1 should be changed
    String dataVersion1new = underTest.getDataVersion(VALID_PATH_1);
    assertNotNull(dataVersion1new);
    assertNotEquals("data version 1 changed", dataVersion1, dataVersion1new);

    // data version for path 2 should be unchanged
    String dataVersion2new = underTest.getDataVersion(VALID_PATH_2);
    assertNotNull(dataVersion2new);
    assertEquals("data version 2 unchanged", dataVersion2, dataVersion2new);
  }