stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject [13/32] stratos git commit: Changes to expose instanceId in handleMemberInitializedEvent and message processor side
Date Fri, 09 Oct 2015 14:35:26 GMT
Changes to expose instanceId in handleMemberInitializedEvent and message processor side


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7ea76ecf
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7ea76ecf
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7ea76ecf

Branch: refs/heads/gsoc-projects-2015
Commit: 7ea76ecf6904e44abfbfbe1d32e45dc22e574b4c
Parents: 6479940
Author: swapnilpatilRajaram <swapnil.patil@students.iiit.ac.in>
Authored: Sat Jul 18 16:43:42 2015 +0000
Committer: swapnilpatilRajaram <swapnil.patil@students.iiit.ac.in>
Committed: Sat Jul 18 16:43:42 2015 +0000

----------------------------------------------------------------------
 .../cartridge/agent/test/JavaCartridgeAgentTest.java        | 3 ++-
 .../messaging/publisher/TopologyEventPublisher.java         | 3 ++-
 .../controller/messaging/topology/TopologyBuilder.java      | 2 +-
 .../messaging/event/topology/MemberInitializedEvent.java    | 9 ++++++++-
 .../topology/MemberInitializedMessageProcessor.java         | 1 +
 .../test/PythonCartridgeAgentTest.java                      | 3 ++-
 6 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/7ea76ecf/components/org.apache.stratos.cartridge.agent/src/test/java/org/apache/stratos/cartridge/agent/test/JavaCartridgeAgentTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.agent/src/test/java/org/apache/stratos/cartridge/agent/test/JavaCartridgeAgentTest.java
