Skip to content

Commit b69ff50

Browse files
authored
Move some implementations classes under impl packages to be clear that are implementations and not APIs
Melt build status notification test classes
1 parent 65d2017 commit b69ff50

33 files changed

+329
-368
lines changed

checkstyle.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<module name="Checker">
55
<module name="FileTabCharacter"/>
66
<module name="NewlineAtEndOfFile">
7-
<property name="lineSeparator" value="lf"/>
87
</module>
98
<module name="RegexpSingleline">
109
<property name="format" value="\s+$"/>

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketGitSCMBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketCloudEndpoint;
3232
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfiguration;
3333
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketServerEndpoint;
34+
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketCredentials;
3435
import com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey;
3536
import com.cloudbees.plugins.credentials.Credentials;
3637
import com.cloudbees.plugins.credentials.common.IdCredentials;

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketNotifier.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import java.io.IOException;
2929

3030
/**
31-
* Abstract Bitbucket commit notifier implementation.
31+
* Implementations must provides a concrete way to notify to Bitbucket commit.
3232
*/
33-
public abstract class BitbucketNotifier {
33+
public interface BitbucketNotifier {
3434

3535
/**
3636
* Notify bitbucket about a new build status on a concrete commit.
@@ -42,8 +42,7 @@ public abstract class BitbucketNotifier {
4242
* @throws IOException if there was a communication error during notification.
4343
* @throws InterruptedException if interrupted during notification.
4444
*/
45-
public abstract void notify(@CheckForNull String repoOwner, @CheckForNull String repoName, String hash, String content)
46-
throws IOException, InterruptedException;
45+
void notifyComment(@CheckForNull String repoOwner, @CheckForNull String repoName, String hash, String content) throws IOException, InterruptedException;
4746

4847
/**
4948
* Notify bitbucket through the build status API.
@@ -52,19 +51,19 @@ public abstract void notify(@CheckForNull String repoOwner, @CheckForNull String
5251
* @throws IOException if there was a communication error during notification.
5352
* @throws InterruptedException if interrupted during notification.
5453
*/
55-
public abstract void buildStatus(BitbucketBuildStatus status) throws IOException, InterruptedException;
54+
void notifyBuildStatus(BitbucketBuildStatus status) throws IOException, InterruptedException;
5655

5756
/**
58-
* Convenience method that calls {@link #notify(String, String, String, String)} without owner
57+
* Convenience method that calls {@link #notifyComment(String, String, String, String)} without owner
5958
* and repository name.
6059
*
6160
* @param hash commit hash
6261
* @param content notification content
6362
* @throws IOException if there was a communication error during notification.
6463
* @throws InterruptedException if interrupted during notification.
6564
*/
66-
public void notify(String hash, String content) throws IOException, InterruptedException {
67-
notify(null, null, hash, content);
65+
default void notifyComment(String hash, String content) throws IOException, InterruptedException {
66+
notifyComment(null, null, hash, content);
6867
}
6968

7069
}

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMNavigator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketCloudEndpoint;
3434
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfiguration;
3535
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketServerEndpoint;
36+
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketCredentials;
37+
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.MirrorListSupplier;
3638
import com.cloudbees.jenkins.plugins.bitbucket.server.BitbucketServerWebhookImplementation;
3739
import com.cloudbees.jenkins.plugins.bitbucket.server.client.repository.BitbucketServerProject;
3840
import com.cloudbees.plugins.credentials.CredentialsNameProvider;
@@ -101,7 +103,7 @@
101103
import org.kohsuke.stapler.DataBoundSetter;
102104
import org.kohsuke.stapler.QueryParameter;
103105

104-
import static com.cloudbees.jenkins.plugins.bitbucket.BitbucketApiUtils.getFromBitbucket;
106+
import static com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketApiUtils.getFromBitbucket;
105107

106108
public class BitbucketSCMNavigator extends SCMNavigator {
107109

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMSource.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
package com.cloudbees.jenkins.plugins.bitbucket;
2525

26-
import com.cloudbees.jenkins.plugins.bitbucket.BitbucketApiUtils.BitbucketSupplier;
2726
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketApi;
2827
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketApiFactory;
2928
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketAuthenticator;
@@ -38,12 +37,14 @@
3837
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketTeam;
3938
import com.cloudbees.jenkins.plugins.bitbucket.client.BitbucketCloudApiClient;
4039
import com.cloudbees.jenkins.plugins.bitbucket.client.repository.UserRoleInRepository;
41-
import com.cloudbees.jenkins.plugins.bitbucket.credentials.BitbucketUsernamePasswordAuthenticator;
4240
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.AbstractBitbucketEndpoint;
4341
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketCloudEndpoint;
4442
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfiguration;
4543
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketServerEndpoint;
4644
import com.cloudbees.jenkins.plugins.bitbucket.hooks.HasPullRequests;
45+
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketApiUtils.BitbucketSupplier;
46+
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketCredentials;
47+
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.MirrorListSupplier;
4748
import com.cloudbees.jenkins.plugins.bitbucket.server.BitbucketServerWebhookImplementation;
4849
import com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient;
4950
import com.cloudbees.jenkins.plugins.bitbucket.server.client.repository.BitbucketServerRepository;
@@ -133,7 +134,7 @@
133134
import org.kohsuke.stapler.QueryParameter;
134135
import org.kohsuke.stapler.interceptor.RequirePOST;
135136

136-
import static com.cloudbees.jenkins.plugins.bitbucket.BitbucketApiUtils.getFromBitbucket;
137+
import static com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketApiUtils.getFromBitbucket;
137138

138139
/**
139140
* SCM source implementation for Bitbucket.

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/api/BitbucketApiFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.cloudbees.jenkins.plugins.bitbucket.api;
22

3-
import com.cloudbees.jenkins.plugins.bitbucket.credentials.BitbucketUsernamePasswordAuthenticator;
3+
import com.cloudbees.jenkins.plugins.bitbucket.impl.credentials.BitbucketUsernamePasswordAuthenticator;
44
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials;
55
import edu.umd.cs.findbugs.annotations.CheckForNull;
66
import edu.umd.cs.findbugs.annotations.NonNull;

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/client/BitbucketCloudApiClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
import com.cloudbees.jenkins.plugins.bitbucket.client.repository.BitbucketRepositorySource;
4949
import com.cloudbees.jenkins.plugins.bitbucket.client.repository.PaginatedBitbucketRepository;
5050
import com.cloudbees.jenkins.plugins.bitbucket.client.repository.UserRoleInRepository;
51-
import com.cloudbees.jenkins.plugins.bitbucket.credentials.BitbucketUsernamePasswordAuthenticator;
5251
import com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile;
53-
import com.cloudbees.jenkins.plugins.bitbucket.internal.api.AbstractBitbucketApi;
52+
import com.cloudbees.jenkins.plugins.bitbucket.impl.client.AbstractBitbucketApi;
53+
import com.cloudbees.jenkins.plugins.bitbucket.impl.credentials.BitbucketUsernamePasswordAuthenticator;
5454
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials;
5555
import com.damnhandy.uri.template.UriTemplate;
5656
import com.damnhandy.uri.template.impl.Operator;

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/internal/api/AbstractBitbucketApi.java renamed to src/main/java/com/cloudbees/jenkins/plugins/bitbucket/impl/client/AbstractBitbucketApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
* THE SOFTWARE.
2323
*/
24-
package com.cloudbees.jenkins.plugins.bitbucket.internal.api;
24+
package com.cloudbees.jenkins.plugins.bitbucket.impl.client;
2525

2626
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException;
2727
import edu.umd.cs.findbugs.annotations.CheckForNull;

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/credentials/BitbucketAccessTokenAuthenticator.java renamed to src/main/java/com/cloudbees/jenkins/plugins/bitbucket/impl/credentials/BitbucketAccessTokenAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* THE SOFTWARE.
2323
*/
2424

25-
package com.cloudbees.jenkins.plugins.bitbucket.credentials;
25+
package com.cloudbees.jenkins.plugins.bitbucket.impl.credentials;
2626

2727
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketAuthenticator;
2828
import com.cloudbees.plugins.credentials.CredentialsScope;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* THE SOFTWARE.
2323
*/
2424

25-
package com.cloudbees.jenkins.plugins.bitbucket.credentials;
25+
package com.cloudbees.jenkins.plugins.bitbucket.impl.credentials;
2626

2727
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketAuthenticator;
2828
import edu.umd.cs.findbugs.annotations.NonNull;

0 commit comments

Comments
 (0)