You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2012/05/16 17:19:49 UTC
svn commit: r1339222 - in
/karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests:
CellarSampleDosgiGreeterTest.java CellarTestSupport.java
Author: jbonofre
Date: Wed May 16 15:19:46 2012
New Revision: 1339222
URL: http://svn.apache.org/viewvc?rev=1339222&view=rev
Log:
[KARAF-1474] Fix the child node extraction in itests
Modified:
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java
karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
Modified: karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java?rev=1339222&r1=1339221&r2=1339222&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarSampleDosgiGreeterTest.java Wed May 16 15:19:46 2012
@@ -51,7 +51,7 @@ public class CellarSampleDosgiGreeterTes
ClusterManager clusterManager = getOsgiService(ClusterManager.class);
assertNotNull(clusterManager);
- System.err.println(executeCommand("features:addurl mvn:org.apache.karaf.cellar.samples/dosgi-greeter/2.2.3-SNAPSHOT/xml/features"));
+ System.err.println(executeCommand("features:addurl mvn:org.apache.karaf.cellar.samples/dosgi-greeter/2.2.4-SNAPSHOT/xml/features"));
System.err.println(executeCommand("admin:list"));
@@ -65,13 +65,14 @@ public class CellarSampleDosgiGreeterTes
String node1 = getNodeIdOfChild("child1");
String node2 = getNodeIdOfChild("child2");
- System.err.println("Child1:" + node1);
- System.err.println("Child2:" + node2);
+ System.err.println("Node 1: " + node1);
+ System.err.println("Node 2: " + node2);
+ executeCommand("cluster:group-create client-grp");
+ executeCommand("cluster:group-create service-grp");
System.err.println(executeCommand("cluster:group-list"));
System.err.println(executeCommand("cluster:group-set client-grp " + localNode.getId()));
System.err.println(executeCommand("cluster:group-set service-grp " + node1));
- System.err.println(executeCommand("cluster:group-list"));
System.err.println(executeCommand("cluster:feature-install client-grp greeter-client"));
Thread.sleep(10000);
Modified: karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java?rev=1339222&r1=1339221&r2=1339222&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/itests/src/test/java/org/apache/karaf/cellar/itests/CellarTestSupport.java Wed May 16 15:19:46 2012
@@ -133,13 +133,14 @@ public class CellarTestSupport {
* @return
*/
protected String getNodeIdOfChild(String name) {
- String nodeId = null;
+ String node;
String nodesList = executeCommand("admin:connect " + name + " cluster:node-list | grep \\\\*", COMMAND_TIMEOUT, true);
- String[] tokens = nodesList.split(" ");
- if (tokens != null && tokens.length > 0) {
- nodeId = tokens[tokens.length - 1].trim().replaceAll("\n", "");
- }
- return nodeId;
+ int stop = nodesList.indexOf(']');
+ node = nodesList.substring(0, stop);
+ int start = node.lastIndexOf('[');
+ node = node.substring(start + 1);
+ node = node.trim();
+ return node;
}
/**