You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by fm...@apache.org on 2011/07/08 06:02:28 UTC
svn commit: r1144149 - in
/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src:
main/java/org/apache/tuscany/sca/binding/websocket/runtime/
test/java/registration/ test/java/salutes/ test/java/sample/
test/java/test/ test/resources/
Author: fmoga
Date: Fri Jul 8 04:02:26 2011
New Revision: 1144149
URL: http://svn.apache.org/viewvc?rev=1144149&view=rev
Log:
Add test to demonstrate data conversion to/from JSON. Fix bug in the JSON array parser. Refactor salutes test.
Added:
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Address.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Confirmation.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Person.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationClient.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationService.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationServiceImpl.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/
- copied from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoServiceImpl.java
- copied, changed from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/CiaoImpl.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloServiceImpl.java
- copied, changed from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/HelloImpl.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutServiceImpl.java
- copied, changed from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/SalutImpl.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/RegistrationWebsocketBindingTestCase.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/SalutesWebsocketBindingTestCase.java
- copied, changed from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/WebsocketBindingTestCase.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/registration.composite
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/salutes.composite
- copied, changed from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/test.composite
Removed:
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoImpl.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloImpl.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutImpl.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/WebsocketBindingTestCase.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/test.composite
Modified:
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoService.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/Client.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloService.java
tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutService.java
Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java?rev=1144149&r1=1144148&r2=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java Fri Jul 8 04:02:26 2011
@@ -49,6 +49,7 @@ public class JSONUtil {
List<String> objects = new ArrayList<String>();
int bracketNum = 0;
int parNum = 0;
+ int quoteNum = 0;
int startPos = 1;
for (int i = 0; i < jsonArray.length(); i++) {
switch (jsonArray.charAt(i)) {
@@ -64,8 +65,11 @@ public class JSONUtil {
case ']':
parNum--;
break;
+ case '\"':
+ quoteNum++;
+ break;
case ',':
- if ((bracketNum == 0) && (parNum == 1)) {
+ if ((bracketNum == 0) && (parNum == 1) && quoteNum % 2 == 0) {
objects.add(jsonArray.substring(startPos, i));
startPos = i + 1;
}
Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java?rev=1144149&r1=1144148&r2=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java Fri Jul 8 04:02:26 2011
@@ -85,7 +85,6 @@ public class WebsocketServiceBindingProv
}
}
websocketServers.clear();
- websocketServers = null;
}
}
Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Address.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Address.java?rev=1144149&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Address.java (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Address.java Fri Jul 8 04:02:26 2011
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package registration;
+
+public class Address {
+
+ private String street;
+ private String city;
+ private int zip;
+
+ public Address() {
+ }
+
+ public Address(String street, String city, int zip) {
+ this.street = street;
+ this.city = city;
+ this.zip = zip;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public int getZip() {
+ return zip;
+ }
+
+ public void setZip(int zip) {
+ this.zip = zip;
+ }
+
+}
Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Confirmation.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Confirmation.java?rev=1144149&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Confirmation.java (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Confirmation.java Fri Jul 8 04:02:26 2011
@@ -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 registration;
+
+public class Confirmation {
+
+ private String message;
+ private int messageLength;
+
+ public Confirmation() {
+ }
+
+ public Confirmation(String confirmationMessage, int messageLength) {
+ this.message = confirmationMessage;
+ this.messageLength = messageLength;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String confirmationMessage) {
+ this.message = confirmationMessage;
+ }
+
+ public int getMessageLength() {
+ return messageLength;
+ }
+
+ public void setMessageLength(int messageLength) {
+ this.messageLength = messageLength;
+ }
+
+}
Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Person.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Person.java?rev=1144149&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Person.java (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/Person.java Fri Jul 8 04:02:26 2011
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package registration;
+
+public class Person {
+
+ private String name;
+ private Address address;
+ private long ssn;
+
+ public Person() {
+ }
+
+ public Person(String name, Address address, long ssn) {
+ this.name = name;
+ this.address = address;
+ this.ssn = ssn;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+
+ public long getSsn() {
+ return ssn;
+ }
+
+ public void setSsn(long ssn) {
+ this.ssn = ssn;
+ }
+
+}
Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationClient.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationClient.java?rev=1144149&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationClient.java (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationClient.java Fri Jul 8 04:02:26 2011
@@ -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 registration;
+
+import java.util.Date;
+
+import org.oasisopen.sca.annotation.Reference;
+
+public class RegistrationClient implements RegistrationService {
+
+ @Reference
+ public RegistrationService service;
+
+ @Override
+ public Confirmation register(Person person, Date date) {
+ return service.register(person, date);
+ }
+
+}
Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationService.java?rev=1144149&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationService.java (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationService.java Fri Jul 8 04:02:26 2011
@@ -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 registration;
+
+import java.util.Date;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface RegistrationService {
+
+ Confirmation register(Person person, Date date);
+
+}
Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationServiceImpl.java?rev=1144149&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationServiceImpl.java (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/registration/RegistrationServiceImpl.java Fri Jul 8 04:02:26 2011
@@ -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 registration;
+
+import java.util.Date;
+
+public class RegistrationServiceImpl implements RegistrationService {
+
+ @Override
+ public Confirmation register(Person person, Date date) {
+ String message = person.getName() + " from " + person.getAddress().getStreet() + ", "
+ + person.getAddress().getCity() + ", " + person.getAddress().getZip() + " with SSN " + person.getSsn()
+ + " registered on " + date.toString();
+ return new Confirmation(message, message.length());
+ }
+
+}
Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoService.java?rev=1144149&r1=1144128&r2=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoService.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoService.java Fri Jul 8 04:02:26 2011
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package sample;
+package salutes;
import org.oasisopen.sca.annotation.Remotable;
Copied: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoServiceImpl.java (from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/CiaoImpl.java)
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoServiceImpl.java?p2=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoServiceImpl.java&p1=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/CiaoImpl.java&r1=1144128&r2=1144149&rev=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/CiaoImpl.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/CiaoServiceImpl.java Fri Jul 8 04:02:26 2011
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package sample;
+package salutes;
-public class CiaoImpl implements CiaoService {
+public class CiaoServiceImpl implements CiaoService {
public String sayCiao(String name) {
return "Ciao " + name;
Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/Client.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/Client.java?rev=1144149&r1=1144128&r2=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/Client.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/Client.java Fri Jul 8 04:02:26 2011
@@ -17,7 +17,7 @@
* under the License.
*/
-package sample;
+package salutes;
import org.oasisopen.sca.annotation.Reference;
Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloService.java?rev=1144149&r1=1144128&r2=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloService.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloService.java Fri Jul 8 04:02:26 2011
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package sample;
+package salutes;
import org.oasisopen.sca.annotation.Remotable;
Copied: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloServiceImpl.java (from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/HelloImpl.java)
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloServiceImpl.java?p2=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloServiceImpl.java&p1=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/HelloImpl.java&r1=1144128&r2=1144149&rev=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/HelloImpl.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/HelloServiceImpl.java Fri Jul 8 04:02:26 2011
@@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package sample;
+package salutes;
-public class HelloImpl implements HelloService {
+public class HelloServiceImpl implements HelloService {
public String sayHello(String name) {
return "Hello " + name;
Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutService.java?rev=1144149&r1=1144128&r2=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutService.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutService.java Fri Jul 8 04:02:26 2011
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package sample;
+package salutes;
import org.oasisopen.sca.annotation.Remotable;
Copied: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutServiceImpl.java (from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/SalutImpl.java)
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutServiceImpl.java?p2=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutServiceImpl.java&p1=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/SalutImpl.java&r1=1144128&r2=1144149&rev=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/sample/SalutImpl.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/salutes/SalutServiceImpl.java Fri Jul 8 04:02:26 2011
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-package sample;
+package salutes;
-public class SalutImpl implements SalutService {
+public class SalutServiceImpl implements SalutService {
public String saySalut(String name) {
return "Salut " + name;
Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/RegistrationWebsocketBindingTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/RegistrationWebsocketBindingTestCase.java?rev=1144149&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/RegistrationWebsocketBindingTestCase.java (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/RegistrationWebsocketBindingTestCase.java Fri Jul 8 04:02:26 2011
@@ -0,0 +1,69 @@
+/*
+ * 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 test;
+
+import java.util.Date;
+
+import junit.framework.Assert;
+
+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;
+
+import registration.Address;
+import registration.Confirmation;
+import registration.Person;
+import registration.RegistrationService;
+
+public class RegistrationWebsocketBindingTestCase {
+
+ private static Node node;
+
+ @Test
+ public void testJSONSerialization() {
+ RegistrationService registrationClient = node.getService(RegistrationService.class,
+ "ClientComponent/RegistrationService");
+ Address address = new Address("Queen Elizabeth", "London", 12345);
+ Person person = new Person("John Locke", address, 1122334455);
+ Date date = new Date();
+
+ Confirmation confirmation = registrationClient.register(person, date);
+
+ String expectedMessage = person.getName() + " from " + person.getAddress().getStreet() + ", "
+ + person.getAddress().getCity() + ", " + person.getAddress().getZip() + " with SSN " + person.getSsn()
+ + " registered on " + date.toString();
+ Assert.assertEquals(expectedMessage, confirmation.getMessage());
+ Assert.assertEquals(expectedMessage.length(), confirmation.getMessageLength());
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ node = NodeFactory.newInstance().createNode("registration.composite").start();
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ if (node != null) {
+ node.stop();
+ }
+ }
+
+}
Copied: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/SalutesWebsocketBindingTestCase.java (from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/WebsocketBindingTestCase.java)
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/SalutesWebsocketBindingTestCase.java?p2=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/SalutesWebsocketBindingTestCase.java&p1=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/WebsocketBindingTestCase.java&r1=1144128&r2=1144149&rev=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/WebsocketBindingTestCase.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/java/test/SalutesWebsocketBindingTestCase.java Fri Jul 8 04:02:26 2011
@@ -26,11 +26,11 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import sample.CiaoService;
-import sample.HelloService;
-import sample.SalutService;
+import salutes.CiaoService;
+import salutes.HelloService;
+import salutes.SalutService;
-public class WebsocketBindingTestCase {
+public class SalutesWebsocketBindingTestCase {
private static Node node;
@@ -54,7 +54,7 @@ public class WebsocketBindingTestCase {
@BeforeClass
public static void init() throws Exception {
- node = NodeFactory.newInstance().createNode("test.composite").start();
+ node = NodeFactory.newInstance().createNode("salutes.composite").start();
}
@AfterClass
Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/registration.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/registration.composite?rev=1144149&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/registration.composite (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/registration.composite Fri Jul 8 04:02:26 2011
@@ -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://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://itest"
+ name="RegistrationComposite">
+
+ <component name="RegistrationComponent">
+ <implementation.java class="registration.RegistrationServiceImpl"/>
+ <service name="RegistrationService" >
+ <tuscany:binding.websocket uri="ws://127.0.0.1:5555" />
+ </service>
+ </component>
+
+ <component name="ClientComponent">
+ <implementation.java class="registration.RegistrationClient"/>
+ <reference name="service" target="RegistrationComponent/RegistrationService" />
+ </component>
+
+</composite>
Copied: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/salutes.composite (from r1144128, tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/test.composite)
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/salutes.composite?p2=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/salutes.composite&p1=tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/test.composite&r1=1144128&r2=1144149&rev=1144149&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/test.composite (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/salutes.composite Fri Jul 8 04:02:26 2011
@@ -20,31 +20,31 @@
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace="http://itest"
- name="HelloWorldComposite">
+ name="SalutesComposite">
<component name="HelloComponent">
- <implementation.java class="sample.HelloImpl"/>
+ <implementation.java class="salutes.HelloServiceImpl"/>
<service name="HelloService" >
<tuscany:binding.websocket uri="ws://127.0.0.1:5555" />
</service>
</component>
<component name="SalutComponent">
- <implementation.java class="sample.SalutImpl"/>
+ <implementation.java class="salutes.SalutServiceImpl"/>
<service name="SalutService" >
<tuscany:binding.websocket uri="ws://127.0.0.1:5555" />
</service>
</component>
<component name="CiaoComponent">
- <implementation.java class="sample.CiaoImpl"/>
+ <implementation.java class="salutes.CiaoServiceImpl"/>
<service name="CiaoService" >
<tuscany:binding.websocket uri="ws://127.0.0.1:6666" />
</service>
</component>
<component name="ClientComponent">
- <implementation.java class="sample.Client"/>
+ <implementation.java class="salutes.Client"/>
<reference name="hello" target="HelloComponent/HelloService" />
<reference name="salut" target="SalutComponent/SalutService" />
<reference name="ciao" target="CiaoComponent/CiaoService" />