Java SCA 2.0-M1 RC1 tag

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@742246 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
lresende 2009-02-09 03:55:10 +00:00
parent fc6e471bd8
commit bf5dc39bf9
3113 changed files with 277478 additions and 0 deletions
tags/java/sca/2.0-M1-RC1
BUILDINGLICENSENOTICE
distribution
etc
features
itest
build-was-integration.xml
callback-api
callback-basic
callback-complex-type
callback-id
callback-multiple-wires
callback-separatethread
callback-set-callback
callback-set-conversation

View file

@ -0,0 +1,56 @@
Building the Apache Tuscany SCA 2.0-M1 February 2009 Release source distribution
=======================================================================================
Initial Setup
-------------
1) Install J2SE 5.0 SDK, which can be downloaded from
http://java.sun.com/j2se/1.5.0/download.jsp. Use version of 1.5.0_06 JDK or higher.
2) Make sure that your JAVA_HOME environment variable is set to the newly installed
JDK location, and that your PATH includes %JAVA_HOME%\bin (windows) or
$JAVA_HOME$/bin (unix).
3) Install Maven 2.0.7 or higher, which can be downloaded from
http://maven.apache.org/download.html. Make sure that your PATH includes
the MVN_HOME/bin directory.
4) Make sure that your MAVEN_OPTS environment variable has -Xmx128M (or more),
you can manually do this by executing the following in your prompt :
Windows users:
set MAVEN_OPTS=-Xmx128M
Unix users:
export MAVEN_OPTS=-Xmx128M
Building
--------
1) Change to the top level directory of Apache Tuscany source distribution.
2) Run
$> mvn -Psetup
$> mvn
This will compile Apache Tuscany and run all of the tests in the source
distribution.
Depending on the load of remote Maven 2.0 repositories, you may have
to run "mvn" several times utill the required dependencies are
all located in your local maven repository. It usually takes some time for
maven to download required dependencies in the first build. Once all the
dependencies have been downloaded you may use the -o option to run maven
in offline mode, for example, 'mvn clean install -o'.
Building the distributions
--------------------------
1) Change to the distribution folder
2) Run
$> mvn
This will build the binary and source distribution with .zip and .gz
formats in the distribution/target directory.

View file

