You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by no...@apache.org on 2011/03/02 17:04:21 UTC
svn commit: r1076271 - in /aries/trunk: application/
application/application-itest-twitter/ application/application-itests/
application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/
application/application-itests/src/tes...
Author: not
Date: Wed Mar 2 16:04:19 2011
New Revision: 1076271
URL: http://svn.apache.org/viewvc?rev=1076271&view=rev
Log:
ARIES-592 Move twitter app from application to samples
Added:
aries/trunk/samples/twitter/ (with props)
aries/trunk/samples/twitter/LICENSE
aries/trunk/samples/twitter/NOTICE
aries/trunk/samples/twitter/pom.xml (with props)
aries/trunk/samples/twitter/twitter-bundle/
- copied from r1076167, aries/trunk/application/application-itest-twitter/twitter-bundle/
aries/trunk/samples/twitter/twitter-bundle/src/main/java/org/apache/aries/sample/
aries/trunk/samples/twitter/twitter-bundle/src/main/java/org/apache/aries/sample/twitter/
aries/trunk/samples/twitter/twitter-bundle/src/main/java/org/apache/aries/sample/twitter/TwitterQuery.java (with props)
aries/trunk/samples/twitter/twitter-eba/
- copied from r1076167, aries/trunk/application/application-itest-twitter/twitter-eba/
aries/trunk/samples/twitter/twitter-itests/
aries/trunk/samples/twitter/twitter-itests/pom.xml (with props)
aries/trunk/samples/twitter/twitter-itests/src/
aries/trunk/samples/twitter/twitter-itests/src/test/
aries/trunk/samples/twitter/twitter-itests/src/test/java/
aries/trunk/samples/twitter/twitter-itests/src/test/java/org/
aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/
aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/
aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/
aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/
aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/
aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/AbstractIntegrationTest.java (with props)
aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/TwitterTest.java (with props)
aries/trunk/samples/twitter/twitter-itests/src/test/resources/
aries/trunk/samples/twitter/twitter-itests/src/test/resources/obr/
aries/trunk/samples/twitter/twitter-twitter4j/
- copied from r1076167, aries/trunk/application/application-twitter4j/
Removed:
aries/trunk/application/application-itest-twitter/
aries/trunk/application/application-itests/src/test/resources/obr/twitter/
aries/trunk/application/application-twitter4j/
aries/trunk/samples/twitter/twitter-bundle/src/main/java/org/apache/aries/application/itest/twitter/
Modified:
aries/trunk/application/application-itests/pom.xml
aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java
aries/trunk/application/pom.xml
aries/trunk/samples/pom.xml
aries/trunk/samples/twitter/twitter-bundle/pom.xml
aries/trunk/samples/twitter/twitter-eba/pom.xml
aries/trunk/samples/twitter/twitter-twitter4j/pom.xml
Modified: aries/trunk/application/application-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-itests/pom.xml?rev=1076271&r1=1076270&r2=1076271&view=diff
==============================================================================
--- aries/trunk/application/application-itests/pom.xml (original)
+++ aries/trunk/application/application-itests/pom.xml Wed Mar 2 16:04:19 2011
@@ -123,21 +123,6 @@
</dependency>
<dependency>
- <groupId>org.apache.aries.application.itest.twitter</groupId>
- <artifactId>org.apache.aries.application.itest.twitter.eba</artifactId>
- <version>${project.version}</version>
- <type>eba</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.aries.application</groupId>
- <artifactId>twitter4j</artifactId>
- <version>2.0.8</version>
-
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.aries.application</groupId>
<artifactId>org.apache.aries.application.management</artifactId>
<scope>test</scope>
Modified: aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java?rev=1076271&r1=1076270&r2=1076271&view=diff
==============================================================================
--- aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java (original)
+++ aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java Wed Mar 2 16:04:19 2011
@@ -28,9 +28,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.InputStreamReader;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -435,68 +432,6 @@ public class OBRResolverAdvancedTest ext
- //Test for JIRA-461 which currently fails.
- @Test
- public void testTwitter() throws Exception
- {
- // provision against the local runtime
- System.setProperty(AppConstants.PROVISON_EXCLUDE_LOCAL_REPO_SYSPROP, "false");
- RepositoryAdmin repositoryAdmin = getOsgiService(RepositoryAdmin.class);
- Repository[] repos = repositoryAdmin.listRepositories();
- for (Repository repo : repos) {
- repositoryAdmin.removeRepository(repo.getURI());
- }
-
-
- // Use the superclasses' getUrlToEba() method instead of the pax-exam mavenBundle() method because pax-exam is running in a
- // diffference bundle which doesn't have visibility to the META-INF/maven/dependencies.properties file used to figure out the
- // version of the maven artifact.
- URL twitterEbaUrl = getUrlToEba("org.apache.aries.application.itest.twitter",
- "org.apache.aries.application.itest.twitter.eba");
- URL twitterCommonLangJar_url = getUrlToBundle("commons-lang", "commons-lang");
- URL twitterJar_url = getUrlToBundle("org.apache.aries.application", "twitter4j");
-
- // add the repository xml to the repository admin
- StringBuilder repositoryXML = new StringBuilder();
- BufferedReader reader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("/obr/twitter/TwitterRepository.xml")));
- String line;
- while ((line = reader.readLine()) != null) {
- repositoryXML.append(line);
- repositoryXML.append("\r\n");
- }
- //replace the jar file url with the real url related to the environment
- String repo = repositoryXML.toString().replaceAll("commons.lang.location", twitterCommonLangJar_url.toExternalForm());
- repo = repo.replaceAll("twitter4j.location", twitterJar_url.toExternalForm());
-
- FileWriter writer = new FileWriter("twitterRepo.xml");
- writer.write(repo);
- writer.close();
- repositoryAdmin.addRepository(new File("twitterRepo.xml").toURI().toURL());
- AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
- AriesApplication app = manager.createApplication(twitterEbaUrl);
- app = manager.resolve(app);
- DeploymentMetadata depMeta = app.getDeploymentMetadata();
- List<DeploymentContent> provision = depMeta.getApplicationProvisionBundles();
- Collection<DeploymentContent> useBundles = depMeta.getDeployedUseBundle();
- Collection<DeploymentContent> appContent = depMeta.getApplicationDeploymentContents();
- // We cannot be sure whether there are two or three provision bundles pulled in by Felix OBR as there is an outstanding defect
- // https://issues.apache.org/jira/browse/FELIX-2672
- // The workaround is to check we get the two bundles we are looking for, instead of insisting on just having two bundles.
-
- List<String> provisionBundleSymbolicNames = new ArrayList<String>();
- for (DeploymentContent dep : provision) {
- provisionBundleSymbolicNames.add(dep.getContentName());
- }
- String provision_bundle1 = "org.apache.commons.lang";
- String provision_bundle2 = "twitter4j";
- assertTrue("Bundle " + provision_bundle1 + " not found.", provisionBundleSymbolicNames.contains(provision_bundle1));
- assertTrue("Bundle " + provision_bundle2 + " not found.", provisionBundleSymbolicNames.contains(provision_bundle2));
- assertEquals(useBundles.toString(), 0, useBundles.size());
- assertEquals(appContent.toString(), 1, appContent.size());
- AriesApplicationContext ctx = manager.install(app);
- ctx.start();
- }
-
private void generateOBRRepoXML(boolean nullURI, String ... bundleFiles) throws Exception
{
Set<ModelledResource> mrs = new HashSet<ModelledResource>();
Modified: aries/trunk/application/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/application/pom.xml?rev=1076271&r1=1076270&r2=1076271&view=diff
==============================================================================
--- aries/trunk/application/pom.xml (original)
+++ aries/trunk/application/pom.xml Wed Mar 2 16:04:19 2011
@@ -240,8 +240,6 @@
<module>application-deployment-management</module>
<module>application-modeller</module>
<module>application-default-local-platform</module>
- <module>application-itest-twitter</module>
- <module>application-twitter4j</module>
</modules>
<build>
Modified: aries/trunk/samples/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/pom.xml?rev=1076271&r1=1076270&r2=1076271&view=diff
==============================================================================
--- aries/trunk/samples/pom.xml (original)
+++ aries/trunk/samples/pom.xml Wed Mar 2 16:04:19 2011
@@ -288,6 +288,7 @@
<module>ariestrader</module>
<module>blog</module>
<module>blueprint</module>
+ <module>twitter</module>
</modules>
</project>
Propchange: aries/trunk/samples/twitter/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Mar 2 16:04:19 2011
@@ -0,0 +1,5 @@
+.settings
+target
+.project
+.classpath
+
Added: aries/trunk/samples/twitter/LICENSE
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/LICENSE?rev=1076271&view=auto
==============================================================================
--- aries/trunk/samples/twitter/LICENSE (added)
+++ aries/trunk/samples/twitter/LICENSE Wed Mar 2 16:04:19 2011
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: aries/trunk/samples/twitter/NOTICE
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/NOTICE?rev=1076271&view=auto
==============================================================================
--- aries/trunk/samples/twitter/NOTICE (added)
+++ aries/trunk/samples/twitter/NOTICE Wed Mar 2 16:04:19 2011
@@ -0,0 +1,2 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
Added: aries/trunk/samples/twitter/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/pom.xml?rev=1076271&view=auto
==============================================================================
--- aries/trunk/samples/twitter/pom.xml (added)
+++ aries/trunk/samples/twitter/pom.xml Wed Mar 2 16:04:19 2011
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.aries.samples</groupId>
+ <artifactId>samples</artifactId>
+ <version>0.4-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <name>Apache Aries Twitter sample</name>
+ <artifactId>twitter</artifactId>
+ <packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <artifactId>org.apache.aries.samples.twitter.twitter4j</artifactId>
+ <version>2.0.8-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <artifactId>org.apache.aries.samples.twitter.bundle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <artifactId>org.apache.aries.samples.twitter.eba</artifactId>
+ <version>${project.version}</version>
+ <type>eba</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+
+ <modules>
+ <module>twitter-twitter4j</module>
+ <module>twitter-bundle</module>
+ <module>twitter-eba</module>
+ <module>twitter-itests</module>
+ </modules>
+
+</project>
Propchange: aries/trunk/samples/twitter/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: aries/trunk/samples/twitter/twitter-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/twitter-bundle/pom.xml?rev=1076271&r1=1076167&r2=1076271&view=diff
==============================================================================
--- aries/trunk/samples/twitter/twitter-bundle/pom.xml (original)
+++ aries/trunk/samples/twitter/twitter-bundle/pom.xml Wed Mar 2 16:04:19 2011
@@ -19,13 +19,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.aries.application.itest.twitter</groupId>
+ <groupId>org.apache.aries.samples.twitter</groupId>
<artifactId>twitter</artifactId>
<version>0.4-SNAPSHOT</version>
</parent>
- <artifactId>org.apache.aries.application.itest.twitter.bundle</artifactId>
- <name>Apache Aries Twitter itest bundle</name>
+ <artifactId>org.apache.aries.samples.twitter.bundle</artifactId>
+ <name>Apache Aries Twitter bundle</name>
<packaging>bundle</packaging>
<properties>
@@ -60,8 +60,8 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <Bundle-Activator>org.apache.aries.application.itest.twitter.TwitterQuery</Bundle-Activator>
- <Private-Package>org.apache.aries.application.itest.twitter</Private-Package>
+ <Bundle-Activator>org.apache.aries.sample.twitter.TwitterQuery</Bundle-Activator>
+ <Private-Package>org.apache.aries.sample.twitter</Private-Package>
</instructions>
</configuration>
</plugin>
Added: aries/trunk/samples/twitter/twitter-bundle/src/main/java/org/apache/aries/sample/twitter/TwitterQuery.java
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/twitter-bundle/src/main/java/org/apache/aries/sample/twitter/TwitterQuery.java?rev=1076271&view=auto
==============================================================================
--- aries/trunk/samples/twitter/twitter-bundle/src/main/java/org/apache/aries/sample/twitter/TwitterQuery.java (added)
+++ aries/trunk/samples/twitter/twitter-bundle/src/main/java/org/apache/aries/sample/twitter/TwitterQuery.java Wed Mar 2 16:04:19 2011
@@ -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.aries.sample.twitter;
+import java.util.List;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import twitter4j.Query;
+import twitter4j.QueryResult;
+import twitter4j.Tweet;
+import twitter4j.Twitter;
+import org.apache.commons.lang.StringEscapeUtils;
+
+public class TwitterQuery implements BundleActivator {
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ Twitter twitter = new Twitter();
+ Query query = new Query("from:theasf");
+
+ try {
+ QueryResult result = twitter.search(query);
+ List<Tweet> tweets = result.getTweets();
+ System.out.println("hits:" + tweets.size());
+ for (Tweet tweet : result.getTweets()) {
+ System.out.println(tweet.getFromUser() + ":" + StringEscapeUtils.unescapeXml(tweet.getText()));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ }
+
+}
Propchange: aries/trunk/samples/twitter/twitter-bundle/src/main/java/org/apache/aries/sample/twitter/TwitterQuery.java
------------------------------------------------------------------------------
svn:executable = *
Modified: aries/trunk/samples/twitter/twitter-eba/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/twitter-eba/pom.xml?rev=1076271&r1=1076167&r2=1076271&view=diff
==============================================================================
--- aries/trunk/samples/twitter/twitter-eba/pom.xml (original)
+++ aries/trunk/samples/twitter/twitter-eba/pom.xml Wed Mar 2 16:04:19 2011
@@ -24,20 +24,20 @@ under the License.
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.aries.application.itest.twitter</groupId>
+ <groupId>org.apache.aries.samples.twitter</groupId>
<artifactId>twitter</artifactId>
<version>0.4-SNAPSHOT</version>
</parent>
- <artifactId>org.apache.aries.application.itest.twitter.eba</artifactId>
- <name>Apache Aries Twitter itest EBA</name>
- <description>This is the module that constructs the Twitter itest application from the Twitter itest bundle</description>
+ <artifactId>org.apache.aries.samples.twitter.eba</artifactId>
+ <name>Apache Aries Twitter EBA</name>
+ <description>This is the module that constructs the Twitter application from the Twitter bundle</description>
<packaging>eba</packaging>
<dependencies>
<dependency>
- <groupId>org.apache.aries.application.itest.twitter</groupId>
- <artifactId>org.apache.aries.application.itest.twitter.bundle</artifactId>
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <artifactId>org.apache.aries.samples.twitter.bundle</artifactId>
</dependency>
</dependencies>
Added: aries/trunk/samples/twitter/twitter-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/twitter-itests/pom.xml?rev=1076271&view=auto
==============================================================================
--- aries/trunk/samples/twitter/twitter-itests/pom.xml (added)
+++ aries/trunk/samples/twitter/twitter-itests/pom.xml Wed Mar 2 16:04:19 2011
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>twitter</artifactId>
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <version>0.4-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.apache.aries.samples.twitter.itests</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Aries Twitter sample integration tests</name>
+ <description>
+ Integration tests for the Twitter sample
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries</groupId>
+ <artifactId>org.apache.aries.util</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.proxy</groupId>
+ <artifactId>org.apache.aries.proxy</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-default</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-mvn</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.bundlerepository</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.utils</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.testsupport</groupId>
+ <artifactId>org.apache.aries.testsupport.unit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime.itest.interfaces</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.management</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime.framework</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime.framework.management</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime.repository</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime.isolated</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.resolver.obr</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.resolver.noop</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.default.local.platform</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.transaction</groupId>
+ <artifactId>org.apache.aries.transaction.blueprint</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <version>1.1.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse</groupId>
+ <artifactId>osgi</artifactId>
+ <version>3.5.0.v20090520</version>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <artifactId>org.apache.aries.samples.twitter.eba</artifactId>
+ <scope>test</scope>
+ <type>eba</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <artifactId>org.apache.aries.samples.twitter.twitter4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <artifactId>org.apache.aries.samples.twitter.bundle</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>generate-depends-file</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ <configuration>
+ <outputFile>${project.build.directory}/test-classes/META-INF/maven/dependencies.properties</outputFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <excludes>
+ <exclude>**/*$*</exclude>
+ <exclude>**/Abstract*.java</exclude>
+ </excludes>
+ <includes>
+ <include>**/Test*.java</include>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>ci-build-profile</id>
+ <activation>
+ <property>
+ <name>maven.repo.local</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!--
+ when the local repo location has been specified, we need to pass
+ on this information to PAX mvn url
+ -->
+ <argLine>-Dorg.ops4j.pax.url.mvn.localRepository=${maven.repo.local}</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Propchange: aries/trunk/samples/twitter/twitter-itests/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/AbstractIntegrationTest.java?rev=1076271&view=auto
==============================================================================
--- aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/AbstractIntegrationTest.java (added)
+++ aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/AbstractIntegrationTest.java Wed Mar 2 16:04:19 2011
@@ -0,0 +1,223 @@
+/**
+ * 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.aries.sample.twitter.itest;
+
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.ops4j.pax.url.mvn.Handler;
+import org.ops4j.pax.url.mvn.ServiceConstants;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.Version;
+import org.osgi.util.tracker.ServiceTracker;
+
+@RunWith(JUnit4TestRunner.class)
+public class AbstractIntegrationTest {
+
+ public static final long DEFAULT_TIMEOUT = 60000;
+
+ @Inject
+ protected BundleContext bundleContext;
+
+ private List<ServiceTracker> srs;
+
+ @Before
+ public void setUp() {
+ srs = new ArrayList<ServiceTracker>();
+ }
+
+ @After
+ public void tearDown() throws Exception{
+ for (ServiceTracker st : srs) {
+ if (st != null) {
+ st.close();
+ }
+ }
+ }
+
+ protected Bundle getBundle(String symbolicName) {
+ return getBundle(symbolicName, null);
+ }
+
+ protected Bundle getBundle(String bundleSymbolicName, String version) {
+ Bundle result = null;
+ for (Bundle b : bundleContext.getBundles()) {
+ if (b.getSymbolicName().equals(bundleSymbolicName)) {
+ if (version == null
+ || b.getVersion().equals(Version.parseVersion(version))) {
+ result = b;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ public static MavenArtifactProvisionOption mavenBundle(String groupId,
+ String artifactId) {
+ return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId)
+ .versionAsInProject();
+ }
+
+
+ protected static Option[] updateOptions(Option[] options) {
+ // We need to add pax-exam-junit here when running with the ibm
+ // jdk to avoid the following exception during the test run:
+ // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration
+ if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
+ Option[] ibmOptions = options(wrappedBundle(mavenBundle(
+ "org.ops4j.pax.exam", "pax-exam-junit")));
+ options = combine(ibmOptions, options);
+ }
+
+ return options;
+ }
+
+ protected <T> T getOsgiService(Class<T> type, long timeout) {
+ return getOsgiService(type, null, timeout);
+ }
+
+ protected <T> T getOsgiService(Class<T> type) {
+ return getOsgiService(type, null, DEFAULT_TIMEOUT);
+ }
+
+ protected <T> T getOsgiService(Class<T> type, String filter, long timeout) {
+ return getOsgiService(null, type, filter, timeout);
+ }
+
+ protected <T> T getOsgiService(BundleContext bc, Class<T> type,
+ String filter, long timeout) {
+ ServiceTracker tracker = null;
+ try {
+ String flt;
+ if (filter != null) {
+ if (filter.startsWith("(")) {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")"
+ + filter + ")";
+ } else {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")("
+ + filter + "))";
+ }
+ } else {
+ flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
+ }
+ Filter osgiFilter = FrameworkUtil.createFilter(flt);
+ tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter,
+ null);
+ tracker.open();
+
+ // add tracker to the list of trackers we close at tear down
+ srs.add(tracker);
+
+ Object x = tracker.waitForService(timeout);
+ Object svc = type.cast(x);
+ if (svc == null) {
+ throw new RuntimeException("Gave up waiting for service " + flt);
+ }
+ return type.cast(svc);
+ } catch (InvalidSyntaxException e) {
+ throw new IllegalArgumentException("Invalid filter", e);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static URL getUrlToEba(String groupId, String artifactId) throws MalformedURLException {
+ String artifactVersion = getArtifactVersion(groupId, artifactId);
+
+ // Need to use handler from org.ops4j.pax.url.mvn
+ URL urlToEba = new URL(null,
+ ServiceConstants.PROTOCOL + ":" + groupId + "/" +artifactId + "/"
+ + artifactVersion + "/eba", new Handler());
+ return urlToEba;
+ }
+
+ public static URL getUrlToBundle(String groupId, String artifactId) throws MalformedURLException {
+ String artifactVersion = getArtifactVersion(groupId, artifactId);
+
+ // Need to use handler from org.ops4j.pax.url.mvn
+ URL urlToEba = new URL(null,
+ ServiceConstants.PROTOCOL + ":" + groupId + "/" +artifactId + "/"
+ + artifactVersion, new Handler());
+ return urlToEba;
+ }
+
+ public static String getArtifactVersion(final String groupId, final String artifactId)
+ {
+ final Properties dependencies = new Properties();
+ try {
+ InputStream in = getFileFromClasspath("META-INF/maven/dependencies.properties");
+ try {
+ dependencies.load(in);
+ } finally {
+ in.close();
+ }
+ final String version = dependencies.getProperty(groupId + "/" + artifactId + "/version");
+ if (version == null) {
+ throw new RuntimeException("Could not resolve version. Do you have a dependency for "
+ + groupId + "/" + artifactId + " in your maven project?");
+ }
+ return version;
+ } catch (IOException e) {
+ // TODO throw a better exception
+ throw new RuntimeException(
+ "Could not resolve version. Did you configure the depends-maven-plugin in your maven project? "
+ + " Or maybe you did not run the maven build and you are using an IDE?");
+ }
+ }
+
+ private static InputStream getFileFromClasspath( final String filePath )
+ throws FileNotFoundException
+ {
+ try
+ {
+ URL fileURL = AbstractIntegrationTest.class.getClassLoader().getResource( filePath );
+ if( fileURL == null )
+ {
+ throw new FileNotFoundException( "File [" + filePath + "] could not be found in classpath" );
+ }
+ return fileURL.openStream();
+ }
+ catch (IOException e)
+ {
+ throw new FileNotFoundException( "File [" + filePath + "] could not be found: " + e.getMessage() );
+ }
+ }
+}
\ No newline at end of file
Propchange: aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/AbstractIntegrationTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/TwitterTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/TwitterTest.java?rev=1076271&view=auto
==============================================================================
--- aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/TwitterTest.java (added)
+++ aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/TwitterTest.java Wed Mar 2 16:04:19 2011
@@ -0,0 +1,168 @@
+/*
+ * 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.aries.sample.twitter.itest;
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.aries.application.DeploymentContent;
+import org.apache.aries.application.DeploymentMetadata;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.AriesApplicationContext;
+import org.apache.aries.application.management.AriesApplicationManager;
+import org.apache.aries.application.utils.AppConstants;
+import org.apache.felix.bundlerepository.Repository;
+import org.apache.felix.bundlerepository.RepositoryAdmin;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+@RunWith(JUnit4TestRunner.class)
+public class TwitterTest extends AbstractIntegrationTest
+{
+ public static final String CORE_BUNDLE_BY_VALUE = "core.bundle.by.value";
+ public static final String CORE_BUNDLE_BY_REFERENCE = "core.bundle.by.reference";
+ public static final String TRANSITIVE_BUNDLE_BY_VALUE = "transitive.bundle.by.value";
+ public static final String TRANSITIVE_BUNDLE_BY_REFERENCE = "transitive.bundle.by.reference";
+ public static final String USE_BUNDLE_BY_REFERENCE = "use.bundle.by.reference";
+ public static final String REPO_BUNDLE = "aries.bundle1";
+ public static final String HELLO_WORLD_CLIENT_BUNDLE="hello.world.client.bundle";
+ public static final String HELLO_WORLD_SERVICE_BUNDLE1="hello.world.service.bundle1";
+ public static final String HELLO_WORLD_SERVICE_BUNDLE2="hello.world.service.bundle2";
+
+ //Test for JIRA-461 which currently fails.
+ @Test
+ public void testTwitter() throws Exception
+ {
+ // provision against the local runtime
+ System.setProperty(AppConstants.PROVISON_EXCLUDE_LOCAL_REPO_SYSPROP, "false");
+ RepositoryAdmin repositoryAdmin = getOsgiService(RepositoryAdmin.class);
+ Repository[] repos = repositoryAdmin.listRepositories();
+ for (Repository repo : repos) {
+ repositoryAdmin.removeRepository(repo.getURI());
+ }
+
+
+ // Use the superclasses' getUrlToEba() method instead of the pax-exam mavenBundle() method because pax-exam is running in a
+ // diffference bundle which doesn't have visibility to the META-INF/maven/dependencies.properties file used to figure out the
+ // version of the maven artifact.
+ URL twitterEbaUrl = getUrlToEba("org.apache.aries.samples.twitter",
+ "org.apache.aries.samples.twitter.eba");
+ URL twitterCommonLangJar_url = getUrlToBundle("commons-lang", "commons-lang");
+ URL twitterJar_url = getUrlToBundle("org.apache.aries.samples.twitter", "org.apache.aries.samples.twitter.twitter4j");
+
+ // add the repository xml to the repository admin
+ StringBuilder repositoryXML = new StringBuilder();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("/obr/twitter/TwitterRepository.xml")));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ repositoryXML.append(line);
+ repositoryXML.append("\r\n");
+ }
+ //replace the jar file url with the real url related to the environment
+ String repo = repositoryXML.toString().replaceAll("commons.lang.location", twitterCommonLangJar_url.toExternalForm());
+ repo = repo.replaceAll("twitter4j.location", twitterJar_url.toExternalForm());
+
+ FileWriter writer = new FileWriter("twitterRepo.xml");
+ writer.write(repo);
+ writer.close();
+ repositoryAdmin.addRepository(new File("twitterRepo.xml").toURI().toURL());
+ AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
+ AriesApplication app = manager.createApplication(twitterEbaUrl);
+ app = manager.resolve(app);
+ DeploymentMetadata depMeta = app.getDeploymentMetadata();
+ List<DeploymentContent> provision = depMeta.getApplicationProvisionBundles();
+ Collection<DeploymentContent> useBundles = depMeta.getDeployedUseBundle();
+ Collection<DeploymentContent> appContent = depMeta.getApplicationDeploymentContents();
+ // We cannot be sure whether there are two or three provision bundles pulled in by Felix OBR as there is an outstanding defect
+ // https://issues.apache.org/jira/browse/FELIX-2672
+ // The workaround is to check we get the two bundles we are looking for, instead of insisting on just having two bundles.
+
+ List<String> provisionBundleSymbolicNames = new ArrayList<String>();
+ for (DeploymentContent dep : provision) {
+ provisionBundleSymbolicNames.add(dep.getContentName());
+ }
+ String provision_bundle1 = "org.apache.commons.lang";
+ String provision_bundle2 = "twitter4j";
+ assertTrue("Bundle " + provision_bundle1 + " not found.", provisionBundleSymbolicNames.contains(provision_bundle1));
+ assertTrue("Bundle " + provision_bundle2 + " not found.", provisionBundleSymbolicNames.contains(provision_bundle2));
+ assertEquals(useBundles.toString(), 0, useBundles.size());
+ assertEquals(appContent.toString(), 1, appContent.size());
+ AriesApplicationContext ctx = manager.install(app);
+ ctx.start();
+ }
+
+ @org.ops4j.pax.exam.junit.Configuration
+ public static Option[] configuration() {
+ Option[] options = options(
+ // Log
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
+ // Felix Config Admin
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
+ // Felix mvn url handler
+ mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
+
+ // this is how you set the default log level when using pax
+ // logging (logProfile)
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+
+ // Bundles
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.api"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.management"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.default.local.platform"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.deployment.management"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.modeller"),
+ mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.itest.interfaces"),
+ mavenBundle("org.apache.aries", "org.apache.aries.util"),
+ mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
+ mavenBundle("asm", "asm-all"),
+ mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
+ mavenBundle("org.osgi", "org.osgi.compendium"),
+ mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
+ /* For debugging, uncomment the next two lines */
+ /*vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5010"),
+ waitForFrameworkStartup(), */
+// vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5010"),
+ /* For debugging, add these imports:
+ import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
+ import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+ */
+
+ equinox().version("3.5.0"));
+ options = updateOptions(options);
+ return options;
+ }
+}
\ No newline at end of file
Propchange: aries/trunk/samples/twitter/twitter-itests/src/test/java/org/apache/aries/sample/twitter/itest/TwitterTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: aries/trunk/samples/twitter/twitter-twitter4j/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/samples/twitter/twitter-twitter4j/pom.xml?rev=1076271&r1=1076167&r2=1076271&view=diff
==============================================================================
--- aries/trunk/samples/twitter/twitter-twitter4j/pom.xml (original)
+++ aries/trunk/samples/twitter/twitter-twitter4j/pom.xml Wed Mar 2 16:04:19 2011
@@ -19,16 +19,16 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.aries.application</groupId>
- <artifactId>application</artifactId>
+ <groupId>org.apache.aries.samples.twitter</groupId>
+ <artifactId>twitter</artifactId>
<version>0.4-SNAPSHOT</version>
</parent>
- <artifactId>twitter4j</artifactId>
+ <artifactId>org.apache.aries.samples.twitter.twitter4j</artifactId>
<packaging>bundle</packaging>
- <name>Apache Aries Application Bundlise Twitter4j</name>
- <version>2.0.8</version>
+ <name>Apache Aries Bundlise Twitter4j</name>
+ <version>2.0.8-SNAPSHOT</version>
<description>
- Application used to bundlelise twitter4j
+ Module used to bundlelise twitter4j
</description>
<dependencies>
<dependency>