Skip to content

Commit

Permalink
compatibility changes for bitbucket server 4.*
Browse files Browse the repository at this point in the history
  • Loading branch information
realshadow committed Jan 21, 2016
1 parent a22d957 commit 836fffb
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 73 deletions.
60 changes: 28 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sk.hts.stash.plugin.satis</groupId>
<groupId>sk.bitbucket.server.plugin.satis</groupId>
<artifactId>satis-build-plugin</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<organization>
<name>H-Tech Solutions s.r.o.</name>
<url>http://www.lukashomza.com/</url>
Expand All @@ -15,9 +15,9 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-parent</artifactId>
<version>${stash.version}</version>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-parent</artifactId>
<version>${bitbucket.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -30,33 +30,35 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-api</artifactId>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-scm-git-api</artifactId>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-git-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-scm-common</artifactId>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-scm-common</artifactId>
<version>${bitbucket.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-spi</artifactId>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-spi</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-page-objects</artifactId>
<groupId>com.atlassian.bitbucket.server</groupId>
<artifactId>bitbucket-page-objects</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -132,40 +134,34 @@
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-stash-plugin</artifactId>
<artifactId>bitbucket-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<products>
<product>
<id>stash</id>
<instanceId>stash</instanceId>
<version>${stash.version}</version>
<dataVersion>${stash.data.version}</dataVersion>
<id>bitbucket</id>
<instanceId>bitbucket</instanceId>
<version>${bitbucket.version}</version>
<dataVersion>${bitbucket.data.version}</dataVersion>
</product>
</products>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<source>1.7
</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<stash.version>3.11.4</stash.version>
<stash.data.version>3.11.4</stash.data.version>
<bitbucket.version>4.2.2</bitbucket.version>
<bitbucket.data.version>${bitbucket.version}</bitbucket.data.version>
<amps.version>6.1.2</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package sk.hts.stash.plugin.satis.hook;
package sk.hts.bitbucket.server.plugin.satis.hook;

import com.atlassian.stash.hook.repository.*;
import com.atlassian.stash.repository.*;
import com.atlassian.stash.setting.*;
import com.atlassian.stash.repository.Repository;
import com.atlassian.bitbucket.hook.repository.*;
import com.atlassian.bitbucket.repository.*;
import com.atlassian.bitbucket.setting.*;
import com.atlassian.bitbucket.repository.Repository;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package sk.hts.stash.plugin.satis.hook;
package sk.hts.bitbucket.server.plugin.satis.hook;

import com.atlassian.event.api.EventListener;
import com.atlassian.stash.event.RepositoryDeletedEvent;
import com.atlassian.stash.event.RepositoryModifiedEvent;
import com.atlassian.bitbucket.event.repository.RepositoryDeletedEvent;
import com.atlassian.bitbucket.event.repository.RepositoryModifiedEvent;

public class SatisEventListener {
private final SatisNotifier satisNotifier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package sk.hts.stash.plugin.satis.hook;
package sk.hts.bitbucket.server.plugin.satis.hook;

import com.atlassian.sal.api.pluginsettings.PluginSettings;
import com.atlassian.sal.api.pluginsettings.PluginSettingsFactory;
import com.atlassian.stash.exception.CommandFailedException;
import com.atlassian.stash.repository.Repository;
import com.atlassian.stash.server.ApplicationPropertiesService;
import com.atlassian.stash.scm.git.GitCommandBuilderFactory;
import com.atlassian.stash.scm.git.GitScm;
import com.atlassian.bitbucket.scm.CommandFailedException;
import com.atlassian.bitbucket.repository.Repository;
import com.atlassian.bitbucket.server.ApplicationPropertiesService;
import com.atlassian.bitbucket.scm.git.command.GitCommandBuilderFactory;
import com.atlassian.bitbucket.scm.git.GitScm;
import com.google.gson.JsonIOException;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
Expand All @@ -31,7 +31,7 @@

public class SatisNotifier
{
public static final String SETTINGS_KEY = "sk.hts.stash.plugin.satis.hook.stash-satis";
public static final String SETTINGS_KEY = "sk.bitbucket.server.plugin.satis.hook.bitbucket-satis";
public static final String API_URL_KEY = "cp-url";

public static final String REPOSITORY_EXTENSION = ".git";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package sk.hts.stash.plugin.satis.hook;
package sk.hts.bitbucket.server.plugin.satis.hook;

import java.io.IOException;

import org.slf4j.Logger;

import com.atlassian.stash.io.LineReader;
import com.atlassian.stash.io.LineReaderOutputHandler;
import com.atlassian.stash.scm.CommandOutputHandler;
import com.atlassian.bitbucket.io.LineReader;
import com.atlassian.bitbucket.io.LineReaderOutputHandler;
import com.atlassian.bitbucket.scm.CommandOutputHandler;
import com.atlassian.utils.process.Watchdog;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package sk.hts.stash.plugin.satis.hook.rest;
package sk.hts.bitbucket.server.plugin.satis.hook.rest;

import org.codehaus.jackson.map.annotate.JsonSerialize;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sk.hts.stash.plugin.satis.hook.rest;
package sk.hts.bitbucket.server.plugin.satis.hook.rest;

import sk.hts.stash.plugin.satis.hook.SatisNotifier;
import sk.hts.bitbucket.server.plugin.satis.hook.SatisNotifier;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
Expand Down
20 changes: 10 additions & 10 deletions src/main/resources/atlassian-plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@
<resource type="i18n" name="i18n" location="satis-build-plugin"/>

<rest name="Configuration Resource" i18n-name-key="configuration-resource.name" key="configuration-resource"
path="/stash-satis" version="1.0">
path="/bitbucket-satis" version="1.0">
<description>Rest resource for configuration</description>
</rest>

<component key="SatisBuildHook" class="sk.hts.stash.plugin.satis.hook.SatisBuildHook"/>
<component key="SatisNotifier" class="sk.hts.stash.plugin.satis.hook.SatisNotifier"/>
<component key="SatisEventListener" class="sk.hts.stash.plugin.satis.hook.SatisEventListener"/>
<component key="SatisBuildHook" class="sk.hts.bitbucket.server.plugin.satis.hook.SatisBuildHook"/>
<component key="SatisNotifier" class="sk.hts.bitbucket.server.plugin.satis.hook.SatisNotifier"/>
<component key="SatisEventListener" class="sk.hts.bitbucket.server.plugin.satis.hook.SatisEventListener"/>

<component-import key="gitScm" interface="com.atlassian.stash.scm.git.GitScm"/>
<component-import key="gitScm" interface="com.atlassian.bitbucket.scm.git.GitScm"/>
<component-import key="requestFactory" interface="com.atlassian.sal.api.net.RequestFactory"/>
<component-import key="soyTemplateRenderer" interface="com.atlassian.soy.renderer.SoyTemplateRenderer"/>
<component-import key="applicationPropertiesService"
interface="com.atlassian.stash.server.ApplicationPropertiesService"/>
interface="com.atlassian.bitbucket.server.ApplicationPropertiesService"/>
<component-import key="pluginSettingsFactory"
interface="com.atlassian.sal.api.pluginsettings.PluginSettingsFactory"/>

<web-item key="satis-config" name="Satis Config Link" section="atl.admin/admin-plugins-section" weight="500">
<description>${project.description}</description>
<label key="sk.satis-stash.satis-config.link"/>
<label>Satis Build Configuration</label>
<link>javascript: void();</link>
<styleClass>satis-config-link</styleClass>
</web-item>

<stash-resource key="satis-admin-soy" name="Admin Soy Templates">
<client-resource key="satis-admin-soy" name="Admin Soy Templates">
<directory location="/views/admin/">
<exclude>/**/*-min.*</exclude>
</directory>
<context>internal.layout.admin</context>
<context>atl.admin</context>
</stash-resource>
</client-resource>

<web-resource key="admin-resources" name="Admin Resources">
<resource type="download" name="satis-admin.js" location="js/satis-admin.js"/>
Expand All @@ -61,7 +61,7 @@
</web-panel>

<repository-hook name="Satis Build" i18n-name-key="satis-build-hook.name" key="satis-build-hook"
class="sk.hts.stash.plugin.satis.hook.SatisBuildHook">
class="sk.hts.bitbucket.server.plugin.satis.hook.SatisBuildHook">
<description key="satis-build-hook.description"/>
<icon>images/satisLogo.png</icon>
<config-form name="Satis Build Hook Config" key="satis-build-hook-config">
Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/js/satis-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@ AJS.$(document).ready(function ($) {
type: 'POST',
data: form.serialize(),
dataType: 'json',
headers: {"X-Atlassian-Token": "no-check"},
success: function (data) {
AJS.messages.success('#satis-stash-aui-message-bar', {
AJS.messages.success('#satis-bitbucket-aui-message-bar', {
title: 'Satis Control Panel URL has been saved successfully.'
});
},
complete: function (data) {
dialog.hide();
},
error: function (jqXHR, textStatus, errorThrown) {
AJS.messages.error('#satis-stash-aui-message-bar', {
AJS.messages.error('#satis-bitbucket-aui-message-bar', {
title: 'Unable to save Satis Control Panel URL.',
body: textStatus
});
Expand All @@ -86,7 +87,7 @@ AJS.$(document).ready(function ($) {

var initAndShow = function () {
$.ajax({
url: AJS.contextPath() + '/rest/stash-satis/1.0/api',
url: AJS.contextPath() + '/rest/bitbucket-satis/1.0/api',
type: 'GET',
dataType: 'json',
success: function (data) {
Expand All @@ -95,7 +96,7 @@ AJS.$(document).ready(function ($) {
dialog.show();
},
error: function (jqXHR, textStatus, errorThrown) {
AJS.messages.error('#satis-stash-aui-message-bar', {
AJS.messages.error('#satis-bitbucket-aui-message-bar', {
title: 'Could not load Satis Control Panel config.',
body: textStatus
});
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/satis-build-plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
my.plugin.name=Satis Build Plugin
satis-build-hook.name=Satis Build Trigger
satis-build-hook.description=Triggers rebuild for current repository in Satis
sk.satis-stash.satis-config.link = Satis Build Configuration
satis-build-hook.config.link = Satis Build Configuration
2 changes: 1 addition & 1 deletion src/main/resources/views/admin/settings.soy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
**/
{template .dialog}
<div>
<form action="{$context}/rest/stash-satis/1.0/api" method="post" id="satis-hook-config" name="satis-hook-config" class="aui unsectioned">
<form action="{$context}/rest/bitbucket-satis/1.0/api" method="post" id="satis-hook-config" name="satis-hook-config" class="aui unsectioned">
<h2>Satis Config</h3>
<fieldset>
<div class="field-group">
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/views/hook/settings.soy
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
*/
{template .formContents}
{call aui.form.radioField}
{param legendContent: stash_i18n('stash.web.stash.junit-enabled.button.description', 'Disable build on change?') /}
{param legendContent: getText('Disable build on change?') /}
{param fields: [
[
'id': 'disable_build',
'value': 'true',
'labelText': stash_i18n('stash.web.stash.enable-ci-radio.button.label', 'Yes'),
'labelText': getText('Yes'),
'isChecked': $config['disable_build'] == 'true' or $config['disable_build'] == null ? true : false
],
[
'id': 'disable_build',
'value': 'false',
'labelText': stash_i18n('stash.web.stash.enable-ci-radio.button.label', 'No'),
'labelText': getText('No'),
'isChecked': $config['disable_build'] == 'false' ? true : false
]
]/}
Expand Down

0 comments on commit 836fffb

Please sign in to comment.