@ -0,0 +1,397 @@
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.
===============================================================================================================
Apache Tuscany SCA for Java Subcomponents
=========================================:
The Tuscany SCA for Java release includes a number of subcomponents with
separate copyright notices and license terms. Your use of the source
code for the these subcomponents is subject to the terms and
conditions of the following licenses.
===============================================================================================================
The module itest/databindings/common includes the test schema; datagraph.xsd, sdoJava.xsd, and sdoModel.xsd
under the following license:
License for the Service Data Objects JavaDoc, Interface Definition files
and XSD files.
The Service Data Objects JavaDoc, Interface Definition files and XSD files
are being provided by the copyright holders under the following license.
By using and/or copying this work, you agree that you have read,
understood and will comply with the following terms and conditions:
Permission to copy, display, make derivative works of and distribute
the Service Data Objects JavaDoc, Interface Definition files and XSD files
(the "Artifacts") in any medium without fee or royalty is hereby granted,
provided that you include the following on ALL copies of the Artifacts,
or portions thereof, that you make:
1. A link or URL to the Artifacts at this location:
http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
2. The full text of this copyright notice as shown in the Artifacts.
THE ARTIFACTS ARE PROVIDED "AS IS" AND THE AUTHORS MAKE NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
ARTIFACTS AND THE IMPLEMENTATION OF THEIR CONTENTS,
INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT OR TITLE.
THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
USE OR DISTRIBUTION OF THE ARTIFACTS.
The name and trademarks of the Authors may NOT be used in any manner,
including advertising or publicity pertaining to the Service Data
Objects Specification or its contents without specific, written prior
permission. Title to copyright in the Service Data Objects
Specification will at all times remain with the Authors.
No other rights are granted by implication, estoppel or otherwise.
Revision level 1.11, last updated on 2007/12/21
=================================================================================================================
The module implementation-script temporarily includes one file under the following BSD license:
Copyright (c) 2006, Sun Microsystems, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of the Sun Microsystems, Inc. nor the names of
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
=================================================================================================================
The module assembly-xsd includes XSD files under the following SCA Collaboration license:
License for the Service Component Architecture JavaDoc, Interface
Definition files and XSD files.
The Service Component Architecture JavaDoc, Interface Definition files,
and XSD files are being provided by the copyright holders under the
following license. By using and/or copying this work, you agree that
you have read, understood and will comply with the following terms and
conditions:
Permission to copy, display, make derivative works of, and distribute
the Service Component Architecture JavaDoc, Interface Definition Files
and XSD files (the "Artifacts") in any medium without fee or royalty is
hereby granted, provided that you include the following on ALL copies
of the Artifacts, or portions thereof, that you make:
1. A link or URL to the Artifacts at this location:
http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
2. The full text of this copyright notice as shown in the Artifacts.
THE ARTIFACTS ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THE
ARTIFACTS AND THE IMPLEMENTATION OF THEIR CONTENTS, INCLUDING, BUT NOT
LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT OR TITLE.
THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
USE OR DISTRIBUTION OF THE ARTIFACTS.
The name and trademarks of the Authors may NOT be used in any manner,
including advertising or publicity pertaining to the Service Component
Architecture Specification or its contents without specific, written
prior permission. Title to copyright in the Service Component
Architecture Specification and the JavaDoc, Interface Definition Files
and XSD Files will at all times remain with the Authors.
No other rights are granted by implication, estoppel or otherwise.
Revision level 1.1, last updated on 2007/11/19
=================================================================================================================
The modules
binding-ws-xml
databinding
databinding-axiom
databinding-jaxb
databinding-json
databinding-sdo
databinding-sdo-axiom
databinding-xmlbeans
interface-wsdl-xml
Include the ipo.xsd and address.xsd information from the XML Schema Primer
(http://www.w3.org/TR/2004/PER-xmlschema-0-20040318/) combined into the
file ipo.xsd and extended with UK postcode structures.
The ipo.xsd file is include under the following license:
W3C(c) SOFTWARE NOTICE AND LICENSE
http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
This work (and included software, documentation such as READMEs, or other
related items) is being provided by the copyright holders under the following
license. By obtaining, using and/or copying this work, you (the licensee) agree
that you have read, understood, and will comply with the following terms and conditions.
Permission to copy, modify, and distribute this software and its documentation,
with or without modification, for any purpose and without fee or royalty is
hereby granted, provided that you include the following on ALL copies of the
software and documentation or portions thereof, including modifications:
1. The full text of this NOTICE in a location viewable to users of the
redistributed or derivative work.
2. Any pre-existing intellectual property disclaimers, notices, or terms
and conditions. If none exist, the W3C Software Short Notice should be
included (hypertext is preferred, text is permitted) within the body of
any redistributed or derivative code.
3. Notice of any changes or modifications to the files, including the date
changes were made. (We recommend you provide URIs to the location from which
the code is derived.)
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
The name and trademarks of copyright holders may NOT be used in advertising or
publicity pertaining to the software without specific, written prior permission.
Title to copyright in this software and any associated documentation will at all
times remain with copyright holders.

View file

@ -0,0 +1,35 @@
Apache Tuscany
Copyright (c) 2005 - 2009 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
This product also includes software under the BSD license
(see the LICENSE file contained in this distribution), with
the following copyright:
Copyright (c) 2006, Sun Microsystems, Inc. All rights reserved.
This product includes software under the Service Component Architecture JavaDoc,
Interface Definition files and XSD files license.
(c) Copyright SCA Collaboration 2006, 2007
This product includes software under the Service Data Objects JavaDoc and
Interface Definition file license
(c) Copyright BEA Systems, Inc., International Business Machines Corporation,
Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
2005, 2006. All rights reserved.
This product includes software under the W3C(c) Software License
with the following copyright:
Copyright (c) 2008 World Wide Web Consortium, (Massachusetts Institute of Technology,
European Research Consortium for Informatics and Mathematics, Keio University).
All Rights Reserved. This work is distributed under the W3C(c) Software License [1] in
the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231

View file

@ -0,0 +1,88 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-distribution</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-distribution-all</artifactId>
<name>Apache Tuscany SCA All-in-one Distribution</name>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature-all</artifactId>
<type>pom</type>
<version>2.0-M1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>distribution-modules</id>
<phase>generate-resources</phase>
<goals>
<goal>generate-modules</goal>
</goals>
<configuration>
<targetDirectory>target/modules</targetDirectory>
<useDistributionName>false</useDistributionName>
<generateManifestJar>true</generateManifestJar>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>distribution-package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
<tarLongFileMode>gnu</tarLongFileMode>
<finalName>apache-tuscany-sca-all-2.0-M1</finalName>
<appendAssemblyId>true</appendAssemblyId>
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,36 @@
<?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.
-->
<assembly>
<!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
<id></id>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>tuscany-sca-2.0-M1</baseDirectory>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<componentDescriptors>
<componentDescriptor>src/main/components/bin-common.xml</componentDescriptor>
<componentDescriptor>src/main/components/bin-modules.xml</componentDescriptor>
<componentDescriptor>src/main/components/bin-samples.xml</componentDescriptor>
<componentDescriptor>src/main/components/bin-launcher.xml</componentDescriptor>
</componentDescriptors>
</assembly>

View file

@ -0,0 +1,54 @@
<?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.
-->
<assembly>
<!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
<id>src</id>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>tuscany-sca-2.0-M1-src</baseDirectory>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>src/main/release</directory>
<outputDirectory></outputDirectory>
<includes>
<include>CHANGES</include>
<include>README</include>
<include>RELEASE_NOTES</include>
</includes>
</fileSet>
<fileSet>
<directory>../..</directory>
<outputDirectory></outputDirectory>
<excludes>
<exclude>**/.*</exclude>
<exclude>**/.*/**</exclude>
<exclude>**/*.log</exclude>
<exclude>**/target</exclude>
<exclude>**/target/**/*</exclude>
<exclude>**/maven-eclipse.xml</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>

View file

@ -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.
-->
<component>
<fileSets>
<!-- Add the text files to the top-level directroy -->
<fileSet>
<directory>src/main/release</directory>
<outputDirectory></outputDirectory>
<includes>
<include>CHANGES</include>
<include>DISCLAIMER</include>
<include>README</include>
<include>RELEASE_NOTES</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/release/bin</directory>
<outputDirectory></outputDirectory>
<includes>
<include>INSTALL</include>
<include>LICENSE</include>
<include>NOTICE</include>
</includes>
</fileSet>
</fileSets>
</component>

View file

@ -0,0 +1,41 @@
<!--
* 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.
-->
<component>
<fileSets>
<fileSet>
<directory>src/main/release/launcher</directory>
<outputDirectory>bin</outputDirectory>
<includes>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>bin</outputDirectory>
<unpack>false</unpack>
<includes>
<include>org.apache.tuscany.sca:tuscany-launcher</include>
</includes>
<outputFileNameMapping>launcher.jar</outputFileNameMapping>
</dependencySet>
</dependencySets>
</component>

View file

@ -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.
-->
<component>
<fileSets>
<fileSet>
<directory>target</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>modules/**/*</include>
<include>features/**/*</include>
</includes>
</fileSet>
</fileSets>
</component>

View file

@ -0,0 +1,65 @@
<!--
* 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.
-->
<component>
<fileSets>
<!-- Add top level samples files -->
<fileSet>
<directory>../../samples</directory>
<outputDirectory>samples</outputDirectory>
<includes>
<include>README</include>
<include>logging.properties</include>
<include>build-common.xml</include>
<include>binding-ws-calculator/**/*</include>
<include>calculator/**/*</include>
<include>calculator-equinox/**/*</include>
<include>calculator-osgi/**/*</include>
<include>calculator-rmi-reference/**/*</include>
<include>calculator-rmi-service/**/*</include>
<include>implementation-java-calculator/**/*</include>
</includes>
<excludes>
<!-- General file/folders to exclude -->
<exclude>**/.*</exclude>
<exclude>**/.*/**</exclude>
<exclude>**/*.log</exclude>
<exclude>**/*.svg</exclude>
<exclude>**/maven-eclipse.xml</exclude>
<!-- Sample specific files/folders to exclude -->
<exclude>pom.xml</exclude>
<!-- exclude>**/target</exclude -->
<!-- exclude>**/target/**/*</exclude -->
<exclude>*/target/mvn-eclipse-cache.properties</exclude>
<exclude>*/target/classes</exclude>
<exclude>*/target/classes/**/*</exclude>
<exclude>*/target/dependency-maven-plugin-markers</exclude>
<exclude>*/target/dependency-maven-plugin-markers/**/*</exclude>
<exclude>*/target/.felix</exclude>
<exclude>*/target/.felix/**/*</exclude>
<exclude>*/target/maven-archiver</exclude>
<exclude>*/target/maven-archiver/**/*</exclude>
<exclude>*/target/test-classes</exclude>
<exclude>*/target/test-classes/**/*</exclude>
<exclude>*/target/surefire-reports</exclude>
<exclude>*/target/surefire-reports/**/*</exclude>
</excludes>
</fileSet>
</fileSets>
</component>

View file

@ -0,0 +1,23 @@
Changes With Apache Tuscany SCA 2.0-M1 February 2009
===========================================================
Features and/or Enhancements
* Core
- Enable Tuscany to run inside an OSGi runtime
- Updated SCA API packages based on OASIS Open CSA specification drafts
* Other Extensions
- Binding RMI
- RMI Binding
- Binding WS
- WebServices Binding
* Samples/Tutorial/Demos
- binding-ws-calculator/
- calculator/
- calculator-equinox/
- calculator-osgi/
- calculator-rmi-reference/
- calculator-rmi-service/
- implementation-java-calculator

View file

@ -0,0 +1,19 @@
Apache Tuscany SCA 2.0-M1 February 2009 README
=====================================================
Welcome to the Tuscany SCA 2.0-M1 release.
See the RELEASE_NOTES file for information specific to this release.
In the binary release see the INSTALL file for information on how to
install the release.
In the source distribution see the BUILDING file for information on
building the source code.

View file

@ -0,0 +1,71 @@
Apache Tuscany SCA 2.0-M1 February 2009 Release Notes
============================================================
Apache Tuscany provides a runtime based on the Service Component
Architecture. SCA is a set of specifications aimed at simplifying SOA
Application Development which are being standardized at OASIS as part
of Open Composite Services Architecture (Open CSA) - http://www.oasis-opencsa.org/.
Overview
--------
The Apache Tuscany SCA 2.0-M1 release includes implementations of the
main SCA specifications and recent updates from Open CSA drafts including:
SCA Assembly Model V1.0
SCA Policy Framework V1.0
SCA Java Common Annotations and APIs V1.0
SCA Java Component Implementation V1.0
SCA Web Services Binding V1.0
It also includes implementations of many features not yet defined
by SCA specifications, including:
- SCA bindings for RMI.
- Databindings for JAXB, Axis2's AXIOM, DOM, SAX and StAX
The Tuscany SCA Runtime can be configured as a single node SCA domain or
as an SCA domain distributed across multiple nodes.
In addition Tuscany SCA supports the following host-deployment options: -
- running standalone
- running in a OSGi enabled runtime Environment (Equinox)
- running with distributed nodes across multiple JVMs
See the CHANGES file for a detailed list of the features in this release.
Support
-------
For more information on Apache Tuscany visit the website at:
http://tuscany.apache.org/tuscany/
Any issues with this release can be reported to Apache Tuscany
using the mailing lists or in the JIRA issue tracker.
Mailing list archives:
http://mail-archives.apache.org/mod_mbox/tuscany-user/
http://mail-archives.apache.org/mod_mbox/tuscany-dev/
Jira:
http://issues.apache.org/jira/browse/TUSCANY
To join the project's mailing lists follow the instructions at:
http://incubator.apache.org/tuscany/mailing-lists.html
To find out more about OASIS Open CSA go to:
http://www.oasis-opencsa.org.
Apache Tuscany welcomes your help. Any contribution, including code,
testing, improving the documentation, or bug reporting is always
appreciated.
Thank you for using Apache Tuscany!
- The Tuscany Team.

View file

@ -0,0 +1,24 @@
Installing the Apache Tuscany SCA 2.0-M1 February 2009 Release binary distribution
=========================================================================================
Unzip Tuscany binary distribution archive and you get the following:
tuscany-sca-1.1-incubating
INSTALL - this help file
LICENSE - the Apache License and any dependecy licenses
NOTICE - attribution notices associated with the licenses
README - readme for the release
RELEASE_NOTES - description of this release
CHANGES - A note of the major changes in this release
/bin - Tuscany launcher ???
/features - OSGi runtime configuration, Tuscany manifest and PDE target
/modules - all of the individual Tuscany jars
/samples - all the Tuscany samples, see the README in that directory

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,62 @@
Apache Tuscany
Copyright (c) 2005 - 2009 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
This product includes/uses XmlSchema developed at
The Apache Software Foundation (http://ws.apache.org/commons/XmlSchema)
Portions Copyright 2006 International Business Machines Corp.
This product includes/uses the Jetty Servlet Engine (http://jetty.mortbay.org),
developed by Mort Bay Consulting (http://www.mortbay.com)
This product includes/uses DOM4J : the flexible XML framework for java (http://www.dom4j.org/)
Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
This product includes/uses software, AOP alliance (http://aopalliance.sourceforge.net)
License: Public Domain
This product includes software from the GlassFish project (https://glassfish.dev.java.net/)
Copyright (c) 2006, Sun Microsystems, Inc.
This product includes/uses the Sourceforge wsdl4j project (http://sourceforge.net/projects/wsdl4j/)
This product includes/uses JDOM (http://www.jdom.org/)
Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin. All rights reserved.
This product includes/uses javacc (https://javacc.dev.java.net/)
Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
This product includes/uses ASM (http://asm.objectweb.org)
Copyright (c) 2000-2005 INRIA, France Telecom. All rights reserved.
This product includes/uses Jaxen (http://jaxen.codehaus.org/)
Copyright 2003-2006 The Werken Company. All Rights Reserved.
This product includes/uses Serp (http://serp.sourceforge.net/) under the BSD license:
Copyright (c) 2002, A. Abram White. All rights reserved.
This product also includes software under the BSD license
with the following copyright:
Copyright (c) 2006, Sun Microsystems, Inc. All rights reserved.
This product also includes "OSGi Materials."
Copyright (c) 2000, 2006
OSGi Alliance Bishop Ranch 6
2400 Camino Ramon, Suite 375
San Ramon, CA 94583 USA
All Rights Reserved.
This product includes software under the Service Component Architecture JavaDoc,
Interface Definition files and XSD files license.
(c) Copyright SCA Collaboration 2006, 2007
This product includes software under the Service Data Objects JavaDoc and
Interface Definition file license
(c) Copyright BEA Systems, Inc., International Business Machines Corporation,
Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
2005, 2006. All rights reserved.

View file

@ -0,0 +1,5 @@
classpath=modules/**
mainClass=org.apache.tuscany.sca.node.NodeMain2
-Djava.util.logging.config.file={TUSCANY_HOME}/samples/logging.properties

View file

@ -0,0 +1,4 @@
classpath=modules/**
-Djava.util.logging.config.file={TUSCANY_HOME}/samples/logging.properties
mainClass=org.apache.tuscany.sca.node.equinox.launcher.NodeLauncher2

View file

@ -0,0 +1,76 @@
REM # Licensed to the Apache Software Foundation (ASF) under one
REM # or more contributor license agreements. See the NOTICE file
REM # distributed with this work for additional information
REM # regarding copyright ownership. The ASF licenses this file
REM # to you under the Apache License, Version 2.0 (the
REM # "License"); you may not use this file except in compliance
REM # with the License. You may obtain a copy of the License at
REM #
REM # http://www.apache.org/licenses/LICENSE-2.0
REM #
REM # Unless required by applicable law or agreed to in writing,
REM # software distributed under the License is distributed on an
REM # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
REM # KIND, either express or implied. See the License for the
REM # specific language governing permissions and limitations
REM # under the License.
@echo off
if "%1"=="/?" goto help
if not "%TUSCANY_HOME%"=="" goto gotHome
SET TUSCANY_HOME=%~dp0\..
if not "%TUSCANY_HOME%"=="" goto gotHome
echo.
echo cannot find TUSCANY_HOME please set TUSCANY_HOME variable to the Tuscany installation dir
echo.
goto error
:gotHome
set _XDEBUG=
if not %1==debug goto skipDebug
set _XDEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
shift
:skipDebug
set _FORK=
if not %1==fork goto skipFork
set _FORK=start
shift
:skipFORK
set _CMD_LINE_ARGS=
:argsLoop
if %1a==a goto doneInit
set _CMD_LINE_ARGS=%_CMD_LINE_ARGS% %1
shift
goto argsLoop
:doneInit
%_FORK% java %_XDEBUG% -jar %TUSCANY_HOME%/bin/launcher.jar %_CMD_LINE_ARGS%
goto end
:help
echo Apache Tuscany SCA runtime launcher
echo TUSCANY [debug] [fork] contributions
echo debug enable Java remote debugging
echo fork start a new command prompt window to run the contributions
echo contributions list of SCA contribution file names seperated by spaces. All
echo deployable composites found in the contributions will be run.
goto end
:error
set ERROR_CODE=1
:end
@endlocal
exit /B %ERROR_CODE%

View file

@ -0,0 +1,4 @@
classpath=modules/**
-Djava.util.logging.config.file={TUSCANY_HOME}/samples/logging.properties
mainClass=[firstArgJarManifestMainClass]

View file

@ -0,0 +1,37 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<relativePath>../pom.xml</relativePath>
<version>2.0-M1</version>
</parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-distribution</artifactId>
<packaging>pom</packaging>
<name>Apache Tuscany SCA Distributions</name>
<modules>
<module>all</module>
</modules>
</project>

View file

@ -0,0 +1,7 @@
grant codeBase "file:/home/continuum/data/working-directory/277/-" {
permission java.security.AllPermission;
};
grant codeBase "file:~/.m2/-" {
permission java.security.AllPermission;
};

View file

@ -0,0 +1,71 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-feature-all</artifactId>
<name>Apache Tuscany SCA All-in-one Feature</name>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature-api</artifactId>
<type>pom</type>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature-core</artifactId>
<type>pom</type>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature-webservice</artifactId>
<type>pom</type>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature-ejava</artifactId>
<type>pom</type>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-launcher</artifactId>
<version>2.0-M1</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,51 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-feature-api</artifactId>
<name>Apache Tuscany SCA API Feature</name>
<packaging>pom</packaging>
<dependencies>
<!-- SCA API -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Node API -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,270 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-feature-core</artifactId>
<name>Apache Tuscany SCA Core Feature</name>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature-api</artifactId>
<type>pom</type>
<version>2.0-M1</version>
</dependency>
<!-- SCA API -->
<!--
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
-->
<!-- Assembly model -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-assembly</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-assembly-xml</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-assembly-xsd</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Bindings -->
<!--dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-corba-runtime</artifactId>
<version>2.0-M1</version>
</dependency-->
<!-- Contribution model -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-contribution</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-contribution-java</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-contribution-namespace</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Core runtime -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-core</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-core-databinding</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-core-spi</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Databindings -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-jaxb</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Data API -->
<!--dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-data-api</artifactId>
<version>2.0-M1</version>
</dependency-->
<!-- Policy definitions -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-definitions-xml</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Domain support -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-endpoint</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Core Extensibility -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-extensibility</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-extensibility-equinox</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Hosts -->
<!--dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-corba-jse</artifactId>
<version>2.0-M1</version>
</dependency-->
<!-- host-http is required by tuscany-implementation-node-runtime -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-http</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Implementation types -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-node-runtime</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Interface models -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-interface-java-xml</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-interface-java-jaxws</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-interface-wsdl-xml</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Node runtime -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-launcher</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-launcher-equinox</artifactId>
<version>2.0-M1</version>
</dependency>
<!--
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-launcher-webapp</artifactId>
<version>2.0-M1</version>
<type>war</type>
</dependency>
-->
<!-- Monitoring -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-monitor</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Policy models -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-policy</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-policy-security</artifactId>
<version>2.0-M1</version>
</dependency>
<!--dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-policy-security-jsr250</artifactId>
<version>2.0-M1</version>
</dependency-->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-policy-xml</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- XMLSchema support -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-xsd</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-xsd-xml</artifactId>
<version>2.0-M1</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,100 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-feature-ejava</artifactId>
<name>Apache Tuscany SCA JEE Feature</name>
<packaging>pom</packaging>
<dependencies>
<!-- Core distribution -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature-core</artifactId>
<type>pom</type>
<version>2.0-M1</version>
</dependency>
<!-- Bindings -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-rmi-runtime</artifactId>
<version>2.0-M1</version>
</dependency>
<!--
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ejb-runtime</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jms-runtime</artifactId>
<version>2.0-M1</version>
</dependency>
-->
<!-- Hosts -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-rmi</artifactId>
<version>2.0-M1</version>
</dependency>
<!--
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-corba-jee</artifactId>
<version>2.0-M1</version>
</dependency>
-->
<!-- Implementations -->
<!--
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-ejb</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-spring</artifactId>
<version>2.0-M1</version>
</dependency>
-->
<!-- Policies -->
<!--
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-policy-transaction</artifactId>
<version>2.0-M1</version>
</dependency>
-->
</dependencies>
</project>

View file

@ -0,0 +1,48 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<relativePath>../pom.xml</relativePath>
<version>2.0-M1</version>
</parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature</artifactId>
<packaging>pom</packaging>
<name>Apache Tuscany SCA Features</name>
<modules>
<module>all</module>
<module>api</module>
<module>core</module>
<module>ejava</module>
<module>webservice</module>
<!--
<module>webapp</module>
<module>manager</module>
<module>process</module>
<module>repository</module>
<module>web20</module>
-->
</modules>
</project>

View file

@ -0,0 +1,133 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-feature-webservice</artifactId>
<name>Apache Tuscany SCA Web Service Feature</name>
<packaging>pom</packaging>
<dependencies>
<!-- Core distribution -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-feature-core</artifactId>
<type>pom</type>
<version>2.0-M1</version>
</dependency>
<!-- Bindings -->
<!--dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-sca-axis2</artifactId>
<version>2.0-M1</version>
</dependency-->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws-axis2</artifactId>
<version>2.0-M1</version>
<exclusions>
<exclusion>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.axis2</groupId>
<artifactId>addressing</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb-codegen</artifactId>
</exclusion>
<exclusion>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk15</artifactId>
</exclusion>
<exclusion>
<groupId>opensaml</groupId>
<artifactId>opensaml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws-wsdlgen</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws-xml</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Databindings -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-axiom</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-jaxb-axiom</artifactId>
<version>2.0-M1</version>
</dependency>
<!--dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-sdo</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-sdo-axiom</artifactId>
<version>2.0-M1</version>
</dependency-->
<!-- Hosts -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-jetty</artifactId>
<version>2.0-M1</version>
</dependency>
<!-- Policy models -->
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-policy-xml-ws</artifactId>
<version>2.0-M1</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,68 @@
<!--
* 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 name="was-integration" default="main" basedir=".">
<property environment="env"/>
<target name="startServer">
<exec dir="." executable="${env.WAS_HOME}/bin/startServer.sh">
<arg value="server1" />
<!--
<arg value="-username" />
<arg value="${sWasUser}" />
<arg value="-password" />
<arg value="${sWasPassword}" />
-->
</exec>
</target>
<target name="stopServer">
<exec dir="." executable="${env.WAS_HOME}/bin/stopServer.sh">
<arg value="server1" />
<!--
<arg value="-username" />
<arg value="${sWasUser}" />
<arg value="-password" />
<arg value="${sWasPassword}" />
-->
</exec>
</target>
<target name="installApplication">
<echo>Installing war ${application.war} on ${application.server} using name ${application.name} and context root ${application.contextRoot} </echo>
<exec dir="." executable="${env.WAS_HOME}/bin/wsadmin.sh">
<arg line="-conntype SOAP -lang jython -f ${was.python.script} installApplicationOnServer ${application.war} ${application.name} ${application.contextRoot} ${application.server}" />
</exec>
<echo>Starting application ${application.name} on ${application.server}</echo>
<exec dir="." executable="${env.WAS_HOME}/bin/wsadmin.sh">
<arg line="-conntype SOAP -lang jython -f ${was.python.script} startApplicationOnServer ${application.name} ${application.server}" />
</exec>
</target>
<target name="uninstallApplication">
<echo>Uninstalling ${application.name} </echo>
<exec dir="." executable="${env.WAS_HOME}/bin/wsadmin.sh">
<arg line="-conntype SOAP -lang jython -f ${was.python.script} uninstallApplicationOnServer ${application.name}" />
</exec>
</target>
</project>

View file

@ -0,0 +1,58 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-itest</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>itest-callback-api</artifactId>
<name>Apache Tuscany SCA Callback API Integration Tests</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<was.ant.script>${basedir}/../build-was-integration.xml</was.ant.script>
<was.python.script>${basedir}/../wasAdmin.py</was.python.script>
</properties>
</project>

View file

@ -0,0 +1,38 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
/**
*
*/
public interface CallBackApiCallBack {
/**
* This function is defined in CallBackApiClientImpl
*/
void callBackMessage(String aString);
/**
* This function is defined in CallBackApiClientImpl
*/
void callBackIncrement(String aString);
}

View file

@ -0,0 +1,30 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface CallBackApiClient {
/**
* This function is defined in CallBackApiClientImpl
*/
void run();
}

View file

@ -0,0 +1,201 @@
/*
* 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.tuscany.sca.test;
import org.junit.Assert;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackApiClient.class)
public class CallBackApiClientImpl implements CallBackApiClient, CallBackApiCallBack {
@Reference
protected CallBackApiService aCallBackService;
private static String returnMessage = null;
private static int callBackCount = 0;
private static Object monitor = new Object();
/**
* This test calls function test 3a,3a1,3b,3c
*/
public void run() {
// This tests basic callback patterns.
// Test3a is the basic callback where the target calls back prior to
// returning to the client.
test3a();
test3a1();
// Test3b is where the target does not call back to the client.
test3b();
// Test3c is where the target calls back multiple times to the client.
test3c();
}
/**
* This test is the basic callback where the target calls back prior to returning to the client.
*/
private void test3a() {
aCallBackService.knockKnock("Knock Knock");
int count = 0;
//
// If we can't get a response in 30 seconds consider this a failure
//
synchronized (monitor) {
while (returnMessage == null && count++ < 30) {
try {
monitor.wait(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage());
}
/**
* This test is the basic callback where the target calls back prior to returning to the client.
*/
private void test3a1() {
aCallBackService.knockKnockByRef("Knock Knock");
int count = 0;
//
// If we can't get a response in 30 seconds consider this a failure
//
synchronized (monitor) {
while (returnMessage == null && count++ < 30) {
try {
monitor.wait(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage());
}
/**
* This test is the basic callback where the target does not call back to the client
*/
private void test3b() {
aCallBackService.noCallBack("No Reply Desired");
Assert.assertEquals("CallBackApiITest - test3b", 1, 1);
}
/**
* This test is the basic callback where the target calls back multiple times to the client
*/
private void test3c() {
aCallBackService.multiCallBack("Call me back 3 times");
int count = 0;
//
// If we can't get a response in 30 seconds consider this a failure
//
synchronized (monitor) {
while (this.getCallBackCount() < 3 && count++ < 30) {
try {
monitor.wait(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Assert.assertEquals("CallBackApiITest - test3c", 3, this.getCallBackCount());
}
/**
* This function returns a string
*
* @param void
* @return String result string
*/
public String getReturnMessage() {
return returnMessage;
}
/**
* This function set the returnMessage string
*
* @param String
*/
public void setReturnMessage(String aReturnMessage) {
returnMessage = aReturnMessage;
}
/**
* This function returns the callBackCount variable
*
* @return Integer callBackCount variable
*/
public int getCallBackCount() {
return callBackCount;
}
/**
* This function increments callBackCount variable by 1
*/
public void incrementCallBackCount() {
callBackCount++;
}
/**
* This function prints a message synched with setReturnMessage function
*
* @param String
*/
public void callBackMessage(String aString) {
System.out.println("Entering callback callBackMessage: " + aString);
synchronized (monitor) {
this.setReturnMessage(aString);
monitor.notify();
}
}
/**
* This function prints a message synched with incrementCallBackCount function
*
* @param String
*/
public void callBackIncrement(String aString) {
System.out.println("Entering callback increment: " + aString);
synchronized (monitor) {
this.incrementCallBackCount();
monitor.notify();
}
}
}

View file

@ -0,0 +1,50 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
@Callback(CallBackApiCallBack.class)
/**
*
*/
public interface CallBackApiService {
/**
* This function is defined in CallBackApiServiceImpl
*/
void knockKnock(String aString);
/**
* This function is defined in CallBackApiServiceImpl
*/
void knockKnockByRef(String aString);
/**
* This function is defined in CallBackApiServiceImpl
*/
void noCallBack(String aString);
/**
* This function is defined in CallBackApiServiceImpl
*/
void multiCallBack(String aString);
}

View file

@ -0,0 +1,113 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.CallableReference;
import org.oasisopen.sca.ComponentContext;
import org.oasisopen.sca.RequestContext;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Context;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackApiService.class)
public class CallBackApiServiceImpl implements CallBackApiService {
@Context
protected ComponentContext componentContext;
/**
* Object of CallBackApiCallBack class
*/
private CallBackApiCallBack callback;
@Callback
protected CallableReference<CallBackApiCallBack> callbackRef;
/**
* This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function and calls the
* callBackMessage function.
*
* @param aString String passed by a function call
*/
public void knockKnock(String aString) {
System.out.println("CallBackApiServiceImpl message received: " + aString);
callback = this.getCallBackInterface();
callback.callBackMessage("Who's There");
System.out.println("CallBackApiServiceImpl response sent");
}
/**
* This function calls the callBackMessage function. <br>
* The reference to this function is received from Call back reference to the class CallBackApiService.
*
* @param aString String passed by a function call
*/
public void knockKnockByRef(String aString) {
System.out.println("CallBackApiServiceImpl message received: " + aString);
callbackRef.getService().callBackMessage("Who's There");
System.out.println("CallBackApiServiceImpl response sent");
}
/**
* This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function. <br>
* This function then places multiple callBack using the callbackIncrement function defined in
* callBack.ApiServiceImpl
*
* @param aString String passed by a function call
*/
public void multiCallBack(String aString) {
callback = this.getCallBackInterface();
System.out.println("CallBackApiServiceImpl message received: " + aString);
callback.callBackIncrement("Who's There 1");
System.out.println("CallBackApiServiceImpl response sent");
callback.callBackIncrement("Who's There 2");
System.out.println("CallBackApiServiceImpl response sent");
callback.callBackIncrement("Who's There 3");
System.out.println("CallBackApiServiceImpl response sent");
}
/**
* This function does not callBack any function.
*
* @param aString String passed by a function call
*/
public void noCallBack(String aString) {
System.out.println("CallBackApiServiceImpl message received: " + aString);
}
/**
* This function get an object of CallBackApiServiceImpl from the present componentContext
*
* @param void
*/
private CallBackApiCallBack getCallBackInterface() {
System.out.println("CallBackApiServiceImpl getting request context");
RequestContext rc = componentContext.getRequestContext();
System.out.println("CallBackApiServiceImpl getting callback from request context");
callback = rc.getCallback();
System.out.println("CallBackApiServiceImpl returning callback");
return callback;
}
}

View file

@ -0,0 +1,33 @@
<?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.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://callback"
name="CallBackApiTest">
<component name="CallBackApiClient">
<implementation.java class="org.apache.tuscany.sca.test.CallBackApiClientImpl"/>
<reference name="aCallBackService" target="CallBackApiService"/>
</component>
<component name="CallBackApiService">
<implementation.java class="org.apache.tuscany.sca.test.CallBackApiServiceImpl"/>
</component>
</composite>

View file

@ -0,0 +1,23 @@
<?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.
-->
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://callback"
xmlns:t="http://callback">
<deployable composite="t:CallBackApiTest" />
</contribution>

View file

@ -0,0 +1,70 @@
/*
* 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.tuscany.sca.test;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class CallBackApiTestCase {
private static Node node;
private CallBackApiClient aCallBackClient;
/**
* This function uses the Instance of CallBackApiClient.class <br>
* This function calls the run function defined in the CallBackApiClinet Interface <br>
* which in turn executes the following test cases. <br>
* 1. Basic callback patterns <br>
* 2. Test in which the target does not call back to the client <br>
* 3. Test in which the target calls back multiple times to the client.
*/
@Test
public void testCallBackBasic() {
aCallBackClient = node.getService(CallBackApiClient.class, "CallBackApiClient");
aCallBackClient.run();
}
/**
* This function creates the Node instance and gets an Instance of CallBackApiClient.class
*/
@BeforeClass
public static void setUp() throws Exception {
if (node == null) {
String location = ContributionLocationHelper.getContributionLocation("CallBackApiTest.composite");
node = NodeFactory.newInstance().createNode("CallBackApiTest.composite", new Contribution("c1", location));
node.start();
}
}
/**
* This function destroys the Node instance that was created in setUp()
*/
@AfterClass
public static void tearDown() throws Exception {
node.stop();
}
}

View file

@ -0,0 +1,58 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-itest</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>itest-callback-basic</artifactId>
<name>Apache Tuscany SCA Callback Basic Integration Tests</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<was.ant.script>${basedir}/../build-was-integration.xml</was.ant.script>
<was.python.script>${basedir}/../wasAdmin.py</was.python.script>
</properties>
</project>

View file

@ -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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
/**
*
*/
public interface CallBackBasicCallBack {
void callBackMessage(String aString);
void callBackIncrement(String aString);
}

View file

@ -0,0 +1,28 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface CallBackBasicClient {
void run();
}

View file

@ -0,0 +1,129 @@
/*
* 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.tuscany.sca.test;
import org.junit.Assert;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackBasicClient.class)
public class CallBackBasicClientImpl implements CallBackBasicClient, CallBackBasicCallBack {
@Reference
protected CallBackBasicService aCallBackService;
private static String returnMessage = null;
private static int callBackCount = 0;
private static Object monitor = new Object();
public void run() {
// This tests basic callback patterns.
// Test1 is the basic callback where the target calls back prior to
// returning to the client.
test1a();
// Test2 is where the target does not call back to the client.
test1b();
// Test3 is where the target calls back multiple times to the client.
test1c();
}
private void test1a() {
aCallBackService.knockKnock("Knock Knock");
int count = 0;
//
// If we can't get a response in 30 seconds consider this a failure
//
synchronized (monitor) {
while (returnMessage == null && count++ < 30) {
try {
monitor.wait(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Assert.assertEquals("CallBackBasicITest - test1a", "Who's There", this.getReturnMessage());
}
private void test1b() {
aCallBackService.noCallBack("No Reply Desired");
Assert.assertEquals("CallBackBasicITest - test1b", 1, 1);
}
private void test1c() {
aCallBackService.multiCallBack("Call me back 3 times");
int count = 0;
//
// If we can't get a response in 30 seconds consider this a failure
//
synchronized (monitor) {
while (this.getCallBackCount() < 3 && count++ < 30) {
try {
monitor.wait(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Assert.assertEquals("CallBackBasicITest - test1c", 3, this.getCallBackCount());
}
public String getReturnMessage() {
return returnMessage;
}
public void setReturnMessage(String aReturnMessage) {
returnMessage = aReturnMessage;
}
public int getCallBackCount() {
return callBackCount;
}
public void incrementCallBackCount() {
callBackCount++;
}
public void callBackMessage(String aString) {
System.out.println("Entering callback callBackMessage: " + aString);
synchronized (monitor) {
this.setReturnMessage(aString);
monitor.notify();
}
}
public void callBackIncrement(String aString) {
System.out.println("Entering callback increment: " + aString);
synchronized (monitor) {
this.incrementCallBackCount();
monitor.notify();
}
}
}

View file

@ -0,0 +1,37 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
@Callback(CallBackBasicCallBack.class)
/**
*
*/
public interface CallBackBasicService {
void knockKnock(String aString);
void noCallBack(String aString);
void multiCallBack(String aString);
}

View file

@ -0,0 +1,56 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackBasicService.class)
public class CallBackBasicServiceImpl implements CallBackBasicService {
@Callback
protected CallBackBasicCallBack callback;
public void knockKnock(String aString) {
System.out.println("CallBackBasicServiceImpl message received: " + aString);
callback.callBackMessage("Who's There");
System.out.println("CallBackBasicServiceImpl response sent");
}
public void multiCallBack(String aString) {
System.out.println("CallBackBasicServiceImpl message received: " + aString);
callback.callBackIncrement("Who's There 1");
System.out.println("CallBackBasicServiceImpl response sent");
callback.callBackIncrement("Who's There 2");
System.out.println("CallBackBasicServiceImpl response sent");
callback.callBackIncrement("Who's There 3");
System.out.println("CallBackBasicServiceImpl response sent");
}
public void noCallBack(String aString) {
System.out.println("CallBackBasicServiceImpl message received: " + aString);
// System.out.println("CallBackBasicServiceImpl No response desired");
}
}

View file

@ -0,0 +1,33 @@
<?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.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://callback"
name="CallBackBasicTest">
<component name="CallBackBasicClient">
<implementation.java class="org.apache.tuscany.sca.test.CallBackBasicClientImpl"/>
<reference name="aCallBackService" target="CallBackBasicService"/>
</component>
<component name="CallBackBasicService">
<implementation.java class="org.apache.tuscany.sca.test.CallBackBasicServiceImpl"/>
</component>
</composite>

View file

@ -0,0 +1,23 @@
<?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.
-->
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://callback"
xmlns:t="http://callback">
<deployable composite="t:CallBackBasicTest" />
</contribution>

View file

@ -0,0 +1,56 @@
/*
* 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.tuscany.sca.test;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class CallBackBasicTestCase {
private static Node node;
private CallBackBasicClient aCallBackClient;
@Test
public void testCallBackBasic() {
aCallBackClient.run();
}
@Before
public void setUp() throws Exception {
if (node == null) {
String location = ContributionLocationHelper.getContributionLocation("CallBackBasicTest.composite");
node = NodeFactory.newInstance().createNode("CallBackBasicTest.composite", new Contribution("c1", location));
node.start();
}
aCallBackClient = node.getService(CallBackBasicClient.class, "CallBackBasicClient");
}
@After
public void tearDown() throws Exception {
node.stop();
}
}

View file

@ -0,0 +1,53 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-itest</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>itest-callback-complex-type</artifactId>
<name>Apache Tuscany SCA Callback Complex Type Integration Tests</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
/**
*
*/
public interface CallBackCTypeCallBack {
void callBackMessage(String aString);
void callBackIncrement(String aString);
}

View file

@ -0,0 +1,28 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface CallBackCTypeClient {
void run();
}

View file

@ -0,0 +1,138 @@
/*
* 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.tuscany.sca.test;
import org.junit.Assert;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackCTypeClient.class)
public class CallBackCTypeClientImpl implements CallBackCTypeClient, CallBackCTypeCallBack {
@Reference
protected CallBackCTypeService aCallBackService;
private static String returnMessage = null;
private static int callBackCount = 0;
private static Object monitor = new Object();
public CallBackCTypeClientImpl() {
}
public void run() {
// This test is the same as the Basic Callback except it uses a
// componentType side file.
// This test currently fails because the integration test environment
// does not properly copy
// the componentType files to the target folder. This is documented in
// Tuscany-967.
// Test12a is the basic callback where the target calls back prior to
// returning to the client.
test12a();
// Test12b is where the target does not call back to the client.
test12b();
// Test12c is where the target calls back multiple times to the client.
test12c();
}
private void test12a() {
aCallBackService.knockKnock("Knock Knock");
int count = 0;
//
// If we can't get a response in 30 seconds consider this a failure
//
synchronized (monitor) {
while (returnMessage == null && count++ < 30) {
try {
monitor.wait(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Assert.assertEquals("CallBackBasicITest - test12a -", "Who's There", this.getReturnMessage());
}
private void test12b() {
aCallBackService.noCallBack("No Reply Desired");
Assert.assertEquals("CallBackBasicITest - test12b -", 1, 1);
}
private void test12c() {
aCallBackService.multiCallBack("Call me back 3 times");
int count = 0;
//
// If we can't get a response in 30 seconds consider this a failure
//
synchronized (monitor) {
while (this.getCallBackCount() < 3 && count++ < 30) {
try {
monitor.wait(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Assert.assertEquals("CallBackBasicITest - test12c -", 3, this.getCallBackCount());
}
public String getReturnMessage() {
return returnMessage;
}
public void setReturnMessage(String aReturnMessage) {
returnMessage = aReturnMessage;
}
public int getCallBackCount() {
return callBackCount;
}
public void incrementCallBackCount() {
callBackCount++;
}
public void callBackMessage(String aString) {
System.out.println("Entering callback callBackMessage: " + aString);
synchronized (monitor) {
this.setReturnMessage(aString);
monitor.notify();
}
}
public void callBackIncrement(String aString) {
System.out.println("Entering callback increment: " + aString);
synchronized (monitor) {
this.incrementCallBackCount();
monitor.notify();
}
}
}

View file

@ -0,0 +1,36 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
// @Callback(CallBackCTypeCallBack.class)
/**
*
*/
public interface CallBackCTypeService {
void knockKnock(String aString);
void noCallBack(String aString);
void multiCallBack(String aString);
}

View file

@ -0,0 +1,59 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackCTypeService.class)
public class CallBackCTypeServiceImpl implements CallBackCTypeService {
@Callback
protected CallBackCTypeCallBack callback;
public CallBackCTypeServiceImpl() {
}
public void knockKnock(String aString) {
System.out.println("CallBackCTypeServiceImpl message received: " + aString);
callback.callBackMessage("Who's There");
System.out.println("CallBackCTypeServiceImpl response sent");
}
public void multiCallBack(String aString) {
System.out.println("CallBackCTypeServiceImpl message received: " + aString);
callback.callBackIncrement("Who's There 1");
System.out.println("CallBackCTypeServiceImpl response sent");
callback.callBackIncrement("Who's There 2");
System.out.println("CallBackCTypeServiceImpl response sent");
callback.callBackIncrement("Who's There 3");
System.out.println("CallBackCTypeServiceImpl response sent");
}
public void noCallBack(String aString) {
System.out.println("CallBackCTypeServiceImpl message received: " + aString);
System.out.println("CallBackCTypeServiceImpl No response desired");
}
}

View file

@ -0,0 +1,33 @@
<?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.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://callback"
name="CallBackCTypeTest">
<component name="CallBackCTypeClient">
<implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeClientImpl"/>
<reference name="aCallBackService" target="CallBackCTypeService"/>
</component>
<component name="CallBackCTypeService">
<implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeServiceImpl"/>
</component>
</composite>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="ASCII"?>
<!--
* 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.
-->
<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" >
<service name="CallBackCTypeService">
<interface.java interface="org.apache.tuscany.sca.test.CallBackCTypeService"
callbackInterface="org.apache.tuscany.sca.test.CallBackCTypeCallBack"/>
</service>
</componentType>

View file

@ -0,0 +1,52 @@
/*
* 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.tuscany.sca.test;
import junit.framework.TestCase;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.After;
import org.junit.Before;
//FIXME Fix this test case
public class CallBackCTypeTestCaseFIXME extends TestCase {
private Node node;
private CallBackCTypeClient aCallBackClient;
public void testCallBackBasic() {
aCallBackClient.run();
}
@Before
public void setUp() throws Exception {
String location = ContributionLocationHelper.getContributionLocation(".composite");
node = NodeFactory.newInstance().createNode("CallBackCTypeClient.composite");
aCallBackClient = node.getService(CallBackCTypeClient.class, "CallBackCTypeClient");
}
@After
public void tearDown() throws Exception {
node.stop();
}
}

View file

@ -0,0 +1,53 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-itest</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>itest-callback-id</artifactId>
<name>Apache Tuscany SCA Callback ID Integration Tests</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,31 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
/**
*
*/
public interface CallBackIdCallBack {
void callBackMessage(String aString);
}

View file

@ -0,0 +1,28 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface CallBackIdClient {
void run();
}

View file

@ -0,0 +1,145 @@
/*
* 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.tuscany.sca.test;
import org.junit.Assert;
import org.oasisopen.sca.ComponentContext;
import org.oasisopen.sca.RequestContext;
import org.oasisopen.sca.ServiceReference;
import org.oasisopen.sca.annotation.Context;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackIdClient.class)
public class CallBackIdClientImpl implements CallBackIdClient, CallBackIdCallBack {
@Context
protected ComponentContext componentContext;
@Reference
protected ServiceReference<CallBackIdService> aCallBackService;
private static String returnMessage = null;
private static Object monitor = new Object();
private static Object callBackId;
public void run() {
// This tests the use of the set/get callbackId API both SCA generated
// and client specified.
// Test1 uses a SCA generated callback ID and compare that with the
// callbackID returned during callback.
test11a();
// Test2 uses a Client specified callback ID and compare that with the
// callbackID returned during callback.
test11b();
}
private void test11a() {
// Retrieve this services callback ID and save it. Once the callback is
// received the callback ID will be compared with the one
// returned. Equal is good.
Object origCallBackId = aCallBackService.getCallbackID();
aCallBackService.getService().knockKnock("Knock Knock - Test1");
int count = 0;
//
// If we cannot get a response in 30 seconds consider this a failure
//
synchronized (monitor) {
while (returnMessage == null && count++ < 30) {
try {
monitor.wait(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Assert.assertEquals("CallBackIdITest - test11a - SCA Generated Id", origCallBackId, this.getCallBackId());
}
private void test11b() {
// Set the services callback ID and save it. Once the callback is
// received the callback ID will be compared with the one
// returned. Equal is good.
String origCallBackId = "CallBackId1";
aCallBackService.setCallbackID(origCallBackId);
aCallBackService.getService().knockKnock("Knock Knock - Test2");
int count = 0;
//
// If we can't get a response in 30 seconds consider this a failure
//
synchronized (monitor) {
while (returnMessage == null && count++ < 30) {
try {
monitor.wait(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Assert
.assertEquals("CallBackIdITest - 11b - Client Specified Id", origCallBackId, (String)this.getCallBackId());
}
public String getReturnMessage() {
return returnMessage;
}
public void setReturnMessage(String aReturnMessage) {
returnMessage = aReturnMessage;
}
public void callBackMessage(String aString) {
System.out.println("Entering callback callBackMessage: " + aString);
RequestContext rc = componentContext.getRequestContext();
Object callBackId = rc.getServiceReference().getCallbackID();
synchronized (monitor) {
this.setReturnMessage(aString);
this.setCallBackId(callBackId);
monitor.notify();
}
}
protected Object getCallBackId() {
return callBackId;
}
protected void setCallBackId(Object aCallBackId) {
callBackId = aCallBackId;
}
}

View file

@ -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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
@Callback(CallBackIdCallBack.class)
/**
*
*/
public interface CallBackIdService {
void knockKnock(String aString);
}

View file

@ -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.tuscany.sca.test;
import org.oasisopen.sca.ComponentContext;
import org.oasisopen.sca.RequestContext;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Context;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackIdService.class)
public class CallBackIdServiceImpl implements CallBackIdService {
@Callback
protected CallBackIdCallBack callback;
@Context
protected ComponentContext compositeContext;
public void knockKnock(String aString) {
System.out.println("CallBackIdServiceImpl message received: " + aString);
RequestContext rc = compositeContext.getRequestContext();
Object callBackId = rc.getServiceReference().getCallbackID();
System.out.println("CallBackIdServiceImpl callbackID: " + callBackId);
callback.callBackMessage("Who's There");
System.out.println("CallBackIdServiceImpl response sent");
}
}

View file

@ -0,0 +1,33 @@
<?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.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://callback"
name="CallBackIdTest">
<component name="CallBackIdClient">
<implementation.java class="org.apache.tuscany.sca.test.CallBackIdClientImpl"/>
<reference name="aCallBackService" target="CallBackIdService"/>
</component>
<component name="CallBackIdService">
<implementation.java class="org.apache.tuscany.sca.test.CallBackIdServiceImpl"/>
</component>
</composite>

View file

@ -0,0 +1,51 @@
/*
* 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.tuscany.sca.test;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class CallBackIdTestCase {
private Node node;
private CallBackIdClient aCallBackClient;
@Test
public void testCallBackBasic() {
aCallBackClient.run();
}
@Before
public void setUp() throws Exception {
String location = ContributionLocationHelper.getContributionLocation("CallBackIdClient.composite");
node = NodeFactory.newInstance().createNode("CallBackIdClient.composite", new Contribution("c1", location));
node.start();
aCallBackClient = node.getService(CallBackIdClient.class, "CallBackIdClient");
}
@After
public void tearDown() throws Exception {
node.stop();
}
}

View file

@ -0,0 +1,53 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-itest</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>itest-callback-multiple-wires</artifactId>
<name>Apache Tuscany SCA Callback With Mutiple Wires Test</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,27 @@
/*
* 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.tuscany.sca.test.callback;
/**
* The client interface
*/
public interface MyClient {
void aClientMethod();
}

View file

@ -0,0 +1,49 @@
/*
* 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.tuscany.sca.test.callback;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Scope;
import org.oasisopen.sca.annotation.Service;
/**
* Demonstrates a component-to-component callback invocation
*/
@Service(MyClient.class)
@Scope("COMPOSITE")
public class MyClientImpl1 implements MyClient, MyServiceCallback {
private MyService myService;
static String result;
@Reference
public void setMyService(MyService myService) {
this.myService = myService;
}
public void aClientMethod() {
myService.someMethod("-> someMethod1");
}
public void receiveResult(String result) {
System.out.println("Work thread " + Thread.currentThread());
System.out.println("Result: " + result);
MyClientImpl1.result = result;
}
}

View file

@ -0,0 +1,49 @@
/*
* 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.tuscany.sca.test.callback;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Scope;
import org.oasisopen.sca.annotation.Service;
/**
* Demonstrates a component-to-component callback invocation
*/
@Service(MyClient.class)
@Scope("COMPOSITE")
public class MyClientImpl2 implements MyClient, MyServiceCallback {
private MyService myService;
static String result;
@Reference
public void setMyService(MyService myService) {
this.myService = myService;
}
public void aClientMethod() {
myService.someMethod("-> someMethod2");
}
public void receiveResult(String result) {
System.out.println("Work thread " + Thread.currentThread());
System.out.println("Result: " + result);
MyClientImpl2.result = result;
}
}

View file

@ -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.tuscany.sca.test.callback;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.OneWay;
/**
* This service that will be invoked in a non-blocking fashion
*/
@Callback(MyServiceCallback.class)
public interface MyService {
@OneWay
void someMethod(String arg);
}

View file

@ -0,0 +1,27 @@
/*
* 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.tuscany.sca.test.callback;
/**
* The callback interface for {@link MyService}.
*/
public interface MyServiceCallback {
void receiveResult(String result);
}

View file

@ -0,0 +1,45 @@
/*
* 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.tuscany.sca.test.callback;
import org.oasisopen.sca.RequestContext;
import org.oasisopen.sca.annotation.Context;
import org.oasisopen.sca.annotation.Scope;
import org.oasisopen.sca.annotation.Service;
/**
* This class implements MyService and uses a callback.
*/
@Service(MyService.class)
@Scope("COMPOSITE")
public class MyServiceImpl implements MyService {
@Context
protected RequestContext requestContext;
public void someMethod(String arg) {
// invoke the callback
try {
MyServiceCallback myServiceCallback = requestContext.getCallback();
myServiceCallback.receiveResult(arg + " -> receiveResult");
} catch (RuntimeException e) {
System.out.println("RuntimeException invoking receiveResult: " + e.toString());
}
}
}

View file

@ -0,0 +1,38 @@
<?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.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://callback"
name="CallbackMultiWireTest">
<component name="MyClientComponent1">
<implementation.java class="org.apache.tuscany.sca.test.callback.MyClientImpl1"/>
<reference name="myService" target="MyServiceComponent"/>
</component>
<component name="MyClientComponent2">
<implementation.java class="org.apache.tuscany.sca.test.callback.MyClientImpl2"/>
<reference name="myService" target="MyServiceComponent"/>
</component>
<component name="MyServiceComponent">
<implementation.java class="org.apache.tuscany.sca.test.callback.MyServiceImpl"/>
</component>
</composite>

View file

@ -0,0 +1,64 @@
/*
* 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.tuscany.sca.test.callback;
import static org.junit.Assert.assertEquals;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* A TestCase that demonstrates resolving the client service and initiating the callback sequence
*/
public class CallbackMultiWireTestCase {
private Node node;
private MyClient myClient1;
private MyClient myClient2;
@Before
public void setUp() throws Exception {
String location = ContributionLocationHelper.getContributionLocation("CallbackMultiWireTest.composite");
node = NodeFactory.newInstance().createNode("CallbackMultiWireTest.composite", new Contribution("c1", location));
node.start();
myClient1 = node.getService(MyClient.class, "MyClientComponent1");
myClient2 = node.getService(MyClient.class, "MyClientComponent2");
}
@After
public void tearDown() throws Exception {
node.stop();
}
@Test
public void test() throws Exception {
System.out.println("Main thread " + Thread.currentThread());
myClient1.aClientMethod();
myClient2.aClientMethod();
System.out.println("Sleeping ...");
Thread.sleep(300);
assertEquals("-> someMethod1 -> receiveResult", MyClientImpl1.result);
assertEquals("-> someMethod2 -> receiveResult", MyClientImpl2.result);
}
}

View file

@ -0,0 +1,53 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-itest</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>itest-callback-separatethread</artifactId>
<name>Apache Tuscany SCA Callback Using Separate Thread Integration Tests</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,34 @@
/*
* 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.tuscany.sca.itest;
import org.oasisopen.sca.annotation.Remotable;
/**
* This is the client interface for the call backs in a separate thread tests
*/
@Remotable
public interface CallBackSeparateThreadClient {
/**
* This tests call back patterns using separate threads.
*/
void runTests();
}

View file

@ -0,0 +1,186 @@
/*
* 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.tuscany.sca.itest;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Assert;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Service;
/**
* This is the client implementation for the call backs in a separate thread tests
*/
@Service(CallBackSeparateThreadClient.class)
public class CallBackSeparateThreadClientImpl implements CallBackSeparateThreadClient, EventProcessorCallBack {
/**
* Max time to wait to receive events. If not all the events are received then timeout.
*/
private static final int TIMEOUT = 30 * 1000;
/**
* Counts the number of fast call backs.
*/
private static final AtomicInteger FAST_CALLBACK_COUNT = new AtomicInteger();
/**
* Counts the number of slow call backs.
*/
private static final AtomicInteger SLOW_CALLBACK_COUNT = new AtomicInteger();
/**
* This is our injected reference to the EventProcessorService
*/
@Reference
protected EventProcessorService aCallBackService;
/**
* This tests call back patterns using separate threads.
*/
public void runTests() {
try {
// Register for fast call back
registerForFastCallback();
// Wait for a few fast call backs
System.out.println("Waiting for some fast call backs");
waitForSomeFastCallbacks();
try {
// Register for slow call back
registerForSlowCallback();
// Wait for a few fast call backs
System.out.println("Waiting for some fast calls");
waitForSomeFastCallbacks();
// Wait for a few slow call backs
System.out.println("Waiting for some slow calls");
waitForSomeSlowCallbacks();
} finally {
unregisterForSlowCallback();
}
System.out.println("Done");
} finally {
unregisterForFastCallback();
}
}
/**
* Waits for some fast call backs to be fired
*/
private void waitForSomeFastCallbacks() {
// Reset the fast call back count
FAST_CALLBACK_COUNT.set(0);
// Wait until we have 10 fast call backs or timeout occurs
final long start = System.currentTimeMillis();
do {
if (FAST_CALLBACK_COUNT.get() >= 10) {
System.out.println("Received enough fast notifications");
return;
}
try {
Thread.sleep(5);
} catch (InterruptedException e) {
Assert.fail("Unexpeceted exception " + e);
}
} while (System.currentTimeMillis() - start < TIMEOUT);
// If we get to here then we did not receive enough events
Assert.fail("Did not receive enough fast events");
}
/**
* Waits for some slow call backs to be fired
*/
private void waitForSomeSlowCallbacks() {
// Reset the slow call back count
SLOW_CALLBACK_COUNT.set(0);
// Wait until we have 4 slow call backs or timeout
final long start = System.currentTimeMillis();
do {
if (SLOW_CALLBACK_COUNT.get() >= 4) {
System.out.println("Received enough slow notifications");
return;
}
try {
Thread.sleep(5);
} catch (InterruptedException e) {
Assert.fail("Unexpeceted exception " + e);
}
} while (System.currentTimeMillis() - start < TIMEOUT);
// If we get to here then we did not receive enough events
Assert.fail("Did not receive enough slow events");
}
/**
* Register to receive fast call backs
*/
private void registerForFastCallback() {
aCallBackService.registerForEvent("FAST");
}
/**
* Register to receive slow call backs
*/
private void registerForSlowCallback() {
aCallBackService.registerForEvent("SLOW");
}
/**
* Unregister to receive fast call backs
*/
private void unregisterForFastCallback() {
aCallBackService.unregisterForEvent("FAST");
}
/**
* Unregister to receive slow call backs
*/
private void unregisterForSlowCallback() {
aCallBackService.unregisterForEvent("SLOW");
}
/**
* Method that is called when an Event is delivered.
*
* @param aEventName The name of the Event
* @param aEventData The Event data
*/
public void eventNotification(String aEventName, Object aEventData) {
// System.out.println("Received Event : " + aEventName + " " + aEventData);
if (aEventName.equals("FAST")) {
final int newValue = FAST_CALLBACK_COUNT.incrementAndGet();
//System.out.println("Received total of " + newValue + " fast call backs");
} else if (aEventName.equals("SLOW")) {
final int newValue = SLOW_CALLBACK_COUNT.incrementAndGet();
//System.out.println("Received total of " + newValue + " slow call backs");
} else {
System.out.println("Unknown event type of " + aEventName);
}
}
}

View file

@ -0,0 +1,37 @@
/*
* 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.tuscany.sca.itest;
import org.oasisopen.sca.annotation.Remotable;
/**
* The call back interface for the EventProcessorService that is implemented
* by the client to receive event notifications
*/
@Remotable
public interface EventProcessorCallBack {
/**
* Call back notifying client of an Event
*
* @param aEventName The name of the Event
* @param aEventData The data for the Event
*/
void eventNotification(String aEventName, Object aEventData);
}

View file

@ -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.tuscany.sca.itest;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Conversational;
import org.oasisopen.sca.annotation.Remotable;
/**
* Sample Event Processor Service
*/
@Conversational
@Callback(EventProcessorCallBack.class)
@Remotable
public interface EventProcessorService {
/**
* Registers the client to receive notifications for the specified event
*
* @param aEventName The name of the Event to register
*/
void registerForEvent(String aEventName);
/**
* Unregisters the client so it no longer receives notifications for the specified event
*
* @param aEventName The name of the Event to unregister
*/
void unregisterForEvent(String aEventName);
}

View file

@ -0,0 +1,195 @@
/*
* 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.tuscany.sca.itest;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.oasisopen.sca.CallableReference;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Destroy;
import org.oasisopen.sca.annotation.Scope;
import org.oasisopen.sca.annotation.Service;
/**
* Sample Event Processor Service Implementation
*/
@Service(EventProcessorService.class)
@Scope("CONVERSATION")
public class EventProcessorServiceImpl implements EventProcessorService {
/**
* Reference to the call back
*/
@Callback
protected CallableReference<EventProcessorCallBack> clientCallback;
/**
* This map contains the call backs for each of the registered Event names
*/
private final Map<String, CallableReference<EventProcessorCallBack>> eventListeners;
/**
* The list of all Event Generators we create
*/
private final EventGenerator[] allEventGenerators;
/**
* Constructor. Starts the Event Generators
*/
public EventProcessorServiceImpl() {
eventListeners = new ConcurrentHashMap<String, CallableReference<EventProcessorCallBack>>();
// We will simulate an Event generator
allEventGenerators = new EventGenerator[2];
allEventGenerators[0] = new EventGenerator("FAST", 10); // Generate the FAST event every 10ms
allEventGenerators[1] = new EventGenerator("SLOW", 50); // Generate the SLOW event every 50ms
}
/**
* Registers the client to receive notifications for the specified event
*
* @param aEventName The name of the Event to register
*/
public void registerForEvent(String aEventName) {
// Register for the Event
eventListeners.put(aEventName, clientCallback);
// Send the "register" started event to the client
receiveEvent(aEventName, "SameThread: Registered to receive notifications for " + aEventName);
}
/**
* Unregisters the client so it no longer receives notifications for the specified event
*
* @param aEventName The name of the Event to unregister
*/
public void unregisterForEvent(String aEventName) {
// Send the "register" started event to the client
receiveEvent(aEventName, "SameThread: Unregister from receiving notifications for " + aEventName);
eventListeners.remove(aEventName);
}
/**
* This method is called whenever the EventProcessorService receives an Event
*
* @param aEventName The name of the Event received
* @param aEventData The Event data
*/
private void receiveEvent(String aEventName, Object aEventData) {
// Get the listener for the Event
final CallableReference<EventProcessorCallBack> callback = eventListeners.get(aEventName);
if (callback == null) {
//System.out.println("No registered listeners for " + aEventName);
return;
}
// Trigger the call back
// System.out.println("Notifying " + callback + " of event " + aEventName);
callback.getService().eventNotification(aEventName, aEventData);
// System.out.println("Done notify " + callback + " of event " + aEventName);
}
/**
* Shuts down the Event Processor
*/
@Destroy
public void shutdown() {
System.out.println("Shutting down the EventProcessor");
// Clear list of call back locations as we don't want to send any more notifications
eventListeners.clear();
// Stop the Event Generators
for (EventGenerator generator : allEventGenerators) {
generator.stop();
}
}
/**
* Utility class for generating Events
*/
private final class EventGenerator {
/**
* The Timer we are using to generate the events
*/
private final Timer timer = new Timer();
/**
* Lock object to ensure that we can cancel the timer cleanly.
*/
private final Object lock = new Object();
/**
* Constructor
*
* @param aEventName The name of the Event to generate
* @param frequencyInMilliseconds How frequently we should generate the Events
*/
private EventGenerator(String aEventName, int frequencyInMilliseconds) {
timer.schedule(new EventGeneratorTimerTask(aEventName),
frequencyInMilliseconds,
frequencyInMilliseconds);
}
/**
* Stop this Event Generator
*/
private void stop() {
synchronized (lock) {
timer.cancel();
}
}
/**
* The TimerTask that is invoked by the Timer for the EventGenerator
*/
private final class EventGeneratorTimerTask extends TimerTask {
/**
* The name of the Event we should generate
*/
private final String eventName;
/**
* Constructor
*
* @param aEventName The name of the Event we should generate
*/
private EventGeneratorTimerTask(String aEventName) {
eventName = aEventName;
}
/**
* Timer calls this method and it will generate an Event
*/
public void run() {
synchronized(lock) {
// System.out.println("Generating new event " + eventName);
receiveEvent(eventName, "Separate Thread Notification: " + UUID.randomUUID().toString());
}
}
}
}
}

View file

@ -0,0 +1,31 @@
<?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.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://callback" name="CallBackSeparateThreadTest">
<component name="CallBackSeparateThreadClient">
<implementation.java class="org.apache.tuscany.sca.itest.CallBackSeparateThreadClientImpl"/>
<reference name="aCallBackService" target="EventProcessorService"/>
</component>
<component name="EventProcessorService">
<implementation.java class="org.apache.tuscany.sca.itest.EventProcessorServiceImpl"/>
</component>
</composite>

View file

@ -0,0 +1,73 @@
/*
* 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.tuscany.sca.itest;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* This test case will attempt to trigger a call back using a separate thread
*/
public class CallBackSeparateThreadTestCase {
/**
* The Node we are using
*/
private Node node;
/**
* The client the tests should use
*/
private CallBackSeparateThreadClient aCallBackClient;
/**
* Run the call back in separate thread tests
*/
@Test
public void testCallBackSeparateThread() {
aCallBackClient.runTests();
}
/**
* Load the Call back in separate thread composite and look up the client.
*/
@Before
public void setUp() throws Exception {
String location = ContributionLocationHelper.getContributionLocation("CallBackSeparateThreadTest.composite");
node = NodeFactory.newInstance().createNode("CallBackSeparateThreadTest.composite", new Contribution("c1", location));
node.start();
aCallBackClient = node.getService(CallBackSeparateThreadClient.class, "CallBackSeparateThreadClient");
}
/**
* Shutdown the SCA node
*/
@After
public void tearDown() throws Exception {
node.stop();
}
}

View file

@ -0,0 +1,53 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-itest</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>itest-callback-set-callback</artifactId>
<name>Apache Tuscany SCA Set Callback Integration Tests</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,34 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Callback;
// @Remotable
@Callback(CallBackSetCallbackCallback.class)
/**
*
*/
public interface CallBackSetCalbackService {
void knockKnock(String aString);
boolean setCallbackIllegally(String aString);
}

View file

@ -0,0 +1,37 @@
/*
* 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.tuscany.sca.test;
import org.junit.Assert;
public class CallBackSetCallbackBadCallback {
public CallBackSetCallbackBadCallback() {
super();
}
public void callback(String aString) {
//
// This callback method should never be called.
//
System.out.println("CallBackSetCallbackBadCallback: callback called");
Assert.fail("CallBackSetCallbackBadCallback: callback called");
}
}

View file

@ -0,0 +1,31 @@
/*
* 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.tuscany.sca.test;
// @Remotable
/**
*
*/
public interface CallBackSetCallbackCallback {
void callBackMessage(String aString);
void callBackIncrement(String aString);
}

View file

@ -0,0 +1,66 @@
/*
* 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.tuscany.sca.test;
import java.io.File;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackSetCallbackCallback.class)
public class CallBackSetCallbackCallbackImpl implements CallBackSetCallbackCallback {
private static String returnMessage = null;
private static int callBackCount = 0;
public String getReturnMessage() {
return returnMessage;
}
public void setReturnMessage(String aReturnMessage) {
returnMessage = aReturnMessage;
}
public int getCallBackCount() {
return callBackCount;
}
public void incrementCallBackCount() {
callBackCount++;
}
public void callBackMessage(String aString) {
System.out.println("Entering CallBackSetCallbackCallbackImpl callBackMessage: " + aString);
File aFile = new File("target/test4_marker");
try {
aFile.createNewFile();
} catch (Exception ex) {
System.out.println("Error Creating target/test4_marker marker file");
ex.printStackTrace();
}
}
public void callBackIncrement(String aString) {
System.out.println("Entering callback increment: " + aString);
this.incrementCallBackCount();
}
}

View file

@ -0,0 +1,28 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface CallBackSetCallbackClient {
void run();
}

View file

@ -0,0 +1,188 @@
/*
* 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.tuscany.sca.test;
import java.io.File;
import org.junit.Assert;
import org.oasisopen.sca.NoRegisteredCallbackException;
import org.oasisopen.sca.ServiceReference;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackSetCallbackClient.class)
public class CallBackSetCallbackClientImpl implements CallBackSetCallbackClient {
@Reference
protected ServiceReference<CallBackSetCalbackService> aCallBackService;
@Reference
protected ServiceReference<CallBackSetCallbackCallback> callBack;
public void run() {
// This test various aspects of the setCallback() API in a stateless
// scope.
/*
* test4 Client does not implement the callback interface but calls
* setCallback with a service reference before invoking the target,
* Verify successful execution.
*/
test4();
/*
* test5 The client does not implement the callback interface and does
* not call setCallback() before invoking the target. Verify a
* NoRegisteredCallbackException is thrown.
*/
test5();
/*
* test6() The client calls setCallback() with an object that is not a
* service reference and the callback interface is stateless. Verify
* that an appropriate exception is thrown. When calling setCallback
* with an object the interface must be stateful. Stateless interfaces
* require a service Reference.
*/
test6();
/*
* test10 The target calls setCallback() on its own service reference,
* e.g. getRequestContext().getServiceReference().getCallback(). Verify
* an appropriate exception occurs.
*/
test10();
}
private void test4() {
//
// Since callbacks do not synchronously return and this test results in
// a callback to a component other
// than this client I am using a marker file to determine the outcome.
// The presence of the marker
// file will be used for the Assertion test. If it exists then the
// callback occurred and all is good.
//
// Make sure the marker file is not present before starting the test.
File aFile = new File("target/test4_marker");
if (aFile.exists()) {
aFile.delete();
}
aCallBackService.setCallback(callBack);
aCallBackService.getService().knockKnock("Knock Knock");
// Lets give the callback a little time to complete....
int count = 0;
long timeout = 1000;
while (count++ < 30 && (aFile.exists() == false)) {
try {
Thread.sleep(timeout);
} catch (InterruptedException ie) {
}
}
Assert.assertEquals("CallBackSetCallback - Test4", true, aFile.exists());
aCallBackService.setCallback(null); // leave this in the default state for next test
}
private void test5() {
boolean correctException = false;
//
// The backend service is expecting a callback reference to be set. This
// test will not
// set one so an exception is expected. According to the spec if a
// client calls a method on
// a service reference prior to calling setCallback() then a
// NoRegisteredCallbackException
// will be thrown on the client.
//
try {
aCallBackService.getService().knockKnock("Knock Knock");
} catch (NoRegisteredCallbackException NotRegEx) {
correctException = true;
} catch (Exception ex) {
ex.printStackTrace();
}
Assert.assertEquals("CallBackSetCallback - Test5", true, correctException);
}
private void test6() {
boolean correctException = false;
//
// This test is to specify an Object that is not a service reference
// that does implement
// the callback interface. However because this callback service is
// stateless the expected
// result is an appropriate exception.
//
try {
aCallBackService.setCallback(new CallBackSetCallbackObjectCallback());
aCallBackService.getService().knockKnock("Knock Knock");
}
//
// This should catch an appropriate exception.
//
catch (IllegalArgumentException goodEx) {
correctException = true;
} catch (Exception ex) {
ex.printStackTrace();
}
Assert.assertEquals("CallBackSetCallback - Test6", true, correctException);
}
private void test10() {
//
// The appropriate exception should be thrown and caught on the service side.
// If this happens, the setCallbackIllegally() method will return true.
// If not, this method will return false.
//
aCallBackService.setCallback(callBack); // ensure no client-side exception
boolean result =
aCallBackService.getService().setCallbackIllegally("Try to set callback on your own service reference");
Assert.assertEquals("CallBackSetCallback - Test10", true, result);
}
}

View file

@ -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.tuscany.sca.test;
public class CallBackSetCallbackObjectCallback implements CallBackSetCallbackCallback {
private int callBackCount = 0;
public CallBackSetCallbackObjectCallback() {
super();
}
public void incrementCallBackCount() {
callBackCount++;
}
public void callBackMessage(String aString) {
System.out.println("Entering CallBackSetCallbackObjectCallback callBackMessage: " + aString);
}
public void callBackIncrement(String aString) {
System.out.println("Entering callback increment: " + aString);
this.incrementCallBackCount();
}
}

View file

@ -0,0 +1,73 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.ComponentContext;
import org.oasisopen.sca.RequestContext;
import org.oasisopen.sca.ServiceReference;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Context;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackSetCalbackService.class)
public class CallBackSetCallbackServiceImpl implements CallBackSetCalbackService {
@Callback
protected CallBackSetCallbackCallback callback;
@Context
protected ComponentContext context;
public void knockKnock(String aString) {
try {
System.out.println("CallBackBasicServiceImpl message received: " + aString);
callback.callBackMessage("Who's There");
System.out.println("CallBackBasicServiceImpl response sent");
return;
} catch (Exception ex) {
ex.printStackTrace();
}
}
public boolean setCallbackIllegally(String aString) {
System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() message received: " + aString);
boolean exceptionProduced = false;
RequestContext requestContext = null;
ServiceReference serviceRef = null;
try {
requestContext = context.getRequestContext();
serviceRef = (ServiceReference)requestContext.getServiceReference();
serviceRef.setCallback(serviceRef);
} catch (ClassCastException goodEx) {
exceptionProduced = true;
System.out.println("Test10 appropriate exception caught during setCallback to own service reference");
} catch (Exception badEx) {
System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() " + badEx.toString());
badEx.printStackTrace();
}
// Return a flag indicating whether we got the exception we are looking for
return exceptionProduced;
}
}

View file

@ -0,0 +1,37 @@
<?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.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://callback"
name="CallBackSetCallbackTest">
<component name="CallBackSetCallbackClient">
<implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackClientImpl"/>
<reference name="aCallBackService" target="CallBackSetCallbackService"/>
<reference name="callBack" target="CallBackSetCallbackCallback"/>
</component>
<component name="CallBackSetCallbackCallback">
<implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackCallbackImpl"/>
</component>
<component name="CallBackSetCallbackService">
<implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackServiceImpl"/>
</component>
</composite>

View file

@ -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.tuscany.sca.test;
import junit.framework.TestCase;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.ContributionLocationHelper;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.After;
import org.junit.Before;
//FIXME Fix this test case
public class CallBackSetCallbackTestCase extends TestCase {
private Node node;
private CallBackSetCallbackClient aCallBackClient;
public void testCallBackSetCallback() {
aCallBackClient.run();
}
@Before
public void setUp() throws Exception {
String location = ContributionLocationHelper.getContributionLocation("CallBackSetCallbackTest.composite");
node =
NodeFactory.newInstance().createNode("CallBackSetCallbackTest.composite", new Contribution("c1", location));
node.start();
aCallBackClient = node.getService(CallBackSetCallbackClient.class, "CallBackSetCallbackClient");
}
@After
public void tearDown() throws Exception {
node.stop();
}
}

View file

@ -0,0 +1,53 @@
<?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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-itest</artifactId>
<version>2.0-M1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>itest-callback-set-conversation</artifactId>
<name>Apache Tuscany SCA Callback Set Conversation Integration Tests</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-api</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,39 @@
/*
* 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.tuscany.sca.test;
import java.io.Serializable;
import org.junit.Assert;
public class CallBackSetCallbackConvBadCallback implements Serializable {
public CallBackSetCallbackConvBadCallback() {
super();
}
public void callback(String aString) {
//
// This callback method should never be called.
//
System.out.println("CallBackSetCallbackBadCallback: callback called");
Assert.fail("CallBackSetCallbackConvBadCallback: callback called");
}
}

View file

@ -0,0 +1,34 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Conversational;
// @Remotable
@Conversational
/**
*
*/
public interface CallBackSetCallbackConvCallback {
void callBackMessage(String aString);
void callBackIncrement(String aString);
}

View file

@ -0,0 +1,28 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface CallBackSetCallbackConvClient {
void run();
}

View file

@ -0,0 +1,157 @@
/*
* 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.tuscany.sca.test;
import org.junit.Assert;
import org.oasisopen.sca.ComponentContext;
import org.oasisopen.sca.ServiceReference;
import org.oasisopen.sca.annotation.Context;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Scope;
import org.oasisopen.sca.annotation.Service;
@Service(CallBackSetCallbackConvClient.class)
@Scope("CONVERSATION")
public class CallBackSetCallbackConvClientImpl implements CallBackSetCallbackConvClient {
@Context
protected ComponentContext componentContext;
@Reference
protected CallBackSetCallbackConvService aCallBackService;
private CallBackSetCallbackConvObjectCallback aCallbackObject = null;
public void run() {
// This tests aspects of the setCallback() API within a conversational
// scope.
/*
* test7 The client calls setCallback() with an object that is not a
* service reference and the callback interface is stateful. Verify
* successful execution.
*/
test7();
/*
* test8() The client calls setCallback() with an object that does not
* implement the callback interface. Verify an appropriate exception is
* thrown. This requires a STATEFUL interface.
*/
test8();
/*
* test9 The client calls setCallback() with an object that is not
* Serializable. Verify an appropriate exception is thrown. This
* requires a STATEFUL callback interface. Move from the stateless test
* case.
*/
test9();
}
private void test7() {
//
// This test is to specify an Object that is not a service reference
// that does implement
// the callback interface and is Serializable. Verify successful
// execution.
//
aCallbackObject = new CallBackSetCallbackConvObjectCallback();
aCallbackObject.incrementCallBackCount();
ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef = componentContext.cast(aCallBackService);
aCallBackServiceRef.setCallback(aCallbackObject);
aCallBackService.knockKnock("Knock Knock 7");
Assert.assertEquals("CallBackSetCallbackConv - Test7", 2, aCallbackObject.getCount());
}
private void test8() {
boolean correctException = false;
//
// This test is to specify an Object that is not a service reference
// that does not implement
// the callback interface. The expected result is an appropriate
// exception.
//
try {
ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef =
componentContext.cast(aCallBackService);
aCallBackServiceRef.setCallback(new CallBackSetCallbackConvBadCallback());
aCallBackService.knockKnock("Knock Knock 8");
}
//
// This should catch an appropriate exception.
//
catch (IllegalArgumentException goodEx) {
System.out.println("correct exception " + goodEx);
correctException = true;
}
catch (Exception ex) {
// This means an inappropriate exception occurred
ex.printStackTrace();
}
Assert.assertEquals("CallBackSetCallbackConv - Test8", true, correctException);
}
private void test9() {
boolean correctException = false;
//
// This test is to specify an Object that is not a service reference
// that does implement
// the callback interface but does not implement Serializable. Verify
// an appropriate exception
// is thrown.
//
try {
ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef =
componentContext.cast(aCallBackService);
aCallBackServiceRef.setCallback(new CallBackSetCallbackConvNonSerCallback());
aCallBackService.knockKnock("Knock Knock 9");
}
//
// This should catch an appropriate exception.
//
catch (IllegalArgumentException goodEx) {
System.out.println("correct exception " + goodEx);
correctException = true;
} catch (Exception ex) {
ex.printStackTrace();
}
Assert.assertEquals("CallBackSetCallbackConv - Test9", true, correctException);
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.tuscany.sca.test;
import org.junit.Assert;
public class CallBackSetCallbackConvNonSerCallback implements CallBackSetCallbackConvCallback {
private int callBackCount = 0;
public CallBackSetCallbackConvNonSerCallback() {
super();
}
public synchronized void incrementCallBackCount() {
callBackCount++;
}
public synchronized int getCount() {
return callBackCount;
}
public void callBackMessage(String aString) {
//
// This callback method should never be called.
//
System.out.println("Entering CallBackSetCallbackConvNonSerCallback callBackMessage: " + aString);
Assert.fail("CallBackSetCallbackConvNonSerCallback: callbackMessage called");
}
public void callBackIncrement(String aString) {
//
// This callback method should never be called.
//
System.out.println("Entering callbackIncrement: " + aString);
this.incrementCallBackCount();
Assert.fail("CallBackSetCallbackConvNonSerCallback: callbackIncrement called");
}
}

View file

@ -0,0 +1,51 @@
/*
* 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.tuscany.sca.test;
import java.io.Serializable;
public class CallBackSetCallbackConvObjectCallback implements CallBackSetCallbackConvCallback, Serializable {
private int callBackCount = 0;
public CallBackSetCallbackConvObjectCallback() {
super();
}
public synchronized void incrementCallBackCount() {
callBackCount++;
}
public synchronized int getCount() {
return callBackCount;
}
public void callBackMessage(String aString) {
System.out.println("Entering CallBackSetCallbackObjectCallback callBackMessage: " + aString);
}
public void callBackIncrement(String aString) {
System.out.println("Entering callback increment: " + aString);
this.incrementCallBackCount();
}
}

View file

@ -0,0 +1,36 @@
/*
* 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.tuscany.sca.test;
import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Conversational;
// @Remotable
@Conversational
@Callback(CallBackSetCallbackConvCallback.class)
/**
*
*/
public interface CallBackSetCallbackConvService {
void knockKnock(String aString);
void setCallbackIllegally(String aString);
}

Some files were not shown because too many files have changed in this diff Show more