コード例 #1
0
  @Test
  public void shouldBulkUpdateKey() {
    dbTester.prepareDbUnit(getClass(), "shared.xml");

    dao.bulkUpdateKey(1, "org.struts", "org.apache.struts");

    dbTester.assertDbUnit(getClass(), "shouldBulkUpdateKey-result.xml", "projects");
  }
コード例 #2
0
  @Test
  public void shouldNotUpdateAllSubmodules() {
    dbTester.prepareDbUnit(getClass(), "shouldNotUpdateAllSubmodules.xml");

    dao.bulkUpdateKey(1, "org.struts", "org.apache.struts");

    dbTester.assertDbUnit(getClass(), "shouldNotUpdateAllSubmodules-result.xml", "projects");
  }
コード例 #3
0
  @Test
  public void shouldUpdateKey() {
    dbTester.prepareDbUnit(getClass(), "shared.xml");

    dao.updateKey(2, "struts:core");

    dbTester.assertDbUnit(getClass(), "shouldUpdateKey-result.xml", "projects");
  }
コード例 #4
0
  @Test
  public void shouldBulkUpdateKeyOnOnlyOneSubmodule() {
    dbTester.prepareDbUnit(getClass(), "shared.xml");

    dao.bulkUpdateKey(1, "struts-ui", "struts-web");

    dbTester.assertDbUnit(
        getClass(), "shouldBulkUpdateKeyOnOnlyOneSubmodule-result.xml", "projects");
  }
コード例 #5
0
  @Test
  public void shouldFailBulkUpdateKeyIfKeyAlreadyExist() {
    dbTester.prepareDbUnit(getClass(), "shared.xml");

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage(
        "Impossible to update key: a resource with \"foo:struts-core\" key already exists.");

    dao.bulkUpdateKey(1, "org.struts", "foo");
  }
コード例 #6
0
  @Test
  public void shouldNotUpdateKey() {
    dbTester.prepareDbUnit(getClass(), "shared.xml");

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage(
        "Impossible to update key: a resource with \"org.struts:struts-ui\" key already exists.");

    dao.updateKey(2, "org.struts:struts-ui");
  }
コード例 #7
0
  @Test
  public void shouldCheckModuleKeysBeforeRenaming() {
    dbTester.prepareDbUnit(getClass(), "shared.xml");

    Map<String, String> checkResults = dao.checkModuleKeysBeforeRenaming(1, "org.struts", "foo");
    assertThat(checkResults.size()).isEqualTo(3);
    assertThat(checkResults.get("org.struts:struts")).isEqualTo("foo:struts");
    assertThat(checkResults.get("org.struts:struts-core")).isEqualTo("#duplicate_key#");
    assertThat(checkResults.get("org.struts:struts-ui")).isEqualTo("foo:struts-ui");
  }