Permalink
Browse files

Initial commit

  • Loading branch information...
ericbottard committed Feb 27, 2012
0 parents commit 5527fa22272a9322c2a60b55165e0c2da2a4310c
Showing with 6,257 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +3 −0 .settings/org.eclipse.core.resources.prefs
  3. +299 −0 .settings/org.eclipse.jdt.core.prefs
  4. +118 −0 .settings/org.eclipse.jdt.ui.prefs
  5. +87 −0 pom.xml
  6. +24 −0 src/main/java/org/springframework/social/bitbucket/api/BitBucket.java
  7. +146 −0 src/main/java/org/springframework/social/bitbucket/api/BitBucketChangeset.java
  8. +45 −0 src/main/java/org/springframework/social/bitbucket/api/BitBucketChangesets.java
  9. +135 −0 src/main/java/org/springframework/social/bitbucket/api/BitBucketRepository.java
  10. +20 −0 src/main/java/org/springframework/social/bitbucket/api/BitBucketSCM.java
  11. +46 −0 src/main/java/org/springframework/social/bitbucket/api/BitBucketUser.java
  12. +52 −0 src/main/java/org/springframework/social/bitbucket/api/RepoOperations.java
  13. +23 −0 src/main/java/org/springframework/social/bitbucket/api/UserOperations.java
  14. +29 −0 src/main/java/org/springframework/social/bitbucket/api/UserWithRepositories.java
  15. +17 −0 src/main/java/org/springframework/social/bitbucket/api/impl/AbstractBitBucketOperations.java
  16. +41 −0 src/main/java/org/springframework/social/bitbucket/api/impl/BitBucketTemplate.java
  17. +101 −0 src/main/java/org/springframework/social/bitbucket/api/impl/RepoTemplate.java
  18. +37 −0 src/main/java/org/springframework/social/bitbucket/api/impl/UTCDateDeserializer.java
  19. +40 −0 src/main/java/org/springframework/social/bitbucket/api/impl/UserTemplate.java
  20. +50 −0 src/main/java/org/springframework/social/bitbucket/connect/BitBucketAdapter.java
  21. +13 −0 src/main/java/org/springframework/social/bitbucket/connect/BitBucketConnectionFactory.java
  22. +26 −0 src/main/java/org/springframework/social/bitbucket/connect/BitBucketServiceProvider.java
  23. +31 −0 src/test/java/org/springframework/social/bitbucket/api/impl/BaseTemplateTest.java
  24. +194 −0 src/test/java/org/springframework/social/bitbucket/api/impl/RepoTemplateTest.java
  25. +85 −0 src/test/java/org/springframework/social/bitbucket/api/impl/UserTemplateTest.java
  26. +11 −0 src/test/resources/org/springframework/social/bitbucket/api/impl/get-one-repo.json
  27. +1,792 −0 src/test/resources/org/springframework/social/bitbucket/api/impl/get-tags.json
  28. +23 −0 src/test/resources/org/springframework/social/bitbucket/api/impl/get-user-repositories.json
  29. +98 −0 src/test/resources/org/springframework/social/bitbucket/api/impl/get-user.json
  30. +479 −0 src/test/resources/org/springframework/social/bitbucket/api/impl/repo-changesets.json
  31. +2,035 −0 src/test/resources/org/springframework/social/bitbucket/api/impl/repo-followers.json
  32. +72 −0 src/test/resources/org/springframework/social/bitbucket/api/impl/search-repos.json
  33. +82 −0 src/test/resources/org/springframework/social/bitbucket/api/impl/user-followers.json
@@ -0,0 +1,3 @@
+/.project
+/.classpath
+/target
@@ -0,0 +1,3 @@
+#Sat Nov 26 16:34:35 CET 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,118 @@
+#Tue Nov 29 21:16:11 CET 2011
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=true
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_custom
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_dataviz
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=1
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=true
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=false
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=false
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
87 pom.xml
@@ -0,0 +1,87 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.springframework.social</groupId>
+ <artifactId>spring-social-bitbucket</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>spring-social-bitbucket</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+ <org.springframework.social.version>1.0.1.RELEASE</org.springframework.social.version>
+ <org.springframework.version>3.1.0.RELEASE</org.springframework.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.social</groupId>
+ <artifactId>spring-social-core</artifactId>
+ <version>${org.springframework.social.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.social</groupId>
+ <artifactId>spring-social-test</artifactId>
+ <version>${org.springframework.social.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-core</artifactId>
+ <version>3.1.0.RELEASE</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.8.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.8.5</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${org.springframework.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
@@ -0,0 +1,24 @@
+package org.springframework.social.bitbucket.api;
+
+import org.springframework.social.ApiBinding;
+
+/**
+ * Main interface for interacting with BitBucket.
+ *
+ * @author ericbottard
+ *
+ */
+public interface BitBucket extends ApiBinding {
+
+ /**
+ * Returns the portion of the BitBucket API that allow interaction with
+ * repositories.
+ */
+ RepoOperations repoOperations();
+
+ /**
+ * Returns the portion of the BitBucket API that allow interaction with user
+ * accounts.
+ */
+ UserOperations userOperations();
+}
@@ -0,0 +1,146 @@
+package org.springframework.social.bitbucket.api;
+
+import java.util.List;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * A changeset, <i>aka</i> commit.
+ *
+ * @author ericbottard
+ *
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class BitBucketChangeset {
+
+ /**
+ * A modification on a single file.
+ *
+ * @author ericbottard
+ *
+ */
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static class FileModification {
+
+ @JsonProperty
+ private String file;
+
+ @JsonProperty
+ private FileModificationType type;
+
+ /**
+ * The path of the file (or directory) affected.
+ */
+ public String getFile() {
+ return file;
+ }
+
+ /**
+ * The kind of modification.
+ */
+ public FileModificationType getType() {
+ return type;
+ }
+ }
+
+ /**
+ * The kind of modification on a file path.
+ */
+ public static enum FileModificationType {
+ modified, added, removed;
+ }
+
+ @JsonProperty
+ private String author;
+
+ @JsonProperty
+ private String branch;
+
+ @JsonProperty
+ private List<FileModification> files;
+
+ @JsonProperty
+ private String message;
+
+ @JsonProperty
+ private String node;
+
+ @JsonProperty
+ private List<String> parents;
+
+ @JsonProperty("raw_author")
+ private String rawAuthor;
+
+ @JsonProperty("raw_node")
+ private String rawNode;
+
+ @JsonProperty
+ private long revision;
+
+ /**
+ * The username of the {@link BitBucketUser} that made the change.
+ */
+ public String getAuthor() {
+ return author;
+ }
+
+ /**
+ * The name of the branch where the commit occurred.
+ */
+ public String getBranch() {
+ return branch;
+ }
+
+ /**
+ * A list of affected files.
+ */
+ public List<FileModification> getFiles() {
+ return files;
+ }
+
+ /**
+ * The commit message as entered by the {@link #getAuthor() author}.
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * The short node hash.
+ */
+ public String getNode() {
+ return node;
+ }
+
+ /**
+ * The parent commit(s) of this change.
+ */
+ public List<String> getParents() {
+ return parents;
+ }
+
+ /**
+ * The raw author identifier of this change (includes email address).
+ */
+ public String getRawAuthor() {
+ return rawAuthor;
+ }
+
+ /**
+ * The full node hash.
+ */
+ public String getRawNode() {
+ return rawNode;
+ }
+
+ public long getRevision() {
+ return revision;
+ }
+
+ @Override
+ public String toString() {
+ return getNode();
+ }
+
+}
Oops, something went wrong.

0 comments on commit 5527fa2

Please sign in to comment.