コード例 #1
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");
  }
コード例 #2
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");
  }
コード例 #3
0
  @Test
  public void shouldBulkUpdateKeyOnOnlyOneSubmodule() {
    dbTester.prepareDbUnit(getClass(), "shared.xml");

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

    dbTester.assertDbUnit(
        getClass(), "shouldBulkUpdateKeyOnOnlyOneSubmodule-result.xml", "projects");
  }
コード例 #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);
   }
 }
コード例 #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");
  }