Skip to content
Browse files

It works!

  • Loading branch information...
1 parent 23bd23c commit 2833a3c8f53ef9df702313b2660d189c0dcac172 @cread committed Dec 2, 2010
View
2 .idea/misc.xml
@@ -21,7 +21,7 @@
<option name="OPEN_IN_BROWSER" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
- <output url="file://out" />
+ <output url="file://$APPLICATION_HOME_DIR$/bin/out" />
</component>
</project>
View
334 .idea/workspace.xml
@@ -60,28 +60,10 @@
<component name="FileColors" enabled="true" enabledForTabs="true" />
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="build-server-plugin.xml" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/META-INF/build-server-plugin.xml">
+ <file leaf-file-name="README" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/README">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="18" selection-start="201" selection-end="201" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="build.xml" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/build.xml">
- <provider selected="true" editor-type-id="text-editor">
- <state line="71" column="31" selection-start="2307" selection-end="2307" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="TCJSON.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/TCJSON.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="12" column="50" selection-start="454" selection-end="521" vertical-scroll-proportion="0.0">
+ <state line="14" column="29" selection-start="319" selection-end="319" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -90,23 +72,14 @@
<file leaf-file-name="JSONMonitorController.java" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSONMonitorController.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="16" column="63" selection-start="688" selection-end="688" vertical-scroll-proportion="0.27042255">
+ <state line="42" column="74" selection-start="1885" selection-end="1885" vertical-scroll-proportion="0.6951724">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="JSONView.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSONView.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="45" column="61" selection-start="1653" selection-end="1653" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
</leaf>
</component>
<component name="FindManager">
@@ -125,10 +98,18 @@
<option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSON.java" />
<option value="$PROJECT_DIR$/src/META-INF/build-server-plugin.xml" />
<option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSON.java" />
- <option value="$PROJECT_DIR$/build.xml" />
<option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/TCJSON.java" />
- <option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSONMonitorController.java" />
+ <option value="$PROJECT_DIR$/build.xml" />
+ <option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/URLParser.java" />
+ <option value="$PROJECT_DIR$/src/tests/com/phrydde/teamcity/URLParserTests.java" />
+ <option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/JobState.java" />
+ <option value="$PROJECT_DIR$/src/tests/com/phrydde/teamcity/JSONViewStateTests.java" />
+ <option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSONViewState.java" />
<option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSONView.java" />
+ <option value="$PROJECT_DIR$/README" />
+ <option value="$PROJECT_DIR$/src/tests/com/phrydde/teamcity/URIParserTests.java" />
+ <option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/URIParser.java" />
+ <option value="$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSONMonitorController.java" />
</list>
</option>
</component>
@@ -185,35 +166,221 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="tcjson" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="tcjson" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="tests" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="com" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="phrydde" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="teamcity" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="tcjson" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="tcjson" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="tcjson" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="tcjson" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="main" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="com" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="phrydde" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="teamcity" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
</subPane>
</pane>
- <pane id="PackagesPane" />
<pane id="Favorites" />
<pane id="Scope" />
+ <pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="GoToFile.includeJavaFiles" value="false" />
- <property name="project.structure.last.edited" value="Global Libraries" />
+ <property name="project.structure.last.edited" value="Modules" />
<property name="OverrideImplement.combined" value="true" />
<property name="project.structure.proportion" value="0.15" />
<property name="options.splitter.main.proportions" value="0.3" />
+ <property name="recentsLimit" value="5" />
<property name="MemberChooser.sorted" value="false" />
- <property name="options.lastSelected" value="editor.preferences.appearance" />
+ <property name="options.lastSelected" value="fileTemplates" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
- <property name="options.splitter.details.proportions" value="0.2" />
+ <property name="dynamic.classpath" value="false" />
<property name="options.searchVisible" value="true" />
+ <property name="options.splitter.details.proportions" value="0.2" />
</component>
<component name="RecentsManager">
<key name="CreateClassDialog.RecentsKey">
<recent name="com.phrydde.teamcity" />
</key>
</component>
- <component name="RunManager">
+ <component name="RunManager" selected="JUnit.URIParserTests">
+ <configuration default="false" name="URIParserTests.testCanPullOutSingleProjectFromURL" type="JUnit" factoryName="JUnit" temporary="true">
+ <extension name="snapshooter" />
+ <module name="tcjson" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PACKAGE_NAME" value="com.phrydde.teamcity" />
+ <option name="MAIN_CLASS_NAME" value="com.phrydde.teamcity.URIParserTests" />
+ <option name="METHOD_NAME" value="testCanPullOutSingleProjectFromURL" />
+ <option name="TEST_OBJECT" value="method" />
+ <option name="VM_PARAMETERS" />
+ <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 />
+ <RunnerSettings RunnerId="Run" />
+ <ConfigurationWrapper RunnerId="Run" />
+ <method />
+ </configuration>
+ <configuration default="false" name="URIParserTests" type="JUnit" factoryName="JUnit" temporary="true">
+ <extension name="snapshooter" />
+ <module name="tcjson" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PACKAGE_NAME" value="com.phrydde.teamcity" />
+ <option name="MAIN_CLASS_NAME" value="com.phrydde.teamcity.URIParserTests" />
+ <option name="METHOD_NAME" />
+ <option name="TEST_OBJECT" value="class" />
+ <option name="VM_PARAMETERS" />
+ <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 />
+ <RunnerSettings RunnerId="Run" />
+ <ConfigurationWrapper RunnerId="Run" />
+ <method />
+ </configuration>
+ <configuration default="false" name="URIParserTests.testCanPullOutMultipleProjectsFromURL" type="JUnit" factoryName="JUnit" temporary="true">
+ <extension name="snapshooter" />
+ <module name="tcjson" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PACKAGE_NAME" value="com.phrydde.teamcity" />
+ <option name="MAIN_CLASS_NAME" value="com.phrydde.teamcity.URIParserTests" />
+ <option name="METHOD_NAME" value="testCanPullOutMultipleProjectsFromURL" />
+ <option name="TEST_OBJECT" value="method" />
+ <option name="VM_PARAMETERS" />
+ <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 />
+ <RunnerSettings RunnerId="Run" />
+ <ConfigurationWrapper RunnerId="Run" />
+ <method />
+ </configuration>
+ <configuration default="false" name="JSONViewStateTests.testShouldRenderEmptyListIfNoJobs" type="JUnit" factoryName="JUnit" temporary="true">
+ <extension name="snapshooter" />
+ <module name="tcjson" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PACKAGE_NAME" value="com.phrydde.teamcity" />
+ <option name="MAIN_CLASS_NAME" value="com.phrydde.teamcity.JSONViewStateTests" />
+ <option name="METHOD_NAME" value="testShouldRenderEmptyListIfNoJobs" />
+ <option name="TEST_OBJECT" value="method" />
+ <option name="VM_PARAMETERS" />
+ <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 />
+ <RunnerSettings RunnerId="Run" />
+ <ConfigurationWrapper RunnerId="Run" />
+ <method />
+ </configuration>
+ <configuration default="false" name="JSONViewStateTests" type="JUnit" factoryName="JUnit" temporary="true">
+ <extension name="snapshooter" />
+ <module name="tcjson" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PACKAGE_NAME" value="com.phrydde.teamcity" />
+ <option name="MAIN_CLASS_NAME" value="com.phrydde.teamcity.JSONViewStateTests" />
+ <option name="METHOD_NAME" />
+ <option name="TEST_OBJECT" value="class" />
+ <option name="VM_PARAMETERS" />
+ <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 />
+ <RunnerSettings RunnerId="Run" />
+ <ConfigurationWrapper RunnerId="Run" />
+ <method />
+ </configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
@@ -322,7 +489,13 @@
<option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
- <list size="0" />
+ <list size="5">
+ <item index="0" class="java.lang.String" itemvalue="JUnit.URLParserTests.testCanPullOutSingleProjectFromURL" />
+ <item index="1" class="java.lang.String" itemvalue="JUnit.URLParserTests" />
+ <item index="2" class="java.lang.String" itemvalue="JUnit.URLParserTests.testCanPullOutMultipleProjectsFromURL" />
+ <item index="3" class="java.lang.String" itemvalue="JUnit.JSONViewStateTests.testShouldRenderEmptyListIfNoJobs" />
+ <item index="4" class="java.lang.String" itemvalue="JUnit.JSONViewStateTests" />
+ </list>
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
<Port>5050</Port>
@@ -348,20 +521,21 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="22" width="1440" height="874" extended-state="0" />
- <editor active="false" />
+ <editor active="true" />
<layout>
<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="Palette" 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="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="Version Control" 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="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32891247" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
- <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" 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="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" 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.24946082" sideWeight="0.6618037" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Dependency Viewer" 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="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24946082" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="Run" active="false" anchor="bottom" 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="Version Control" 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="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32891247" 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="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" />
@@ -404,44 +578,94 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
- <entry file="jar://$PROJECT_DIR$/../TeamCity/devPackage/runtime-util.jar!/jetbrains/buildServer/messages/Status.class">
+ <entry file="file://$PROJECT_DIR$/src/META-INF/build-server-plugin.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="5" column="26" selection-start="181" selection-end="181" vertical-scroll-proportion="0.069970846">
+ <state line="4" column="18" selection-start="201" selection-end="201" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/META-INF/build-server-plugin.xml">
+ <entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/TCJSON.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="18" selection-start="201" selection-end="201" vertical-scroll-proportion="0.0">
+ <state line="12" column="50" selection-start="454" selection-end="521" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="71" column="31" selection-start="2307" selection-end="2307" vertical-scroll-proportion="0.0">
+ <state line="119" column="32" selection-start="3891" selection-end="3891" vertical-scroll-proportion="-31.05">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/TCJSON.java">
+ <entry file="jar://$PROJECT_DIR$/../TeamCity/devPackage/runtime-util.jar!/jetbrains/buildServer/messages/Status.class">
<provider selected="true" editor-type-id="text-editor">
- <state line="12" column="50" selection-start="454" selection-end="521" vertical-scroll-proportion="0.0">
+ <state line="5" column="26" selection-start="181" selection-end="187" vertical-scroll-proportion="-0.055684455">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/tests/com/phrydde/teamcity/JSONViewStateTests.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="31" column="17" selection-start="1310" selection-end="1310" vertical-scroll-proportion="0.0">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/JobState.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="12" column="65" selection-start="381" selection-end="381" vertical-scroll-proportion="0.30638298">
<folding />
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSONViewState.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="26" column="30" selection-start="884" selection-end="884" vertical-scroll-proportion="0.6638298">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
<entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSONView.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="45" column="61" selection-start="1653" selection-end="1653" vertical-scroll-proportion="0.0">
+ <state line="43" column="45" selection-start="1640" selection-end="1640" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/tests/com/phrydde/teamcity/URIParserTests.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="15" column="45" selection-start="502" selection-end="502" vertical-scroll-proportion="0.0">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/URIParser.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="11" column="64" selection-start="374" selection-end="374" vertical-scroll-proportion="0.18206896">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/README">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="14" column="29" selection-start="319" selection-end="319" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/com/phrydde/teamcity/JSONMonitorController.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="16" column="63" selection-start="688" selection-end="688" vertical-scroll-proportion="0.27042255">
+ <state line="42" column="74" selection-start="1885" selection-end="1885" vertical-scroll-proportion="0.6951724">
<folding>
<element signature="imports" expanded="true" />
</folding>
View
17 README
@@ -0,0 +1,17 @@
+This is a Server Side Plugin to add JSON and JSONP support to TeamCity.
+
+Install
+
+To install, simply copy the tcjson.jar file to the $TEAMCITY_HOME/webapps/ROOT/WEB-INF/lib directory.
+
+Usage
+
+To see all active builds:
+
+GET /app/json/api/json
+
+To see all active builds for a given project:
+
+GET /app/json/<projectId>/api/json
+
+By default it requires authentication for the project you want to examine.
View
28 build.xml
@@ -1,5 +1,6 @@
<project name="tcjson" default="build">
<property name="app" value="tcjson"/>
+ <property name="build.sysclasspath" value="ignore"/>
<tstamp>
<format property="version" timezone="UTC" pattern="yyyyMMdd"/>
@@ -11,6 +12,7 @@
<path id="build.classpath">
<fileset dir="lib" includes="*.jar"/>
+ <pathelement location="build/classes"/>
<fileset dir="${teamcity.home}/lib" includes="*.jar" excludes="${app}*.jar"/>
<fileset dir="${teamcity.appdir}/lib" includes="*.jar" excludes="${app}*.jar"/>
</path>
@@ -48,6 +50,16 @@
target="1.5">
<src path="src/main"/>
+ </javac>
+
+ <mkdir dir="build/test-classes"/>
+ <javac classpathref="build.classpath"
+ destdir="build/test-classes"
+ debug="yes"
+ failonerror="yes"
+ source="1.5"
+ target="1.5">
+
<src path="src/tests"/>
</javac>
</target>
@@ -65,9 +77,7 @@
<target name="jar.app" depends="compile, build.identifier, dir.dist">
<jar destfile="${distdir}/${app}.jar" compress="false">
- <fileset dir="build/classes">
- <exclude name="nat/piazza/tests/**"/>
- </fileset>
+ <fileset dir="build/classes"/>
<fileset dir="src">
<include name="META-INF/**/*"/>
</fileset>
@@ -76,9 +86,7 @@
<target name="jar.tests" depends="compile, dir.dist">
<jar destfile="${distdir}/${app}-tests.jar" compress="false">
- <fileset dir="build/classes">
- <include name="nat/piazza/tests/**"/>
- </fileset>
+ <fileset dir="build/test-classes"/>
</jar>
</target>
@@ -93,15 +101,13 @@
<classpath>
<path refid="build.classpath"/>
<fileset dir="${distdir}" includes="*.jar"/>
- <fileset dir="src/tests" excludes="*.java"/>
</classpath>
<formatter type="brief" usefile="no"/>
<batchtest haltonfailure="yes">
<fileset dir="src/tests">
<include name="**/*Tests.java"/>
- <exclude name="**/Abstract*"/>
</fileset>
</batchtest>
</junit>
@@ -111,10 +117,4 @@
description="Deploys to a local TeamCity server">
<copy file="${distdir}/${app}.jar" todir="${teamcity.appdir}/lib"/>
</target>
-
- <target name="undeploy">
- <teamcity action="stop"/>
- <delete dir="${teamcity.appdir}/lib" includes="${app}.jar"/>
- <teamcity action="start"/>
- </target>
</project>
View
BIN lib/junit-4.8.2.jar
Binary file not shown.
View
51 src/main/com/phrydde/teamcity/JSONMonitorController.java
@@ -1,17 +1,13 @@
package com.phrydde.teamcity;
import com.intellij.openapi.diagnostic.Logger;
-import jetbrains.buildServer.messages.Status;
-import jetbrains.buildServer.serverSide.ProjectManager;
-import jetbrains.buildServer.serverSide.SBuildAgent;
-import jetbrains.buildServer.serverSide.SBuildServer;
-import jetbrains.buildServer.serverSide.SProject;
+import jetbrains.buildServer.serverSide.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.util.HashMap;
+import java.util.List;
public class JSONMonitorController implements Controller {
final Logger LOG = Logger.getInstance(JSONMonitorController.class.getName());
@@ -23,30 +19,35 @@ public JSONMonitorController(SBuildServer server, ProjectManager projectManager)
this.projectManager = projectManager;
}
- public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
- int numberOfProjects = projectManager.getNumberOfProjects();
+ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ String rootURL = server.getRootUrl();
+ JSONViewState state = new JSONViewState(rootURL);
- ModelAndView modelAndView = new ModelAndView(new JSONView());
-
- modelAndView.addObject("url", server.getRootUrl());
- modelAndView.addObject("numExecutors", server.getBuildAgentManager().<SBuildAgent>getRegisteredAgents().size());
- modelAndView.addObject("projectCount", numberOfProjects);
-
- HashMap projects = new HashMap();
+ List<String> requestedProjects = URIParser.getProjectList(request.getRequestURI());
+ if (requestedProjects.size() == 0) {
+ for (SProject project : projectManager.getActiveProjects()) {
+ requestedProjects.add(project.getProjectId());
+ }
+ }
- for (int i = 0; i < numberOfProjects; i++) {
- HashMap p = new HashMap();
- SProject project = projectManager.getProjects().get(i);
- System.out.println(" -> project.getName() = " + project.getName());
- LOG.error(" -> project.getName() = " + project.getName());
- p.put("name", project.getName());
- p.put("url", project.getProjectId());
- p.put("color", project.getStatus());
+ ModelAndView modelAndView = new ModelAndView(new JSONView());
- projects.put("project-" + String.valueOf(i), p);
+ for (String requestedProject : requestedProjects) {
+ SProject project = projectManager.findProjectById(requestedProject);
+ if (project != null) {
+ List<SBuildType> buildTypes = project.getBuildTypes();
+ for (SBuildType buildType : buildTypes) {
+ state.addJob(new JobState(buildType.getName(), buildType.getBuildTypeId(), buildType.getStatus().getText()));
+ }
+ } else {
+ // TODO: Given a project that does not exist. Throw a 404?
+ }
}
- modelAndView.addObject("projects", projects);
+ modelAndView.addObject("ViewState", state);
+ modelAndView.addObject("url", rootURL + "/");
+ modelAndView.addObject("numExecutors", server.getBuildAgentManager().<SBuildAgent>getRegisteredAgents().size());
+
return modelAndView;
}
}
View
73 src/main/com/phrydde/teamcity/JSONView.java
@@ -6,7 +6,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
-import java.util.HashMap;
import java.util.Map;
public class JSONView implements View {
@@ -21,60 +20,38 @@ public void render(Map map, HttpServletRequest request, HttpServletResponse resp
response.setCharacterEncoding("UTF-8");
StringBuilder data = new StringBuilder();
- String[] jsonp = request.getParameterValues("jsonp");
-
- if (jsonp != null) {
- data.append(jsonp[0]).append("(");
- }
-
-
data.append("{")
- .append("\"assignedLabels\":[{}],")
- .append("\"mode\":\"NORMAL\",")
- .append("\"nodeDescription\":\"TeamCity Hudson clone\",")
- .append("\"nodeName\":\"\",")
- .append("\"numExecutors\":").append(map.get("numExecutors")).append(",")
- .append("\"projectCount\":").append(map.get("projectCount")).append(",")
- .append("\"description\":null,")
- .append("\"jobs\":[{");
+ .append("\"assignedLabels\":[{}],")
+ .append("\"mode\":\"NORMAL\",")
+ .append("\"nodeDescription\":\"TeamCity Hudson clone\",")
+ .append("\"nodeName\":\"\",")
+ .append("\"numExecutors\":").append(map.get("numExecutors")).append(",")
+ .append("\"description\":null,");
- for (int i = 0; i < (Integer)map.get("projectCount"); i++) {
- HashMap project = (HashMap)map.get("project-" + String.valueOf(i));
+ JSONViewState state = (JSONViewState)map.get("ViewState");
- if (project == null) {
- LOG.error("Got a null project! project-" + String.valueOf(i));
- }
- data.append("\"name\":\"").append(project.get("name")).append("\",");
- data.append("\"url\":\"").append(project.get("url")).append("\",");
- data.append("\"color\":\"").append(project.get("color")).append("\",");
+ if (state != null) {
+ data.append(state.renderJobsList());
}
- // TODO: Loop through and fill this in
-// "name":"Broken Build",
-// "url":"http://localhost:8080/job/Broken%20Build/",
-// "color":"red"
-// },
-// {
-// "name":"Clean Build",
-// "url":"http://localhost:8080/job/Clean%20Build/",
-// "color":"blue"
-// }],
- data.append("}],")
- .append("\"overallLoad\":{},")
- .append("\"primaryView\":{")
- .append("\"name\":\"All\",")
- .append("\"url\":\"").append(map.get("url")).append("\"")
- .append(")},")
- .append("\"slaveAgentPort\":0,")
- .append("\"useCrumbs\":false,")
- .append("\"useSecurity\":false,")
- .append("\"views\":[{")
- .append("\"name\":\"All\",")
- .append("\"url\":\"").append(map.get("url")).append("\"")
- .append(")}]")
- .append("}");
+ data.append("\"overallLoad\":{},")
+ .append("\"primaryView\":{")
+ .append("\"name\":\"All\",")
+ .append("\"url\":\"").append(map.get("url")).append("\"")
+ .append(")},")
+ .append("\"slaveAgentPort\":0,")
+ .append("\"useCrumbs\":false,")
+ .append("\"useSecurity\":true,")
+ .append("\"views\":[{")
+ .append("\"name\":\"All\",")
+ .append("\"url\":\"").append(map.get("url")).append("\"")
+ .append(")}]")
+ .append("}");
+
+ String[] jsonp = request.getParameterValues("jsonp");
if (jsonp != null) {
+ data.insert(0, jsonp[0] + "(");
data.append(")\n");
} else {
data.append("\n");
View
38 src/main/com/phrydde/teamcity/JSONViewState.java
@@ -0,0 +1,38 @@
+package com.phrydde.teamcity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class JSONViewState {
+ private final String rootURL;
+ private final List<JobState> jobs;
+
+ public JSONViewState(String rootURL) {
+ this.rootURL = rootURL;
+ this.jobs = new ArrayList<JobState>();
+ }
+
+ public String renderJobsList() {
+ StringBuilder data = new StringBuilder();
+ data.append("\"jobs\":[");
+
+ if (jobs.size() > 0) {
+ for (JobState job : jobs) {
+ data.append("{\"name\":\"").append(job.name)
+ .append("\",\"url\":\"").append(rootURL).append("/viewType.html?buildTypeId=").append(job.id)
+ .append("\",\"color\":\"").append(job.color).append("\"},");
+ }
+ data.deleteCharAt(data.length() - 1);
+ } else {
+ data.append("{}");
+ }
+
+
+ data.append("],");
+ return data.toString();
+ }
+
+ public void addJob(JobState job) {
+ jobs.add(job);
+ }
+}
View
15 src/main/com/phrydde/teamcity/JobState.java
@@ -0,0 +1,15 @@
+package com.phrydde.teamcity;
+
+public class JobState {
+ public final String name;
+ public final String id;
+ public final String status;
+ public final String color;
+
+ public JobState(String name, String id, String status) {
+ this.name = name;
+ this.id = id;
+ this.status = status;
+ this.color = ("SUCCESS".equals(status)) ? "blue" : "red";
+ }
+}
View
20 src/main/com/phrydde/teamcity/URIParser.java
@@ -0,0 +1,20 @@
+package com.phrydde.teamcity;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class URIParser {
+ public static List<String> getProjectList(String uri) {
+ List<String> list = new ArrayList<String>();
+ Pattern pattern = Pattern.compile("^/app/json/(.*?)/api/json$");
+ Matcher matcher = pattern.matcher(uri);
+ if (matcher.matches()) {
+ String[] ids = matcher.group(1).split("/");
+ list.addAll(Arrays.asList(ids));
+ }
+ return list;
+ }
+}
View
35 src/tests/com/phrydde/teamcity/JSONViewStateTests.java
@@ -0,0 +1,35 @@
+package com.phrydde.teamcity;
+
+import junit.framework.TestCase;
+
+import jetbrains.buildServer.messages.Status;
+
+public class JSONViewStateTests extends TestCase {
+ public void testShouldRenderEmptyListIfNoJobs() {
+ JSONViewState state = new JSONViewState("");
+ assertEquals("\"jobs\":[{}],", state.renderJobsList());
+ }
+
+ public void testShouldBeAbleToRenderMultipleJobDetails() {
+ JSONViewState state = new JSONViewState("http://localhost:8111");
+
+ state.addJob(new JobState("Job1", "bt3", "ERROR"));
+ state.addJob(new JobState("Job2", "bt5", "SUCCESS"));
+
+ assertEquals("\"jobs\":[" +
+ "{\"name\":\"Job1\",\"url\":\"http://localhost:8111/viewType.html?buildTypeId=bt3\",\"color\":\"red\"}," +
+ "{\"name\":\"Job2\",\"url\":\"http://localhost:8111/viewType.html?buildTypeId=bt5\",\"color\":\"blue\"}" +
+ "],", state.renderJobsList());
+ }
+
+ public void testShouldBeAbleToRenderSingleJobDetails() {
+ JSONViewState state = new JSONViewState("http://localhost:8111");
+
+ state.addJob(new JobState("Job1", "bt3", "ERROR"));
+
+ assertEquals("\"jobs\":[" +
+ "{\"name\":\"Job1\",\"url\":\"http://localhost:8111/viewType.html?buildTypeId=bt3\",\"color\":\"red\"}" +
+ "],", state.renderJobsList());
+ }
+
+}
View
35 src/tests/com/phrydde/teamcity/URIParserTests.java
@@ -0,0 +1,35 @@
+package com.phrydde.teamcity;
+
+import junit.framework.TestCase;
+
+import java.util.List;
+
+public class URIParserTests extends TestCase {
+ public void testCanPullOutSingleProjectFromURL() {
+ List<String> list = URIParser.getProjectList("/app/json/MyProjectID/api/json");
+ assertNotNull(list);
+ assertEquals(1, list.size());
+ assertEquals(list.get(0), "MyProjectID");
+ }
+
+ public void testCanPullOutMultipleProjectsFromURL() {
+ List<String> list = URIParser.getProjectList("/app/json/Proj1/Proj2/Proj3/api/json");
+ assertNotNull(list);
+ assertEquals(3, list.size());
+ assertEquals(list.get(0), "Proj1");
+ assertEquals(list.get(1), "Proj2");
+ assertEquals(list.get(2), "Proj3");
+ }
+
+ public void testOnlyAcceptsAPIJSONAtTheEnd() {
+ List<String> list = URIParser.getProjectList("/app/json/MyProjectID/sheep/cheese");
+ assertNotNull(list);
+ assertEquals(0, list.size());
+ list = URIParser.getProjectList("/app/json/MyProjectID/api/cheese");
+ assertNotNull(list);
+ assertEquals(0, list.size());
+ list = URIParser.getProjectList("/app/json/MyProjectID/sheep/json");
+ assertNotNull(list);
+ assertEquals(0, list.size());
+ }
+}
View
10 tcjson.iml
@@ -4,10 +4,20 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="TeamCity" level="project" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/junit-4.8.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
</component>
</module>

0 comments on commit 2833a3c

Please sign in to comment.
Something went wrong with that request. Please try again.