Now fetching missing version IDs.

This commit is contained in:
Winston Li 2014-11-06 12:30:45 +00:00
parent d59c3da400
commit acd2a52b86
4 changed files with 262 additions and 131 deletions

View file

@ -7,20 +7,10 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="0c822a5a-f421-4f3c-b941-5c2809c4546f" name="Default" comment=""> <list default="true" id="0c822a5a-f421-4f3c-b941-5c2809c4546f" name="Default" comment="">
<change type="MOVED" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/JSONSource.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/JSONModel.java" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java" />
<change type="MOVED" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/Snapshot.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/Snapshot.java" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLProject.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLProject.java" />
<change type="MOVED" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/WLDataModel.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLProjectTests.java" afterPath="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLProjectTests.java" />
<change type="MOVED" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/WLProject.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLProject.java" />
<change type="MOVED" beforePath="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/SnapshotTests.java" afterPath="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/SnapshotTests.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/DummySnapshotAPI.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/DummySnapshotAPI.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/DummySnapshotDBAPI.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/DummySnapshotDBAPI.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/SnapshotAPI.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/SnapshotAPI.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/SnapshotDBAPI.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/SnapshotDBAPI.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/bridge/WLBridgedProject.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/bridge/WLBridgedProject.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServlet.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServlet.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/handler/WLReceivePackFactory.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/handler/WLReceivePackFactory.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/writelatex-git-bridge.iml" afterPath="$PROJECT_DIR$/writelatex-git-bridge.iml" />
</list> </list>
<ignored path="writelatex-git-bridge.iws" /> <ignored path="writelatex-git-bridge.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
@ -43,21 +33,11 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf>
<file leaf-file-name="Request.java" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="DummySnapshotDBAPI.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/request/Request.java"> <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/DummySnapshotDBAPI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="320" max-vertical-offset="705"> <state vertical-scroll-proportion="0.0" vertical-offset="260" max-vertical-offset="645">
<caret line="38" column="5" selection-start-line="38" selection-start-column="5" selection-end-line="38" selection-end-column="5" /> <caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SnapshotGetSavedVersRequest.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/request/SnapshotGetSavedVersRequest.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="300">
<caret line="10" column="29" selection-start-line="10" selection-start-column="29" selection-end-line="10" selection-end-column="29" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -66,28 +46,38 @@
<file leaf-file-name="RequestTests.java" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="RequestTests.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/RequestTests.java"> <entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/RequestTests.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="200" max-vertical-offset="705"> <state vertical-scroll-proportion="0.0" vertical-offset="150" max-vertical-offset="705">
<caret line="30" column="60" selection-start-line="30" selection-start-column="60" selection-end-line="30" selection-end-column="60" /> <caret line="18" column="40" selection-start-line="18" selection-start-column="30" selection-end-line="18" selection-end-column="40" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="SnapshotAPIRequestTests.java" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="Snapshot.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/SnapshotAPIRequestTests.java"> <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/Snapshot.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315"> <state vertical-scroll-proportion="0.0" vertical-offset="43" max-vertical-offset="405">
<caret line="7" column="38" selection-start-line="7" selection-start-column="38" selection-end-line="13" selection-end-column="0" /> <caret line="9" column="25" selection-start-line="9" selection-start-column="25" selection-end-line="9" selection-end-column="25" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="SnapshotGetDocRequestTests.java" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="WLProject.java" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/SnapshotGetDocRequestTests.java"> <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLProject.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315"> <state vertical-scroll-proportion="0.8051948" vertical-offset="905" max-vertical-offset="1665">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" /> <caret line="81" column="8" selection-start-line="81" selection-start-column="8" selection-end-line="81" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="WLDataModel.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="450">
<caret line="20" column="33" selection-start-line="20" selection-start-column="33" selection-end-line="20" selection-end-column="33" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -97,7 +87,7 @@
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/JSONModel.java"> <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/JSONModel.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="270"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="270">
<caret line="12" column="0" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" /> <caret line="7" column="17" selection-start-line="7" selection-start-column="17" selection-end-line="7" selection-end-column="17" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -113,18 +103,8 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="WLProjectTests.java" pinned="false" current="true" current-in-tab="true"> <file leaf-file-name="SnapshotTests.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLProjectTests.java"> <entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/SnapshotTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.5064935" vertical-offset="0" max-vertical-offset="385">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SnapshotGetSavedVersRequestTests.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/SnapshotGetSavedVersRequestTests.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" /> <caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
@ -133,8 +113,18 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="SnapshotGetForVersionRequestTests.java" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="WLProjectTests.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/SnapshotGetForVersionRequestTests.java"> <entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLProjectTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="510">
<caret line="15" column="53" selection-start-line="15" selection-start-column="53" selection-end-line="15" selection-end-column="53" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SnapshotGetSavedVersRequestTests.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/SnapshotGetSavedVersRequestTests.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" /> <caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
@ -156,8 +146,6 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="changedFiles"> <option name="changedFiles">
<list> <list>
<option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/exception/InvalidProgramArgumentsExceptionTests.java" />
<option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/git/exception/InvalidRootDirectoryPathException.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/handler/WLRepositoryResolver.java" /> <option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/handler/WLRepositoryResolver.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/RepositoryBuilder.java" /> <option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/RepositoryBuilder.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotAPIFacade.java" /> <option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotAPIFacade.java" />
@ -206,7 +194,9 @@
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/JSONSource.java" /> <option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/JSONSource.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/JSONModel.java" /> <option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/JSONModel.java" />
<option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLDataModelTests.java" /> <option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLDataModelTests.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java" />
<option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLProjectTests.java" /> <option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLProjectTests.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLProject.java" />
</list> </list>
</option> </option>
</component> </component>
@ -241,8 +231,6 @@
<sortByType /> <sortByType />
</navigator> </navigator>
<panes> <panes>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<PATH> <PATH>
@ -923,6 +911,8 @@
</PATH> </PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane" />
<pane id="Scope" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
@ -968,7 +958,7 @@
<recent name="$PROJECT_DIR$/libs" /> <recent name="$PROJECT_DIR$/libs" />
</key> </key>
</component> </component>
<component name="RunManager" selected="Application.Request"> <component name="RunManager" selected="JUnit.RequestTests">
<configuration default="false" name="Request" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> <configuration default="false" name="Request" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="uk.ac.ic.wlgitbridge.writelatex.api.request.Request" /> <option name="MAIN_CLASS_NAME" value="uk.ac.ic.wlgitbridge.writelatex.api.request.Request" />
<option name="VM_PARAMETERS" /> <option name="VM_PARAMETERS" />
@ -985,6 +975,50 @@
<ConfigurationWrapper RunnerId="Run" /> <ConfigurationWrapper RunnerId="Run" />
<method /> <method />
</configuration> </configuration>
<configuration default="false" name="RequestTests" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="writelatex-git-bridge" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" value="uk.ac.ic.wlgitbridge.test.writelatex.api" />
<option name="MAIN_CLASS_NAME" value="uk.ac.ic.wlgitbridge.test.writelatex.api.RequestTests" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
<configuration default="false" name="WLProjectTests" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
<module name="writelatex-git-bridge" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" value="uk.ac.ic.wlgitbridge.test.writelatex.model" />
<option name="MAIN_CLASS_NAME" value="uk.ac.ic.wlgitbridge.test.writelatex.model.WLProjectTests" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin"> <configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" /> <module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" /> <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
@ -1035,6 +1069,19 @@
</ExternalSystemSettings> </ExternalSystemSettings>
<method /> <method />
</configuration> </configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<method />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG"> <configuration default="true" type="TestNG" factoryName="TestNG">
<module name="" /> <module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@ -1062,19 +1109,6 @@
<listeners /> <listeners />
<method /> <method />
</configuration> </configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<method />
</configuration>
<configuration default="true" type="Application" factoryName="Application"> <configuration default="true" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" /> <option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" /> <option name="VM_PARAMETERS" />
@ -1167,14 +1201,18 @@
<ConfigurationWrapper RunnerId="Run" /> <ConfigurationWrapper RunnerId="Run" />
<method /> <method />
</configuration> </configuration>
<list size="3"> <list size="5">
<item index="0" class="java.lang.String" itemvalue="Application.writelatex-git-bridge" /> <item index="0" class="java.lang.String" itemvalue="Application.writelatex-git-bridge" />
<item index="1" class="java.lang.String" itemvalue="JUnit.writelatex-git-bridge tests" /> <item index="1" class="java.lang.String" itemvalue="JUnit.writelatex-git-bridge tests" />
<item index="2" class="java.lang.String" itemvalue="Application.Request" /> <item index="2" class="java.lang.String" itemvalue="Application.Request" />
<item index="3" class="java.lang.String" itemvalue="JUnit.RequestTests" />
<item index="4" class="java.lang.String" itemvalue="JUnit.WLProjectTests" />
</list> </list>
<recent_temporary> <recent_temporary>
<list size="1"> <list size="3">
<item index="0" class="java.lang.String" itemvalue="Application.Request" /> <item index="0" class="java.lang.String" itemvalue="JUnit.RequestTests" />
<item index="1" class="java.lang.String" itemvalue="JUnit.WLProjectTests" />
<item index="2" class="java.lang.String" itemvalue="Application.Request" />
</list> </list>
</recent_temporary> </recent_temporary>
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false"> <configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
@ -1198,7 +1236,6 @@
<frame x="0" y="23" width="1366" height="741" extended-state="6" /> <frame x="0" y="23" width="1366" height="741" extended-state="6" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="FLOATING" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" x="100" y="123" width="1166" height="541" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
@ -1215,9 +1252,10 @@
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2510981" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2510981" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3169643" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3169643" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="FLOATING" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" x="100" y="123" width="1166" height="541" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
@ -1371,14 +1409,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/SnapshotTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeApplicationTests.java"> <entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeApplicationTests.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="570"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="570">
@ -1495,22 +1525,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/Snapshot.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="405">
<caret line="9" column="25" selection-start-line="9" selection-start-column="25" selection-end-line="9" selection-end-column="25" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLProject.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="60" max-vertical-offset="495">
<caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/SnapshotDBAPI.java"> <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/SnapshotDBAPI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="330"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="330">
@ -1527,22 +1541,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="9" max-vertical-offset="450">
<caret line="17" column="5" selection-start-line="17" selection-start-column="5" selection-end-line="17" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/DummySnapshotDBAPI.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="645">
<caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/SnapshotAPI.java"> <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/SnapshotAPI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
@ -1615,18 +1613,18 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/SnapshotGetSavedVersRequestTests.java"> <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/api/DummySnapshotDBAPI.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="645">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" /> <caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/RequestTests.java"> <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/Snapshot.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="200" max-vertical-offset="705"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="405">
<caret line="30" column="60" selection-start-line="30" selection-start-column="60" selection-end-line="30" selection-end-column="60" /> <caret line="9" column="25" selection-start-line="9" selection-start-column="25" selection-end-line="9" selection-end-column="25" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -1634,7 +1632,7 @@
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/JSONModel.java"> <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/JSONModel.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="270"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="270">
<caret line="12" column="0" selection-start-line="12" selection-start-column="0" selection-end-line="12" selection-end-column="0" /> <caret line="7" column="17" selection-start-line="7" selection-start-column="17" selection-end-line="7" selection-end-column="17" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -1647,14 +1645,54 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/SnapshotGetSavedVersRequestTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLProjectTests.java"> <entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/WLProjectTests.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.5064935" vertical-offset="0" max-vertical-offset="385"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="510">
<caret line="15" column="53" selection-start-line="15" selection-start-column="53" selection-end-line="15" selection-end-column="53" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/model/SnapshotTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" /> <caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/api/RequestTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="705">
<caret line="18" column="40" selection-start-line="18" selection-start-column="30" selection-end-line="18" selection-end-column="40" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLDataModel.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="450">
<caret line="20" column="33" selection-start-line="20" selection-start-column="33" selection-end-line="20" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/model/WLProject.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.8051948" vertical-offset="905" max-vertical-offset="1665">
<caret line="81" column="8" selection-start-line="81" selection-start-column="8" selection-end-line="81" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
</component> </component>
<component name="masterDetails"> <component name="masterDetails">
<states> <states>

