You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by kr...@apache.org on 2010/02/07 10:38:43 UTC
svn commit: r907402 [2/2] - in /camel/trunk/components/camel-gae: ./
src/main/java/org/apache/camel/component/gae/auth/
src/main/java/org/apache/camel/component/gae/bind/
src/main/java/org/apache/camel/component/gae/http/
src/main/java/org/apache/camel...
Added: camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/login/GLoginServiceImpl.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/login/GLoginServiceImpl.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/login/GLoginServiceImpl.java (added)
+++ camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/login/GLoginServiceImpl.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,117 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.login;
+
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.nio.charset.Charset;
+
+import com.google.gdata.client.GoogleAuthTokenFactory;
+import com.google.gdata.util.AuthenticationException;
+
+/**
+ * Implements the interactions with Google's authentication and authorization
+ * services. If the endpoint is configured to run in development mode the
+ * authentication and authorization services of the development server are used.
+ */
+public class GLoginServiceImpl implements GLoginService {
+
+ /**
+ * Authenticates a user and stores the authentication token to
+ * {@link GLoginData#setAuthenticationToken(String)}. If the endpoint is
+ * configured to run in development mode this method simply returns without
+ * any further action.
+ */
+ public void authenticate(GLoginData data) throws AuthenticationException {
+ if (data.isDevMode()) {
+ return;
+ }
+ GoogleAuthTokenFactory factory =
+ new GoogleAuthTokenFactory("ah", data.getClientName(), null);
+ String token = factory.getAuthToken(
+ data.getUserName(),
+ data.getPassword(),
+ null, null, "ah", data.getClientName());
+ data.setAuthenticationToken(token);
+ }
+
+ /**
+ * Dispatches authorization to {@link #authorizeDev(GLoginData)} if the
+ * endpoint is configured to run in development mode, otherwise to
+ * {@link #authorizeStd(GLoginData)}.
+ */
+ public void authorize(GLoginData data) throws Exception {
+ if (data.isDevMode()) {
+ authorizeDev(data);
+ } else {
+ authorizeStd(data);
+ }
+ }
+
+ /**
+ * Authorizes access to a development server and stores the resulting
+ * authorization cookie to {@link GLoginData#setAuthorizationCookie(String)}
+ * . Authorization in development mode doesn't require an authentication
+ * token.
+ */
+ protected void authorizeDev(GLoginData data) throws Exception {
+ String homeLocation = String.format("http://%s:%d", data.getHostName(), data.getDevPort());
+ HttpURLConnection connection = createURLConnection(homeLocation + "/_ah/login", true);
+ connection.connect();
+ PrintWriter writer = new PrintWriter(
+ new OutputStreamWriter(connection.getOutputStream()));
+ writer.println(String.format("email=%s&isAdmin=%s&continue=%s",
+ URLEncoder.encode(data.getUserName(), Charset.defaultCharset().name()),
+ data.isDevAdmin() ? "on" : "off",
+ URLEncoder.encode(homeLocation, Charset.defaultCharset().name())));
+ writer.flush();
+ data.setAuthorizationCookie(connection.getHeaderField("Set-Cookie"));
+ connection.disconnect();
+ }
+
+ /**
+ * Authorizes access to a Google App Engine application and stores the
+ * resulting authorization cookie to
+ * {@link GLoginData#setAuthorizationCookie(String)}. This method requires
+ * an authentication token from
+ * {@link GLoginData#getAuthenticationToken()}.
+ */
+ protected void authorizeStd(GLoginData data) throws Exception {
+ String url = String.format("https://%s/_ah/login?auth=%s",
+ data.getHostName(), data.getAuthenticationToken());
+ HttpURLConnection connection = createURLConnection(url, false);
+ connection.connect();
+ data.setAuthorizationCookie(connection.getHeaderField("Set-Cookie"));
+ connection.disconnect();
+ }
+
+ private static HttpURLConnection createURLConnection(String url, boolean dev) throws Exception {
+ // TODO: support usage of proxy (via endpoint parameters or GLoginData object)
+ HttpURLConnection connection = (HttpURLConnection)new URL(url).openConnection();
+ connection.setInstanceFollowRedirects(false);
+ if (dev) {
+ connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+ connection.setRequestMethod("POST");
+ connection.setDoOutput(true);
+ }
+ return connection;
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/login/GLoginServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java?rev=907402&r1=907401&r2=907402&view=diff
==============================================================================
--- camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java (original)
+++ camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java Sun Feb 7 09:38:41 2010
@@ -26,7 +26,7 @@
import org.apache.camel.impl.DefaultComponent;
/**
- * The <a href="http://camel.apache.org/todo.html">Google App Engine Mail
+ * The <a href="http://camel.apache.org/gmail.html">Google App Engine Mail
* Component</a> supports outbound mail communication. It makes use of the mail
* service provided by Google App Engine.
*/
Modified: camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailEndpoint.java?rev=907402&r1=907401&r2=907402&view=diff
==============================================================================
--- camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailEndpoint.java (original)
+++ camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailEndpoint.java Sun Feb 7 09:38:41 2010
@@ -27,7 +27,7 @@
import org.apache.camel.impl.DefaultEndpoint;
/**
- * Represents a <a href="http://camel.apache.org/todo.html">Google App Engine Mail endpoint</a>.
+ * Represents a <a href="http://camel.apache.org/gmail.html">Google App Engine Mail endpoint</a>.
*/
public class GMailEndpoint extends DefaultEndpoint implements OutboundBindingSupport<GMailEndpoint, Message, Void> {
Modified: camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskBinding.java?rev=907402&r1=907401&r2=907402&view=diff
==============================================================================
--- camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskBinding.java (original)
+++ camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskBinding.java Sun Feb 7 09:38:41 2010
@@ -85,7 +85,7 @@
}
/**
- * @throws UnsupportedOperationException.
+ * @throws UnsupportedOperationException
*/
public Exchange readResponse(GTaskEndpoint endpoint, Exchange exchange, Void response) {
throw new UnsupportedOperationException("gtask responses not supported");
@@ -109,11 +109,8 @@
return exchange;
}
- /**
- * @throws UnsupportedOperationException.
- */
public HttpServletResponse writeResponse(GTaskEndpoint endpoint, Exchange exchange, HttpServletResponse response) {
- throw new UnsupportedOperationException("gtask responses not supported");
+ return response;
}
// ----------------------------------------------------------------
Modified: camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskComponent.java?rev=907402&r1=907401&r2=907402&view=diff
==============================================================================
--- camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskComponent.java (original)
+++ camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskComponent.java Sun Feb 7 09:38:41 2010
@@ -32,11 +32,11 @@
import org.apache.commons.httpclient.params.HttpClientParams;
/**
- * The <a href="http://camel.apache.org/todo.html">Google App Engine Task
+ * The <a href="http://camel.apache.org/gtask.html">Google App Engine Task
* Queueing Component</a> supports asynchronous message processing. Outbound
* communication uses the task queueing service of the Google App Engine.
* Inbound communication is realized in terms of the <a
- * href="http://camel.apache.org/servlet.html"> Servlet Component</a> component
+ * href="http://camel.apache.org/servlet.html">Servlet Component</a> component
* for installing a web hook.
*/
public class GTaskComponent extends ServletComponent {
Modified: camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskEndpoint.java?rev=907402&r1=907401&r2=907402&view=diff
==============================================================================
--- camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskEndpoint.java (original)
+++ camel/trunk/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskEndpoint.java Sun Feb 7 09:38:41 2010
@@ -40,7 +40,7 @@
import org.apache.commons.httpclient.params.HttpClientParams;
/**
- * Represents a <a href="http://camel.apache.org/todo.html">Google App Engine Task Queueing endpoint</a>.
+ * Represents a <a href="http://camel.apache.org/gtask.html">Google App Engine Task Queueing endpoint</a>.
*/
public class GTaskEndpoint extends ServletEndpoint implements OutboundBindingSupport<GTaskEndpoint, TaskOptions, Void> {
Added: camel/trunk/components/camel-gae/src/main/resources/META-INF/services/org/apache/camel/component/gauth
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/resources/META-INF/services/org/apache/camel/component/gauth?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/main/resources/META-INF/services/org/apache/camel/component/gauth (added)
+++ camel/trunk/components/camel-gae/src/main/resources/META-INF/services/org/apache/camel/component/gauth Sun Feb 7 09:38:41 2010
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+class=org.apache.camel.component.gae.auth.GAuthComponent
Added: camel/trunk/components/camel-gae/src/main/resources/META-INF/services/org/apache/camel/component/glogin
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/main/resources/META-INF/services/org/apache/camel/component/glogin?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/main/resources/META-INF/services/org/apache/camel/component/glogin (added)
+++ camel/trunk/components/camel-gae/src/main/resources/META-INF/services/org/apache/camel/component/glogin Sun Feb 7 09:38:41 2010
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+class=org.apache.camel.component.gae.login.GLoginComponent
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthAuthorizeBindingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthAuthorizeBindingTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthAuthorizeBindingTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthAuthorizeBindingTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import static java.net.URLEncoder.encode;
+
+import com.google.gdata.client.authn.oauth.GoogleOAuthParameters;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultExchange;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.apache.camel.component.gae.auth.GAuthAuthorizeBinding.GAUTH_CALLBACK;
+import static org.apache.camel.component.gae.auth.GAuthAuthorizeBinding.GAUTH_SCOPE;
+import static org.apache.camel.component.gae.auth.GAuthTestUtils.createComponent;
+import static org.junit.Assert.assertEquals;
+
+public class GAuthAuthorizeBindingTest {
+
+ private static GAuthAuthorizeBinding binding;
+
+ private static GAuthComponent component;
+
+ private static GAuthEndpoint endpoint;
+
+ private Exchange exchange;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ component = createComponent();
+ binding = new GAuthAuthorizeBinding();
+ StringBuffer buffer = new StringBuffer("gauth:authorize")
+ .append("?").append("scope=" + encode("http://scope.example.org", "UTF-8"))
+ .append("&").append("callback=" + encode("http://test.example.org/handler", "UTF-8"));
+ endpoint = component.createEndpoint(buffer.toString());
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ exchange = new DefaultExchange(component.getCamelContext());
+ }
+
+ @Test
+ public void testWriteRequestDefault() {
+ GoogleOAuthParameters params = binding.writeRequest(endpoint, exchange, null);
+ assertEquals("testConsumerKey", params.getOAuthConsumerKey());
+ assertEquals("testConsumerSecret", params.getOAuthConsumerSecret());
+ assertEquals("http://test.example.org/handler", params.getOAuthCallback());
+ assertEquals("http://scope.example.org", params.getScope());
+ }
+
+ @Test
+ public void testWriteRequestCustom() {
+ exchange.getIn().setHeader(GAUTH_SCOPE, "http://scope.custom.org");
+ exchange.getIn().setHeader(GAUTH_CALLBACK, "http://test.custom.org/handler");
+ GoogleOAuthParameters params = binding.writeRequest(endpoint, exchange, null);
+ assertEquals("http://test.custom.org/handler", params.getOAuthCallback());
+ assertEquals("http://scope.custom.org", params.getScope());
+ }
+
+ @Test
+ public void testReadResponse() throws Exception {
+ GoogleOAuthParameters params = binding.writeRequest(endpoint, exchange, null);
+ params.setOAuthToken("testToken");
+ params.setOAuthTokenSecret("testTokenSecret");
+ binding.readResponse(endpoint, exchange, params);
+ String redirectUrl = "https://www.google.com/accounts/OAuthAuthorizeToken"
+ + "?oauth_token=testToken"
+ + "&oauth_callback=http%3A%2F%2Ftest.example.org%2Fhandler";
+ String secretCookie = "gauth-token-secret=testTokenSecret";
+ assertEquals(302, exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
+ assertEquals(redirectUrl, exchange.getOut().getHeader("Location"));
+ assertEquals(secretCookie, exchange.getOut().getHeader("Set-Cookie"));
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthAuthorizeBindingTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthEndpointTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthEndpointTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthEndpointTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import static java.net.URLEncoder.encode;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.apache.camel.component.gae.auth.GAuthEndpoint.Name.AUTHORIZE;
+import static org.apache.camel.component.gae.auth.GAuthEndpoint.Name.UPGRADE;
+import static org.apache.camel.component.gae.auth.GAuthTestUtils.createComponent;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class GAuthEndpointTest {
+
+ private GAuthComponent component;
+
+ @Before
+ public void setUp() {
+ component = createComponent();
+ }
+
+ @Test
+ public void testCustomParams() throws Exception {
+ String scope = "http://scope1.example.org,http://scope2.example.org";
+ StringBuffer buffer = new StringBuffer("gauth://authorize")
+ .append("?").append("scope=" + encode(scope, "UTF-8"))
+ .append("&").append("callback=" + encode("http://callback.example.org", "UTF-8"))
+ .append("&").append("consumerKey=customConsumerKey")
+ .append("&").append("consumerSecret=customConsumerSecret")
+ .append("&").append("authorizeBindingRef=#customAuthorizeBinding")
+ .append("&").append("upgradeBindingRef=#customUpgradeBinding")
+ .append("&").append("keyLoaderRef=#gAuthKeyLoader")
+ .append("&").append("serviceRef=#gAuthService");
+ GAuthEndpoint endpoint = component.createEndpoint(buffer.toString());
+ assertEquals(AUTHORIZE, endpoint.getName());
+ assertArrayEquals(new String [] {
+ "http://scope1.example.org",
+ "http://scope2.example.org"}, endpoint.getScopeArray());
+ assertEquals(scope, endpoint.getScope());
+ assertEquals("http://callback.example.org", endpoint.getCallback());
+ assertEquals("customConsumerKey", endpoint.getConsumerKey());
+ assertEquals("customConsumerSecret", endpoint.getConsumerSecret());
+ assertFalse(endpoint.getAuthorizeBinding().getClass().equals(GAuthAuthorizeBinding.class));
+ assertFalse(endpoint.getUpgradeBinding().getClass().equals(GAuthUpgradeBinding.class));
+ assertTrue(endpoint.getAuthorizeBinding() instanceof GAuthAuthorizeBinding);
+ assertTrue(endpoint.getUpgradeBinding() instanceof GAuthUpgradeBinding);
+ assertTrue(endpoint.getKeyLoader() instanceof GAuthPk8Loader);
+ assertTrue(endpoint.getService() instanceof GAuthServiceMock);
+
+ }
+
+ @Test
+ public void testDefaultParams() throws Exception {
+ component.setConsumerKey(null);
+ component.setConsumerSecret(null);
+ GAuthEndpoint endpoint = component.createEndpoint("gauth:authorize");
+ assertNull(endpoint.getScope());
+ assertNull(endpoint.getCallback());
+ assertNull(endpoint.getConsumerKey());
+ assertNull(endpoint.getConsumerSecret());
+ assertNull(endpoint.getKeyLoader());
+ assertTrue(endpoint.getAuthorizeBinding().getClass().equals(GAuthAuthorizeBinding.class));
+ assertTrue(endpoint.getUpgradeBinding().getClass().equals(GAuthUpgradeBinding.class));
+ assertTrue(endpoint.getService().getClass().equals(GAuthServiceImpl.class));
+ }
+
+ @Test
+ public void testComponentDefaultParams() throws Exception {
+ component.setKeyLoader(new GAuthPk8Loader());
+ GAuthEndpoint endpoint = component.createEndpoint("gauth:authorize");
+ assertNull(endpoint.getScope());
+ assertNull(endpoint.getCallback());
+ assertEquals("testConsumerKey", endpoint.getConsumerKey());
+ assertEquals("testConsumerSecret", endpoint.getConsumerSecret());
+ assertTrue(endpoint.getAuthorizeBinding().getClass().equals(GAuthAuthorizeBinding.class));
+ assertTrue(endpoint.getUpgradeBinding().getClass().equals(GAuthUpgradeBinding.class));
+ assertTrue(endpoint.getService().getClass().equals(GAuthServiceImpl.class));
+ assertTrue(endpoint.getKeyLoader().getClass().equals(GAuthPk8Loader.class));
+ }
+
+ public void testCreateUpgradeEndpoint() throws Exception {
+ GAuthEndpoint endpoint = component.createEndpoint("gauth:upgrade");
+ assertEquals(UPGRADE, endpoint.getName());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testInvalidEndpointName() throws Exception {
+ component.createEndpoint("gauth:invalid");
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthEndpointTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthJksLoaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthJksLoaderTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthJksLoaderTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthJksLoaderTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import java.security.PrivateKey;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.core.io.ClassPathResource;
+
+import static org.junit.Assert.assertEquals;
+
+public class GAuthJksLoaderTest {
+
+ private GAuthJksLoader keyLoader;
+
+ @Before
+ public void setUp() throws Exception {
+ keyLoader = new GAuthJksLoader();
+ keyLoader.setKeyStoreLocation(new ClassPathResource("org/apache/camel/component/gae/auth/test1.jks"));
+ keyLoader.setKeyAlias("test1");
+ keyLoader.setStorePass("test1pass");
+ keyLoader.setKeyPass("test1pass");
+ }
+
+ @Test
+ public void testLoadPrivateKey() throws Exception {
+ PrivateKey key = keyLoader.loadPrivateKey();
+ assertEquals("RSA", key.getAlgorithm());
+ assertEquals("PKCS#8", key.getFormat());
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthJksLoaderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthPk8LoaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthPk8LoaderTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthPk8LoaderTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthPk8LoaderTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import java.security.PrivateKey;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.core.io.ClassPathResource;
+
+import static org.junit.Assert.assertEquals;
+
+public class GAuthPk8LoaderTest {
+
+ private GAuthPk8Loader keyLoader;
+
+ @Before
+ public void setUp() throws Exception {
+ keyLoader = new GAuthPk8Loader();
+ keyLoader.setKeyLocation(new ClassPathResource("org/apache/camel/component/gae/auth/test2.pk8"));
+ }
+
+ @Test
+ public void testLoadPrivateKey() throws Exception {
+ PrivateKey key = keyLoader.loadPrivateKey();
+ assertEquals("RSA", key.getAlgorithm());
+ assertEquals("PKCS#8", key.getFormat());
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthPk8LoaderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilder.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilder.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilder.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilder.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class GAuthRouteBuilder extends RouteBuilder {
+
+ public static final String AUTHORIZE_URI_PART =
+ "authorize"
+ + "?scope=http%3A%2F%2Ftest.example.org%2Fscope"
+ + "&callback=http%3A%2F%2Ftest.example.org%2Fhandler"
+ + "&serviceRef=#testService";
+
+ public static final String UPGRADE_URI_PART =
+ "upgrade?serviceRef=#testService";
+
+ @Override
+ public void configure() throws Exception {
+ // Endpoints that use a consumer secret for signing requests
+ from("direct:input1-cs").to("gauth-cs:" + AUTHORIZE_URI_PART);
+ from("direct:input2-cs").to("gauth-cs:" + UPGRADE_URI_PART);
+ // Endpoints that use a private key for signing requests
+ from("direct:input1-pk").to("gauth-pk:" + AUTHORIZE_URI_PART);
+ from("direct:input2-pk").to("gauth-pk:" + UPGRADE_URI_PART);
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilderTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilderTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilderTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,106 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import static org.apache.camel.component.gae.auth.GAuthTokenSecret.COOKIE_NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"/org/apache/camel/component/gae/auth/context.xml"})
+public class GAuthRouteBuilderTest {
+
+ @Autowired
+ private ProducerTemplate template;
+
+ @Test
+ public void testAuthorizeCs() throws Exception {
+ Exchange exchange = template.request("direct:input1-cs", new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ // ...
+ }
+ });
+ assertEquals("gauth-token-secret=testRequestTokenSecret1", exchange.getOut().getHeader("Set-Cookie"));
+ assertEquals(302, exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
+ assertEquals("https://www.google.com/accounts/OAuthAuthorizeToken"
+ + "?oauth_token=testRequestToken1"
+ + "&oauth_callback=http%3A%2F%2Ftest.example.org%2Fhandler",
+ exchange.getOut().getHeader("Location"));
+ }
+
+ @Test
+ public void testAuthorizePk() throws Exception {
+ Exchange exchange = template.request("direct:input1-pk", new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ // ...
+ }
+ });
+ assertNull(exchange.getOut().getHeader("Set-Cookie"));
+ assertEquals(302, exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
+ assertEquals("https://www.google.com/accounts/OAuthAuthorizeToken"
+ + "?oauth_token=testRequestToken1"
+ + "&oauth_callback=http%3A%2F%2Ftest.example.org%2Fhandler",
+ exchange.getOut().getHeader("Location"));
+ }
+
+ @Test
+ public void testUpgradeCs() throws Exception {
+ Exchange exchange = template.request("direct:input2-cs", new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader("auth_token", "testToken1");
+ exchange.getIn().setHeader("auth_verifier", "testVerifier1");
+ exchange.getIn().setHeader("Cookie", COOKIE_NAME + "=testSecret1");
+ }
+ });
+ assertEquals("testAccessTokenSecret1", exchange.getOut().getHeader(GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN_SECRET));
+ assertEquals("testAccessToken1", exchange.getOut().getHeader(GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN));
+ }
+
+ @Test
+ // should be in binding test (remove from here)
+ public void testUpgradeCsNoCookie() throws Exception {
+ Exchange exchange = template.request("direct:input2-cs", new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader("auth_token", "testToken1");
+ exchange.getIn().setHeader("auth_verifier", "testVerifier1");
+ }
+ });
+ assertEquals(GAuthException.class, exchange.getException().getClass());
+ }
+
+ @Test
+ public void testUpgradePk() throws Exception {
+ Exchange exchange = template.request("direct:input2-pk", new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader("auth_token", "testToken1");
+ exchange.getIn().setHeader("auth_verifier", "testVerifier1");
+ }
+ });
+ assertEquals("testAccessTokenSecret1", exchange.getOut().getHeader(GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN_SECRET));
+ assertEquals("testAccessToken1", exchange.getOut().getHeader(GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN));
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthRouteBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthServiceMock.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthServiceMock.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthServiceMock.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthServiceMock.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import com.google.gdata.client.authn.oauth.OAuthParameters;
+
+public class GAuthServiceMock implements GAuthService {
+
+ public void getUnauthorizedRequestToken(OAuthParameters oauthParameters) throws Exception {
+ oauthParameters.setOAuthToken("testRequestToken1");
+ oauthParameters.setOAuthTokenSecret("testRequestTokenSecret1");
+ }
+
+ public void getAccessToken(OAuthParameters oauthParameters) {
+ oauthParameters.setOAuthToken("testAccessToken1");
+ oauthParameters.setOAuthTokenSecret("testAccessTokenSecret1");
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthServiceMock.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTestUtils.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTestUtils.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTestUtils.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTestUtils.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import com.google.appengine.api.mail.MailService.Message;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.SimpleRegistry;
+
+public final class GAuthTestUtils {
+
+ private GAuthTestUtils() {
+ }
+
+ public static GAuthComponent createComponent() {
+ SimpleRegistry registry = new SimpleRegistry();
+ registry.put("customAuthorizeBinding", new GAuthAuthorizeBinding() { }); // subclass
+ registry.put("customUpgradeBinding", new GAuthUpgradeBinding() { }); // subclass
+ registry.put("gAuthKeyLoader", new GAuthPk8Loader());
+ registry.put("gAuthService", new GAuthServiceMock());
+ CamelContext context = new DefaultCamelContext(registry);
+ GAuthComponent component = new GAuthComponent();
+ component.setConsumerKey("testConsumerKey");
+ component.setConsumerSecret("testConsumerSecret");
+ component.setCamelContext(context);
+ return component;
+ }
+
+ public static Message createMessage() throws Exception {
+ return new Message();
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTokenSecretTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTokenSecretTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTokenSecretTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTokenSecretTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.apache.camel.component.gae.auth.GAuthTokenSecret.COOKIE_NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class GAuthTokenSecretTest {
+
+ private GAuthTokenSecret tokenSecret;
+
+ @Before
+ public void setUp() {
+ tokenSecret = new GAuthTokenSecret("abc123");
+ }
+
+ @Test
+ public void testToCookie() {
+ assertEquals(COOKIE_NAME + "=abc123", tokenSecret.toCookie());
+ }
+
+ @Test
+ public void testFromCookieExist() {
+ String cookie0 = " " + COOKIE_NAME + "=abc122";
+ String cookie1 = " " + COOKIE_NAME + "=abc123 ";
+ String cookie2 = " " + COOKIE_NAME + "=abc124; ";
+ String cookie3 = " " + COOKIE_NAME + "=abc125;";
+ String cookie4 = " " + COOKIE_NAME + "=abc126; x=y;";
+ assertEquals("abc122", GAuthTokenSecret.fromCookie(cookie0).getValue());
+ assertEquals("abc123", GAuthTokenSecret.fromCookie(cookie1).getValue());
+ assertEquals("abc124", GAuthTokenSecret.fromCookie(cookie2).getValue());
+ assertEquals("abc125", GAuthTokenSecret.fromCookie(cookie3).getValue());
+ assertEquals("abc126", GAuthTokenSecret.fromCookie(cookie4).getValue());
+ }
+
+ @Test
+ public void testFromCookieNotExist() {
+ String cookie = "blah=abc123";
+ assertNull(GAuthTokenSecret.fromCookie(cookie));
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthTokenSecretTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthUpgradeBindingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthUpgradeBindingTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthUpgradeBindingTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthUpgradeBindingTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.auth;
+
+import com.google.gdata.client.authn.oauth.GoogleOAuthParameters;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultExchange;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.apache.camel.component.gae.auth.GAuthTestUtils.createComponent;
+import static org.apache.camel.component.gae.auth.GAuthTokenSecret.COOKIE_NAME;
+import static org.apache.camel.component.gae.auth.GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN;
+import static org.apache.camel.component.gae.auth.GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN_SECRET;
+import static org.junit.Assert.assertEquals;
+
+public class GAuthUpgradeBindingTest {
+
+ private static GAuthUpgradeBinding binding;
+
+ private static GAuthComponent component;
+
+ private static GAuthEndpoint endpoint;
+
+ private Exchange exchange;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ component = createComponent();
+ binding = new GAuthUpgradeBinding();
+ endpoint = component.createEndpoint("gauth:upgrade");
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ exchange = new DefaultExchange(component.getCamelContext());
+ }
+
+ @Test
+ public void testWriteRequest() throws Exception {
+ exchange.getIn().setHeader("oauth_token", "token1");
+ exchange.getIn().setHeader("oauth_verifier", "verifier1");
+ exchange.getIn().setHeader("Cookie", COOKIE_NAME + "=secret1");
+ GoogleOAuthParameters params = binding.writeRequest(endpoint, exchange, null);
+ assertEquals("testConsumerKey", params.getOAuthConsumerKey());
+ assertEquals("testConsumerSecret", params.getOAuthConsumerSecret());
+ assertEquals("token1", params.getOAuthToken());
+ assertEquals("secret1", params.getOAuthTokenSecret());
+ assertEquals("verifier1", params.getOAuthVerifier());
+ }
+
+ @Test(expected = GAuthException.class)
+ public void testWriteRequestNoCookie() throws Exception {
+ exchange.getIn().setHeader("oauth_token", "token1");
+ exchange.getIn().setHeader("oauth_verifier", "verifier1");
+ binding.writeRequest(endpoint, exchange, null);
+ }
+
+ @Test
+ public void testReadResponse() throws Exception {
+ GoogleOAuthParameters params = new GoogleOAuthParameters();
+ params.setOAuthToken("token2");
+ params.setOAuthTokenSecret("tokenSecret2");
+ binding.readResponse(endpoint, exchange, params);
+ assertEquals("token2", exchange.getOut().getHeader(GAUTH_ACCESS_TOKEN));
+ assertEquals("tokenSecret2", exchange.getOut().getHeader(GAUTH_ACCESS_TOKEN_SECRET));
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/auth/GAuthUpgradeBindingTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginBindingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginBindingTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginBindingTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginBindingTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.login;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultExchange;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.apache.camel.component.gae.login.GLoginBinding.GLOGIN_COOKIE;
+import static org.apache.camel.component.gae.login.GLoginBinding.GLOGIN_HOST_NAME;
+import static org.apache.camel.component.gae.login.GLoginBinding.GLOGIN_PASSWORD;
+import static org.apache.camel.component.gae.login.GLoginBinding.GLOGIN_TOKEN;
+import static org.apache.camel.component.gae.login.GLoginBinding.GLOGIN_USER_NAME;
+import static org.apache.camel.component.gae.login.GLoginTestUtils.createEndpoint;
+import static org.apache.camel.component.gae.login.GLoginTestUtils.getCamelContext;
+import static org.junit.Assert.assertEquals;
+
+public class GLoginBindingTest {
+
+ private static GLoginBinding binding;
+
+ private static GLoginEndpoint endpoint;
+
+ private Exchange exchange;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ binding = new GLoginBinding();
+ StringBuffer buffer = new StringBuffer("glogin:test.appspot.com")
+ .append("?").append("userName=testUserName")
+ .append("&").append("password=testPassword");
+ endpoint = createEndpoint(buffer.toString());
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ exchange = new DefaultExchange(getCamelContext());
+ }
+
+ @Test
+ public void testWriteRequestDefault() {
+ GLoginData data = binding.writeRequest(endpoint, exchange, null);
+ assertEquals("apache-camel-2.x", data.getClientName());
+ assertEquals("test.appspot.com", data.getHostName());
+ assertEquals("testUserName", data.getUserName());
+ assertEquals("testPassword", data.getPassword());
+ }
+
+ @Test
+ public void testWriteRequestCustom() {
+ exchange.getIn().setHeader(GLOGIN_HOST_NAME, "custom.appspot.com");
+ exchange.getIn().setHeader(GLOGIN_USER_NAME, "customUserName");
+ exchange.getIn().setHeader(GLOGIN_PASSWORD, "customPassword");
+ GLoginData data = binding.writeRequest(endpoint, exchange, null);
+ assertEquals("custom.appspot.com", data.getHostName());
+ assertEquals("customUserName", data.getUserName());
+ assertEquals("customPassword", data.getPassword());
+ }
+
+ @Test
+ public void testReadResponse() throws Exception {
+ GLoginData data = new GLoginData();
+ data.setAuthenticationToken("testToken");
+ data.setAuthorizationCookie("testCookie=1234ABCD");
+ binding.readResponse(endpoint, exchange, data);
+ assertEquals("testToken", exchange.getOut().getHeader(GLOGIN_TOKEN));
+ assertEquals("testCookie=1234ABCD", exchange.getOut().getHeader(GLOGIN_COOKIE));
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginBindingTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginEndpointTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginEndpointTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginEndpointTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.login;
+
+import org.junit.Test;
+
+import static org.apache.camel.component.gae.login.GLoginTestUtils.createEndpoint;
+import static org.junit.Assert.*;
+
+public class GLoginEndpointTest {
+
+ @Test
+ public void testEndpointProperties() throws Exception {
+ // test internet hostname
+ StringBuffer buffer = new StringBuffer("glogin:test.appspot.com")
+ .append("?").append("clientName=testClientName")
+ .append("&").append("userName=testUserName")
+ .append("&").append("password=testPassword");
+ GLoginEndpoint endpoint = createEndpoint(buffer.toString());
+ assertEquals("test.appspot.com", endpoint.getHostName());
+ assertEquals("testClientName", endpoint.getClientName());
+ assertEquals("testUserName", endpoint.getUserName());
+ assertEquals("testPassword", endpoint.getPassword());
+ assertFalse(endpoint.isDevMode());
+ endpoint = createEndpoint("glogin:test.appspot.com");
+ assertEquals("apache-camel-2.x", endpoint.getClientName());
+ // test localhost with default port
+ endpoint = createEndpoint("glogin:localhost?devMode=true&devAdmin=true");
+ assertEquals("localhost", endpoint.getHostName());
+ assertEquals(8080, endpoint.getDevPort());
+ assertTrue(endpoint.isDevMode());
+ assertTrue(endpoint.isDevAdmin());
+ // test localhost with custom port
+ endpoint = createEndpoint("glogin:localhost:9090?devMode=true");
+ assertEquals("localhost", endpoint.getHostName());
+ assertEquals(9090, endpoint.getDevPort());
+ assertFalse(endpoint.isDevAdmin());
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginEndpointTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilder.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilder.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilder.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilder.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.login;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class GLoginRouteBuilder extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+ from("direct:input1")
+ .to("glogin:test.example.org"
+ + "?userName=testuser"
+ + "&password=testpass"
+ + "&serviceRef=#testService");
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilderTest.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilderTest.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilderTest.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.login;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"/org/apache/camel/component/gae/login/context.xml"})
+public class GLoginRouteBuilderTest {
+
+ @Autowired
+ private ProducerTemplate template;
+
+ @Test
+ public void testLogin() {
+ Exchange exchange = template.request("direct:input1", new Processor() {
+ public void process(Exchange exchange) {
+ }
+ });
+ assertEquals("testAuthenticationToken", exchange.getOut().getHeader(GLoginBinding.GLOGIN_TOKEN));
+ assertEquals("testAuthorizationCookie=1234ABCD", exchange.getOut().getHeader(GLoginBinding.GLOGIN_COOKIE));
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginRouteBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginServiceMock.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginServiceMock.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginServiceMock.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginServiceMock.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.login;
+
+public class GLoginServiceMock implements GLoginService {
+
+ public void authenticate(GLoginData data) throws Exception {
+ data.setAuthenticationToken("testAuthenticationToken");
+ }
+
+ public void authorize(GLoginData data) throws Exception {
+ data.setAuthorizationCookie("testAuthorizationCookie=1234ABCD");
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginServiceMock.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginTestUtils.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginTestUtils.java?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginTestUtils.java (added)
+++ camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginTestUtils.java Sun Feb 7 09:38:41 2010
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.component.gae.login;
+
+import com.google.appengine.api.mail.MailService.Message;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.SimpleRegistry;
+
+public final class GLoginTestUtils {
+
+ private static CamelContext context;
+ private static GLoginComponent component;
+
+ static {
+ SimpleRegistry registry = new SimpleRegistry();
+ registry.put("customOutboundBinding", new GLoginBinding() { }); // subclass
+ context = new DefaultCamelContext(registry);
+ component = new GLoginComponent();
+ component.setCamelContext(context);
+ }
+
+ private GLoginTestUtils() {
+ }
+
+ public static CamelContext getCamelContext() {
+ return context;
+ }
+
+ public static GLoginEndpoint createEndpoint(String endpointUri) throws Exception {
+ return (GLoginEndpoint)component.createEndpoint(endpointUri);
+ }
+
+ public static Message createMessage() throws Exception {
+ return new Message();
+ }
+
+}
Propchange: camel/trunk/components/camel-gae/src/test/java/org/apache/camel/component/gae/login/GLoginTestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/context.xml?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/context.xml (added)
+++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/context.xml Sun Feb 7 09:38:41 2010
@@ -0,0 +1,57 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans
+http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+http://camel.apache.org/schema/spring
+http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camel:camelContext id="camelContext">
+ <camel:jmxAgent id="agent" disabled="true" />
+ <camel:routeBuilder ref="routeBuilder"/>
+ </camel:camelContext>
+
+ <bean id="routeBuilder"
+ class="org.apache.camel.component.gae.auth.GAuthRouteBuilder">
+ </bean>
+
+ <bean id="gauth-cs" class="org.apache.camel.component.gae.auth.GAuthComponent">
+ <property name="consumerKey" value="testComsumerKey" />
+ <property name="consumerSecret" value="testComsumerSecret" />
+ </bean>
+
+ <bean id="gauth-pk" class="org.apache.camel.component.gae.auth.GAuthComponent">
+ <property name="consumerKey" value="test" />
+ <property name="keyLoader" ref="keyLoader" />
+ </bean>
+
+ <bean id="keyLoader" class="org.apache.camel.component.gae.auth.GAuthJksLoader">
+ <property name="keyStoreLocation" value="org/apache/camel/component/gae/auth/test1.jks" />
+ <property name="keyAlias" value="test1" />
+ <property name="keyPass" value="test1pass" />
+ <property name="storePass" value="test1pass" />
+ </bean>
+
+ <bean id="testService" class="org.apache.camel.component.gae.auth.GAuthServiceMock" />
+
+</beans>
Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test1.jks
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test1.jks?rev=907402&view=auto
==============================================================================
Binary file - no diff available.
Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test1.jks
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test2.pk8
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test2.pk8?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test2.pk8 (added)
+++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/auth/test2.pk8 Sun Feb 7 09:38:41 2010
@@ -0,0 +1,16 @@
+-----BEGIN PRIVATE KEY-----
+MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAMeSUIoDPJ2Xn7Jd
+nm8+fzP1Ls4p/aTILw/7MprVu9pOoMw1JN1suEnH+5jlEEr5QSdm044TV2SlDx5l
+8zYDdInaRw6VevnuZ3ZhcfLe7uguf2xllGncjwBrHfEv+QNpxm7k2lwUA35b9p9H
+4M1K205K9g6lE/jMfmOeW2MOblxdAgMBAAECgYAnD3kZ+hY0FggYpgArb8T/y140
+1b0iMlgbvaOi8HBLAxavwTsM54mOT0jsHPE6a1yYNKT1as2xEilKXtPiX3zAYfAA
+xPUYtQ3tTtCbrULCVc/CV4puwrrJWK0Rha7fKh+fSoMamVAWQansjqYOzFEdfUjb
+aZN6aH9umuiglkPClQJBAOPGhXwtxPnKOfaKv3L/K0SXfJ08Sh1f6xYxb89lSYrG
+Z3i5UYInI9b4E5ESt/PEOXzrKd+ziP3h5Vq5e9LIw68CQQDgTRwhJdEQLvEAeCUx
+uwRpVdd8403tGJv1YIlipRKQaP/Q1ClG00gGBL+No7lJcNDcNKvsGONS6ljQ/Vco
+uEezAkEAliukhiKG40j4vhrr7h1doXNerSu6kXNTwuYFGW9l9SCpx2Ym3vB/KJOW
+EueMcCLG5B0HFn1/rCLq282+XVIP8QJBAJEJK1w/wLyPLeUYyywp+sNF743gyP27
+wPTclFmF1cgtLOVSmtIiQlsp7NbgfCoB2fvZzyVePnfZ8s5IUniRGEMCQCUb1Ckq
+0RskVGzpp2meDgg8BrT9EZNAvRc1CrhxSkzJlUTsae8KRwcAawDlC/BxwwIphhmJ
+uKWdE17Ig4Idm88=
+-----END PRIVATE KEY-----
Added: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/login/context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/login/context.xml?rev=907402&view=auto
==============================================================================
--- camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/login/context.xml (added)
+++ camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/login/context.xml Sun Feb 7 09:38:41 2010
@@ -0,0 +1,40 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans
+http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+http://camel.apache.org/schema/spring
+http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+ <camel:camelContext id="camelContext">
+ <camel:jmxAgent id="agent" disabled="true" />
+ <camel:routeBuilder ref="routeBuilder"/>
+ </camel:camelContext>
+
+ <bean id="routeBuilder"
+ class="org.apache.camel.component.gae.login.GLoginRouteBuilder">
+ </bean>
+
+ <bean id="testService" class="org.apache.camel.component.gae.login.GLoginServiceMock" />
+
+</beans>
Propchange: camel/trunk/components/camel-gae/src/test/resources/org/apache/camel/component/gae/login/context.xml
------------------------------------------------------------------------------
svn:eol-style = native