Skip to content
Browse files

Updated 1.0.2 branch to latest dependencies and prepared for changes.

  • Loading branch information...
1 parent 9ce41ca commit 9f07571efaed61737cd36a965a39bc57e590a630 Craig Walls committed
Showing with 849 additions and 519 deletions.
  1. 0 docs/src/info/license.txt → LICENSE
  2. +21 −0 NOTICE
  3. +224 −123 build.gradle
  4. +1 −42 gradle.properties
  5. BIN gradle/wrapper/gradle-wrapper.jar
  6. +6 −0 gradle/wrapper/gradle-wrapper.properties
  7. +81 −64 gradlew
  8. +32 −68 gradlew.bat
  9. +60 −0 publish-maven.gradle
  10. +1 −11 ...ial-facebook/src/main/java/org/springframework/social/facebook/api/impl/FacebookErrorHandler.java
  11. +1 −6 ...ocial-facebook/src/test/java/org/springframework/social/facebook/api/AbstractFacebookApiTest.java
  12. +11 −9 ...ng-social-facebook/src/test/java/org/springframework/social/facebook/api/CommentTemplateTest.java
  13. +28 −24 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/ErrorHandlingTest.java
  14. +21 −20 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/EventTemplateTest.java
  15. +42 −43 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/FeedTemplateTest.java
  16. +19 −18 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/FriendTemplateTest.java
  17. +10 −9 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/GroupTemplateTest.java
  18. +24 −20 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/LikeTemplateTest.java
  19. +24 −23 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/MediaTemplateTest.java
  20. +12 −11 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/PageTemplateTest.java
  21. +12 −11 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/PlacesTemplateTest.java
  22. +10 −13 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/UserTemplateTest.java
  23. 0 ...cebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/accounts.json
  24. 0 ...book/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/activities.json
  25. 0 ...ava → resources}/org/springframework/social/facebook/api/testdata/album-with-unknown-privacy.json
  26. 0 .../{java → resources}/org/springframework/social/facebook/api/testdata/album-with-unknown-type.json
  27. 0 ...-facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/album.json
  28. 0 ...facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/albums.json
  29. 0 ...rc/test/{java → resources}/org/springframework/social/facebook/api/testdata/application-page.json
  30. 0 ...ebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/attending.json
  31. 0 ...acebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/checkin.json
  32. 0 ...cebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/checkins.json
  33. 0 ...acebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/comment.json
  34. +1 −1 ...cebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/comments.json
  35. 0 .../test/{java → resources}/org/springframework/social/facebook/api/testdata/create-friend-list.json
  36. 0 ...cebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/declined.json
  37. 0 ...est/{java → resources}/org/springframework/social/facebook/api/testdata/error-app-capability.json
  38. 0 ...va → resources}/org/springframework/social/facebook/api/testdata/error-current-user-no-token.json
  39. 0 ...t/{java → resources}/org/springframework/social/facebook/api/testdata/error-duplicate-status.json
  40. 0 ...test/{java → resources}/org/springframework/social/facebook/api/testdata/error-expired-token.json
  41. 0 ...a → resources}/org/springframework/social/facebook/api/testdata/error-insufficient-privilege.json
  42. 0 .../test/{java → resources}/org/springframework/social/facebook/api/testdata/error-invalid-fbid.json
  43. 0 ...ava → resources}/org/springframework/social/facebook/api/testdata/error-invalid-token-deauth.json
  44. 0 ...a → resources}/org/springframework/social/facebook/api/testdata/error-invalid-token-password.json
  45. 0 ...va → resources}/org/springframework/social/facebook/api/testdata/error-invalid-token-signout.json
  46. 0 .../test/{java → resources}/org/springframework/social/facebook/api/testdata/error-not-a-friend.json
  47. 0 .../src/test/{java → resources}/org/springframework/social/facebook/api/testdata/error-not-json.html
  48. 0 ...test/{java → resources}/org/springframework/social/facebook/api/testdata/error-not-the-owner.json
  49. 0 ...rc/test/{java → resources}/org/springframework/social/facebook/api/testdata/error-permission.json
  50. 0 ...rc/test/{java → resources}/org/springframework/social/facebook/api/testdata/error-rate-limit.json
  51. 0 ...test/{java → resources}/org/springframework/social/facebook/api/testdata/error-unknown-alias.json
  52. 0 .../test/{java → resources}/org/springframework/social/facebook/api/testdata/error-unknown-path.json
  53. 0 ...test/{java → resources}/org/springframework/social/facebook/api/testdata/error-url-parameter.json
  54. 0 ...src/test/{java → resources}/org/springframework/social/facebook/api/testdata/error-whitelist.json
  55. 0 ...book/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/event-list.json
  56. 0 ...-facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/event.json
  57. 0 ...t/{java → resources}/org/springframework/social/facebook/api/testdata/feed-with-unknown-type.json
  58. 0 ...l-facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/feed.json
  59. 0 ...book/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/friend-ids.json
  60. 0 ...ook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/friend-list.json
  61. 0 ...ok/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/friend-lists.json
  62. 0 ...acebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/friends.json
  63. 0 ...book/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/full-event.json
  64. 0 ...ok/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/full-profile.json
  65. 0 ...book/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/group-list.json
  66. 0 ...k/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/group-members.json
  67. 0 ...c/test/{java → resources}/org/springframework/social/facebook/api/testdata/group-memberships.json
  68. 0 ...-facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/group.json
  69. 0 ...ebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/interests.json
  70. 0 ...acebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/invited.json
  71. 0 ...-facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/likes.json
  72. 0 ...-facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/links.json
  73. 0 ...src/test/{java → resources}/org/springframework/social/facebook/api/testdata/maybe-attending.json
  74. 0 ...→ resources}/org/springframework/social/facebook/api/testdata/minimal-profile-no-middle-name.json
  75. 0 ...src/test/{java → resources}/org/springframework/social/facebook/api/testdata/minimal-profile.json
  76. 0 ...book/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/no-replies.json
  77. 0 ...c/test/{java → resources}/org/springframework/social/facebook/api/testdata/organization-page.json
  78. 0 ...-facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/photo.json
  79. 0 ...facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/photos.json
  80. 0 ...book/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/place-page.json
  81. 0 ...ook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/places-list.json
  82. 0 ...ebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/post-list.json
  83. 0 ...l-facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/post.json
  84. 0 ...ok/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/product-page.json
  85. 0 ...ok/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/simple-event.json
  86. 0 ...facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/tinyrod.jpg
  87. 0 ...ook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/user-events.json
  88. 0 ...book/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/user-likes.json
  89. 0 ...book/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/user-notes.json
  90. 0 ...rc/test/{java → resources}/org/springframework/social/facebook/api/testdata/user-permissions.json
  91. 0 ...k/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/user-profiles.json
  92. 0 ...src/test/{java → resources}/org/springframework/social/facebook/api/testdata/user-references.json
  93. 0 ...k/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/user-statuses.json
  94. 0 ...-facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/video.json
  95. 0 ...facebook/src/test/{java → resources}/org/springframework/social/facebook/api/testdata/videos.json
  96. 0 {docs → }/src/api/doc-files/th-background.png
  97. 0 {docs → }/src/api/overview.html
  98. 0 {docs → }/src/api/spring-javadoc.css
  99. +5 −0 {docs/src/info → src/dist}/changelog.txt
  100. +201 −0 src/dist/license.txt
  101. 0 {docs/src/info → src/dist}/notice.txt
  102. +2 −3 {docs/src/info → src/dist}/readme.txt
  103. 0 {docs → }/src/reference/docbook/api.xml
  104. 0 {docs → }/src/reference/docbook/connecting.xml
  105. 0 {docs → }/src/reference/docbook/index.xml
  106. 0 {docs → }/src/reference/docbook/overview.xml
  107. 0 {docs → }/src/reference/resources/css/highlight.css
  108. 0 {docs → }/src/reference/resources/css/html.css
  109. 0 {docs → }/src/reference/resources/css/manual.css
  110. 0 {docs → }/src/reference/resources/css/stylesheet.css
  111. 0 {docs → }/src/reference/resources/image_src/oauth_flows.graffle
  112. 0 {docs/src/reference/resources/images → src/reference/resources/images/admon}/note.png
  113. 0 {docs → }/src/reference/resources/images/callouts/1.gif
  114. 0 {docs → }/src/reference/resources/images/callouts/1.png
  115. 0 {docs → }/src/reference/resources/images/callouts/1.svg
  116. 0 {docs → }/src/reference/resources/images/callouts/10.gif
  117. 0 {docs → }/src/reference/resources/images/callouts/10.png
  118. 0 {docs → }/src/reference/resources/images/callouts/10.svg
  119. 0 {docs → }/src/reference/resources/images/callouts/11.gif
  120. 0 {docs → }/src/reference/resources/images/callouts/11.png
  121. 0 {docs → }/src/reference/resources/images/callouts/11.svg
  122. 0 {docs → }/src/reference/resources/images/callouts/12.gif
  123. 0 {docs → }/src/reference/resources/images/callouts/12.png
  124. 0 {docs → }/src/reference/resources/images/callouts/12.svg
  125. 0 {docs → }/src/reference/resources/images/callouts/13.gif
  126. 0 {docs → }/src/reference/resources/images/callouts/13.png
  127. 0 {docs → }/src/reference/resources/images/callouts/13.svg
  128. 0 {docs → }/src/reference/resources/images/callouts/14.gif
  129. 0 {docs → }/src/reference/resources/images/callouts/14.png
  130. 0 {docs → }/src/reference/resources/images/callouts/14.svg
  131. 0 {docs → }/src/reference/resources/images/callouts/15.gif
  132. 0 {docs → }/src/reference/resources/images/callouts/15.png
  133. 0 {docs → }/src/reference/resources/images/callouts/15.svg
  134. 0 {docs → }/src/reference/resources/images/callouts/16.svg
  135. 0 {docs → }/src/reference/resources/images/callouts/17.svg
  136. 0 {docs → }/src/reference/resources/images/callouts/18.svg
  137. 0 {docs → }/src/reference/resources/images/callouts/19.svg
  138. 0 {docs → }/src/reference/resources/images/callouts/2.gif
  139. 0 {docs → }/src/reference/resources/images/callouts/2.png
  140. 0 {docs → }/src/reference/resources/images/callouts/2.svg
  141. 0 {docs → }/src/reference/resources/images/callouts/20.svg
  142. 0 {docs → }/src/reference/resources/images/callouts/21.svg
  143. 0 {docs → }/src/reference/resources/images/callouts/22.svg
  144. 0 {docs → }/src/reference/resources/images/callouts/23.svg
  145. 0 {docs → }/src/reference/resources/images/callouts/24.svg
  146. 0 {docs → }/src/reference/resources/images/callouts/25.svg
  147. 0 {docs → }/src/reference/resources/images/callouts/26.svg
  148. 0 {docs → }/src/reference/resources/images/callouts/27.svg
  149. 0 {docs → }/src/reference/resources/images/callouts/28.svg
  150. 0 {docs → }/src/reference/resources/images/callouts/29.svg
  151. 0 {docs → }/src/reference/resources/images/callouts/3.gif
  152. 0 {docs → }/src/reference/resources/images/callouts/3.png
  153. 0 {docs → }/src/reference/resources/images/callouts/3.svg
  154. 0 {docs → }/src/reference/resources/images/callouts/30.svg
  155. 0 {docs → }/src/reference/resources/images/callouts/4.gif
  156. 0 {docs → }/src/reference/resources/images/callouts/4.png
  157. 0 {docs → }/src/reference/resources/images/callouts/4.svg
  158. 0 {docs → }/src/reference/resources/images/callouts/5.gif
  159. 0 {docs → }/src/reference/resources/images/callouts/5.png
  160. 0 {docs → }/src/reference/resources/images/callouts/5.svg
  161. 0 {docs → }/src/reference/resources/images/callouts/6.gif
  162. 0 {docs → }/src/reference/resources/images/callouts/6.png
  163. 0 {docs → }/src/reference/resources/images/callouts/6.svg
  164. 0 {docs → }/src/reference/resources/images/callouts/7.gif
  165. 0 {docs → }/src/reference/resources/images/callouts/7.png
  166. 0 {docs → }/src/reference/resources/images/callouts/7.svg
  167. 0 {docs → }/src/reference/resources/images/callouts/8.gif
  168. 0 {docs → }/src/reference/resources/images/callouts/8.png
  169. 0 {docs → }/src/reference/resources/images/callouts/8.svg
  170. 0 {docs → }/src/reference/resources/images/callouts/9.gif
  171. 0 {docs → }/src/reference/resources/images/callouts/9.png
  172. 0 {docs → }/src/reference/resources/images/callouts/9.svg
  173. 0 {docs → }/src/reference/resources/images/facebook-authorize-basic.png
  174. 0 {docs → }/src/reference/resources/images/facebook-authorize-loginbutton.png
  175. 0 {docs → }/src/reference/resources/images/facebook-authorize-scoped.png
  176. 0 {docs → }/src/reference/resources/images/important.png
  177. 0 {docs → }/src/reference/resources/images/logo.png
  178. 0 {docs/src/reference/resources/images/admon → src/reference/resources/images}/note.png
  179. 0 {docs → }/src/reference/resources/images/oauth1_flow.png
  180. 0 {docs → }/src/reference/resources/images/oauth2_flow.png
  181. 0 {docs → }/src/reference/resources/images/sign-in-with-facebook.png
  182. 0 {docs → }/src/reference/resources/images/sign-in-with-twitter-d.png
  183. 0 {docs → }/src/reference/resources/images/sign-in-with-twitter.png
  184. 0 {docs → }/src/reference/resources/images/spring-social-twitter-example.png
  185. 0 {docs → }/src/reference/resources/images/tip.png
  186. 0 {docs → }/src/reference/resources/images/twitter-authorize.png
  187. 0 {docs → }/src/reference/resources/images/xdev-spring_logo.jpg
  188. 0 {docs → }/src/reference/resources/xsl/html-custom.xsl
  189. 0 {docs → }/src/reference/resources/xsl/html-single-custom.xsl
  190. 0 {docs → }/src/reference/resources/xsl/pdf-custom.xsl