b/components/org.apache.stratos.cartridge.agent/src/test/java/org/apache/stratos/cartridge/agent/test/JavaCartridgeAgentTest.java
index 3f0e73e..d8126c8 100644
--- a/components/org.apache.stratos.cartridge.agent/src/test/java/org/apache/stratos/cartridge/agent/test/JavaCartridgeAgentTest.java
+++ b/components/org.apache.stratos.cartridge.agent/src/test/java/org/apache/stratos/cartridge/agent/test/JavaCartridgeAgentTest.java
@@ -78,6 +78,7 @@ public class JavaCartridgeAgentTest {
     private static final String TENANT_ID = "-1234";
     private static final String SERVICE_NAME = "php";
     public static final String AGENT_NAME = "apache-stratos-cartridge-agent-4.1.0-SNAPSHOT";
+    private static final String INSTANCE_ID = "instance-1";
     private static HashMap<String, Executor> executorList;
     private static ArrayList<ServerSocket> serverSocketList;
     private final ArtifactUpdatedEvent artifactUpdatedEvent;
@@ -327,7 +328,7 @@ public class JavaCartridgeAgentTest {
                                 // Publish member initialized event
                                 log.info("Publishing member initialized event...");
                                 MemberInitializedEvent memberInitializedEvent = new MemberInitializedEvent(
-                                        SERVICE_NAME, CLUSTER_ID, CLUSTER_INSTANCE_ID, MEMBER_ID,
NETWORK_PARTITION_ID, PARTITION_ID
+                                        SERVICE_NAME, CLUSTER_ID, CLUSTER_INSTANCE_ID, MEMBER_ID,
NETWORK_PARTITION_ID, PARTITION_ID, INSTANCE_ID
                                 );
                                 publishEvent(memberInitializedEvent);
                                 log.info("Member initialized event published");

http://git-wip-us.apache.org/repos/asf/stratos/blob/7ea76ecf/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
index 7225a61..b55d3a2 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/publisher/TopologyEventPublisher.java
@@ -171,7 +171,8 @@ public class TopologyEventPublisher {
                 memberContext.getClusterInstanceId(),
                 memberContext.getMemberId(),
                 memberContext.getNetworkPartitionId(),
-                memberContext.getPartition().getId());
+                memberContext.getPartition().getId(),
+                memberContext.getInstanceId());
 
         memberInitializedEvent.setDefaultPrivateIP(memberContext.getDefaultPrivateIP());
         if (memberContext.getPrivateIPs() != null) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/7ea76ecf/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
index 66831ad..a73cd14 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
@@ -419,7 +419,6 @@ public class TopologyBuilder {
             member.setStatus(MemberStatus.Created);
             member.setLbClusterId(lbClusterId);
             member.setProperties(CloudControllerUtil.toJavaUtilProperties(memberContext.getProperties()));
-            member.setInstanceId(memberContext.getInstanceId());
             cluster.addMember(member);
             TopologyManager.updateTopology(topology);
         } finally {
@@ -469,6 +468,7 @@ public class TopologyBuilder {
             if (memberContext.getPublicIPs() != null) {
                 member.setMemberPublicIPs(Arrays.asList(memberContext.getPublicIPs()));
             }
+            member.setInstanceId(memberContext.getInstanceId());
 
             // try update lifecycle state
             if (!member.isStateTransitionValid(MemberStatus.Initialized)) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/7ea76ecf/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberInitializedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberInitializedEvent.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberInitializedEvent.java
index edf64e3..45adcc5 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberInitializedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/MemberInitializedEvent.java
@@ -36,6 +36,8 @@ public class MemberInitializedEvent extends TopologyEvent implements Serializabl
     private final String networkPartitionId;
     private final String partitionId;
     private final String memberId;
+    //instance Id provided by IaaS
+    private final String instanceId;
 
     private List<String> memberPublicIPs;
     private String defaultPublicIP;
@@ -44,13 +46,14 @@ public class MemberInitializedEvent extends TopologyEvent implements Serializabl
     private Properties properties;
 
     public MemberInitializedEvent(String serviceName, String clusterId, String clusterInstanceId,
String memberId,
-                                  String networkPartitionId, String partitionId) {
+                                  String networkPartitionId, String partitionId, String instanceId)
{
         this.serviceName = serviceName;
         this.clusterId = clusterId;
         this.clusterInstanceId = clusterInstanceId;
         this.memberId = memberId;
         this.networkPartitionId = networkPartitionId;
         this.partitionId = partitionId;
+        this.instanceId = instanceId;
     }
 
     public String getServiceName() {
@@ -116,4 +119,8 @@ public class MemberInitializedEvent extends TopologyEvent implements Serializabl
     public void setMemberPrivateIPs(List<String> memberPrivateIPs) {
         this.memberPrivateIPs = memberPrivateIPs;
     }
+
+    public String getInstanceId() {
+        return instanceId;
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/7ea76ecf/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/MemberInitializedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/MemberInitializedMessageProcessor.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/MemberInitializedMessageProcessor.java
index 57d0680..0bd064a 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/MemberInitializedMessageProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/MemberInitializedMessageProcessor.java
@@ -140,6 +140,7 @@ public class MemberInitializedMessageProcessor extends MessageProcessor
{
             member.setMemberPublicIPs(event.getMemberPublicIPs());
             member.setDefaultPrivateIP(event.getDefaultPrivateIP());
             member.setMemberPrivateIPs(event.getMemberPrivateIPs());
+            member.setInstanceId(event.getInstanceId());
 
             if (log.isInfoEnabled()) {
                 log.info(String.format("Member initialized: [service] %s [cluster] %s [member]
%s",

http://git-wip-us.apache.org/repos/asf/stratos/blob/7ea76ecf/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
b/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
index bb116ce..7a4e788 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
+++ b/components/org.apache.stratos.python.cartridge.agent/src/test/java/org/apache/stratos/python.cartridge.agent/test/PythonCartridgeAgentTest.java
@@ -70,6 +70,7 @@ public class PythonCartridgeAgentTest {
     private static final String TENANT_ID = "-1234";
     private static final String SERVICE_NAME = "php";
     public static final String SOURCE_PATH = "/tmp/stratos-pca-test-app-path/";
+    private static final String INSTANCE_ID = "instance-1";
 
     private static List<ServerSocket> serverSocketList;
     private static Map<String, Executor> executorList;
@@ -256,7 +257,7 @@ public class PythonCartridgeAgentTest {
                                 // Publish member initialized event
                                 log.info("Publishing member initialized event...");
                                 MemberInitializedEvent memberInitializedEvent = new MemberInitializedEvent(
-                                        SERVICE_NAME, CLUSTER_ID, CLUSTER_INSTANCE_ID, MEMBER_ID,
NETWORK_PARTITION_ID, PARTITION_ID
+                                        SERVICE_NAME, CLUSTER_ID, CLUSTER_INSTANCE_ID, MEMBER_ID,
NETWORK_PARTITION_ID, PARTITION_ID, INSTANCE_ID
                                 );
                                 publishEvent(memberInitializedEvent);
                                 log.info("Member initialized event published");


Mime
View raw message