View file

@ -2,12 +2,14 @@ package uk.ac.ic.wlgitbridge.writelatex.model;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutionException;
/** /**
* Created by Winston on 06/11/14. * Created by Winston on 06/11/14.
*/ */
public class WLDataModel implements JSONModel { public class WLDataModel {
private final Map<String, WLProject> projects; private final Map<String, WLProject> projects;
@ -15,8 +17,8 @@ public class WLDataModel implements JSONModel {
this.projects = projects; this.projects = projects;
} }
@Override public void updateProjectWithName(String name) throws InterruptedException, ExecutionException, IOException {
public void updateFromJSON(JsonElement json) { projects.get(name).update();
}
} }
}

View file

@ -1,21 +1,34 @@
package uk.ac.ic.wlgitbridge.writelatex.model; package uk.ac.ic.wlgitbridge.writelatex.model;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.sun.javafx.collections.transformation.SortedList;
import uk.ac.ic.wlgitbridge.writelatex.api.request.Request;
import uk.ac.ic.wlgitbridge.writelatex.api.request.SnapshotGetDocRequest;
import uk.ac.ic.wlgitbridge.writelatex.api.request.SnapshotGetForVersionRequest;
import uk.ac.ic.wlgitbridge.writelatex.api.request.SnapshotGetSavedVersRequest;
import java.util.HashMap; import java.io.IOException;
import java.util.Map; import java.util.*;
import java.util.concurrent.ExecutionException;
/** /**
* Created by Winston on 06/11/14. * Created by Winston on 06/11/14.
*/ */
public class WLProject implements JSONModel { public class WLProject implements JSONModel {
private final String name;
public static final int VERSION_ID_INVALID = -1; public static final int VERSION_ID_INVALID = -1;
private final Map<Integer, Snapshot> snapshots; private final Map<Integer, Snapshot> snapshots;
private final SortedSet<Integer> versions;
private int latestVersionID; private int latestVersionID;
public WLProject() { public WLProject(String name) {
this.name = name;
snapshots = new HashMap<Integer, Snapshot>(); snapshots = new HashMap<Integer, Snapshot>();
versions = new TreeSet<Integer>();
latestVersionID = VERSION_ID_INVALID; latestVersionID = VERSION_ID_INVALID;
} }
@ -24,4 +37,69 @@ public class WLProject implements JSONModel {
} }
public void update() throws InterruptedException, ExecutionException, IOException {
getNew();
}
private boolean getNew() throws InterruptedException, ExecutionException, IOException {
Request getDoc = new SnapshotGetDocRequest(name);
Request getSavedVers = new SnapshotGetSavedVersRequest(name);
getDoc.request();
getSavedVers.request();
List<Integer> ids = new LinkedList<Integer>();
boolean result = false;
ids.add(getLatestVersionID(getDoc.getResponse()));
ids.addAll(getLatestVersionIDs(getSavedVers.getResponse()));
List<Integer> idsToUpdate = new LinkedList<Integer>();
boolean hasNew = false;
for (Integer id : ids) {
boolean contains = versions.contains(id);
result = result || contains;
if (!contains) {
idsToUpdate.add(id);
}
}
updateIDs(idsToUpdate);
return result;
}
private void updateIDs(List<Integer> idsToUpdate) {
List<Request> requests = new LinkedList<Request>();
for (int id : idsToUpdate) {
SnapshotGetForVersionRequest request = new SnapshotGetForVersionRequest(name, id);
requests.add(request);
request.request();
}
}
private int getLatestVersionID(String response) {
Gson gson = new Gson();
JsonObject responseObject = gson.fromJson(response, JsonObject.class);
return responseObject.get("latestVerId").getAsInt();
}
private Collection<? extends Integer> getLatestVersionIDs(String response) {
List<Integer> ids = new LinkedList<Integer>();
Gson gson = new Gson();
JsonArray responseArray = gson.fromJson(response, JsonArray.class);
for (JsonElement elem : responseArray) {
ids.add(getVersionID(elem.getAsJsonObject()));
}
return ids;
}
private Integer getVersionID(JsonObject object) {
return object.get("versionId").getAsInt();
}
} }

View file

@ -1,6 +1,10 @@
package uk.ac.ic.wlgitbridge.test.writelatex.model; package uk.ac.ic.wlgitbridge.test.writelatex.model;
import org.junit.Test; import org.junit.Test;
import uk.ac.ic.wlgitbridge.writelatex.model.WLProject;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
/** /**
* Created by Winston on 06/11/14. * Created by Winston on 06/11/14.
@ -9,7 +13,16 @@ public class WLProjectTests {
@Test @Test
public void nothingToTest() { public void nothingToTest() {
WLProject project = new WLProject("1826rqgsdb");
try {
project.update();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} }
} }