Permalink
Browse files

Merge branch 'release/22.0.6-BETA'

  • Loading branch information...
2 parents 3ff62c6 + c28edb5 commit 2ccf9d30e68f92e48e53ade1fdf77a425e4ca7e9 Nawab Iqbal committed Aug 26, 2011
Showing with 652 additions and 297 deletions.
  1. +1 −1 build-tools/pom.xml
  2. +1 −1 codegen/pom.xml
  3. +7 −8 connector/doc/connection-url.md
  4. +0 −25 connector/doc/native-api.md
  5. +2 −2 connector/pom.xml
  6. +1 −1 connector/src/main/java/com/force/sdk/connector/ForceConnectorConfig.java
  7. +68 −15 connector/src/main/java/com/force/sdk/connector/ForceConnectorUtils.java
  8. +22 −25 connector/src/test/java/com/force/sdk/connector/ForceConnectorConfigTest.java
  9. +2 −2 connector/src/test/resources/cliforce.properties
  10. +1 −1 connector/src/test/resources/unitconnurl.properties
  11. +13 −5 doc/force-sdk-overview.md
  12. +3 −7 doc/quick-start.md
  13. +5 −5 doc/sts.md
  14. +1 −1 javasdk-test/codegen-test/pom.xml
  15. +2 −2 javasdk-test/connector-test/pom.xml
  16. +2 −2 javasdk-test/connector-test/src/test/java/com/force/sdk/connector/BaseForceServiceConnectorTest.java
  17. +2 −2 ...sdk-test/connector-test/src/test/java/com/force/sdk/connector/ForceServiceConnectorCacheTest.java
  18. +1 −1 ...-test/connector-test/src/test/java/com/force/sdk/connector/NegativeForceServiceConnectorTest.java
  19. +1 −1 javasdk-test/connector-test/src/test/resources/funcconnurl.properties
  20. +1 −1 javasdk-test/jpa-test-beanvalidation/pom.xml
  21. +2 −2 javasdk-test/jpa-test-connection/pom.xml
  22. +2 −2 ...dk-test/jpa-test-connection/src/test/java/com/force/sdk/jpa/connection/BaseJPAConnectionTest.java
  23. +26 −6 ...k-test/jpa-test-connection/src/test/java/com/force/sdk/jpa/connection/BasicJPAConnectionTest.java
  24. +22 −5 javasdk-test/jpa-test-connection/src/test/resources/META-INF/persistence.xml
  25. +1 −1 javasdk-test/jpa-test-connection/src/test/resources/connUrlPropFile.properties
  26. +1 −1 javasdk-test/jpa-test-connection/src/test/resources/connUrlWithOptionsPropFile.properties
  27. +1 −1 javasdk-test/jpa-test-query/pom.xml
  28. +1 −1 javasdk-test/jpa-test-schema/pom.xml
  29. +12 −2 javasdk-test/jpa-test/pom.xml
  30. +1 −1 javasdk-test/jpa-test/src/test/resources/META-INF/persistence.xml
  31. +2 −2 javasdk-test/mock-oauth-server/pom.xml
  32. +2 −2 javasdk-test/oauth-app/pom.xml
  33. +6 −6 javasdk-test/oauth-app/src/main/webapp/WEB-INF/web.xml
  34. +2 −2 javasdk-test/oauth-integration-test/pom.xml
  35. +1 −1 javasdk-test/oauth-integration-test/testng-endtoend.xml
  36. +7 −4 javasdk-test/oauth-test/pom.xml
  37. +2 −2 javasdk-test/oauth-test/src/test/java/com/force/sdk/oauth/BaseOAuthTest.java
  38. +41 −1 javasdk-test/oauth-test/src/test/java/com/force/sdk/oauth/BasicAuthFilterTest.java
  39. +1 −1 ...sdk-test/oauth-test/src/test/java/com/force/sdk/oauth/connector/BasicForceOAuthConnectorTest.java
  40. +20 −23 ...sdk-test/oauth-test/src/test/java/com/force/sdk/oauth/connector/ForceOAuthConnectionInfoTest.java
  41. +1 −1 javasdk-test/oauth-test/src/test/resources/funcconnurl.properties
  42. +1 −1 javasdk-test/oauth-test/src/test/resources/unitconnurl.properties
  43. +1 −1 javasdk-test/pom.xml
  44. +1 −1 javasdk-test/qa-utils/pom.xml
  45. +3 −3 ...dk-test/qa-utils/src/main/java/com/force/sdk/qa/util/integration/BaseSecurityIntegrationTest.java
  46. +24 −0 javasdk-test/qa-utils/src/main/java/com/force/sdk/qa/util/jpa/BaseJPAFTest.java
  47. +1 −1 javasdk-test/qa-utils/src/main/resources/force-sdk-test.properties
  48. +2 −2 javasdk-test/springsecurity-app/pom.xml
  49. +3 −2 javasdk-test/springsecurity-app/src/main/webapp/WEB-INF/security-config-ns.xml
  50. +2 −2 javasdk-test/springsecurity-integration-test/pom.xml
  51. +22 −1 javasdk-test/springsecurity-test/pom.xml
  52. +41 −23 ...ecurity-test/src/test/java/com/force/sdk/springsecurity/config/OAuthBeanDefinitionParserTest.java
  53. +58 −0 javasdk-test/springsecurity-test/src/test/resources/security-config-ns-connUrl-env.xml
  54. +58 −0 javasdk-test/springsecurity-test/src/test/resources/security-config-ns-connUrl-javaprop.xml
  55. +1 −1 javasdk-test/springsecurity-test/src/test/resources/security-config-ns-connUrl.xml
  56. +25 −25 jpa/doc/database-com-datatypes.md
  57. +8 −8 jpa/doc/java-db-com-datatypes-map.md
  58. +3 −3 jpa/doc/jpa-annotations-custom.md
  59. +4 −4 jpa/doc/jpa-config-persistence.md
  60. +3 −3 jpa/doc/jpa-cud.md
  61. +1 −1 jpa/doc/jpa-provider.md
  62. +1 −1 jpa/doc/jpa-queries-soql.md
  63. +1 −1 jpa/doc/jpa-queries.md
  64. +1 −1 jpa/pom.xml
  65. +32 −11 jpa/src/main/java/com/force/sdk/jpa/ForceStoreManager.java
  66. +4 −4 oauth/doc/oauth-auth.md
  67. +1 −1 oauth/pom.xml
  68. +12 −1 oauth/src/main/java/com/force/sdk/oauth/AuthFilter.java
  69. +1 −1 oauth/src/main/java/com/force/sdk/oauth/connector/ForceOAuthConnectionInfo.java
  70. +2 −2 pom.xml
  71. +44 −16 springsecurity/doc/spring-security.md
  72. +1 −1 springsecurity/pom.xml
