@Test
  public void shouldNotUpdateAllSubmodules() {
    dbTester.prepareDbUnit(getClass(), "shouldNotUpdateAllSubmodules.xml");

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

    dbTester.assertDbUnit(getClass(), "shouldNotUpdateAllSubmodules-result.xml", "projects");
  }
  @Test
  public void shouldBulkUpdateKey() {
    dbTester.prepareDbUnit(getClass(), "shared.xml");

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

    dbTester.assertDbUnit(getClass(), "shouldBulkUpdateKey-result.xml", "projects");
  }
  @Test
  public void shouldBulkUpdateKeyOnOnlyOneSubmodule() {
    dbTester.prepareDbUnit(getClass(), "shared.xml");

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

    dbTester.assertDbUnit(
        getClass(), "shouldBulkUpdateKeyOnOnlyOneSubmodule-result.xml", "projects");
  }
Ejemplo n.º 4
0
 public void bulkUpdateKey(long projectId, String stringToReplace, String replacementString) {
   DbSession session = mybatis.openSession(true);
   try {
     bulkUpdateKey(session, projectId, stringToReplace, replacementString);
     session.commit();
   } finally {
     MyBatis.closeQuietly(session);
   }
 }
  @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");
  }