Skip to content
Permalink
Browse files

TeamCity 9.1 API compatibility

  • Loading branch information
orybak committed Jul 14, 2015
1 parent a15a100 commit 0f585462c09075fdc94eb815686bb414cbacf46c
@@ -10,7 +10,7 @@

<packaging>pom</packaging>
<properties>
<teamcity-version>8.0</teamcity-version>
<teamcity-version>9.1-SNAPSHOT</teamcity-version>
<idea-version>95.677</idea-version>
</properties>
<repositories>
@@ -4,14 +4,10 @@
import com.marcusilgner.ghcity.models.GithubIssue;
import jetbrains.buildServer.issueTracker.AbstractIssueFetcher;
import jetbrains.buildServer.issueTracker.IssueData;
import jetbrains.buildServer.util.FileUtil;
import jetbrains.buildServer.util.cache.EhCacheUtil;
import org.apache.commons.httpclient.Credentials;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@@ -30,7 +26,7 @@

private final static Log LOGGER = LogFactory.getLog(GithubIssueFetcher.class);

private final static String HOST_PATTERN = "^([\\w-]+)/([\\w-_\\.]+)$";
private final static String HOST_PATTERN = "^(.+)/(.+)$";
private Pattern myPattern;

public void setPattern(final Pattern _myPattern) {
@@ -2,6 +2,7 @@

import jetbrains.buildServer.issueTracker.AbstractIssueProvider;
import jetbrains.buildServer.issueTracker.IssueFetcher;
import jetbrains.buildServer.issueTracker.IssueProviderType;
import org.jetbrains.annotations.NotNull;

import java.util.Map;
@@ -16,14 +17,16 @@
public class GithubIssueProvider
extends AbstractIssueProvider {

public GithubIssueProvider(@org.jetbrains.annotations.NotNull IssueFetcher fetcher) {
super("GithubIssues", fetcher);
public GithubIssueProvider(@NotNull final IssueProviderType type,
@NotNull IssueFetcher fetcher) {
super(type.getType(), fetcher);
}

@Override
public void setProperties(@NotNull final Map<String, String> map) {
super.setProperties(map);
myHost = map.get("repository");
myFetchHost = myHost;
}

@NotNull
@@ -3,6 +3,7 @@
import jetbrains.buildServer.issueTracker.AbstractIssueProviderFactory;
import jetbrains.buildServer.issueTracker.IssueFetcher;
import jetbrains.buildServer.issueTracker.IssueProvider;
import jetbrains.buildServer.issueTracker.IssueProviderType;
import org.jetbrains.annotations.NotNull;

/**
@@ -11,12 +12,12 @@
*/
public class GithubIssueProviderFactory
extends AbstractIssueProviderFactory {
protected GithubIssueProviderFactory(@NotNull IssueFetcher fetcher) {
super(fetcher, "GithubIssues");
public GithubIssueProviderFactory(@NotNull final IssueProviderType type, @NotNull IssueFetcher fetcher) {
super(type, fetcher);
}

@NotNull
public IssueProvider createProvider() {
return new GithubIssueProvider(myFetcher);
return new GithubIssueProvider(myType, myFetcher);
}
}
@@ -0,0 +1,50 @@
package com.marcusilgner.ghcity;

import jetbrains.buildServer.issueTracker.IssueProviderType;
import jetbrains.buildServer.web.openapi.PluginDescriptor;
import org.jetbrains.annotations.NotNull;

/**
* Created with IntelliJ IDEA.
*
* @author Oleg Rybak (oleg.rybak@jetbrains.com)
*/
public class GithubIssueProviderType extends IssueProviderType {

@NotNull
private final String myConfigUrl;

@NotNull
private final String myPopupUrl;

public GithubIssueProviderType(@NotNull final PluginDescriptor pluginDescriptor) {
myConfigUrl = pluginDescriptor.getPluginResourcesPath("admin/editIssueProvider.jsp");
myPopupUrl = pluginDescriptor.getPluginResourcesPath("popup-experimental.jsp");
}

@NotNull
@Override
public String getType() {
return "GithubIssues";
}

@NotNull
@Override
public String getDisplayName() {
return "GitHub Issues";
}

@NotNull
@Override
public String getEditParametersUrl() {
return myConfigUrl;
}

@NotNull
@Override
public String getIssueDetailsUrl() {
return myPopupUrl;
}


}
@@ -2,10 +2,12 @@
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans default-autowire="constructor">
<bean id="githubIssueProviderType" class="com.marcusilgner.ghcity.GithubIssueProviderType"/>
<bean id="githubFetcher" class="com.marcusilgner.ghcity.GithubIssueFetcher">
<constructor-arg index="0" ref="ehCacheUtil"/>
</bean>
<bean id="githubFactory" class="com.marcusilgner.ghcity.GithubIssueProviderFactory">
<constructor-arg index="0" ref="githubFetcher"/>
<constructor-arg index="0" ref="githubIssueProviderType"/>
<constructor-arg index="1" ref="githubFetcher"/>
</bean>
</beans>

0 comments on commit 0f58546

Please sign in to comment.
You can’t perform that action at this time.