View
0 docs/src/info/license.txt → LICENSE
File renamed without changes.
View
21 NOTICE
@@ -0,0 +1,21 @@
+ ============================================================================
+ == NOTICE file corresponding to section 4 d of the Apache License, ==
+ == Version 2.0, in this case for the Spring Social Facebook distribution. ==
+ ============================================================================
+
+ This product includes software developed by
+ the Apache Software Foundation (http://www.apache.org).
+
+ The end-user documentation included with a redistribution, if any,
+ must include the following acknowledgement:
+
+ "This product includes software developed by the Spring Framework
+ Project (http://www.springframework.org)."
+
+ Alternatively, this acknowledgement may appear in the software itself,
+ if and wherever such third-party acknowledgements normally appear.
+
+ The names "Spring", "Spring Framework", and "Spring Social" must
+ not be used to endorse or promote products derived from this software
+ without prior written permission. For written permission, please contact
+ enquiries@springsource.com.
View
347 build.gradle
@@ -1,146 +1,101 @@
-/*
- * Copyright 2010 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- import org.springframework.build.Version
-
-// -----------------------------------------------------------------------------
-// Main gradle build file for Spring Social Facebook
-// @author Chris Beams
-// @author Craig Walls
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// Configuration for the root project
-// -----------------------------------------------------------------------------
-description = 'Spring Social Facebook'
-abbreviation = 'SOCIAL-FACEBOOK'
-
-apply plugin: 'base'
-apply plugin: 'idea'
-
-def buildSrcDir = "$rootDir/buildSrc"
-apply from: "$buildSrcDir/wrapper.gradle"
-apply from: "$buildSrcDir/maven-root-pom.gradle"
-
-// -----------------------------------------------------------------------------
-// Configuration for all projects including this one (the root project)
-//
-// @see settings.gradle for list of all subprojects
-// -----------------------------------------------------------------------------
-allprojects {
- // group will translate to groupId during pom generation and deployment
- group = 'org.springframework.social'
-
- // version will be used in maven pom generation as well as determining
- // where artifacts should be deployed, based on release type of snapshot,
- // milestone or release.
- // @see org.springframework.build.Version under buildSrc/ for more info
- // @see gradle.properties for the declaration of this property.
- version = new Version(springSocialFacebookVersion)
-
- // default set of maven repositories to be used when resolving dependencies
+buildscript {
repositories {
- mavenRepo urls: 'http://maven.springframework.org/release'
- mavenRepo urls: 'http://maven.springframework.org/milestone'
- mavenRepo urls: 'http://maven.springframework.org/snapshot'
- mavenCentral()
+ maven { url 'http://repo.springsource.org/plugins-release' }
+ }
+ dependencies {
+ classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.3'
}
}
+configure(allprojects) {
+ apply plugin: 'java'
+ apply plugin: 'eclipse'
+ apply plugin: 'idea'
-// -----------------------------------------------------------------------------
-// Create collections of subprojects - each will receive their own configuration
-// - all subprojects that start with spring-social-* are 'java projects'
-// - documentation-related subprojects are not collected here
-//
-// @see configure(*) sections below
-// -----------------------------------------------------------------------------
-
-javaprojects = subprojects.findAll { project ->
- project.path.startsWith(':spring-social-')
-}
-
-// -----------------------------------------------------------------------------
-// Configuration for all java subprojects
-// -----------------------------------------------------------------------------
-configure(javaprojects) {
+ group = 'org.springframework.social'
- apply plugin: 'java' // tasks for conventional java lifecycle
- apply plugin: 'maven' // `gradle install` to push jars to local .m2 cache
- apply plugin: 'eclipse' // `gradle eclipse` to generate .classpath/.project
- apply plugin: 'idea' // `gradle idea` to generate .ipr/.iml
+ sourceCompatibility=1.5
+ targetCompatibility=1.5
- // set up dedicated directories for jars and source jars.
- // this makes it easier when putting together the distribution
- libsBinDir = new File(libsDir, 'bin')
- libsSrcDir = new File(libsDir, 'src')
+ springSocialVersion = '1.0.2.RELEASE'
+ jacksonVersion = '1.9.9'
+ jspApiVersion = '2.1'
+ junitVersion = '4.10'
+ mockitoVersion = '1.9.0'
+ servletApiVersion = '2.5'
+ springSecurityCryptoVersion = '3.1.0.RELEASE'
+ springVersion = '3.1.2.RELEASE'
+ springTestMvcVersion = "1.0.0.BUILD-SNAPSHOT"
- // add tasks for creating source jars and generating poms etc
- apply from: "$buildSrcDir/maven-deployment.gradle"
+ [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:none']
- // add tasks for finding and publishing .xsd files
- apply from: "$buildSrcDir/schema-publication.gradle"
+ sourceSets.test.resources.srcDirs = ['src/test/resources', 'src/test/java']
- springSocialVersion = '1.0.1.RELEASE'
- jacksonVersion = '1.9.2'
- jspApiVersion = '2.1'
- junitVersion = '4.9'
- mockitoVersion = '1.8.5'
- servletApiVersion = '2.5'
- springVersion = '3.1.0.RELEASE'
+ test.systemProperty("java.awt.headless", "true")
- sourceSets {
- main {
- resources {
- srcDirs = ['src/main/java']
- }
- }
- test {
- resources {
- srcDirs = ['src/test/java']
- }
- }
+ repositories {
+ maven { url "http://repo.springsource.org/libs-snapshot" }
}
- // dependencies that are common across all java projects
dependencies {
- testCompile "junit:junit:$junitVersion"
+ testCompile "junit:junit-dep:$junitVersion"
testCompile "org.mockito:mockito-all:$mockitoVersion"
testCompile "org.springframework:spring-test:$springVersion"
}
- // enable all compiler warnings (GRADLE-1077)
- [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all']
-
- // generate .classpath files without GRADLE_CACHE variable (GRADLE-1079)
- eclipseClasspath.variables = [:]
+ // servlet-api (2.5) and tomcat-servlet-api (3.0) classpath entries should not be
+ // exported to dependent projects in Eclipse to avoid false compilation errors due
+ // to changing APIs across these versions
+ eclipse.classpath.file.whenMerged { classpath ->
+ classpath.entries.findAll { entry -> entry.path.contains('servlet-api') }*.exported = false
+ }
}
+configure(subprojects) { subproject ->
+ apply from: "${rootProject.projectDir}/publish-maven.gradle"
+
+ jar {
+ manifest.attributes['Implementation-Title'] = subproject.name
+ manifest.attributes['Implementation-Version'] = subproject.version
+
+ from("${rootProject.projectDir}/src/dist") {
+ include "license.txt"
+ include "notice.txt"
+ into "META-INF"
+ expand(copyright: new Date().format('yyyy'), version: project.version)
+ }
+ }
+
+ javadoc {
+ options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
+ options.author = true
+ options.header = project.name
+ //options.overview = "${projectDir}/src/main/java/overview.html"
+ }
+
+ task sourcesJar(type: Jar, dependsOn:classes) {
+ classifier = 'sources'
+ from sourceSets.main.allJava
+ }
+
+ task javadocJar(type: Jar) {
+ classifier = 'javadoc'
+ from javadoc
+ }
+
+ artifacts {
+ archives sourcesJar
+ archives javadocJar
+ }
+}
-// -----------------------------------------------------------------------------
-// Configuration for each individual core java subproject
-//
-// @see configure(javaprojects) above for general config
-// -----------------------------------------------------------------------------
project('spring-social-facebook') {
description = 'Facebook API'
dependencies {
compile "org.springframework.social:spring-social-core:$springSocialVersion"
compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion"
- testCompile "org.springframework.social:spring-social-test:$springSocialVersion"
+ testCompile "org.springframework:spring-test-mvc:$springTestMvcVersion"
}
}
@@ -148,17 +103,163 @@ project('spring-social-facebook-web') {
description = 'Facebook Web'
dependencies {
compile ("org.springframework:spring-web:$springVersion")
+ compile ("org.springframework.social:spring-social-core:$springSocialVersion") { optional = true }
+ compile project(':spring-social-facebook') { optional = true }
+ compile ("org.springframework.security:spring-security-crypto:$springSecurityCryptoVersion") { optional = true }
+ compile ("org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion") { optional = true }
compile ("javax.servlet:servlet-api:$servletApiVersion") { provided = true }
compile ("javax.servlet.jsp:jsp-api:$jspApiVersion") { provided = true }
+ testCompile "org.springframework:spring-test-mvc:$springTestMvcVersion"
+ }
+}
+
+configure(rootProject) {
+ description = 'Spring Social Facebook'
+
+ apply plugin: 'docbook-reference'
+
+ reference {
+ sourceDir = file('src/reference/docbook')
+ }
+
+ // don't publish the default jar for the root project
+ configurations.archives.artifacts.clear()
+
+ dependencies { // for integration tests
+ }
+
+ task api(type: Javadoc) {
+ group = 'Documentation'
+ description = 'Generates aggregated Javadoc API documentation.'
+ title = "${rootProject.description} ${version} API"
+ options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
+ options.author = true
+ options.header = rootProject.description
+ options.overview = 'src/api/overview.html'
+ options.links(
+ 'http://docs.jboss.org/jbossas/javadoc/4.0.5/connector'
+ )
+ source subprojects.collect { project ->
+ project.sourceSets.main.allJava
+ }
+ destinationDir = new File(buildDir, "api")
+ classpath = files(subprojects.collect { project ->
+ project.sourceSets.main.compileClasspath
+ })
+ maxMemory = '1024m'
+ }
+
+ task docsZip(type: Zip) {
+ group = 'Distribution'
+ classifier = 'docs'
+ description = "Builds -${classifier} archive containing api and reference " +
+ "for deployment at static.springframework.org/spring-social/docs."
+
+ from('src/dist') {
+ include 'changelog.txt'
+ }
+
+ from (api) {
+ into 'api'
+ }
+
+ from (reference) {
+ into 'reference'
+ }
+ }
+
+ task schemaZip(type: Zip) {
+ group = 'Distribution'
+ classifier = 'schema'
+ description = "Builds -${classifier} archive containing all " +
+ "XSDs for deployment at static.springframework.org/schema."
+
+ subprojects.each { subproject ->
+ def Properties schemas = new Properties();
+
+ subproject.sourceSets.main.resources.find {
+ it.path.endsWith('META-INF/spring.schemas')
+ }?.withInputStream { schemas.load(it) }
+
+ for (def key : schemas.keySet()) {
+ def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
+ assert shortName != key
+ File xsdFile = subproject.sourceSets.main.resources.find {
+ it.path.endsWith(schemas.get(key))
+ }
+ assert xsdFile != null
+ into (shortName) {
+ from xsdFile.path
+ }
+ }
+ }
}
+
+ task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
+ group = 'Distribution'
+ classifier = 'dist'
+ description = "Builds -${classifier} archive, containing all jars and docs, " +
+ "suitable for community download page."
+
+ baseDir = "${project.name}-${project.version}";
+
+ from('src/dist') {
+ include 'readme.txt'
+ include 'license.txt'
+ include 'notice.txt'
+ into "${baseDir}"
+ expand(copyright: new Date().format('yyyy'), version: project.version)
+ }
+
+ from(zipTree(docsZip.archivePath)) {
+ into "${baseDir}/docs"
+ }
+
+ from(zipTree(schemaZip.archivePath)) {
+ into "${baseDir}/schema"
+ }
+
+ subprojects.each { subproject ->
+ into ("${baseDir}/libs") {
+ from subproject.jar
+ if (subproject.tasks.findByPath('sourcesJar')) {
+ from subproject.sourcesJar
+ }
+ if (subproject.tasks.findByPath('javadocJar')) {
+ from subproject.javadocJar
+ }
+ }
+ }
+ }
+
+ artifacts {
+ archives docsZip
+// archives schemaZip
+ archives distZip
+ }
+
+ task wrapper(type: Wrapper) {
+ description = 'Generates gradlew[.bat] scripts'
+ gradleVersion = '1.0-milestone-8a'
+ }
+
}
-// -----------------------------------------------------------------------------
-// Configuration for the docs subproject
-// -----------------------------------------------------------------------------
-project('docs') {
- apply from: "$buildSrcDir/docs.gradle"
+task updateRootDocs << {
+ copy {
+ from 'src/dist'
+ into "${rootProject.projectDir}"
+ include 'notice.txt'
+ expand(copyright: new Date().format('yyyy'), version: project.version)
+ rename { filename -> 'NOTICE' }
+ }
+
+ copy {
+ from 'src/dist'
+ into "${rootProject.projectDir}"
+ include 'license.txt'
+ rename { filename -> 'LICENSE' }
+ }
}
-apply from: "$buildSrcDir/dist.gradle"
-apply from: "$buildSrcDir/checks.gradle"
+build.dependsOn('updateRootDocs')
View
43 gradle.properties
@@ -1,42 +1 @@
-# Copyright 2002-2010 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# ------------------------------------------------------------------------------
-# version to be applied to all projects in this multi-project build. this is
-# the one and only location version changes need to be made.
-# ------------------------------------------------------------------------------
-springSocialFacebookVersion=1.0.2.BUILD-SNAPSHOT
-
-# ------------------------------------------------------------------------------
-# build system user roles
-# role may be either 'developer' or 'buildmaster'
-# ------------------------------------------------------------------------------
-role=buildmaster
-
-# ------------------------------------------------------------------------------
-# for buildmasters: create a $HOME/.gradle/gradle.properties with the following
-# properties. They'll be necessary uploading artifacts to s3, maven repos, and
-# static.springframework.org. By placing them in your home directory, there's
-# no need to change/check in this file. Remember that properties can also be
-# specified at the gradle command line with -P, e.g.: -Prole=buildmaster
-# ------------------------------------------------------------------------------
-# role = buildmaster # overrides default 'role = developer' above
-# s3AccessKey=<springsource s3 access key>
-# s3SecretAccessKey=<springsource s3 secret access key>
-# docsHost=static.springsource.org
-# sshHost=static.springsource.org
-# sshUsername=<your user id>
-# sshPrivateKey=<path to your ssh private key used for logging into sshHost
-# mavenSyncRepoDir=<path to sourceforge cvs checkout for maven central sync>
+version = 1.0.2.BUILD-SNAPSHOT
View
BIN gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
View
6 gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Feb 23 13:43:17 CET 2012
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.0-milestone-8a-bin.zip
View
145 gradlew
@@ -1,27 +1,35 @@
#!/bin/bash
##############################################################################
-## ##
-## Gradle wrapper script for UN*X ##
-## ##
+##
+## Gradle start up script for UN*X
+##
##############################################################################
-# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
-GRADLE_OPTS="$GRADLE_OPTS -Xmx512m"
-# JAVA_OPTS="$JAVA_OPTS -Xmx512m"
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
-GRADLE_APP_NAME=Gradle
+# ADDED BY HAND -- DO NOT ACCIDENTALLY DELETE WHEN UPGRADING GRADLE WRAPPER!
+GRADLE_OPTS="-XX:MaxPermSize=1024m -Xmx1024m $GRADLE_OPTS"
+# END ADDED BY HAND
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
warn ( ) {
- echo "${PROGNAME}: $*"
+ echo "$*"
}
die ( ) {
- warn "$*"
+ echo
+ echo "$*"
+ echo
exit 1
}
-
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
@@ -38,62 +46,77 @@ case "`uname`" in
;;
esac
-# Attempt to set JAVA_HOME if it's not already set.
-if [ -z "$JAVA_HOME" ] ; then
- if $darwin ; then
- [ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
- [ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
- else
- javaExecutable="`which javac`"
- [ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
- # readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- [ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME."
- javaExecutable="`readlink -f \"$javaExecutable\"`"
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
- export JAVA_HOME="$javaHome"
- fi
-fi
-
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
- [ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
-STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
-CLASSPATH=`dirname "$0"`/buildSrc/wrapper/gradle-wrapper.jar
-WRAPPER_PROPERTIES=`dirname "$0"`/buildSrc/wrapper/gradle-wrapper.properties
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/"
+APP_HOME="`pwd -P`"
+cd "$SAVED"
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
else
- JAVACMD="java"
+ JAVACMD="$JAVA_HOME/bin/java"
fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
fi
-if [ ! -x "$JAVACMD" ] ; then
- die "JAVA_HOME is not defined correctly, can not execute: $JAVACMD"
-fi
-if [ -z "$JAVA_HOME" ] ; then
- warn "JAVA_HOME environment variable is not set"
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query businessSystem maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
fi
-# For Darwin, add GRADLE_APP_NAME to the JAVA_OPTS as -Xdock:name
+# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
- JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GRADLE_APP_NAME"
-# we may also want to set -Xdock:image
+ JAVA_OPTS="$JAVA_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
- JAVA_HOME=`cygpath --path --mixed "$JAVA_HOME"`
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
@@ -120,7 +143,7 @@ if $cygwin ; then
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
- done
+ done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
@@ -135,17 +158,11 @@ if $cygwin ; then
esac
fi
-GRADLE_APP_BASE_NAME=`basename "$0"`
-
-"$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \
- -classpath "$CLASSPATH" \
- -Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \
- -Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
- $STARTER_MAIN_CLASS \
- "$@"
-
-RETCODE=$?
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-if [ "$RETCODE" == "1" ] ; then
- echo "Gradle classes not found -- did you forget to clone --recursive when checking out this repository? See README for more details"
-fi
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
View
100 gradlew.bat
@@ -1,86 +1,55 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
-@rem ##
-@rem Gradle startup script for Windows ##
-@rem ##
-@rem ##########################################################################
-
@rem
-@rem $Revision: 10602 $ $Date: 2008-01-25 02:49:54 +0100 (ven., 25 janv. 2008) $
+@rem Gradle startup script for Windows
@rem
+@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@rem Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
-@rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512m
-@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512m
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.\
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
-@rem Determine the command interpreter to execute the "CD" later
-set COMMAND_COM="cmd.exe"
-if exist "%SystemRoot%\system32\cmd.exe" set COMMAND_COM="%SystemRoot%\system32\cmd.exe"
-if exist "%SystemRoot%\command.com" set COMMAND_COM="%SystemRoot%\command.com"
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
-@rem Use explicit find.exe to prevent cygwin and others find.exe from being used
-set FIND_EXE="find.exe"
-if exist "%SystemRoot%\system32\find.exe" set FIND_EXE="%SystemRoot%\system32\find.exe"
-if exist "%SystemRoot%\command\find.exe" set FIND_EXE="%SystemRoot%\command\find.exe"
-
-:check_JAVA_HOME
-@rem Make sure we have a valid JAVA_HOME
-if not "%JAVA_HOME%" == "" goto have_JAVA_HOME
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
echo.
-echo ERROR: Environment variable JAVA_HOME has not been set.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
-echo.
-goto end
-:have_JAVA_HOME
-@rem Validate JAVA_HOME
-%COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%" >nul
-if not errorlevel 1 goto init
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
echo.
-echo ERROR: JAVA_HOME might be set to an invalid directory: %JAVA_HOME%
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation if there are problems.
-echo.
+echo location of your Java installation.
+
+goto fail
:init
-@rem get name of script to launch with full path
@rem Get command-line arguments, handling Windowz variants
-SET _marker=%JAVA_HOME: =%
-@rem IF NOT "%_marker%" == "%JAVA_HOME%" ECHO JAVA_HOME "%JAVA_HOME%" contains spaces. Please change to a location without spaces if this causes problems.
if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%eval[2+2]" == "4" goto 4NT_args
-
-IF "%_marker%" == "%JAVA_HOME%" goto :win9xME_args
-
-set _FIXPATH=
-call :fixpath "%JAVA_HOME%"
-set JAVA_HOME=%_FIXPATH:~1%
-
-goto win9xME_args
-
-:fixpath
-if not %1.==. (
-for /f "tokens=1* delims=;" %%a in (%1) do (
-call :shortfilename "%%a" & call :fixpath "%%b"
-)
-)
-goto :EOF
-:shortfilename
-for %%i in (%1) do set _FIXPATH=%_FIXPATH%;%%~fsi
-goto :EOF
-
+if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -100,27 +69,22 @@ set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
-set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
-set CLASSPATH=%DIRNAME%\buildSrc\wrapper\gradle-wrapper.jar
-set WRAPPER_PROPERTIES=%DIRNAME%\buildSrc\wrapper\gradle-wrapper.properties
-set JAVA_EXE=%JAVA_HOME%\bin\java.exe
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%"
-
-"%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% %CMD_LINE_ARGS%
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
-if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1
-
+:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit "%ERRORLEVEL%"
-exit /b "%ERRORLEVEL%"
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
-:omega
+:omega
View
60 publish-maven.gradle
@@ -0,0 +1,60 @@
+apply plugin: 'maven'
+
+optionalDeps = []
+providedDeps = []
+
+optional = { optionalDeps << it }
+provided = { providedDeps << it }
+
+install {
+ repositories.mavenInstaller {
+ customizePom(pom, project)
+ }
+}
+
+def customizePom(pom, gradleProject) {
+ pom.whenConfigured { generatedPom ->
+ // respect 'optional' and 'provided' dependencies
+ gradleProject.optionalDeps.each { dep ->
+ generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true
+ }
+ gradleProject.providedDeps.each { dep ->
+ generatedPom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided'
+ }
+
+ // eliminate test-scoped dependencies (no need in maven central poms)
+ generatedPom.dependencies.removeAll { dep ->
+ dep.scope == 'test'
+ }
+
+ // add all items necessary for maven central publication
+ generatedPom.project {
+ name = gradleProject.description
+ description = gradleProject.description
+ url = 'https://github.com/SpringSource/spring-social-facebook'
+ organization {
+ name = 'SpringSource'
+ url = 'http://springsource.org/spring-social'
+ }
+ licenses {
+ license {
+ name 'The Apache Software License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ distribution 'repo'
+ }
+ }
+ scm {
+ url = 'https://github.com/SpringSource/spring-social'
+ connection = 'scm:git:git://github.com/SpringSource/spring-social-facebook'
+ developerConnection = 'scm:git:git://github.com/SpringSource/spring-social-facebook'
+ }
+ developers {
+ developer {
+ id = 'cwalls'
+ name = 'Craig Walls'
+ email = 'cwalls@vmware.com'
+ }
+ }
+ }
+ }
+}
View
12 ...book/src/main/java/org/springframework/social/facebook/api/impl/FacebookErrorHandler.java
@@ -62,16 +62,6 @@ public void handleError(ClientHttpResponse response) throws IOException {
// if not otherwise handled, do default handling and wrap with UncategorizedApiException
handleUncategorizedError(response, errorDetails);
}
-
- @Override
- public boolean hasError(ClientHttpResponse response) throws IOException {
- if(super.hasError(response)) {
- return true;
- }
- // only bother checking the body for errors if we get past the default error check
- String content = readFully(response.getBody());
- return content.startsWith("{\"error\":") || content.equals("false");
- }
/**
* Examines the error data returned from Facebook and throws the most applicable exception.
@@ -82,7 +72,7 @@ void handleFacebookError(HttpStatus statusCode, Map<String, String> errorDetails
// Can rely only on the message (which itself isn't very consistent).
String message = errorDetails.get("message");
- if (statusCode == HttpStatus.OK) {
+ if (statusCode == HttpStatus.NOT_FOUND) {
if (message.contains("Some of the aliases you requested do not exist")) {
throw new ResourceNotFoundException(message);
}
View
7 ...cebook/src/test/java/org/springframework/social/facebook/api/AbstractFacebookApiTest.java
@@ -24,10 +24,8 @@
import org.junit.Before;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
import org.springframework.social.facebook.api.impl.FacebookTemplate;
-import org.springframework.social.test.client.MockRestServiceServer;
+import org.springframework.test.web.client.MockRestServiceServer;
public class AbstractFacebookApiTest {
protected static final String ACCESS_TOKEN = "someAccessToken";
@@ -35,14 +33,11 @@
protected FacebookTemplate facebook;
protected FacebookTemplate unauthorizedFacebook;
protected MockRestServiceServer mockServer;
- protected HttpHeaders responseHeaders;
@Before
public void setup() {
facebook = new FacebookTemplate(ACCESS_TOKEN);
mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
- responseHeaders = new HttpHeaders();
- responseHeaders.setContentType(MediaType.APPLICATION_JSON);
unauthorizedFacebook = new FacebookTemplate();
MockRestServiceServer.createServer(unauthorizedFacebook.getRestTemplate());
View
20 ...l-facebook/src/test/java/org/springframework/social/facebook/api/CommentTemplateTest.java
@@ -17,12 +17,14 @@
import static org.junit.Assert.*;
import static org.springframework.http.HttpMethod.*;
-import static org.springframework.social.test.client.RequestMatchers.*;
-import static org.springframework.social.test.client.ResponseCreators.*;
+import static org.springframework.test.web.client.RequestMatchers.*;
+import static org.springframework.test.web.client.ResponseCreators.*;
import java.util.List;
import org.junit.Test;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.MediaType;
import org.springframework.social.NotAuthorizedException;
/**
@@ -31,11 +33,11 @@
public class CommentTemplateTest extends AbstractFacebookApiTest {
@Test
- public void getComments() {
+ public void getComments() throws Exception {
mockServer.expect(requestTo("https://graph.facebook.com/123456/comments?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/comments"), responseHeaders));
+ .andRespond(withSuccess(new FileSystemResource("/Users/habuma/foo.json"), MediaType.APPLICATION_JSON));
List<Comment> comments = facebook.commentOperations().getComments("123456");
assertEquals(2, comments.size());
@@ -54,7 +56,7 @@ public void getComments_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/123456/comments?offset=75&limit=100"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/comments"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/comments"), MediaType.APPLICATION_JSON));
List<Comment> comments = facebook.commentOperations().getComments("123456", 75, 100);
assertEquals(2, comments.size());
@@ -73,7 +75,7 @@ public void getComment() {
mockServer.expect(requestTo("https://graph.facebook.com/1533260333_122829644452184_587062"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/comment"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/comment"), MediaType.APPLICATION_JSON));
Comment comment = facebook.commentOperations().getComment("1533260333_122829644452184_587062");
assertEquals("1533260333", comment.getFrom().getId());
assertEquals("Art Names", comment.getFrom().getName());
@@ -88,7 +90,7 @@ public void addComment() {
.andExpect(method(POST))
.andExpect(body("message=Cool+beans"))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse("{\"id\":\"123456_543210\"}", responseHeaders));
+ .andRespond(withSuccess("{\"id\":\"123456_543210\"}", MediaType.APPLICATION_JSON));
assertEquals("123456_543210", facebook.commentOperations().addComment("123456", "Cool beans"));
}
@@ -103,7 +105,7 @@ public void deleteComment() {
.andExpect(method(POST))
.andExpect(body("method=delete"))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse("{}", responseHeaders));
+ .andRespond(withSuccess("{}", MediaType.APPLICATION_JSON));
facebook.commentOperations().deleteComment("1533260333_122829644452184_587062");
mockServer.verify();
}
@@ -117,7 +119,7 @@ public void deleteComment_unauthorized() {
public void getLikes() {
mockServer.expect(requestTo("https://graph.facebook.com/123456/likes")).andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/likes"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/likes"), MediaType.APPLICATION_JSON));
List<Reference> likes = facebook.commentOperations().getLikes("123456");
assertEquals(3, likes.size());
Reference like1 = likes.get(0);
View
52 ...ial-facebook/src/test/java/org/springframework/social/facebook/api/ErrorHandlingTest.java
@@ -17,12 +17,14 @@
import static org.junit.Assert.*;
import static org.springframework.http.HttpMethod.*;
-import static org.springframework.social.test.client.RequestMatchers.*;
-import static org.springframework.social.test.client.ResponseCreators.*;
+import static org.springframework.test.web.client.RequestMatchers.*;
+import static org.springframework.test.web.client.ResponseCreators.*;
+import org.junit.Ignore;
import org.junit.Test;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
import org.springframework.social.ExpiredAuthorizationException;
import org.springframework.social.InsufficientPermissionException;
import org.springframework.social.MissingAuthorizationException;
@@ -32,7 +34,7 @@
import org.springframework.social.RevokedAuthorizationException;
import org.springframework.social.UncategorizedApiException;
import org.springframework.social.facebook.api.impl.FacebookTemplate;
-import org.springframework.social.test.client.MockRestServiceServer;
+import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.HttpClientErrorException;
public class ErrorHandlingTest extends AbstractFacebookApiTest {
@@ -46,7 +48,7 @@ public void insufficientPrivileges() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832/declined"))
.andExpect(method(POST))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/error-insufficient-privilege"), responseHeaders, HttpStatus.FORBIDDEN, ""));
+ .andRespond(withStatus(HttpStatus.FORBIDDEN).body(jsonResource("testdata/error-insufficient-privilege")).contentType(MediaType.APPLICATION_JSON));
facebook.eventOperations().declineInvitation("193482154020832");
fail();
} catch (InsufficientPermissionException e) {
@@ -61,7 +63,7 @@ public void notAFriend() {
mockServer.expect(requestTo("https://graph.facebook.com/119297590579/members/100001387295207"))
.andExpect(method(POST))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/error-not-a-friend"), responseHeaders, HttpStatus.INTERNAL_SERVER_ERROR, ""));
+ .andRespond(withServerError().body(jsonResource("testdata/error-not-a-friend")).contentType(MediaType.APPLICATION_JSON));
facebook.friendOperations().addToFriendList("119297590579", "100001387295207");
fail();
} catch (NotAFriendException e) {
@@ -75,7 +77,7 @@ public void unknownPath() {
mockServer.expect(requestTo("https://graph.facebook.com/me/boguspath"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/error-unknown-path"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-unknown-path")).contentType(MediaType.APPLICATION_JSON));
facebook.fetchConnections("me", "boguspath", String.class);
fail();
} catch (ResourceNotFoundException e) {
@@ -90,7 +92,7 @@ public void notTheOwner() {
.andExpect(method(POST))
.andExpect(header("Authorization", "OAuth someAccessToken"))
.andExpect(body("method=delete"))
- .andRespond(withResponse(jsonResource("testdata/error-not-the-owner"), responseHeaders, HttpStatus.INTERNAL_SERVER_ERROR, ""));
+ .andRespond(withServerError().body(jsonResource("testdata/error-not-the-owner")).contentType(MediaType.APPLICATION_JSON));
facebook.friendOperations().deleteFriendList("1234567890");
fail();
} catch (ResourceOwnershipException e) {
@@ -99,13 +101,14 @@ public void notTheOwner() {
}
@Test
+ @Ignore("This doesn't seem to be true anymore...It looks like FB fixed their status code.")
public void unknownAlias_HTTP200() {
// yes, Facebook really does return this error as HTTP 200 (probably should be 404)
try {
mockServer.expect(requestTo("https://graph.facebook.com/dummyalias"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/error-unknown-alias"), responseHeaders, HttpStatus.OK, ""));
+ .andRespond(withSuccess(jsonResource("testdata/error-unknown-alias"), MediaType.APPLICATION_JSON));
facebook.fetchObject("dummyalias", FacebookProfile.class);
fail("Expected GraphAPIException when fetching an unknown object alias");
} catch (ResourceNotFoundException e) {
@@ -119,7 +122,7 @@ public void currentUser_noAccessToken() {
MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
mockServer.expect(requestTo("https://graph.facebook.com/me"))
.andExpect(method(GET))
- .andRespond(withResponse(jsonResource("testdata/error-current-user-no-token"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-current-user-no-token")).contentType(MediaType.APPLICATION_JSON));
facebook.userOperations().getUserProfile();
}
@@ -130,7 +133,7 @@ public void htmlErrorResponse() {
MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
mockServer.expect(requestTo("https://graph.facebook.com/123456/picture?type=normal"))
.andExpect(method(GET))
- .andRespond(withResponse(new ClassPathResource("testdata/error-not-json.html", getClass()), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(new ClassPathResource("testdata/error-not-json.html", getClass())).contentType(MediaType.TEXT_HTML));
facebook.userOperations().getUserProfileImage("123456");
fail("Expected UncategorizedApiException");
} catch (UncategorizedApiException e) {
@@ -144,7 +147,7 @@ public void tokenInvalid_tokenExpired() {
MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
mockServer.expect(requestTo("https://graph.facebook.com/me"))
.andExpect(method(GET))
- .andRespond(withResponse(jsonResource("testdata/error-expired-token"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-expired-token")).contentType(MediaType.APPLICATION_JSON));
facebook.userOperations().getUserProfile();
}
@@ -152,8 +155,8 @@ public void tokenInvalid_tokenExpired() {
public void tokenInvalid_passwordChanged_badRequest() {
MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
mockServer.expect(requestTo("https://graph.facebook.com/me"))
- .andExpect(method(GET))
- .andRespond(withResponse(jsonResource("testdata/error-invalid-token-password"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andExpect(method(GET))
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-invalid-token-password")).contentType(MediaType.APPLICATION_JSON));
try {
facebook.userOperations().getUserProfile();
fail("Expected RevokedAuthorizationException");
@@ -167,7 +170,7 @@ public void tokenInvalid_applicationDeauthorized_badRequest() {
MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
mockServer.expect(requestTo("https://graph.facebook.com/me"))
.andExpect(method(GET))
- .andRespond(withResponse(jsonResource("testdata/error-invalid-token-deauth"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-invalid-token-deauth")).contentType(MediaType.APPLICATION_JSON));
try {
facebook.userOperations().getUserProfile();
fail("Expected RevokedAuthorizationException");
@@ -181,7 +184,7 @@ public void tokenInvalid_signedOutOfFacebook_badRequest() {
MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
mockServer.expect(requestTo("https://graph.facebook.com/me"))
.andExpect(method(GET))
- .andRespond(withResponse(jsonResource("testdata/error-invalid-token-signout"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-invalid-token-signout")).contentType(MediaType.APPLICATION_JSON));
try {
facebook.userOperations().getUserProfile();
fail("Expected RevokedAuthorizationException");
@@ -195,7 +198,7 @@ public void tokenInvalid_passwordChanged_unauthorized() {
MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
mockServer.expect(requestTo("https://graph.facebook.com/me"))
.andExpect(method(GET))
- .andRespond(withResponse(jsonResource("testdata/error-invalid-token-password"), responseHeaders, HttpStatus.UNAUTHORIZED, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-invalid-token-password")).contentType(MediaType.APPLICATION_JSON));
try {
facebook.userOperations().getUserProfile();
fail("Expected RevokedAuthorizationException");
@@ -209,7 +212,7 @@ public void tokenInvalid_applicationDeauthorized_unauthorized() {
MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
mockServer.expect(requestTo("https://graph.facebook.com/me"))
.andExpect(method(GET))
- .andRespond(withResponse(jsonResource("testdata/error-invalid-token-deauth"), responseHeaders, HttpStatus.UNAUTHORIZED, ""));
+ .andRespond(withStatus(HttpStatus.UNAUTHORIZED).body(jsonResource("testdata/error-invalid-token-deauth")).contentType(MediaType.APPLICATION_JSON));
try {
facebook.userOperations().getUserProfile();
fail("Expected RevokedAuthorizationException");
@@ -223,7 +226,7 @@ public void tokenInvalid_signedOutOfFacebook_unauthorized() {
MockRestServiceServer mockServer = MockRestServiceServer.createServer(facebook.getRestTemplate());
mockServer.expect(requestTo("https://graph.facebook.com/me"))
.andExpect(method(GET))
- .andRespond(withResponse(jsonResource("testdata/error-invalid-token-signout"), responseHeaders, HttpStatus.UNAUTHORIZED, ""));
+ .andRespond(withStatus(HttpStatus.UNAUTHORIZED).body(jsonResource("testdata/error-invalid-token-signout")).contentType(MediaType.APPLICATION_JSON));
try {
facebook.userOperations().getUserProfile();
fail("Expected RevokedAuthorizationException");
@@ -237,7 +240,7 @@ public void appDoesNotHaveCapability() {
mockServer.expect(requestTo("https://graph.facebook.com/123456/likes"))
.andExpect(method(POST))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/error-app-capability"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-app-capability")).contentType(MediaType.APPLICATION_JSON));
facebook.likeOperations().like("123456");
}
@@ -247,7 +250,7 @@ public void appMustBeOnWhitelist() {
.andExpect(method(POST))
.andExpect(body("method=delete"))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/error-whitelist"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-whitelist")).contentType(MediaType.APPLICATION_JSON));
facebook.likeOperations().unlike("123456");
}
@@ -256,7 +259,7 @@ public void invalidObject_urlParameterError() {
mockServer.expect(requestTo("https://graph.facebook.com/123456/likes"))
.andExpect(method(POST))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/error-url-parameter"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-url-parameter")).contentType(MediaType.APPLICATION_JSON));
facebook.likeOperations().like("123456");
}
@@ -265,16 +268,17 @@ public void invalidObject_invalidFbidError() {
mockServer.expect(requestTo("https://graph.facebook.com/123456/likes"))
.andExpect(method(POST))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/error-invalid-fbid"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-invalid-fbid")).contentType(MediaType.APPLICATION_JSON));
facebook.likeOperations().like("123456");
}
@Test(expected = InsufficientPermissionException.class)
+ @Ignore("This doesn't seem to happen anymore...It looks like FB fixed their errors.")
public void falseResponse() {
mockServer.expect(requestTo("https://graph.facebook.com/someobject"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse("false", responseHeaders, HttpStatus.OK, ""));
+ .andRespond(withSuccess("false", MediaType.APPLICATION_JSON));
facebook.fetchObject("someobject", FacebookProfile.class);
}
@@ -284,7 +288,7 @@ public void rateLimit() {
.andExpect(method(POST))
.andExpect(body("message=Test+Message"))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/error-rate-limit"), responseHeaders, HttpStatus.BAD_REQUEST, ""));
+ .andRespond(withBadRequest().body(jsonResource("testdata/error-rate-limit")).contentType(MediaType.APPLICATION_JSON));
facebook.feedOperations().updateStatus("Test Message");
}
View
41 ...ial-facebook/src/test/java/org/springframework/social/facebook/api/EventTemplateTest.java
@@ -17,12 +17,13 @@
import static org.junit.Assert.*;
import static org.springframework.http.HttpMethod.*;
-import static org.springframework.social.test.client.RequestMatchers.*;
-import static org.springframework.social.test.client.ResponseCreators.*;
+import static org.springframework.test.web.client.RequestMatchers.*;
+import static org.springframework.test.web.client.ResponseCreators.*;
import java.util.List;
import org.junit.Test;
+import org.springframework.http.MediaType;
import org.springframework.social.NotAuthorizedException;
public class EventTemplateTest extends AbstractFacebookApiTest {
@@ -32,7 +33,7 @@ public void getInvitations() {
mockServer.expect(requestTo("https://graph.facebook.com/me/events?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/user-events"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/user-events"), MediaType.APPLICATION_JSON));
List<Invitation> events = facebook.eventOperations().getInvitations();
assertInvitations(events);
}
@@ -42,7 +43,7 @@ public void getInvitations_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/me/events?offset=50&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/user-events"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/user-events"), MediaType.APPLICATION_JSON));
List<Invitation> events = facebook.eventOperations().getInvitations(50, 25);
assertInvitations(events);
}
@@ -57,7 +58,7 @@ public void getInvitations_forSpecificUser() {
mockServer.expect(requestTo("https://graph.facebook.com/123456789/events?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/user-events"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/user-events"), MediaType.APPLICATION_JSON));
List<Invitation> events = facebook.eventOperations().getInvitations("123456789");
assertInvitations(events);
}
@@ -67,7 +68,7 @@ public void getInvitations_forSpecificUser_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/123456789/events?offset=60&limit=30"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/user-events"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/user-events"), MediaType.APPLICATION_JSON));
List<Invitation> events = facebook.eventOperations().getInvitations("123456789", 60, 30);
assertInvitations(events);
}
@@ -82,7 +83,7 @@ public void getEvent() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/simple-event"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/simple-event"), MediaType.APPLICATION_JSON));
Event event = facebook.eventOperations().getEvent("193482154020832");
assertEquals("193482154020832", event.getId());
assertEquals("100001387295207", event.getOwner().getId());
@@ -101,7 +102,7 @@ public void getEvent_withLocationAndDescription() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/full-event"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/full-event"), MediaType.APPLICATION_JSON));
Event event = facebook.eventOperations().getEvent("193482154020832");
assertEquals("193482154020832", event.getId());
assertEquals("100001387295207", event.getOwner().getId());
@@ -121,7 +122,7 @@ public void createEvent() {
.andExpect(method(POST))
.andExpect(body("name=Test+Event&start_time=2011-04-01T15%3A30%3A00&end_time=2011-04-01T18%3A30%3A00"))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse("{\"id\":\"193482145020832\"}", responseHeaders));
+ .andRespond(withSuccess("{\"id\":\"193482145020832\"}", MediaType.APPLICATION_JSON));
String eventId = facebook.eventOperations().createEvent("Test Event", "2011-04-01T15:30:00", "2011-04-01T18:30:00");
assertEquals("193482145020832", eventId);
}
@@ -136,7 +137,7 @@ public void deleteEvent() {
mockServer.expect(requestTo("https://graph.facebook.com/123456789"))
.andExpect(method(POST))
.andExpect(body("method=delete"))
- .andRespond(withResponse("", responseHeaders));
+ .andRespond(withSuccess("", MediaType.APPLICATION_JSON));
facebook.eventOperations().deleteEvent("123456789");
mockServer.verify();
}
@@ -151,7 +152,7 @@ public void getInvited() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832/invited"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/invited"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/invited"), MediaType.APPLICATION_JSON));
List<EventInvitee> invited = facebook.eventOperations().getInvited("193482154020832");
assertEquals(3, invited.size());
assertInvitee(invited.get(0), "100001387295207", "Art Names", RsvpStatus.ATTENDING);
@@ -164,7 +165,7 @@ public void getAttending() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832/attending"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/attending"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/attending"), MediaType.APPLICATION_JSON));
List<EventInvitee> invited = facebook.eventOperations().getAttending("193482154020832");
assertEquals(3, invited.size());
assertInvitee(invited.get(0), "100001387295207", "Art Names", RsvpStatus.ATTENDING);
@@ -177,7 +178,7 @@ public void getMaybeAttending() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832/maybe"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/maybe-attending"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/maybe-attending"), MediaType.APPLICATION_JSON));
List<EventInvitee> invited = facebook.eventOperations().getMaybeAttending("193482154020832");
assertEquals(3, invited.size());
assertInvitee(invited.get(0), "100001387295207", "Art Names", RsvpStatus.UNSURE);
@@ -190,7 +191,7 @@ public void getNoReplies() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832/noreply"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/no-replies"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/no-replies"), MediaType.APPLICATION_JSON));
List<EventInvitee> invited = facebook.eventOperations().getNoReplies("193482154020832");
assertEquals(3, invited.size());
assertInvitee(invited.get(0), "100001387295207", "Art Names", RsvpStatus.NOT_REPLIED);
@@ -203,7 +204,7 @@ public void getDeclined() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832/declined"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/declined"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/declined"), MediaType.APPLICATION_JSON));
List<EventInvitee> invited = facebook.eventOperations().getDeclined("193482154020832");
assertEquals(3, invited.size());
assertInvitee(invited.get(0), "100001387295207", "Art Names", RsvpStatus.DECLINED);
@@ -216,7 +217,7 @@ public void acceptInvitation() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832/attending"))
.andExpect(method(POST))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse("true", responseHeaders));
+ .andRespond(withSuccess("true", MediaType.APPLICATION_JSON));
facebook.eventOperations().acceptInvitation("193482154020832");
mockServer.verify();
}
@@ -231,7 +232,7 @@ public void maybeInvitation() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832/maybe"))
.andExpect(method(POST))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse("true", responseHeaders));
+ .andRespond(withSuccess("true", MediaType.APPLICATION_JSON));
facebook.eventOperations().maybeInvitation("193482154020832");
mockServer.verify();
}
@@ -246,7 +247,7 @@ public void declineInvitation() {
mockServer.expect(requestTo("https://graph.facebook.com/193482154020832/declined"))
.andExpect(method(POST))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse("true", responseHeaders));
+ .andRespond(withSuccess("true", MediaType.APPLICATION_JSON));
facebook.eventOperations().declineInvitation("193482154020832");
mockServer.verify();
}
@@ -261,7 +262,7 @@ public void search() {
mockServer.expect(requestTo("https://graph.facebook.com/search?q=Spring+User+Group&type=event&offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/event-list"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/event-list"), MediaType.APPLICATION_JSON));
List<Event> results = facebook.eventOperations().search("Spring User Group");
assertEquals(1, results.size());
assertEquals("196119297091135", results.get(0).getId());
@@ -276,7 +277,7 @@ public void search_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/search?q=Spring+User+Group&type=event&offset=30&limit=15"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/event-list"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/event-list"), MediaType.APPLICATION_JSON));
List<Event> results = facebook.eventOperations().search("Spring User Group", 30, 15);
assertEquals(1, results.size());
assertEquals("196119297091135", results.get(0).getId());
View
85 ...cial-facebook/src/test/java/org/springframework/social/facebook/api/FeedTemplateTest.java
@@ -17,13 +17,13 @@
import static org.junit.Assert.*;
import static org.springframework.http.HttpMethod.*;
-import static org.springframework.social.test.client.RequestMatchers.*;
-import static org.springframework.social.test.client.ResponseCreators.*;
+import static org.springframework.test.web.client.RequestMatchers.*;
+import static org.springframework.test.web.client.ResponseCreators.*;
import java.util.List;
import org.junit.Test;
-import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
import org.springframework.social.DuplicateStatusException;
import org.springframework.social.NotAuthorizedException;
import org.springframework.social.facebook.api.Post.PostType;
@@ -38,7 +38,7 @@ public void getFeed() {
mockServer.expect(requestTo("https://graph.facebook.com/me/feed?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/feed"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/feed"), MediaType.APPLICATION_JSON));
List<Post> feed = facebook.feedOperations().getFeed();
assertEquals(5, feed.size());
assertTrue(feed.get(0) instanceof StatusPost);
@@ -54,7 +54,7 @@ public void getFeed_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/me/feed?offset=40&limit=20"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/feed"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/feed"), MediaType.APPLICATION_JSON));
List<Post> feed = facebook.feedOperations().getFeed(40, 20);
assertEquals(5, feed.size());
assertTrue(feed.get(0) instanceof StatusPost);
@@ -70,7 +70,7 @@ public void getFeed_withUnknownType() {
mockServer.expect(requestTo("https://graph.facebook.com/me/feed?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/feed-with-unknown-type"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/feed-with-unknown-type"), MediaType.APPLICATION_JSON));
List<Post> feed = facebook.feedOperations().getFeed();
assertEquals(1, feed.size());
assertTrue(feed.get(0) instanceof Post);
@@ -92,7 +92,7 @@ public void getFeed_forOwnerId() {
mockServer.expect(requestTo("https://graph.facebook.com/12345678/feed?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/feed"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/feed"), MediaType.APPLICATION_JSON));
List<Post> feed = facebook.feedOperations().getFeed("12345678");
assertEquals(5, feed.size());
assertFeedEntries(feed);
@@ -103,7 +103,7 @@ public void getFeed_forOwnerId_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/12345678/feed?offset=100&limit=50"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/feed"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/feed"), MediaType.APPLICATION_JSON));
List<Post> feed = facebook.feedOperations().getFeed("12345678", 100, 50);
assertEquals(5, feed.size());
assertFeedEntries(feed);
@@ -119,7 +119,7 @@ public void getHomeFeed() {
mockServer.expect(requestTo("https://graph.facebook.com/me/home?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/feed"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/feed"), MediaType.APPLICATION_JSON));
List<Post> homeFeed = facebook.feedOperations().getHomeFeed();
assertEquals(5, homeFeed.size());
assertFeedEntries(homeFeed);
@@ -130,7 +130,7 @@ public void getHomeFeed_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/me/home?offset=40&limit=20"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/feed"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/feed"), MediaType.APPLICATION_JSON));
List<Post> homeFeed = facebook.feedOperations().getHomeFeed(40, 20);
assertEquals(5, homeFeed.size());
assertFeedEntries(homeFeed);
@@ -146,7 +146,7 @@ public void getStatuses() {
mockServer.expect(requestTo("https://graph.facebook.com/me/statuses?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/user-statuses"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/user-statuses"), MediaType.APPLICATION_JSON));
assertStatuses(facebook.feedOperations().getStatuses());
}
@@ -155,7 +155,7 @@ public void getStatuses_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/me/statuses?offset=30&limit=10"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/user-statuses"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/user-statuses"), MediaType.APPLICATION_JSON));
assertStatuses(facebook.feedOperations().getStatuses(30, 10));
}
@@ -169,7 +169,7 @@ public void getStatuses_forSpecificUser() {
mockServer.expect(requestTo("https://graph.facebook.com/24680/statuses?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/user-statuses"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/user-statuses"), MediaType.APPLICATION_JSON));
assertStatuses(facebook.feedOperations().getStatuses("24680"));
}
@@ -178,7 +178,7 @@ public void getStatuses_forSpecificUser_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/24680/statuses?offset=15&limit=5"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/user-statuses"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/user-statuses"), MediaType.APPLICATION_JSON));
assertStatuses(facebook.feedOperations().getStatuses("24680", 15, 5));
}
@@ -192,7 +192,7 @@ public void getLinks() {
mockServer.expect(requestTo("https://graph.facebook.com/me/links?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/links"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/links"), MediaType.APPLICATION_JSON));
assertLinks(facebook.feedOperations().getLinks());
}
@@ -201,7 +201,7 @@ public void getLinks_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/me/links?offset=40&limit=20"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/links"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/links"), MediaType.APPLICATION_JSON));
assertLinks(facebook.feedOperations().getLinks(40, 20));
}
@@ -215,7 +215,7 @@ public void getLinks_forSpecificUser() {
mockServer.expect(requestTo("https://graph.facebook.com/13579/links?offset=0&limit=25"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/links"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/links"), MediaType.APPLICATION_JSON));
assertLinks(facebook.feedOperations().getLinks("13579"));
}
@@ -224,7 +224,7 @@ public void getLinks_forSpecificUser_withOffsetAndLimit() {
mockServer.expect(requestTo("https://graph.facebook.com/13579/links?offset=40&limit=20"))
.andExpect(method(GET))
.andExpect(header("Authorization", "OAuth someAccessToken"))
- .andRespond(withResponse(jsonResource("testdata/links"), responseHeaders));
+ .andRespond(withSuccess(jsonResource("testdata/links"), MediaType.APPLICATION_JSON));
assertLinks(facebook.feedOperations().getLinks("13579", 40, 20));