View
2 build-tools/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2 codegen/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
15 connector/doc/connection-url.md
@@ -45,7 +45,7 @@ You can encode the JPA connection information for the default integration user a
The format of a connection URL that includes JPA connection information for the default integration user and OAuth credentials is:
<pre>
- <code>force://login.salesforce.com;user=<em>user@salesforcedoc.org</em>;password=<em>samplePassword</em>;oauth_key=<em>xyz</em>;oauth_secret=<em>abc</em></code>
+ <code>force://login.salesforce.com?user=<em>user@salesforcedoc.org</em>&password=<em>samplePassword</em>&oauth_key=<em>xyz</em>&oauth_secret=<em>abc</em></code>
</pre>
Substitute values in the *user* and *password* fields with the username and password for the default integration user.
@@ -56,11 +56,10 @@ There is also an optional *timeout* parameter, which is the number of millisecon
timing out. This parameter is equivalent to the **datanucleus.datastoreReadTimeout** property in `persistence.xml`. This connection URL shows sample usage:
<pre>
- <code>force://login.salesforce.com;user=<em>user@salesforcedoc.org</em>;password=<em>samplePassword</em>;timeout=<em>10000</em></code>
+ <code>force://login.salesforce.com?user=<em>user@salesforcedoc.org</em>&password=<em>samplePassword</em>&timeout=<em>10000</em></code>
</pre>
-Each version of the Database.com Java SDK is automatically linked with an API version. For example, version 22.0.0 of the SDK
-uses API version 22.0. For JPA functionality, the major version of the SDK must always match the API version. To use a native API connection class to override the default API version for the SDK, see <a href="native-api#setAPIversion">Setting an API Version</a>.
+Each version of the Database.com Java SDK is automatically linked with an API version. The major version of the SDK matches the major version of the API. For example, version 22.0.0 of the SDK uses API version 22.0.
<a name ="configConnectionURL"> </a>
## Configuring Connection URLs
@@ -106,14 +105,14 @@ information for this persistence unit in a Java system property named force.*per
The following code shows you how to set the authentication information in a Java system property:
System.setProperty("force.persistenceUnitName.url",
- "force://login.salesforce.com;user=user@salesforcedoc.org;password=samplePassword");
+ "force://login.salesforce.com?user=user@salesforcedoc.org&password=samplePassword");
If you use a Java system property to set the authentication information, you must include <code>\<property
name="datanucleus.storeManagerType" value="force"/></code> in the <code>persistence-unit</code> element in your application's
`persistence.xml` file.
<a name="propFile"> </a>
-### Connection Properties File
+### Connection URL in Properties file in the Classpath
You can set the connection URL in a properties file in the classpath. If you add the properties file to the `src/main/resources` directory of your
application, Maven automatically copies it to your classpath.
@@ -129,13 +128,13 @@ information for this persistence unit in a *persistenceUnitName*.properties file
A file containing this line is an example of a properties file containing a url property.
- url=force://login.salesforce.com;user=user@salesforcedoc.org;password=samplePassword
+ url=force://login.salesforce.com?user=user@salesforcedoc.org&password=samplePassword
<!-- Comment out until release cliforce. Uncomment this section and add a link to the bullet list earlier in the file when ready.
<a name="UrlConnectionsPropFile"> </a>
You can set the connection URL in the $HOME/.force/cliforce_urls file, where $HOME refers to your home directory. The format is:
- persistenceUnitName=force://login.salesforce.com;user=user@salesforcedoc.org;password=samplePassword
+ persistenceUnitName=force://login.salesforce.com?user=user@salesforcedoc.org&password=samplePassword
-->
View
25 connector/doc/native-api.md
@@ -26,31 +26,6 @@ The BulkConnection class enables you to execute Bulk API requests. The Bulk API
[Read more about the Bulk API](http://www.salesforce.com/us/developer/docs/api_asynch/)
-<a name="setAPIversion"> </a>
-## Setting an API Version
-
-By default, a Database.com Service Connector is bound to the API whose major version matches its own. For example, a service connector from SDK version 22.0.0 is automatically bound to API version 22.0.
-
- // ForceConnectorConfig, ForceServiceConnector from SDK 22.0.0
- ForceConnectorConfig config = new ForceConnectorConfig();
- config.setConnectionUrl("force://login.salesforce.com;user=user@salesforcedoc.org;password=samplePassword");
-
- // Gets a connection to API version 22.0
- ForceServiceConnector connector = new ForceServiceConnector(config);
- PartnerConnection connection = connector.getConnection();
-
-However, for certain advanced use cases, you may wish to issue native API calls to a different version of the API. To do this, you can override the default API version bound to a service connector by specifying a fully qualified API endpoint. In the following example, we are getting an API version 23.0 connection using SDK version 22.0.0.
-
- // ForceConnectorConfig, ForceServiceConnector from SDK 22.0.0
- ForceConnectorConfig config = new ForceConnectorConfig();
- config.setConnectionUrl("force://login.salesforce.com/services/Soap/u/23.0;user=user@salesforcedoc.org;password=samplePassword");
-
- // Gets a connection to API version 23.0
- ForceServiceConnector connector = new ForceServiceConnector(config);
- PartnerConnection connection = connector.getConnection();
-
-For more information about connection endpoints, see [Connection Configuration](connection-url#configConnectionURL).
-
## API Queries
An alternative to using JPQL or SOQL queries is to bypass JPA and execute a [query()](http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_query.htm) call using the Web services API. The advantage of using JPQL or SOQL rather than a <code>query()</code> call is that JPA entities are
View
4 connector/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -21,7 +21,7 @@
<configuration>
<environmentVariables>
<FORCE_ENVVARCONN_URL>
- force://url;user=user;password=password
+ force://url?user=user&amp;password=password
</FORCE_ENVVARCONN_URL>
</environmentVariables>
</configuration>
View
2 connector/src/main/java/com/force/sdk/connector/ForceConnectorConfig.java
@@ -171,7 +171,7 @@ public void setConnectionUrl(String connectionUrl) {
Map<ForceConnectionProperty, String> propMap = ForceConnectorUtils.loadConnectorPropsFromUrl(connectionUrl);
if (propMap == null || propMap.size() < MIN_CONN_URL_PROPS) {
throw new IllegalArgumentException("The connection url (" + connectionUrl + ") must contain at least three parts. "
- + "It should be in the form force://<endPoint>;user=<user>;password=<password>");
+ + "It should be in the form force://<endPoint>?user=<user>&password=<password>");
}
setPropsFromMap(propMap, connectionUrl);
View
83 connector/src/main/java/com/force/sdk/connector/ForceConnectorUtils.java
@@ -34,6 +34,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -126,6 +128,47 @@ public static String buildForceApiEndpoint(String endpoint) {
}
/**
+ * Returns true if var has some value enclosed in ${ and }; which means that user intended the value to be injected from
+ * system variables or environment variables.
+ * @param var any string.
+ * @return true if var is enclosed by ${ and }
+ */
+ public static boolean isInjectable(String var) {
+ return var != null && var.startsWith("${") && var.endsWith("}");
+ }
+
+ /**
+ * This method will fetch and return the value of 'var' from system variables and if not found in system variables
+ * then in environment variables.
+ * @param var name of var enclosed by ${ and }
+ * @return value of var
+ */
+ public static String extractValue(String var) {
+ if (var != null) {
+ if (!var.startsWith("${") || !var.endsWith("}")) {
+ return null;
+ }
+
+ var = var.replace("${" , "");
+ var = var.substring(0, var.length() - 1);
+
+ if (var != null) {
+ if (System.getProperty(var) != null) {
+ LOGGER.info("Connection : loading " + var + " from Java System Properties");
+ return System.getProperty(var);
+ }
+
+ if (System.getenv(var) != null) {
+ LOGGER.info("Connection : loading " + var + " from Environment Variables");
+ return System.getenv(var);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
* Loads Force.com connection properties from a connection name.
* <p>
* A connection name can represent connection properties in several
@@ -272,31 +315,41 @@ public static String buildForceApiEndpoint(String endpoint) {
if (connectionUrl == null) throw new IllegalArgumentException("Connection url cannot be null.");
// Parse the connection url
- String[] parsedConnectionUrl = connectionUrl.split(";");
- for (int i = 0; i < parsedConnectionUrl.length; i++) {
- parsedConnectionUrl[i] = parsedConnectionUrl[i].trim();
+ URI connectionUri;
+ try {
+ connectionUri = new URI(connectionUrl);
+ } catch (URISyntaxException e) {
+ throw new IllegalArgumentException("Unable to parse connection url (" + connectionUrl + ")", e);
}
// Basic validation of connection url
- if (parsedConnectionUrl.length < 0) throw new IllegalArgumentException("Connection url cannot be empty.");
- if (!parsedConnectionUrl[0].startsWith("force://")) {
+ if (!"force".equals(connectionUri.getScheme())) {
throw new IllegalArgumentException("Illegal prefix for connection url (" + connectionUrl + "). "
+ "It must start with force://");
- } else {
- // Strip out the "force://" prefix
- parsedConnectionUrl[0] = parsedConnectionUrl[0].split("://", 2)[1];
}
-
- Map<ForceConnectionProperty, String> connectorPropMap =
- new HashMap<ForceConnectionProperty, String>(parsedConnectionUrl.length);
+
+ Map<ForceConnectionProperty, String> connectorPropMap = new HashMap<ForceConnectionProperty, String>(3);
// In a connection url, the endpoint won't be marked with a property key
// so add it here first
- ForceConnectionProperty.ENDPOINT.validateValue(parsedConnectionUrl[0], "Illegal connection url (" + connectionUrl + ").");
- connectorPropMap.put(ForceConnectionProperty.ENDPOINT, parsedConnectionUrl[0]);
+ String endpoint = connectionUri.getHost();
+ if (endpoint != null) {
+ StringBuffer sb = new StringBuffer(endpoint);
+ if (connectionUri.getPort() > -1) sb.append(":").append(connectionUri.getPort());
+ if (connectionUri.getPath() != null) sb.append(connectionUri.getPath());
+
+ endpoint = sb.toString();
+ }
+
+ ForceConnectionProperty.ENDPOINT.validateValue(endpoint, "Illegal connection url (" + connectionUrl + ").");
+ connectorPropMap.put(ForceConnectionProperty.ENDPOINT, endpoint);
- for (int i = 1; i < parsedConnectionUrl.length; i++) {
- String[] parsedUrlProperty = parsedConnectionUrl[i].split("=", 2);
+ String queryString = connectionUri.getQuery();
+ if (queryString == null) return connectorPropMap;
+
+ String[] parsedQueryString = connectionUri.getQuery().split("&");
+ for (String queryParam : parsedQueryString) {
+ String[] parsedUrlProperty = queryParam.split("=", 2);
if (parsedUrlProperty.length == 2) {
ForceConnectionProperty connProp = ForceConnectionProperty.fromPropertyName(parsedUrlProperty[0]);
View
47 connector/src/test/java/com/force/sdk/connector/ForceConnectorConfigTest.java
@@ -104,7 +104,7 @@ public void testLoadFromEnvVariable(String connectionName) throws Exception {
@Test(dataProvider = "javaPropertyProvider")
public void testLoadFromJavaProperty(String propName, String connectionName) throws Exception {
try {
- System.setProperty(propName, "force://url;user=user@org.com;password=password");
+ System.setProperty(propName, "force://url?user=user@org.com&password=password");
ForceConnectorConfig config = ForceConnectorConfig.loadFromName(connectionName);
assertNotNull(config);
@@ -119,7 +119,7 @@ public void testLoadFromJavaProperty(String propName, String connectionName) thr
@Test
public void testLoadFromJavaPropertyIsCaseSensitive() throws Exception {
try {
- System.setProperty("force.xyz.url", "force://url;user=user@org.com;password=password");
+ System.setProperty("force.xyz.url", "force://url?user=user@org.com&password=password");
assertNull(ForceConnectorConfig.loadFromName("XYZ"));
} finally {
System.clearProperty("force.xyz.url");
@@ -131,7 +131,7 @@ public void testLoadFromJavaPropertyIsCaseSensitive() throws Exception {
public void testLoadEnvVariableBeforeJavaProperty() throws Exception {
try {
// Set a Java property that conflicts with the environment variable set in the pom
- System.setProperty("force.envvarconn.url", "force://url;user=user;password=password");
+ System.setProperty("force.envvarconn.url", "force://url?user=user&password=password");
// Try loading from the environment variable.
// The assertions in that test should still work.
@@ -145,7 +145,7 @@ public void testLoadEnvVariableBeforeJavaProperty() throws Exception {
public void testLoadJavaPropertyBeforePropertyFile() throws Exception {
try {
// Set a Java property that conficts with the unitconnurl properties file
- System.setProperty("force.unitconnurl.url", "force://javapropurl;user=javapropuser;password=javaproppassword");
+ System.setProperty("force.unitconnurl.url", "force://javapropurl?user=javapropuser&password=javaproppassword");
ForceConnectorConfig config = ForceConnectorConfig.loadFromName("unitconnurl");
assertNotNull(config);
@@ -171,10 +171,11 @@ public void testLoadWithNothingSet() throws Exception {
{null},
{""},
{"url"},
- {"url;user=user;password=password"},
+ {"url?user=user&password=password"},
{"force://"},
{"force://url"},
- {"force://url;user=user"},
+ {"force://url?user=user"},
+ {" force://url?user=user&password=password"}, // Leading space
};
}
@@ -197,11 +198,11 @@ public void testParseBadConnectionUrl(String connectionUrl) throws Exception {
@DataProvider
protected Object[][] connectionUrlWithBadPropertyProvider() {
return new Object[][] {
- {"force://;user=user;password=password", "endpoint", null},
- {"force://url;user=;password=password", "user", null},
- {"force://url;user=user;password=", "password", null},
- {"force://url/a;user=user;password=", "endpoint", "url/a"},
- {"force://url;user=user;password=password;timeout=abc", "timeout", "abc"},
+ {"force://?user=user&password=password", "endpoint", null},
+ {"force://url?user=&password=password", "user", null},
+ {"force://url?user=user&password=", "password", null},
+ {"force://url/a?user=user&password=", "endpoint", "url/a"},
+ {"force://url?user=user&password=password&timeout=abc", "timeout", "abc"},
};
}
@@ -224,17 +225,13 @@ public void testParseConnectionUrlWithBadProperty(String connectionUrl, String b
@DataProvider
protected Object[][] basicGoodConnectionUrlProvider() {
return new Object[][] {
- {"force://url;user=user;password=password"},
- {"force://url;password=password;user=user"},
- {"force://url/;user=user;password=password"},
- {"force://url;user=user;password=password;testProp"}, // Ignore unknown properties
- {"force://url;user=user;password=password;testProp="}, // Ignore unknown properties
- {"force://url;user=user;password=password;oauth_secret=abc"}, // Ignore unused properties
- {"force://url;user=user;password=password;"}, // Trailing ';'
- {" force://url;user=user;password=password"}, // Leading whitespace
- {"force://url; user=user;password=password"}, // Space between url and user
- {"force://url;user=user; password=password"}, // Space between user and password
- {"force://url;user=user;password=password "}, // Trailing whitespace
+ {"force://url?user=user&password=password"},
+ {"force://url?password=password&user=user"},
+ {"force://url/?user=user&password=password"},
+ {"force://url?user=user&password=password&testProp"}, // Ignore unknown properties
+ {"force://url?user=user&password=password&testProp="}, // Ignore unknown properties
+ {"force://url?user=user&password=password&oauth_secret=abc"}, // Ignore unused properties
+ {"force://url?user=user&password=password&"}, // Trailing '&'
};
}
@@ -255,11 +252,11 @@ public void testParseBasicGoodConnectionUrl(String connectionUrl) throws Excepti
@DataProvider
protected Object[][] goodConnectionUrlProvider() {
return new Object[][] {
- {"force://url;user=user;password=password;clientid=id;timeout=1;trace=true",
+ {"force://url?user=user&password=password&clientid=id&timeout=1&trace=true",
null /* skip validation */, "user", "password", "id", 1},
- {"force://url/services/Soap/u/0;user=user;password=password",
+ {"force://url/services/Soap/u/0?user=user&password=password",
"https://url/services/Soap/u/0", "user", "password", null, 0},
- {"force://url;user=user;password=password=",
+ {"force://url?user=user&password=password=",
null /* skip validation */, "user", "password=", null, 0}, // Trailing '='
};
}
View
4 connector/src/test/resources/cliforce.properties
@@ -24,5 +24,5 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-connA=force://url.com;user=abc@abc.com;password=Pass1234
-connB=force://web.com;user=xyz@xyz.com;password=1234pasS
+connA=force://url.com?user=abc@abc.com&password=Pass1234
+connB=force://web.com?user=xyz@xyz.com&password=1234pasS
View
2 connector/src/test/resources/unitconnurl.properties
@@ -24,4 +24,4 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-url=force://url;user=username;password=password;clientid=id;timeout=1;trace=true
+url=force://url?user=username&password=password&clientid=id&timeout=1&trace=true
View
18 doc/force-sdk-overview.md
@@ -6,7 +6,7 @@ title: Introduction
---
# Introduction
-Force.com is a complete application development platform that provides tools for managing data, logic, and user interfaces of your cloud apps. Database.com is the underlying database that powers Force.com and all the applications built on the platform, including Sales Cloud, Service Cloud and Chatter.
+Force.com is a complete application development platform that provides tools for managing data, logic, and user interfaces of your cloud apps. Database.com is the underlying database that powers Force.com and all the applications built on the platform, including Sales Cloud, Service Cloud, and Chatter.
If you are a Force.com developer, you are already using Database.com to manage the data for your application and to automatically expose your data in both a [REST API][1] and [SOAP API][2]. It also provides a [Metadata API][3] to handle changes to your data model.
@@ -21,7 +21,7 @@ If you are a Java developer and you want to build a Java application that access
* Leverage the Database.com user security model to manage data access for your application
* Extend existing Force.com applications with Java logic
-The SDK is not tied to any particular runtime. You can build applications that run on your own server, on Amazon's EC2 or other cloud runtimes as long as you can make HTTPS connections to Database.com.
+The SDK is not tied to any particular runtime. You can build applications that run on your own server, on Amazon's EC2, or other cloud runtimes as long as you can make HTTPS connections to Database.com.
You can use the Database.com Java SDK with any organization that has Force.com API calls enabled. This includes Enterprise, Unlimited, Developer, and Database.com Editions.
@@ -39,18 +39,26 @@ The JPA provider enables you to use Database.com as a persistent data store for
[Read more](jpa-provider)
-## OAuth authentication and authorization
+## OAuth Authentication and Authorization
If you're building an application for authenticated Database.com users, you can configure single sign-on and leverage the security model in Database.com using OAuth2.
[Read more](oauth-auth)
-## Spring security plugin
+## Spring Security Plugin
This plugin enables you to use Spring Security for authentication and authorization in your applications. The Spring Security library uses the API Connector and the OAuth Connector to allow authentication via the Force.com APIs. There is also a custom Spring Security namespace that helps to simplify configuration.
[Read more](spring-security)
-## Spring MVC project template
+## Spring MVC Project Template
The SDK includes a Spring MVC project template distributed as a Maven archetype. You can quickly and easily create new projects from this template. The template sets up all the Maven dependencies needed for a new Spring MVC application using the JPA provider and Spring Security plugin.
+
+To see the Maven archetype in action, read the [quick start](quick-start).
+
+## Code Generation Plugin
+
+This plugin is not part of the Database.com Java SDK, but you can use it to generate Java classes based on the objects already present in your organization.
+
+[Read more](https://github.com/forcedotcom/maven-force-plugin)
View
10 doc/quick-start.md
@@ -21,7 +21,7 @@ This quick start walks you through creating a new Spring MVC application from a
### A word about Maven before you get started
-Many of the commands in this quick start trigger downloads of additional Maven dependencies. If you have never used Maven before or if you are going through this quick start on a new machine or with a new user account, this can be slow initially. However, once the modules are downloaded, they are cached in a local repository and subsequent commands execute quicker.
+Many of the commands in this quick start trigger downloads of additional Maven dependencies. If you have never used Maven before or if you are going through this quick start on a new machine or with a new user account, this can be slow initially. However, once the modules are downloaded, they are cached in a local repository and subsequent commands execute more quickly.
## 1. Create a new project from a template
@@ -66,7 +66,7 @@ Navigate to <http://localhost:8080/hellocloud> where you should see a welcome sc
## 4. Next Steps
-The Database.com SDK is not tied to any particular runtime. You can now proceed to deploy the application on your own server, Cloud Foundry, EC2 or other cloud runtimes as long as you can make HTTPS connections to Database.com.
+The Database.com SDK is not tied to any particular runtime. You can now proceed to deploy the application on your own server, Cloud Foundry, EC2, or other cloud runtimes as long as you can make HTTPS connections to Database.com.
If you want to take a look at an application that is built out a little bit more, you can look at the "Music Library" application here: <https://github.com/forcedotcom/javasample-musiclib>. You can clone this project by running:
@@ -78,8 +78,4 @@ Now, build and run the musiclib application.
mvn tomcat:run-war
-And see it at <http://localhost:8080/musiclib>. It will pick up the same connection parameters that you already set up and create entities in the same Force.com organization.
-
-Happy coding.
-
-
+And see it at <http://localhost:8080/musiclib>. It will pick up the same connection parameters that you already set up and create entities in the same Force.com organization.
View
10 doc/sts.md
@@ -27,18 +27,18 @@ The Database.com JPA provider uses the [DataNucleus Access Platform](http://www.
To install DataNucleus Eclipse plugin:
1. Click the SpringSource icon in the toolbar to open the Dashboard.
-- Click the Extensions tab at the bottom left of the Dashboard.
+- Click the **Extensions** tab at the bottom left of the Dashboard.
- Search for DataNucleus and install the DataNucleus Eclipse Plugin.
-- Click Install at the bottom right of the Dashboard.
-- An Install popup window lists the items for installation. Click Next.
-- Review the installation details and click Next and Finish.
+- Click **Install** at the bottom right of the Dashboard.
+- An Install popup window lists the items for installation. Click **Next**.
+- Review the installation details and click **Next** and **Finish**.
- Restart SpringSource Tool Suite for the changes to take effect.
## 3. Import the Quick Start Sample Application
1. Once you have STS installed, launch it with a new workspace.
1. Click **File > Import**.
-1. In the import source list, click **Maven > Existing Maven Projects** and then click Next.
+1. In the import source list, click **Maven > Existing Maven Projects** and then click **Next**.
1. Click **Browse** and navigate to the root folder of the `hellocloud` sample application you created in the [quick start](quick-start). The root folder contains pom.xml.
1. Click **OK** and you should see your pom.xml and project name in the Projects list.
1. Click **Finish**.
View
2 javasdk-test/codegen-test/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<build>
View
4 javasdk-test/connector-test/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<build>
@@ -37,7 +37,7 @@
<configuration>
<environmentVariables>
<FORCE_ENVVARCONN_URL>
- force://${endpoint}/services/Soap/u/${force.apiVersion};user=${user};password=${password}
+ force://${endpoint}/services/Soap/u/${force.apiVersion}?user=${user}&amp;password=${password}
</FORCE_ENVVARCONN_URL>
</environmentVariables>
</configuration>
View
4 ...t/connector-test/src/test/java/com/force/sdk/connector/BaseForceServiceConnectorTest.java
@@ -103,8 +103,8 @@ protected String createConnectionUrl() {
StringBuffer sb = new StringBuffer();
sb.append("force://").append(parsedEndPoint[parsedEndPoint.length - 1])
- .append(";user=").append(userInfo.getUserName())
- .append(";password=").append(userInfo.getPassword());
+ .append("?user=").append(userInfo.getUserName())
+ .append("&password=").append(userInfo.getPassword());
return sb.toString();
}
View
4 .../connector-test/src/test/java/com/force/sdk/connector/ForceServiceConnectorCacheTest.java
@@ -66,12 +66,12 @@ public void testCacheWithConfig() throws Exception {
public void testCacheWithConnectionName() throws Exception {
String connUrl = createConnectionUrl();
try {
- System.setProperty("force.testCacheWithConnectionName.url", connUrl + ";timeout=1234");
+ System.setProperty("force.testCacheWithConnectionName.url", connUrl + "&timeout=1234");
ForceServiceConnector connector = new ForceServiceConnector("testCacheWithConnectionName");
connector.getConnection();
- System.setProperty("force.testCacheWithConnectionName.url", connUrl + ";timeout=2345");
+ System.setProperty("force.testCacheWithConnectionName.url", connUrl + "&timeout=2345");
connector = new ForceServiceConnector("testCacheWithConnectionName");
// We should hit the cache here and retrieve the original read timeout
View
2 ...nnector-test/src/test/java/com/force/sdk/connector/NegativeForceServiceConnectorTest.java
@@ -62,7 +62,7 @@ public void testCannotResetConnectorAfterGetConnection() throws Exception {
@Test
public void testEqualsSignInConnectionUrl() throws Exception {
try {
- System.setProperty("force.testMissingStateInConnectionUrl.url", "force://url;useruser;password=password");
+ System.setProperty("force.testMissingStateInConnectionUrl.url", "force://url?useruser&password=password");
ForceServiceConnector connector = new ForceServiceConnector("testMissingStateInConnectionUrl");
connector.getConnection();
View
2 javasdk-test/connector-test/src/test/resources/funcconnurl.properties
@@ -24,4 +24,4 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-url=force://${endpoint}/services/Soap/u/${force.apiVersion};user=${user};password=${password}
+url=force://${endpoint}/services/Soap/u/${force.apiVersion}?user=${user}&password=${password}
View
2 javasdk-test/jpa-test-beanvalidation/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<build>
View
4 javasdk-test/jpa-test-connection/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<build>
@@ -41,7 +41,7 @@
</properties>
<environmentVariables>
<FORCE_CONNURLENVVAR_URL>
- force://${endpoint}/services/Soap/u/${force.apiVersion};user=${user};password=${password}
+ force://${endpoint}/services/Soap/u/${force.apiVersion}?user=${user}&amp;password=${password}
</FORCE_CONNURLENVVAR_URL>
</environmentVariables>
</configuration>
View
4 ...jpa-test-connection/src/test/java/com/force/sdk/jpa/connection/BaseJPAConnectionTest.java
@@ -64,8 +64,8 @@ protected String createConnectionUrl() {
StringBuffer sb = new StringBuffer();
sb.append("force://").append(parsedEndPoint[parsedEndPoint.length - 1])
- .append(";user=").append(userInfo.getUserName())
- .append(";password=").append(userInfo.getPassword());
+ .append("?user=").append(userInfo.getUserName())
+ .append("&password=").append(userInfo.getPassword());
return sb.toString();
}
View
32 ...pa-test-connection/src/test/java/com/force/sdk/jpa/connection/BasicJPAConnectionTest.java
@@ -26,15 +26,13 @@
package com.force.sdk.jpa.connection;
-import java.util.Collections;
-import java.util.Map;
+import com.force.sdk.connector.ForceConnectorTestUtils;
+import org.testng.annotations.Test;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
-
-import org.testng.annotations.Test;
-
-import com.force.sdk.connector.ForceConnectorTestUtils;
+import java.util.Collections;
+import java.util.Map;
/**
* Basic tests for JPA connections.
@@ -53,6 +51,15 @@ public void testConnFromConnUrlEnvironmentVariable() throws Exception {
verifyEntityManager(emf.createEntityManager());
}
+ // NOTE: This test is not going to pass in STS. You have to execute from the command line.
+ @Test
+ public void testConnFromCustomEnvironmentVariable() throws Exception {
+ // FORCE_CONNURLENVVAR_URL is defined in pom.xml
+ // See connUrlEnvVar2 persistence-unit in persistence.xml. The config is read as : ${FORCE_CONNURLENVVAR_URL}
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory("connUrlEnvVar2");
+ verifyEntityManager(emf.createEntityManager());
+ }
+
@Test
public void testConnFromConnUrlJavaProperty() throws Exception {
// See connUrlJavaProp persistence-unit in persistence.xml
@@ -67,6 +74,19 @@ public void testConnFromConnUrlJavaProperty() throws Exception {
}
@Test
+ public void testConnFromCustomJavaProperty() throws Exception {
+ // See connUrlJavaProp persistence-unit in persistence.xml
+ try {
+ System.setProperty("custom.url", createConnectionUrl());
+
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory("connUrlJavaProp2");
+ verifyEntityManager(emf.createEntityManager());
+ } finally {
+ System.clearProperty("custom.url");
+ }
+ }
+
+ @Test
public void testConnFromConnUrlPersistenceProperty() throws Exception {
// See connUrlPersistenceProp persistence-unit in persistence.xml
EntityManagerFactory emf = Persistence.createEntityManagerFactory("connUrlPersistenceProp");
View
27 javasdk-test/jpa-test-connection/src/test/resources/META-INF/persistence.xml
@@ -48,19 +48,37 @@
<property name="force.skipConfigCache" value="true"/>
</properties>
</persistence-unit>
-
- <persistence-unit name="connUrlJavaProp">
+
+ <persistence-unit name="connUrlEnvVar2">
<provider>com.force.sdk.jpa.PersistenceProviderImpl</provider>
<properties>
<property name="datanucleus.storeManagerType" value="force"/>
+ <property name="datanucleus.ConnectionURL" value="${FORCE_CONNURLENVVAR_URL}" />
<property name="force.skipConfigCache" value="true"/>
</properties>
</persistence-unit>
+
+ <persistence-unit name="connUrlJavaProp">
+ <provider>com.force.sdk.jpa.PersistenceProviderImpl</provider>
+ <properties>
+ <property name="datanucleus.storeManagerType" value="force"/>
+ <property name="force.skipConfigCache" value="true"/>
+ </properties>
+ </persistence-unit>
+ <persistence-unit name="connUrlJavaProp2">
+ <provider>com.force.sdk.jpa.PersistenceProviderImpl</provider>
+ <properties>
+ <property name="datanucleus.storeManagerType" value="force"/>
+ <property name="datanucleus.ConnectionURL" value="${custom.url}" />
+ <property name="force.skipConfigCache" value="true"/>
+ </properties>
+ </persistence-unit>
+
<persistence-unit name="connUrlPersistenceProp">
<provider>com.force.sdk.jpa.PersistenceProviderImpl</provider>
<properties>
- <property name="datanucleus.ConnectionURL" value="force://${endpoint};user=${user};password=${password}" />
+ <property name="datanucleus.ConnectionURL" value="force://${endpoint}?user=${user}&amp;password=${password}" />
<property name="force.skipConfigCache" value="true"/>
</properties>
</persistence-unit>
@@ -99,7 +117,7 @@
<persistence-unit name="fullConnUrlPersistenceProp">
<provider>com.force.sdk.jpa.PersistenceProviderImpl</provider>
<properties>
- <property name="datanucleus.ConnectionURL" value="force://${endpoint}/services/Soap/u/${force.apiVersion};user=${user};password=${password}" />
+ <property name="datanucleus.ConnectionURL" value="force://${endpoint}/services/Soap/u/${force.apiVersion}?user=${user}&amp;password=${password}" />
<property name="force.skipConfigCache" value="true"/>
</properties>
</persistence-unit>
@@ -146,5 +164,4 @@
<property name="force.skipConfigCache" value="true"/>
</properties>
</persistence-unit>
-
</persistence>
View
2 javasdk-test/jpa-test-connection/src/test/resources/connUrlPropFile.properties
@@ -24,4 +24,4 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-url=force://${endpoint}/services/Soap/u/${force.apiVersion};user=${user};password=${password}
+url=force://${endpoint}/services/Soap/u/${force.apiVersion}?user=${user}&password=${password}
View
2 javasdk-test/jpa-test-connection/src/test/resources/connUrlWithOptionsPropFile.properties
@@ -24,4 +24,4 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-url=force://${endpoint}/services/Soap/u/${force.apiVersion};user=${user};password=${password};clientId=testClientId;timeout=10000
+url=force://${endpoint}/services/Soap/u/${force.apiVersion}?user=${user}&password=${password}&clientId=testClientId&timeout=10000
View
2 javasdk-test/jpa-test-query/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<build>
View
2 javasdk-test/jpa-test-schema/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<build>
View
14 javasdk-test/jpa-test/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
@@ -69,6 +69,11 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ </plugin>
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
@@ -77,7 +82,12 @@
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
- </configuration>
+ <environmentVariables>
+ <CUSTOM_ENVURL>
+ force://${endpoint}/services/Soap/u/${force.apiVersion}?user=${user}&amp;password=${password}
+ </CUSTOM_ENVURL>
+ </environmentVariables>
+ </configuration>
</plugin>
<plugin>
View
2 javasdk-test/jpa-test/src/test/resources/META-INF/persistence.xml
@@ -44,7 +44,7 @@
<property name="datanucleus.datastoreTransactionDelayOperations" value="true"/>
<property name="datanucleus.jpa.addClassTransformer" value="false" />
<property name="datanucleus.cache.level2.type" value="none"/>
- <property name="force.ConnectionName" value="force-sdk-test"/>
+ <property name="datanucleus.ConnectionURL" value="${CUSTOM_ENVURL}" />
</properties>
</persistence-unit>
<!-- testDNJpaPersistence2 is used for optimistic transactions -->
View
4 javasdk-test/mock-oauth-server/pom.xml
@@ -7,9 +7,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<artifactId>force-mock-oauth-server-app</artifactId>
<name>force-mock-oauth-server-app</name>
<packaging>war</packaging>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
<properties>
- <force.sdk.version>22.0.5-BETA</force.sdk.version>
+ <force.sdk.version>22.0.6-BETA</force.sdk.version>
<apache.cxf.version>2.3.0</apache.cxf.version>
<!-- Need to upgrade when http://jira.codehaus.org/browse/MCHECKSTYLE-147 is fixed -->
<checkstyle.plugin.version>2.4</checkstyle.plugin.version>
View
4 javasdk-test/oauth-app/pom.xml
@@ -5,13 +5,13 @@
<artifactId>force-oauth-app</artifactId>
<name>force-oauth-app</name>
<packaging>war</packaging>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
<properties>
<!-- Need to upgrade when http://jira.codehaus.org/browse/MCHECKSTYLE-147 is fixed -->
<checkstyle.plugin.version>2.4</checkstyle.plugin.version>
<force.api.version>22.0.0</force.api.version>
- <force.sdk.version>22.0.5-BETA</force.sdk.version>
+ <force.sdk.version>22.0.6-BETA</force.sdk.version>
<spring.version>3.0.3.RELEASE</spring.version>
<spring.security.version>3.0.3.RELEASE</spring.security.version>
<java.compile.version>1.6</java.compile.version>
View
12 javasdk-test/oauth-app/src/main/webapp/WEB-INF/web.xml
@@ -37,8 +37,8 @@
<filter-name>DefaultFilter</filter-name>
<filter-class>com.force.sdk.oauth.AuthFilter</filter-class>
<init-param>
- <param-name>connectionName</param-name>
- <param-value>integrationserver</param-value>
+ <param-name>url</param-name>
+ <param-value>${integrationserver.url}</param-value>
</init-param>
<init-param>
<param-name>secure-key-file</param-name>
@@ -59,8 +59,8 @@
<filter-name>FilterA</filter-name>
<filter-class>com.force.sdk.oauth.AuthFilter</filter-class>
<init-param>
- <param-name>connectionName</param-name>
- <param-value>integrationserver</param-value>
+ <param-name>url</param-name>
+ <param-value>${integrationserver.url}</param-value>
</init-param>
<init-param>
<param-name>secure-key-file</param-name>
@@ -91,8 +91,8 @@
<filter-name>FilterB</filter-name>
<filter-class>com.force.sdk.oauth.AuthFilter</filter-class>
<init-param>
- <param-name>connectionName</param-name>
- <param-value>integrationserver</param-value>
+ <param-name>url</param-name>
+ <param-value>${integrationserver.url}</param-value>
</init-param>
<init-param>
<param-name>secure-key-file</param-name>
View
4 javasdk-test/oauth-integration-test/pom.xml
@@ -6,12 +6,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>com.force.sdk</groupId>
<artifactId>force-oauth-integration-test</artifactId>
<name>force-oauth-integration-test</name>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<properties>
View
2 javasdk-test/oauth-integration-test/testng-endtoend.xml
@@ -28,7 +28,7 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-<suite name="springsecurity-endtoend-integration-tests" verbose="7">
+<suite name="oauth-endtoend-integration-tests" verbose="7">
<parameter name="testType" value="ENDTOEND"/>
<listeners>
View
11 javasdk-test/oauth-test/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<build>
@@ -36,9 +36,12 @@
<version>${surefire.version}</version>
<configuration>
<environmentVariables>
- <FORCE_CONNURLENVVAR_URL>
- force://${endpoint};oauth_key=${force.test.oauth.key};oauth_secret=${force.test.oauth.secret}
- </FORCE_CONNURLENVVAR_URL>
+ <FORCE_CONNURLENVVAR_URL>
+ force://${endpoint}?oauth_key=${force.test.oauth.key}&amp;oauth_secret=${force.test.oauth.secret}
+ </FORCE_CONNURLENVVAR_URL>
+ <FORCE_URL_ORDER_TEST>
+ force://url?oauth_key=ABCDEF&amp;oauth_secret=123456
+ </FORCE_URL_ORDER_TEST>
</environmentVariables>
<systemPropertyVariables>
<loginConfigPath>${basedir}/src/test/resources</loginConfigPath>
View
4 javasdk-test/oauth-test/src/test/java/com/force/sdk/oauth/BaseOAuthTest.java
@@ -73,8 +73,8 @@ protected String createConnectionUrl() {
String host = this.endpoint.split("://", 2)[1];
StringBuffer connectionUrl = new StringBuffer("force://")
.append(host)
- .append(";oauth_key=").append(oauthKey)
- .append(";oauth_secret=").append(oauthSecret);
+ .append("?oauth_key=").append(oauthKey)
+ .append("&oauth_secret=").append(oauthSecret);
return connectionUrl.toString();
}
View
42 javasdk-test/oauth-test/src/test/java/com/force/sdk/oauth/BasicAuthFilterTest.java
@@ -124,6 +124,46 @@ public void testOAuthLoginRedirectWithEnvVariable() throws Exception {
}
@Test
+ public void testOAuthLoginRedirectWithCustomEnvVariable() throws Exception {
+ // Initialize the filter with an environment variable name
+ MockFilterConfig filterConfig = new MockFilterConfig();
+ filterConfig.addInitParameter("url", "${FORCE_CONNURLENVVAR_URL}"); // FORCE_CONNURLENVVAR_URL is set in pom file
+
+ testOAuthLoginRedirectInternal(filterConfig);
+ }
+
+ @Test
+ public void testOAuthLoginRedirectWithCustomJavaProperty() throws Exception {
+ // Initialize the filter with an environment variable name
+ try {
+ System.setProperty("custom.force.connection", createConnectionUrl());
+
+ MockFilterConfig filterConfig = new MockFilterConfig();
+ filterConfig.addInitParameter("url", "${custom.force.connection}");
+
+ testOAuthLoginRedirectInternal(filterConfig);
+ } finally {
+ System.clearProperty("custom.force.connection");
+ }
+ }
+
+ @Test
+ public void testUrlConfigOrder() throws Exception {
+ // Initialize the filter with an environment variable name
+ try {
+ // pom file creates an env variable with same name but invalid url.
+ System.setProperty("FORCE_URL_ORDER_TEST", createConnectionUrl());
+
+ MockFilterConfig filterConfig = new MockFilterConfig();
+ filterConfig.addInitParameter("url", "${FORCE_URL_ORDER_TEST}");
+
+ testOAuthLoginRedirectInternal(filterConfig);
+ } finally {
+ System.clearProperty("FORCE_URL_ORDER_TEST");
+ }
+ }
+
+ @Test
public void testOAuthLoginRedirectWithJavaProperty() throws Exception {
try {
System.setProperty("force.filterWithConnUrlJavaProperty.url", createConnectionUrl());
@@ -179,7 +219,7 @@ public void testOAuthInfoIsFirst() throws Exception {
filterConfig.addInitParameter("storeUsername", "false");
// Add a bad connection url
- filterConfig.addInitParameter("url", "force://url;oauth_key=ABCDEF;oauth_secret=123456");
+ filterConfig.addInitParameter("url", "force://url?oauth_key=ABCDEF&oauth_secret=123456");
// Add a bad connection name
filterConfig.addInitParameter("connectionName", "badConnectionName");
View
2 .../oauth-test/src/test/java/com/force/sdk/oauth/connector/BasicForceOAuthConnectorTest.java
@@ -81,7 +81,7 @@ public void testConnectorWithConnectionValues() throws Exception {
//add a bad connection in. The values above should take precedence.
System.setProperty("force.testExternalConnInfoBeforeConnNameLookup.url",
- "force://url;oauth_key=ABCDEF;oauth_secret=123456");
+ "force://url?oauth_key=ABCDEF&oauth_secret=123456");
connector.setConnectionName("testExternalConnInfoBeforeConnNameLookup");
connector.setTokenRetrievalService(new MockTokenRetrievalService(
View
43 .../oauth-test/src/test/java/com/force/sdk/oauth/connector/ForceOAuthConnectionInfoTest.java
@@ -132,7 +132,7 @@ public void testLoadFromEnvVariable(String connectionName) throws Exception {
@Test(dataProvider = "javaPropertyProvider")
public void testLoadFromJavaProperty(String propName, String connectionName) throws Exception {
try {
- System.setProperty(propName, "force://url;oauth_key=ABCDEF;oauth_secret=123456");
+ System.setProperty(propName, "force://url?oauth_key=ABCDEF&oauth_secret=123456");
ForceOAuthConnectionInfo connInfo = ForceOAuthConnectionInfo.loadFromName(connectionName);
assertNotNull(connInfo);
@@ -147,7 +147,7 @@ public void testLoadFromJavaProperty(String propName, String connectionName) thr
@Test
public void testLoadFromJavaPropertyIsCaseSensitive() throws Exception {
try {
- System.setProperty("force.xyz.url", "force://url;oauth_key=ABCDEF;oauth_secret=123456");
+ System.setProperty("force.xyz.url", "force://url?oauth_key=ABCDEF&oauth_secret=123456");
assertNull(ForceOAuthConnectionInfo.loadFromName("XYZ"));
} finally {
System.clearProperty("force.xyz.url");
@@ -159,7 +159,7 @@ public void testLoadFromJavaPropertyIsCaseSensitive() throws Exception {
public void testLoadEnvVariableBeforeJavaProperty() throws Exception {
try {
// Set a Java property that conflicts with the environment variable set in the pom
- System.setProperty("force.connurlenvvar.url", "force://javapropurl;oauth_key=javapropkey;oauth_secret=7891011");
+ System.setProperty("force.connurlenvvar.url", "force://javapropurl?oauth_key=javapropkey&oauth_secret=7891011");
// Try loading from the environment variable.
// The assertions in that test should still work.
@@ -173,7 +173,7 @@ public void testLoadEnvVariableBeforeJavaProperty() throws Exception {
public void testLoadJavaPropertyBeforePropertyFile() throws Exception {
try {
// Set a Java property that conficts with the unitconnurl properties file
- System.setProperty("force.unitconnurl.url", "force://javapropurl;oauth_key=javapropkey;oauth_secret=7891011");
+ System.setProperty("force.unitconnurl.url", "force://javapropurl?oauth_key=javapropkey&oauth_secret=7891011");
ForceOAuthConnectionInfo connInfo = ForceOAuthConnectionInfo.loadFromName("unitconnurl");
assertNotNull(connInfo);
@@ -199,10 +199,11 @@ public void testLoadWithNothingSet() throws Exception {
{null},
{""},
{"url"},
- {"url;oauth_key=ABCDEF;oauth_secret=123456"},
+ {"url?oauth_key=ABCDEF&oauth_secret=123456"},
{"force://"},
{"force://url"},
- {"force://url;oauth_key=ABCDEF"},
+ {"force://url?oauth_key=ABCDEF"},
+ {" force://url;oauth_key=ABCDEF;oauth_secret=123456", "url", "ABCDEF", "123456"}, // Leading whitespace
};
}
@@ -225,11 +226,11 @@ public void testParseBadConnectionUrl(String connectionUrl) throws Exception {
@DataProvider
protected Object[][] connectionUrlWithBadPropertyProvider() {
return new Object[][] {
- {"force://;oauth_key=ABCDEF;oauth_secret=123456", "endpoint", null},
- {"force://url;oauth_key=;oauth_secret=123456", "oauth_key", null},
- {"force://url;oauth_key=ABCDEF;oauth_secret=", "oauth_secret", null},
- {"force://url/a;oauth_key=ABCDEF;oauth_secret=", "endpoint", "url/a"},
- {"force://url;oauth_key=ABCDEF;oauth_secret=abc", "oauth_secret", "abc"},
+ {"force://?oauth_key=ABCDEF&oauth_secret=123456", "endpoint", null},
+ {"force://url?oauth_key=&oauth_secret=123456", "oauth_key", null},
+ {"force://url?oauth_key=ABCDEF&oauth_secret=", "oauth_secret", null},
+ {"force://url/a?oauth_key=ABCDEF&oauth_secret=", "endpoint", "url/a"},
+ {"force://url?oauth_key=ABCDEF&oauth_secret=abc", "oauth_secret", "abc"},
};
}
@@ -252,18 +253,14 @@ public void testParseConnectionUrlWithBadProperty(String connectionUrl, String b
@DataProvider
protected Object[][] goodConnectionUrlProvider() {
return new Object[][] {
- {"force://url;oauth_key=ABCDEF;oauth_secret=123456", "url", "ABCDEF", "123456"},
- {"force://url;oauth_secret=123456;oauth_key=ABCDEF", "url", "ABCDEF", "123456"},
- {"force://url/;oauth_key=ABCDEF;oauth_secret=123456", "url/", "ABCDEF", "123456"},
- {"force://url/services/Soap/u/0;oauth_key=ABCDEF;oauth_secret=123456", "url/services/Soap/u/0", "ABCDEF", "123456"},
- {"force://url;oauth_key=ABCDEF;oauth_secret=123456;testProp", "url", "ABCDEF", "123456"}, // Ignore unknown props
- {"force://url;oauth_key=ABCDEF;oauth_secret=123456;testProp=", "url", "ABCDEF", "123456"}, // Ignore unknown props
- {"force://url;oauth_key=ABCDEF;oauth_secret=123456;", "url", "ABCDEF", "123456"}, // Trailing ';'
- {"force://url;oauth_secret=123456;oauth_key=ABCDEF=", "url", "ABCDEF=", "123456"}, // Trailing '='
- {" force://url;oauth_key=ABCDEF;oauth_secret=123456", "url", "ABCDEF", "123456"}, // Leading whitespace
- {"force://url; oauth_key=ABCDEF;oauth_secret=123456", "url", "ABCDEF", "123456"}, // Space between url and user
- {"force://url;oauth_key=ABCDEF; oauth_secret=123456", "url", "ABCDEF", "123456"}, // Space between user and password
- {"force://url;oauth_key=ABCDEF;oauth_secret=123456 ", "url", "ABCDEF", "123456"}, // Trailing whitespace
+ {"force://url?oauth_key=ABCDEF&oauth_secret=123456", "url", "ABCDEF", "123456"},
+ {"force://url?oauth_secret=123456&oauth_key=ABCDEF", "url", "ABCDEF", "123456"},
+ {"force://url/?oauth_key=ABCDEF&oauth_secret=123456", "url/", "ABCDEF", "123456"},
+ {"force://url/services/Soap/u/0?oauth_key=ABCDEF&oauth_secret=123456", "url/services/Soap/u/0", "ABCDEF", "123456"},
+ {"force://url?oauth_key=ABCDEF&oauth_secret=123456&testProp", "url", "ABCDEF", "123456"}, // Ignore unknown props
+ {"force://url?oauth_key=ABCDEF&oauth_secret=123456&testProp=", "url", "ABCDEF", "123456"}, // Ignore unknown props
+ {"force://url?oauth_key=ABCDEF&oauth_secret=123456&", "url", "ABCDEF", "123456"}, // Trailing '&'
+ {"force://url?oauth_secret=123456&oauth_key=ABCDEF=", "url", "ABCDEF=", "123456"}, // Trailing '='
};
}
View
2 javasdk-test/oauth-test/src/test/resources/funcconnurl.properties
@@ -24,4 +24,4 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-url=force://${endpoint};oauth_key=${force.test.oauth.key};oauth_secret=${force.test.oauth.secret}
+url=force://${endpoint}?oauth_key=${force.test.oauth.key}&oauth_secret=${force.test.oauth.secret}
View
2 javasdk-test/oauth-test/src/test/resources/unitconnurl.properties
@@ -24,4 +24,4 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-url=force://url;oauth_key=ABCDEF;oauth_secret=123456
+url=force://url?oauth_key=ABCDEF&oauth_secret=123456
View
2 javasdk-test/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
View
2 javasdk-test/qa-utils/pom.xml
@@ -10,7 +10,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<parent>
<artifactId>force-sdk-test</artifactId>
<groupId>com.force.sdk</groupId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<properties>
View
6 ...qa-utils/src/main/java/com/force/sdk/qa/util/integration/BaseSecurityIntegrationTest.java
@@ -60,7 +60,7 @@
protected final String mockOauthKey = "123";
protected final String mockOauthSecret = "456";
protected final String mockSfdcEndpoint = "localhost:" + port + "/force-mock-oauth-server-app";
- protected final String forceUrlPropName = "force.integrationserver.url";
+ protected final String forceUrlPropName = "integrationserver.url";
protected final String mockAuthCode = "789";
protected final String useMockApi = "mockapi";
@@ -133,11 +133,11 @@ public String getJMockitPath() {
if (TestContext.get().getTestType() == TestType.ENDTOEND) {
map.put(useMockApi, "false");
map.put(forceUrlPropName, "force://" + sfdcEndpoint
- + ";oauth_key=" + oauthKey + ";oauth_secret=" + oauthSecret);
+ + "?oauth_key=" + oauthKey + "&oauth_secret=" + oauthSecret);
} else if (TestContext.get().getTestType() == TestType.MOCK) {
map.put(useMockApi, "true");
map.put(forceUrlPropName, "force://" + mockSfdcEndpoint
- + ";oauth_key=" + mockOauthKey + ";oauth_secret=" + mockOauthSecret);
+ + "?oauth_key=" + mockOauthKey + "&oauth_secret=" + mockOauthSecret);
}
return map;
View
24 javasdk-test/qa-utils/src/main/java/com/force/sdk/qa/util/jpa/BaseJPAFTest.java
@@ -27,11 +27,14 @@
package com.force.sdk.qa.util.jpa;
import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
import java.util.List;
import java.util.Properties;
import javax.persistence.*;
+import com.force.sdk.connector.ForceConnectorUtils;
import org.datanucleus.ObjectManager;
import org.datanucleus.ObjectManagerImpl;
import org.datanucleus.store.connection.ConnectionFactory;
@@ -70,12 +73,32 @@
*/
@BeforeClass
protected final void initialize() throws Exception {
+ System.setProperty("jpaConnection", getConnectionUrl());
+
createStaticEntityMangers();
populateTestContext(getTestName(), UserInfo.loadFromPropertyFile(PropsUtil.FORCE_SDK_TEST_NAME));
ForceServiceConnector connector = new ForceServiceConnector(PropsUtil.FORCE_SDK_TEST_NAME);
service = connector.getConnection();
}
+ private String getConnectionUrl() throws IOException {
+ URL propsFileUrl = ForceConnectorUtils.class.getResource("/" + "force-sdk-test.properties");
+ if (propsFileUrl == null) {
+ throw new IllegalArgumentException("force-sdk-test.properties is not on classpath.");
+ }
+
+ Properties connectorProps = new Properties();
+ InputStream is = null;
+ try {
+ is = propsFileUrl.openStream();
+ connectorProps.load(is);
+ } finally {
+ if (is != null) is.close();
+ }
+
+ return connectorProps.getProperty("url");
+ }
+
protected void createStaticEntityMangers() throws Exception {
emfac = Persistence.createEntityManagerFactory(TestContext.get().getPersistenceUnitName());
em = emfac.createEntityManager();
@@ -94,6 +117,7 @@ protected void testCleanup() throws Exception {
@AfterTest(alwaysRun = true)
protected void testTeardown() throws Exception {
cleanSchema();
+ System.clearProperty("jpaConnection");
}
protected void cleanSchema() throws Exception {
View
2 javasdk-test/qa-utils/src/main/resources/force-sdk-test.properties
@@ -106,7 +106,7 @@ force.test.oauth.secret=
# Force.com connection URL used in tests.
# This is built from the properties above so *do not edit*.
-url=force://${endpoint}/services/Soap/u/${force.apiVersion};user=${user};password=${password}
+url=force://${endpoint}/services/Soap/u/${force.apiVersion}?user=${user}&password=${password}
# This property is used by the JavaCloud test infrastructure
test.func.persistenceUnitName=testDNJpaPersistence
View
4 javasdk-test/springsecurity-app/pom.xml
@@ -5,13 +5,13 @@
<artifactId>force-springsecurity-app</artifactId>
<name>force-springsecurity-app</name>
<packaging>war</packaging>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
<properties>
<!-- Need to upgrade when http://jira.codehaus.org/browse/MCHECKSTYLE-147 is fixed -->
<checkstyle.plugin.version>2.4</checkstyle.plugin.version>
<force.api.version>22.0.0</force.api.version>
- <force.sdk.version>22.0.5-BETA</force.sdk.version>
+ <force.sdk.version>22.0.6-BETA</force.sdk.version>
<spring.version>3.0.3.RELEASE</spring.version>
<spring.security.version>3.0.3.RELEASE</spring.security.version>
<java.compile.version>1.6</java.compile.version>
View
5 javasdk-test/springsecurity-app/src/main/webapp/WEB-INF/security-config-ns.xml
@@ -39,11 +39,12 @@
http://www.salesforce.com/schema/springsecurity
http://media.developerforce.com/schema/force-springsecurity-1.3.xsd">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
+
<!-- Force.com OAuth security config -->
<fss:oauth default-login-success="/login_success.html" default-logout-success="/logout_success.html"
login-url="/login" logout-url="/logout" logout-from-force-dot-com="false" secure-key-file='spring-app-key.properties'>
-
- <fss:connectionName name="integrationserver"/>
+ <fss:connectionUrl url="${integrationserver.url}"/>
</fss:oauth>
<!-- Configure Spring Security -->
View
4 javasdk-test/springsecurity-integration-test/pom.xml
@@ -6,12 +6,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<groupId>com.force.sdk</groupId>
<artifactId>force-springsecurity-integration-test</artifactId>
<name>force-springsecurity-integration-test</name>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
<properties>
View
23 javasdk-test/springsecurity-test/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>com.force.sdk</groupId>
<artifactId>force-sdk-test</artifactId>
- <version>22.0.5-BETA</version>
+ <version>22.0.6-BETA</version>
</parent>
@@ -23,6 +23,27 @@
</testResource>
</testResources>
+ <plugins>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${failsafe.version}</version>
+ <configuration>
+ <environmentVariables>
+ <CUSTOM_ENV_URL>
+ force://endpoint?oauth_key=key&amp;oauth_secret=123456
+ </CUSTOM_ENV_URL>
+ </environmentVariables>
+ </configuration>
+ </plugin>
+
+ </plugins>
</build>
View
64 ...test/src/test/java/com/force/sdk/springsecurity/config/OAuthBeanDefinitionParserTest.java
@@ -26,14 +26,12 @@
package com.force.sdk.springsecurity.config;
-import static mockit.Deencapsulation.invoke;
-import static org.testng.Assert.*;
-
-import java.net.MalformedURLException;
-import java.util.*;
-
-import javax.servlet.Filter;
-
+import com.force.sdk.oauth.connector.ForceOAuthConnectionInfo;
+import com.force.sdk.oauth.connector.ForceOAuthConnector;
+import com.force.sdk.oauth.context.store.AESUtil;
+import com.force.sdk.oauth.userdata.UserDataRetrievalService;
+import com.force.sdk.springsecurity.AuthenticationProcessingFilter;
+import com.force.sdk.springsecurity.ForceConnectionStorageFilter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.security.web.FilterChainProxy;
@@ -44,12 +42,14 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import com.force.sdk.oauth.connector.ForceOAuthConnectionInfo;
-import com.force.sdk.oauth.connector.ForceOAuthConnector;
-import com.force.sdk.oauth.context.store.AESUtil;
-import com.force.sdk.oauth.userdata.UserDataRetrievalService;
-import com.force.sdk.springsecurity.AuthenticationProcessingFilter;
-import com.force.sdk.springsecurity.ForceConnectionStorageFilter;
+import javax.servlet.Filter;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import static mockit.Deencapsulation.invoke;
+import static org.testng.Assert.*;
/**
* Unit tests for the OAuthBeanDefinitionParser.
@@ -98,10 +98,28 @@ public void testParseOAuthInfo(String configLocation) {
verifyAllFiltersArePresent(context);
}
-
- @Test
- public void testParseConnectionUrl() {
- String configLocation = "security-config-ns-connUrl.xml";
+
+ @DataProvider
+ public Object[][] connectionUrlXml() throws NumberFormatException, MalformedURLException {
+ Object [][] params = new Object[][]{
+ {"security-config-ns-connUrl.xml", false},
+ {"security-config-ns-connUrl-env.xml", false },
+ {"security-config-ns-connUrl-javaprop.xml", true},
+ };
+
+ return params;
+ }
+
+ @Test(dataProvider = "connectionUrlXml")
+ public void testParseConnectionUrl(String configLocation, boolean systemVariabe) {
+ if (systemVariabe) {
+ System.setProperty("CUSTOM_JAVA_VAR_URL", System.getenv("CUSTOM_ENV_URL"));
+ }
+
+ verifyConnectionUrlMethod(configLocation);
+ }
+
+ private void verifyConnectionUrlMethod(String configLocation) {
ApplicationContext context = new ClassPathXmlApplicationContext(configLocation);
assertTrue(context.containsBean("oauthConnectionInfo"),
"Could not find oauthConnectionInfo bean after parsing " + configLocation);
@@ -113,24 +131,24 @@ public void testParseConnectionUrl() {
"Could not find rememberMeFilter bean after parsing " + configLocation);
assertTrue(context.containsBean("connectionStorageFilter"),
"Could not find connectionStorageFilter bean after parsing " + configLocation);
-
+
ForceOAuthConnectionInfo connInfo = context.getBean("oauthConnectionInfo", ForceOAuthConnectionInfo.class);
ForceOAuthConnector connector = context.getBean("oauthConnector", ForceOAuthConnector.class);
UserDataRetrievalService userDataRetrievalService =
context.getBean("userDataRetrievalService", UserDataRetrievalService.class);
-
+
assertTrue(userDataRetrievalService.isStoreUsername(),
"store-user-name was set to true so the storeUsername value "
+ "on the user data retrieval service should be true");
validateConnectionInfo(connInfo, "Parsing " + configLocation + ", checking ForceOAuthConnectionInfo");
-
+
ForceOAuthConnectionInfo connInfoOnConnector = invoke(connector, "getConnInfo");
validateConnectionInfo(connInfoOnConnector,
"Parsing " + configLocation + ", checking ForceOAuthConnectionInfo on ForceOAuthConnector");
-
+
verifyAllFiltersArePresent(context);
}
-
+
@Test
public void testParseConnectionName() {
String configLocation = "security-config-ns-connName.xml";
View
58 javasdk-test/springsecurity-test/src/test/resources/security-config-ns-connUrl-env.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (c) 2011, salesforce.com, inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+ Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+ promote products derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:security="http://www.springframework.org/schema/security"
+ xmlns:fss="http://www.salesforce.com/schema/springsecurity"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/security
+ http://www.springframework.org/schema/security/spring-security-3.0.xsd
+ http://www.salesforce.com/schema/springsecurity
+ http://www.salesforce.com/schema/springsecurity/force-springsecurity-1.3.xsd">
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
+
+ <!-- SFDC OAuth security config with connectionUrl-->
+ <fss:oauth store-user-name="true">
+ <fss:connectionUrl url="${CUSTOM_ENV_URL}"/>
+ </fss:oauth>
+
+ <!-- Configure Spring Security -->
+ <security:http entry-point-ref="authenticationProcessingFilterEntryPoint" use-expressions="true">
+ <security:intercept-url pattern="/**" access="isAuthenticated()"/>
+ <security:custom-filter position="FORM_LOGIN_FILTER" ref="authenticationFilter"/>
+ <security:custom-filter position="LOGOUT_FILTER" ref="logoutFilter"/>
+ <security:custom-filter position="REMEMBER_ME_FILTER" ref="rememberMeFilter"/>
+ <security:custom-filter after="REMEMBER_ME_FILTER" ref="connectionStorageFilter"/>
+ </security:http>
+
+</beans>
View
58 javasdk-test/springsecurity-test/src/test/resources/security-config-ns-connUrl-javaprop.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (c) 2011, salesforce.com, inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+ Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+ promote products derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:security="http://www.springframework.org/schema/security"
+ xmlns:fss="http://www.salesforce.com/schema/springsecurity"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/security
+ http://www.springframework.org/schema/security/spring-security-3.0.xsd
+ http://www.salesforce.com/schema/springsecurity
+ http://www.salesforce.com/schema/springsecurity/force-springsecurity-1.3.xsd">
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
+
+ <!-- SFDC OAuth security config with connectionUrl-->
+ <fss:oauth store-user-name="true">
+ <fss:connectionUrl url="${CUSTOM_JAVA_VAR_URL}"/>
+ </fss:oauth>
+
+ <!-- Configure Spring Security -->
+ <security:http entry-point-ref="authenticationProcessingFilterEntryPoint" use-expressions="true">
+ <security:intercept-url pattern="/**" access="isAuthenticated()"/>
+ <security:custom-filter position="FORM_LOGIN_FILTER" ref="authenticationFilter"/>
+ <security:custom-filter position="LOGOUT_FILTER" ref="logoutFilter"/>
+ <security:custom-filter position="REMEMBER_ME_FILTER" ref="rememberMeFilter"/>
+ <security:custom-filter after="REMEMBER_ME_FILTER" ref="connectionStorageFilter"/>
+ </security:http>
+
+</beans>
View
2 javasdk-test/springsecurity-test/src/test/resources/security-config-ns-connUrl.xml
@@ -41,7 +41,7 @@
<!-- SFDC OAuth security config with connectionUrl-->
<fss:oauth store-user-name="true">
- <fss:connectionUrl url="force://endpoint;oauth_key=key;oauth_secret=123456"/>
+ <fss:connectionUrl url="force://endpoint?oauth_key=key&amp;oauth_secret=123456"/>
</fss:oauth>
<!-- Configure Spring Security -->
View
50 jpa/doc/database-com-datatypes.md
@@ -4,15 +4,15 @@ layout: doc
title: Force.com Data Types
---
-# Force.com Data Types
+# Database.com Data Types
-Force.com has its own built-in list of data types optimized for building business applications. To see how these data types map to standard Java data types, see [Mapping Force.com to Java Data Types](java-db-com-datatypes-map#mapForceToJava).
+Database.com has its own built-in list of data types optimized for building business applications. To see how these data types map to standard Java data types, see [Mapping Database.com to Java Data Types](java-db-com-datatypes-map#mapForceToJava).
**Note**: Field names in Java classes must start with a lowercase letter to match bean-naming conventions. For example, use <code>String id</code> instead of <code>String Id</code>.
For information on primary key fields, see [Primary Keys](jpa-provider#primaryKeys).
-The rest of this section highlights useful information about a subset of Force.com data types. For a list of all the data types, see [Mapping Force.com to Java Data Types](java-db-com-datatypes-map#mapForceToJava).
+The rest of this section highlights useful information about a subset of Database.com data types. For a list of all the data types, see [Mapping Database.com to Java Data Types](java-db-com-datatypes-map#mapForceToJava).
- [Text Fields](#text)
- [Number Fields](#number)
@@ -31,7 +31,7 @@ The rest of this section highlights useful information about a subset of Force.c
<a name="text"> </a>
## Text Fields
-The Force.com Text data type is used for string and character fields.
+The Database.com Text data type is used for string and character fields.
The length of Text fields is controlled by the length attribute of the <code>@Column</code> annotation. For example:
@@ -42,18 +42,18 @@ This code defines a Text field called flag of length 1. The default length is 25
<a name="number"> </a>
## Number Fields
-The Force.com Number data type is used for numbers of various sizes. The precision and scale is set by the <code>@Column</code> annotation.
+The Database.com Number data type is used for numbers of various sizes. The precision and scale is set by the <code>@Column</code> annotation.
For example:
@Column(precision=1, scale=0)
int digit;
-This code defines an integer that can range from 0 to 9. The default precision and scale are 18 and 0 for integers and 18 and
-2 for floats and doubles. For more information, see [Mapping Force.com to Java Data Types](java-db-com-datatypes-map#mapForceToJava).
+This code defines an integer that can range from 0 to 9. The default precision and scale are 18 and 0 for integers and 16 and
+2 for floats and doubles. For more information, see [Mapping Database.com to Java Data Types](java-db-com-datatypes-map#mapForceToJava).
<a name="autoNumber"> </a>
## Auto Number Fields
-To create a Force.com auto number field, use <code>@CustomField(type=FieldType.AutoNumber</code>) with an int or Integer
+To create a Database.com auto number field, use <code>@CustomField(type=FieldType.AutoNumber</code>) with an int or Integer
Java type. For example:
@CustomField(type=FieldType.AutoNumber)