diff --git a/services/git-bridge/.idea/compiler.xml b/services/git-bridge/.idea/compiler.xml index 8d3613cc8b..0ad16f8d1b 100644 --- a/services/git-bridge/.idea/compiler.xml +++ b/services/git-bridge/.idea/compiler.xml @@ -17,7 +17,7 @@ - + @@ -29,5 +29,4 @@ - - + \ No newline at end of file diff --git a/services/git-bridge/.idea/encodings.xml b/services/git-bridge/.idea/encodings.xml index 74c0d0a52b..8ffd759b0f 100644 --- a/services/git-bridge/.idea/encodings.xml +++ b/services/git-bridge/.idea/encodings.xml @@ -2,6 +2,6 @@ + - - + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__cglib_cglib_nodep_2_1_3.xml b/services/git-bridge/.idea/libraries/Maven__cglib_cglib_nodep_2_1_3.xml deleted file mode 100644 index 55692b94d6..0000000000 --- a/services/git-bridge/.idea/libraries/Maven__cglib_cglib_nodep_2_1_3.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_3.xml b/services/git-bridge/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_3.xml new file mode 100644 index 0000000000..6c9fc331cf --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_3.xml b/services/git-bridge/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_3.xml new file mode 100644 index 0000000000..fd35ca4525 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_3.xml b/services/git-bridge/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_3.xml new file mode 100644 index 0000000000..e59fa72af0 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_5_3.xml b/services/git-bridge/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_5_3.xml new file mode 100644 index 0000000000..186af6a4d6 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_5_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_5_3.xml b/services/git-bridge/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_5_3.xml new file mode 100644 index 0000000000..3b579b5203 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_5_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_github_fge_btf_1_2.xml b/services/git-bridge/.idea/libraries/Maven__com_github_fge_btf_1_2.xml new file mode 100644 index 0000000000..be485ed5dc --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_github_fge_btf_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_github_fge_jackson_coreutils_1_8.xml b/services/git-bridge/.idea/libraries/Maven__com_github_fge_jackson_coreutils_1_8.xml new file mode 100644 index 0000000000..b28d54b463 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_github_fge_jackson_coreutils_1_8.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_github_fge_json_schema_core_1_2_5.xml b/services/git-bridge/.idea/libraries/Maven__com_github_fge_json_schema_core_1_2_5.xml new file mode 100644 index 0000000000..6faeec933b --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_github_fge_json_schema_core_1_2_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_github_fge_json_schema_validator_2_2_6.xml b/services/git-bridge/.idea/libraries/Maven__com_github_fge_json_schema_validator_2_2_6.xml new file mode 100644 index 0000000000..6deb5e3fe5 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_github_fge_json_schema_validator_2_2_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_github_fge_msg_simple_1_1.xml b/services/git-bridge/.idea/libraries/Maven__com_github_fge_msg_simple_1_1.xml new file mode 100644 index 0000000000..0fefc8c94c --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_github_fge_msg_simple_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_github_fge_uri_template_0_9.xml b/services/git-bridge/.idea/libraries/Maven__com_github_fge_uri_template_0_9.xml new file mode 100644 index 0000000000..de219cb9c1 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_github_fge_uri_template_0_9.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_0.xml b/services/git-bridge/.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_0.xml new file mode 100644 index 0000000000..6644d12ef8 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_google_guava_guava_18_0.xml b/services/git-bridge/.idea/libraries/Maven__com_google_guava_guava_18_0.xml new file mode 100644 index 0000000000..bbd71d77e9 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_google_guava_guava_18_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_googlecode_libphonenumber_libphonenumber_6_2.xml b/services/git-bridge/.idea/libraries/Maven__com_googlecode_libphonenumber_libphonenumber_6_2.xml new file mode 100644 index 0000000000..9e81cf42b5 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_googlecode_libphonenumber_libphonenumber_6_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__com_jcraft_jzlib_1_1_3.xml b/services/git-bridge/.idea/libraries/Maven__com_jcraft_jzlib_1_1_3.xml new file mode 100644 index 0000000000..897f365a3f --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__com_jcraft_jzlib_1_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml b/services/git-bridge/.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml new file mode 100644 index 0000000000..7b5b3b7580 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__io_netty_netty_buffer_4_0_31_Final.xml b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_buffer_4_0_31_Final.xml new file mode 100644 index 0000000000..9fcfff811e --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_buffer_4_0_31_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__io_netty_netty_codec_4_0_31_Final.xml b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_codec_4_0_31_Final.xml new file mode 100644 index 0000000000..05d2d1330b --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_codec_4_0_31_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__io_netty_netty_codec_http_4_0_31_Final.xml b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_codec_http_4_0_31_Final.xml new file mode 100644 index 0000000000..31741c0f5c --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_codec_http_4_0_31_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__io_netty_netty_codec_socks_4_0_31_Final.xml b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_codec_socks_4_0_31_Final.xml new file mode 100644 index 0000000000..7623350309 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_codec_socks_4_0_31_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__io_netty_netty_common_4_0_31_Final.xml b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_common_4_0_31_Final.xml new file mode 100644 index 0000000000..35e0542627 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_common_4_0_31_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__io_netty_netty_handler_4_0_31_Final.xml b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_handler_4_0_31_Final.xml new file mode 100644 index 0000000000..f74684fc17 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_handler_4_0_31_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__io_netty_netty_transport_4_0_31_Final.xml b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_transport_4_0_31_Final.xml new file mode 100644 index 0000000000..2fccd23dbb --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__io_netty_netty_transport_4_0_31_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__janino_janino_2_5_10.xml b/services/git-bridge/.idea/libraries/Maven__janino_janino_2_5_10.xml new file mode 100644 index 0000000000..7f72f578c9 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__janino_janino_2_5_10.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__javax_activation_activation_1_1.xml b/services/git-bridge/.idea/libraries/Maven__javax_activation_activation_1_1.xml new file mode 100644 index 0000000000..180d587561 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__javax_activation_activation_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__javax_mail_mailapi_1_4_3.xml b/services/git-bridge/.idea/libraries/Maven__javax_mail_mailapi_1_4_3.xml new file mode 100644 index 0000000000..74617052b5 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__javax_mail_mailapi_1_4_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__junit_junit_4_10.xml b/services/git-bridge/.idea/libraries/Maven__junit_junit_4_10.xml deleted file mode 100644 index ed8bf5fe7f..0000000000 --- a/services/git-bridge/.idea/libraries/Maven__junit_junit_4_10.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__junit_junit_4_12.xml b/services/git-bridge/.idea/libraries/Maven__junit_junit_4_12.xml new file mode 100644 index 0000000000..d411041745 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__junit_junit_4_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__net_sf_jopt_simple_jopt_simple_4_6.xml b/services/git-bridge/.idea/libraries/Maven__net_sf_jopt_simple_jopt_simple_4_6.xml new file mode 100644 index 0000000000..18ea23b96c --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__net_sf_jopt_simple_jopt_simple_4_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_4.xml b/services/git-bridge/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_4.xml new file mode 100644 index 0000000000..78cfcd37a1 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_bouncycastle_bcmail_jdk15on_1_52.xml b/services/git-bridge/.idea/libraries/Maven__org_bouncycastle_bcmail_jdk15on_1_52.xml new file mode 100644 index 0000000000..cc4ce0a512 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_bouncycastle_bcmail_jdk15on_1_52.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_bouncycastle_bcpkix_jdk15on_1_52.xml b/services/git-bridge/.idea/libraries/Maven__org_bouncycastle_bcpkix_jdk15on_1_52.xml new file mode 100644 index 0000000000..cfcf4f2c1c --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_bouncycastle_bcpkix_jdk15on_1_52.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_bouncycastle_bcprov_jdk15on_1_52.xml b/services/git-bridge/.idea/libraries/Maven__org_bouncycastle_bcprov_jdk15on_1_52.xml new file mode 100644 index 0000000000..4b942f167a --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_bouncycastle_bcprov_jdk15on_1_52.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml b/services/git-bridge/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml similarity index 64% rename from services/git-bridge/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml rename to services/git-bridge/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml index acdf44300b..f58bbc1127 100644 --- a/services/git-bridge/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml +++ b/services/git-bridge/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_jmock_jmock_legacy_2_6_0.xml b/services/git-bridge/.idea/libraries/Maven__org_jmock_jmock_legacy_2_6_0.xml deleted file mode 100644 index d1371a2a99..0000000000 --- a/services/git-bridge/.idea/libraries/Maven__org_jmock_jmock_legacy_2_6_0.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_json_json_20090211.xml b/services/git-bridge/.idea/libraries/Maven__org_json_json_20090211.xml new file mode 100644 index 0000000000..e57dc0ae98 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_json_json_20090211.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_client_java_3_10_1.xml b/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_client_java_3_10_1.xml new file mode 100644 index 0000000000..2162d5effc --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_client_java_3_10_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_core_3_10_1.xml b/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_core_3_10_1.xml new file mode 100644 index 0000000000..e898afa710 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_core_3_10_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_logging_3_10_1.xml b/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_logging_3_10_1.xml new file mode 100644 index 0000000000..cd8560af6c --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_logging_3_10_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_netty_3_10_1.xml b/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_netty_3_10_1.xml new file mode 100644 index 0000000000..42398ab9b9 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_mock_server_mockserver_netty_3_10_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_mozilla_rhino_1_7R4.xml b/services/git-bridge/.idea/libraries/Maven__org_mozilla_rhino_1_7R4.xml new file mode 100644 index 0000000000..82eb241284 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_mozilla_rhino_1_7R4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_objenesis_objenesis_1_0.xml b/services/git-bridge/.idea/libraries/Maven__org_objenesis_objenesis_1_0.xml deleted file mode 100644 index c79fa27d22..0000000000 --- a/services/git-bridge/.idea/libraries/Maven__org_objenesis_objenesis_1_0.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/services/git-bridge/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_2_3.xml b/services/git-bridge/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_2_3.xml new file mode 100644 index 0000000000..ed116b8a15 --- /dev/null +++ b/services/git-bridge/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/git-bridge/pom.xml b/services/git-bridge/pom.xml index 9377b85d79..c403314a66 100644 --- a/services/git-bridge/pom.xml +++ b/services/git-bridge/pom.xml @@ -49,18 +49,14 @@ junit junit - 4.10 + 4.12 test org.jmock jmock-junit4 2.6.0 - - - org.jmock - jmock-legacy - 2.6.0 + test org.eclipse.jetty.aggregate @@ -102,6 +98,12 @@ joda-time 2.7 + + org.mock-server + mockserver-netty + 3.10.1 + test + \ No newline at end of file diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/DataStore.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/DataStore.java index f81b4ddfdb..f9f217dd7d 100644 --- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/DataStore.java +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/DataStore.java @@ -10,6 +10,7 @@ import uk.ac.ic.wlgitbridge.data.filestore.GitDirectoryContents; import uk.ac.ic.wlgitbridge.data.filestore.RawDirectory; import uk.ac.ic.wlgitbridge.data.filestore.RawFile; import uk.ac.ic.wlgitbridge.data.model.db.PersistentStore; +import uk.ac.ic.wlgitbridge.data.model.db.SqlitePersistentStore; import uk.ac.ic.wlgitbridge.snapshot.exception.FailedConnectionException; import uk.ac.ic.wlgitbridge.snapshot.getforversion.SnapshotAttachment; import uk.ac.ic.wlgitbridge.snapshot.push.exception.SnapshotPostException; @@ -31,7 +32,7 @@ public class DataStore { public DataStore(String rootGitDirectoryPath) { rootGitDirectory = initRootGitDirectory(rootGitDirectoryPath); - persistentStore = new PersistentStore(rootGitDirectory); + persistentStore = new SqlitePersistentStore(rootGitDirectory); List excludedFromDeletion = persistentStore.getProjectNames(); excludedFromDeletion.add(".wlgb"); Util.deleteInDirectoryApartFrom(rootGitDirectory, excludedFromDeletion.toArray(new String[] {})); diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/ResourceFetcher.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/ResourceFetcher.java index 4bc0c277d9..836bc2f42f 100644 --- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/ResourceFetcher.java +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/ResourceFetcher.java @@ -42,9 +42,15 @@ public class ResourceFetcher { if (contents == null) { RawFile rawFile = new RepositoryObjectTreeWalker(repository).getDirectoryContents().getFileTable().get(path); if (rawFile == null) { - throw new IllegalStateException("file was not in the current commit, or the git tree, yet path was not null"); + Util.sout( + "WARNING: " + + "File " + path + " was not in the current commit, or the git tree, yet path was not null. " + + "File url is: " + url + ); + contents = fetch(projectName, url, path); + } else { + contents = rawFile.getContents(); } - contents = rawFile.getContents(); } } return new RepositoryFile(newPath, contents); @@ -83,5 +89,4 @@ public class ResourceFetcher { persistentStore.addURLIndexForProject(projectName, url, path); return contents; } - } diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/db/PersistentStore.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/db/PersistentStore.java index 310a75f099..59cf8103c2 100644 --- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/db/PersistentStore.java +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/db/PersistentStore.java @@ -1,72 +1,20 @@ package uk.ac.ic.wlgitbridge.data.model.db; -import uk.ac.ic.wlgitbridge.data.model.db.sql.SQLiteWLDatabase; - -import java.io.File; -import java.sql.SQLException; import java.util.List; /** - * Created by Winston on 19/11/14. + * Created by m on 20/11/15. */ -public class PersistentStore { +public interface PersistentStore { + List getProjectNames(); - private final SQLiteWLDatabase database; + void setLatestVersionForProject(String project, int versionID); - public PersistentStore(File rootGitDirectory) { - try { - database = new SQLiteWLDatabase(rootGitDirectory); - } catch (SQLException e) { - throw new RuntimeException(e); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - } + int getLatestVersionForProject(String project); - public List getProjectNames() { - try { - return database.getProjectNames(); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - public void setLatestVersionForProject(String project, int versionID) { - try { - database.setVersionIDForProject(project, versionID); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } + void addURLIndexForProject(String projectName, String url, String path); - public int getLatestVersionForProject(String project) { - try { - return database.getVersionIDForProjectName(project); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - public void addURLIndexForProject(String projectName, String url, String path) { - try { - database.addURLIndex(projectName, url, path); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - - public void deleteFilesForProject(String project, String... files) { - try { - database.deleteFilesForProject(project, files); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } - public String getPathForURLInProject(String projectName, String url) { - try { - return database.getPathForURLInProject(projectName, url); - } catch (SQLException e) { - throw new RuntimeException(e); - } - } + void deleteFilesForProject(String project, String... files); + String getPathForURLInProject(String projectName, String url); } diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/db/SqlitePersistentStore.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/db/SqlitePersistentStore.java new file mode 100644 index 0000000000..7a56d6111f --- /dev/null +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/data/model/db/SqlitePersistentStore.java @@ -0,0 +1,78 @@ +package uk.ac.ic.wlgitbridge.data.model.db; + +import uk.ac.ic.wlgitbridge.data.model.db.sql.SQLiteWLDatabase; + +import java.io.File; +import java.sql.SQLException; +import java.util.List; + +/** + * Created by Winston on 19/11/14. + */ +public class SqlitePersistentStore implements PersistentStore { + + private final SQLiteWLDatabase database; + + public SqlitePersistentStore(File rootGitDirectory) { + try { + database = new SQLiteWLDatabase(rootGitDirectory); + } catch (SQLException e) { + throw new RuntimeException(e); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + } + + @Override + public List getProjectNames() { + try { + return database.getProjectNames(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + @Override + public void setLatestVersionForProject(String project, int versionID) { + try { + database.setVersionIDForProject(project, versionID); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + @Override + public int getLatestVersionForProject(String project) { + try { + return database.getVersionIDForProjectName(project); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + @Override + public void addURLIndexForProject(String projectName, String url, String path) { + try { + database.addURLIndex(projectName, url, path); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + @Override + public void deleteFilesForProject(String project, String... files) { + try { + database.deleteFilesForProject(project, files); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + @Override + public String getPathForURLInProject(String projectName, String url) { + try { + return database.getPathForURLInProject(projectName, url); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/data/model/ResourceFetcherTest.java b/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/data/model/ResourceFetcherTest.java new file mode 100644 index 0000000000..66bd4c87db --- /dev/null +++ b/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/data/model/ResourceFetcherTest.java @@ -0,0 +1,74 @@ +package uk.ac.ic.wlgitbridge.data.model; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +import org.eclipse.jgit.lib.*; +import org.eclipse.jgit.storage.file.FileRepositoryBuilder; +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.hamcrest.TypeSafeMatcher; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.mockserver.client.server.MockServerClient; +import org.mockserver.junit.MockServerRule; +import uk.ac.ic.wlgitbridge.data.model.db.PersistentStore; + + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by m on 20/11/15. + */ +public class ResourceFetcherTest { + @Rule + public MockServerRule mockServerRule = new MockServerRule(this); + + private MockServerClient mockServerClient; + + @Test + public void fetchesFilesThatAreMissingFromUrlStoreCache() throws IOException { + final String testProjectName = "123abc"; + final String testUrl = "http://localhost:" + mockServerRule.getHttpPort() + "/123abc"; + final String oldTestPath = "testPath"; + final String newTestPath = "missingPath"; + + mockServerClient.when( + request() + .withMethod("GET") + .withPath("/123abc") + ) + .respond( + response() + .withStatusCode(200) + .withBody("content") + ); + + final Mockery context = new Mockery(); + final PersistentStore persistentStore = context.mock(PersistentStore.class); + context.checking(new Expectations() {{ + // It should fetch the file once it finds it is missing. + oneOf(persistentStore).getPathForURLInProject(testProjectName, testUrl); + will(returnValue(oldTestPath)); + + // It should update the URL index store once it has fetched; at present, it does not actually change the stored path. + oneOf(persistentStore).addURLIndexForProject(testProjectName, testUrl, oldTestPath); + }}); + + ResourceFetcher resourceFetcher = new ResourceFetcher(persistentStore); + TemporaryFolder repositoryFolder = new TemporaryFolder(); + repositoryFolder.create(); + Repository repository = new FileRepositoryBuilder().setWorkTree(repositoryFolder.getRoot()).build(); + Map fetchedUrls = new HashMap(); + resourceFetcher.get(testProjectName, testUrl, newTestPath, repository, fetchedUrls); + + // We don't bother caching in this case, at present. + assertEquals(0, fetchedUrls.size()); + } +} \ No newline at end of file diff --git a/services/git-bridge/writelatex-git-bridge.iml b/services/git-bridge/writelatex-git-bridge.iml index 2b9d1d4a93..8ffc696701 100644 --- a/services/git-bridge/writelatex-git-bridge.iml +++ b/services/git-bridge/writelatex-git-bridge.iml @@ -17,15 +17,12 @@ - - - - - - - - - + + + + + + @@ -44,5 +41,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file