Esempio n. 1
0
        public void Startup()
        {
            lock (this)
            {
                LogUtil.Info("CloudTank startup...");

                if (service != null)
                {
                    throw new Exception("CloudTank already started.");
                }

                IniConfigSource configSource = new IniConfigSource("CloudTank.ini");

                {
                    IConfig cloudTankConfig = configSource.Configs["cloud-tank"];
                    LogUtil.LogDebug = cloudTankConfig.GetBoolean("log-debug");
                    string address    = cloudTankConfig.GetString("address");
                    int    serverPort = cloudTankConfig.GetInt("server-port");
                    int    hubPort    = cloudTankConfig.GetInt("hub-port");
                    service = new CloudService("http://example.asset.url", address, hubPort, serverPort,
                                               CloudTankConstants.ProgramName, CloudTankConstants.ProgramMajorVersion,
                                               CloudTankConstants.ProgramMinorVersion);
                }

                foreach (IConfig config in configSource.Configs)
                {
                    if (config.Name.StartsWith("bubble"))
                    {
                        string bubbleName            = config.GetString("bubble-name");
                        Guid   bubbleId              = new Guid(config.GetString("bubble-id"));
                        float  bubbleRange           = config.GetFloat("bubble-range");
                        float  bubblePerceptionRange = config.GetFloat("bubble-perception-range");

                        CloudBubble bubble = new CloudBubble(bubbleId, bubbleName, bubbleRange, bubblePerceptionRange);
                        service.AddBubble(bubble);



                        foreach (string propertyName in config.GetKeys())
                        {
                            if (propertyName.StartsWith("allowed-remote-hub-address"))
                            {
                                bubble.AddAllowedRemoteHubAddress(config.GetString(propertyName));
                            }

                            if (propertyName.StartsWith("bubble-link"))
                            {
                                Uri    uri                = new Uri(config.GetString(propertyName));
                                string remoteAddress      = uri.Host;
                                int    remoteHubPort      = uri.IsDefaultPort ? MxpConstants.DefaultHubPort : uri.Port;
                                string remoteBubbleString = uri.AbsolutePath.Substring(1);
                                Guid   remoteBubbleId     = new Guid(remoteBubbleString);
                                string query              = uri.Query;

                                float    x          = 0;
                                float    y          = 0;
                                float    z          = 0;
                                string[] parameters = query.Substring(1).Split('&');

                                foreach (string parameter in parameters)
                                {
                                    string[] parameterParts = parameter.Split('=');
                                    if (parameterParts[0].Equals("x"))
                                    {
                                        x = Convert.ToSingle(parameterParts[1]);
                                    }
                                    if (parameterParts[0].Equals("y"))
                                    {
                                        y = Convert.ToSingle(parameterParts[1]);
                                    }
                                    if (parameterParts[0].Equals("z"))
                                    {
                                        z = Convert.ToSingle(parameterParts[1]);
                                    }
                                }

                                service.AddBubbleLink(bubbleId, remoteBubbleId, remoteAddress, remoteHubPort, -x, -y, -z,
                                                      true, true);
                            }
                        }
                    }


                    if (config.Name.StartsWith("ball-daemon"))
                    {
                        string     serverAddress    = config.GetString("server-address");
                        int        serverPort       = config.GetInt("server-port");
                        Guid       bubbleId         = new Guid(config.GetString("bubble-id"));
                        string     daemonIdentifier = config.GetString("daemon-identifier");
                        string     daemonSecret     = config.GetString("daemon-secret");
                        BallDaemon ballDaemon       = new BallDaemon(serverAddress, serverPort, bubbleId, daemonIdentifier, daemonSecret);
                        ballDaemons.Add(ballDaemon);
                    }
                }

                service.Startup(false);

                foreach (BallDaemon ballDaemon in ballDaemons)
                {
                    ballDaemon.Startup();
                }

                LogUtil.Info("CloudTank startup done.");
            }
        }
Esempio n. 2
0
        public void MovementEvent()
        {
            CloudService serviceAlpha = new CloudService(serviceAlphaAssetCacheUrl, serviceAlphaAddress, serviceAlphaHubPort, serviceAlphaServerPort, serviceAlphaProgram, serviceAlphaProgramMajorVersion, serviceAlphaProgramMinorVersion);
            CloudBubble  bubbleOne    = new CloudBubble(bubbleOneId, bubbleOneName, bubbleOneRange, bubbleOnePerceptionRange);

            serviceAlpha.AddBubble(bubbleOne);
            bubbleOne.AddAllowedRemoteHubAddress(serviceBetaAddress);

            serviceAlpha.AddBubbleLink(bubbleOneId, bubbleTwoId, serviceBetaAddress, serviceBetaHubPort, bubbleOneTwoDeltaX, bubbleOneTwoDeltaY, bubbleOneTwoDeltaZ, true, true);

            CloudService serviceBeta = new CloudService(serviceBetaAssetCacheUrl, serviceBetaAddress, serviceBetaHubPort, serviceBetaServerPort, serviceBetaProgram, serviceBetaProgramMajorVersion, serviceBetaProgramMinorVersion);
            CloudBubble  bubbleTwo   = new CloudBubble(bubbleTwoId, bubbleTwoName, bubbleTwoRange, bubbleTwoPerceptionRange);

            bubbleTwo.AddAllowedRemoteHubAddress(serviceAlphaAddress);
            serviceBeta.AddBubble(bubbleTwo);

            CloudBubble bubbleThree = new CloudBubble(bubbleThreeId, bubbleThreeName, bubbleThreeRange, bubbleThreePerceptionRange);

            bubbleThree.AddAllowedRemoteHubAddress(serviceAlphaAddress);
            bubbleThree.AddAllowedRemoteHubAddress(serviceBetaAddress);
            serviceBeta.AddBubble(bubbleThree);

            serviceBeta.AddBubbleLink(bubbleTwoId, bubbleThreeId, serviceBetaAddress, serviceBetaHubPort, bubbleTwoThreeDeltaX, bubbleTwoThreeDeltaY, bubbleTwoThreeDeltaZ, true, true);

            serviceAlpha.Startup(false);
            serviceBeta.Startup(false);

            CloudView viewOne = new CloudView(1000, clientProgramName, clientProgramMajorVersion, clientProgramMinorVersion);

            viewOne.Connect(serviceAlphaAddress, serviceAlphaServerPort, bubbleOneId, "", "", participantIdentityProviderUrl, participantNameOne, participantPassphraseOne, objectId, false);

            CloudView viewTwo = new CloudView(1000, clientProgramName, clientProgramMajorVersion, clientProgramMinorVersion);

            viewTwo.Connect(serviceBetaAddress, serviceBetaServerPort, bubbleThreeId, "", "", participantIdentityProviderUrl, participantNameTwo, participantPassphraseTwo, objectId, false);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsTrue(viewOne.IsConnected);
            Assert.IsTrue(viewTwo.IsConnected);

            InjectRequestMessage injectRequestMessage = new InjectRequestMessage();

            injectRequestMessage.ObjectFragment.ObjectId                     = objectId;
            injectRequestMessage.ObjectFragment.ObjectIndex                  = objectIndex;
            injectRequestMessage.ObjectFragment.ObjectName                   = objectName;
            injectRequestMessage.ObjectFragment.TypeId                       = objectTypeId;
            injectRequestMessage.ObjectFragment.TypeName                     = objectTypeName;
            injectRequestMessage.ObjectFragment.OwnerId                      = viewOne.ParticipantId;
            injectRequestMessage.ObjectFragment.ParentObjectId               = objectParentObjectId;
            injectRequestMessage.ObjectFragment.Mass                         = objectMass;
            injectRequestMessage.ObjectFragment.BoundingSphereRadius         = objectBoundingSphereRadius;
            injectRequestMessage.ObjectFragment.Location.X                   = objectLocationX;
            injectRequestMessage.ObjectFragment.Location.Y                   = objectLocationY;
            injectRequestMessage.ObjectFragment.Location.Z                   = objectLocationZ;
            injectRequestMessage.ObjectFragment.Velocity.X                   = objectVelocityX;
            injectRequestMessage.ObjectFragment.Velocity.Y                   = objectVelocityY;
            injectRequestMessage.ObjectFragment.Velocity.Z                   = objectVelocityZ;
            injectRequestMessage.ObjectFragment.Acceleration.X               = objectAccelerationX;
            injectRequestMessage.ObjectFragment.Acceleration.Y               = objectAccelerationY;
            injectRequestMessage.ObjectFragment.Acceleration.Z               = objectAccelerationZ;
            injectRequestMessage.ObjectFragment.Orientation.X                = objectOrientationX;
            injectRequestMessage.ObjectFragment.Orientation.Y                = objectOrientationY;
            injectRequestMessage.ObjectFragment.Orientation.Z                = objectOrientationZ;
            injectRequestMessage.ObjectFragment.Orientation.W                = objectOrientationW;
            injectRequestMessage.ObjectFragment.AngularVelocity.X            = objectAngularVelocityX;
            injectRequestMessage.ObjectFragment.AngularVelocity.Y            = objectAngularVelocityY;
            injectRequestMessage.ObjectFragment.AngularVelocity.Z            = objectAngularVelocityZ;
            injectRequestMessage.ObjectFragment.AngularVelocity.W            = objectAngularVelocityW;
            injectRequestMessage.ObjectFragment.AngularAcceleration.X        = objectAngularAccelerationX;
            injectRequestMessage.ObjectFragment.AngularAcceleration.Y        = objectAngularAccelerationY;
            injectRequestMessage.ObjectFragment.AngularAcceleration.Z        = objectAngularAccelerationZ;
            injectRequestMessage.ObjectFragment.AngularAcceleration.W        = objectAngularAccelerationW;
            injectRequestMessage.ObjectFragment.ExtensionDialect             = objectExtensionDialect;
            injectRequestMessage.ObjectFragment.ExtensionDialectMajorVersion = objectExtensionDialectMajorVersion;
            injectRequestMessage.ObjectFragment.ExtensionDialectMinorVersion = objectExtensionDialectMinorVersion;
            injectRequestMessage.ObjectFragment.SetExtensionData(objectExtensionData);
            viewOne.InjectObject(injectRequestMessage);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();


            CloudObject bubbleOneCloudObject = bubbleOne.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleOneCloudObject);

            CloudObject bubbleTwoCloudObject = bubbleTwo.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleTwoCloudObject);

            CloudObject bubbleThreeCloudObject = bubbleThree.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleThreeCloudObject);

            CloudObject viewOneCloudObject = viewOne.CloudCache.GetObject(objectId);

            Assert.IsNotNull(viewOneCloudObject);

            CloudObject viewTwoCloudObject = viewTwo.CloudCache.GetObject(objectId);

            Assert.IsNotNull(viewTwoCloudObject);

            MovementEventMessage movement = new MovementEventMessage();

            movement.ObjectIndex   = viewOneCloudObject.LocalObjectIndex;
            movement.Location.X    = modifiedObjectLocationX;
            movement.Location.Y    = modifiedObjectLocationY;
            movement.Location.Z    = modifiedObjectLocationZ;
            movement.Orientation.X = objectOrientationX;
            movement.Orientation.Y = objectOrientationY;
            movement.Orientation.Z = objectOrientationZ;
            movement.Orientation.W = objectOrientationW;

            viewOne.MoveObject(movement);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.AreEqual(modifiedObjectLocationX - bubbleOneTwoDeltaX - bubbleTwoThreeDeltaX, bubbleThreeCloudObject.Location.X);
            Assert.AreEqual(modifiedObjectLocationY - bubbleOneTwoDeltaY - bubbleTwoThreeDeltaY, bubbleThreeCloudObject.Location.Y);
            Assert.AreEqual(modifiedObjectLocationZ - bubbleOneTwoDeltaZ - bubbleTwoThreeDeltaZ, bubbleThreeCloudObject.Location.Z);
            Assert.AreEqual(objectOrientationX, bubbleThreeCloudObject.Orientation.X);
            Assert.AreEqual(objectOrientationY, bubbleThreeCloudObject.Orientation.Y);
            Assert.AreEqual(objectOrientationZ, bubbleThreeCloudObject.Orientation.Z);
            Assert.AreEqual(objectOrientationW, bubbleThreeCloudObject.Orientation.W);

            EjectRequestMessage ejectRequestMessage = new EjectRequestMessage();

            ejectRequestMessage.ObjectId = objectId;
            viewOne.EjectObject(ejectRequestMessage);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsNull(bubbleOne.CloudCache.GetObject(objectId));
            Assert.IsNull(bubbleTwo.CloudCache.GetObject(objectId));
            Assert.IsNull(bubbleThree.CloudCache.GetObject(objectId));
            Assert.IsNull(viewOne.CloudCache.GetObject(objectId));
            Assert.IsNull(viewTwo.CloudCache.GetObject(objectId));

            viewOne.Disconnect();
            viewTwo.Disconnect();

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            serviceAlpha.Shutdown();
            serviceBeta.Shutdown();
        }
Esempio n. 3
0
        public void Startup()
        {
            lock (this)
            {
                Thread.CurrentThread.Name   = LocalProcessId.ToString() + "-main";
                MxpOptions.ThreadNamePrefix = LocalProcessId.ToString();

                LogUtil.Info("Daemon Process startup...");

                if (service != null)
                {
                    throw new Exception("DaemonProcess already started.");
                }

                // Preparing database entity context.
                entityContext = new DaemonEntities();

                // Loading configuration from database.
                localProcessEntity = QueryUtil.First <LocalProcess>(
                    from lp in entityContext.LocalProcess where lp.LocalProcessId == LocalProcessId select lp);
                participantEntity = QueryUtil.First <DaemonLogic.Participant>(
                    from lp in entityContext.LocalProcess where lp.LocalProcessId == LocalProcessId select lp.Participant);
                remoteProcessEntities = (from rp in entityContext.RemoteProcess where rp.LocalProcess.LocalProcessId == LocalProcessId select rp).ToList <RemoteProcess>();
                bubbleEntities        = (from b in entityContext.Bubble where b.LocalProcess.LocalProcessId == LocalProcessId select b).ToList <Bubble>();

                LogUtil.Info("Loaded local process configuration: " + localProcessEntity.Address + ":" + localProcessEntity.ServerPort + "/" + localProcessEntity.HubPort);

                // Creating service, bubbles and bubble links.
                service = new CloudService(ConfigurationManager.AppSettings["DaemonMemberWeb"],
                                           localProcessEntity.Address,
                                           localProcessEntity.HubPort,
                                           localProcessEntity.ServerPort,
                                           localProcessEntity.Name,
                                           DaemonProcessConstants.ProgramMajorVersion,
                                           DaemonProcessConstants.ProgramMinorVersion);

                foreach (Bubble bubble in bubbleEntities)
                {
                    CloudBubble cloudBubble = new CloudBubble(bubble.BubbleId, bubble.Name, (float)bubble.Range, (float)bubble.PerceptionRange);
                    cloudBubble.ParticipantConnectAuthorize  += OnParticipantConnectAuthorize;
                    cloudBubble.CloudParticipantDisconnected += OnCloudParticipantDisconnected;
                    service.AddBubble(cloudBubble);

                    foreach (RemoteProcess remoteProcess in remoteProcessEntities)
                    {
                        cloudBubble.AddAllowedRemoteHubAddress(remoteProcess.Address);
                    }

                    // Loading bubble link configuration from database.
                    List <DaemonLogic.BubbleLink> bubbleLinkConfigurations = (from b in entityContext.BubbleLink where b.Bubble.BubbleId == bubble.BubbleId select b).ToList <DaemonLogic.BubbleLink>();

                    foreach (DaemonLogic.BubbleLink bubbleLink in bubbleLinkConfigurations)
                    {
                        service.AddBubbleLink(bubble.BubbleId, bubbleLink.RemoteBubbleId, bubbleLink.Address, bubbleLink.Port, (float)-bubbleLink.X, (float)-bubbleLink.Y, (float)-bubbleLink.Z,
                                              true, true);
                    }
                }

                // Saving process state info to database.
                localProcessStateEntity = new LocalProcessState
                {
                    LocalProcessStateId = Guid.NewGuid(),
                    LocalProcess        = localProcessEntity,
                    Participant         = participantEntity,
                    Created             = DateTime.Now,
                    Modified            = DateTime.Now,
                    Cpu = OnGetProcessingTime(),
                    Mem = (System.Diagnostics.Process.GetCurrentProcess().WorkingSet64) / 1024
                };
                entityContext.AddToLocalProcessState(localProcessStateEntity);
                entityContext.SaveChanges();

                service.Startup(false);

                LogUtil.Info("Daemon Process startup done.");
            }
        }
Esempio n. 4
0
        public void ActionEvent()
        {
            CloudService serviceAlpha = new CloudService(serviceAlphaAssetCacheUrl, serviceAlphaAddress, serviceAlphaHubPort, serviceAlphaServerPort, serviceAlphaProgram, serviceAlphaProgramMajorVersion, serviceAlphaProgramMinorVersion);
            CloudBubble  bubbleOne    = new CloudBubble(bubbleOneId, bubbleOneName, bubbleOneRange, bubbleOnePerceptionRange);

            serviceAlpha.AddBubble(bubbleOne);
            bubbleOne.AddAllowedRemoteHubAddress(serviceBetaAddress);

            serviceAlpha.AddBubbleLink(bubbleOneId, bubbleTwoId, serviceBetaAddress, serviceBetaHubPort, bubbleOneTwoDeltaX, bubbleOneTwoDeltaY, bubbleOneTwoDeltaZ, true, true);

            CloudService serviceBeta = new CloudService(serviceBetaAssetCacheUrl, serviceBetaAddress, serviceBetaHubPort, serviceBetaServerPort, serviceBetaProgram, serviceBetaProgramMajorVersion, serviceBetaProgramMinorVersion);
            CloudBubble  bubbleTwo   = new CloudBubble(bubbleTwoId, bubbleTwoName, bubbleTwoRange, bubbleTwoPerceptionRange);

            bubbleTwo.AddAllowedRemoteHubAddress(serviceAlphaAddress);
            serviceBeta.AddBubble(bubbleTwo);

            CloudBubble bubbleThree = new CloudBubble(bubbleThreeId, bubbleThreeName, bubbleThreeRange, bubbleThreePerceptionRange);

            bubbleThree.AddAllowedRemoteHubAddress(serviceAlphaAddress);
            bubbleThree.AddAllowedRemoteHubAddress(serviceBetaAddress);
            serviceBeta.AddBubble(bubbleThree);

            serviceBeta.AddBubbleLink(bubbleTwoId, bubbleThreeId, serviceBetaAddress, serviceBetaHubPort, bubbleTwoThreeDeltaX, bubbleTwoThreeDeltaY, bubbleTwoThreeDeltaZ, true, true);

            serviceAlpha.Startup(false);
            serviceBeta.Startup(false);

            CloudView viewOne = new CloudView(1000, clientProgramName, clientProgramMajorVersion, clientProgramMinorVersion);

            viewOne.Connect(serviceAlphaAddress, serviceAlphaServerPort, bubbleOneId, "", "", participantIdentityProviderUrl, participantNameOne, participantPassphraseOne, objectId, false);

            CloudView viewTwo = new CloudView(1000, clientProgramName, clientProgramMajorVersion, clientProgramMinorVersion);

            viewTwo.Connect(serviceBetaAddress, serviceBetaServerPort, bubbleThreeId, "", "", participantIdentityProviderUrl, participantNameTwo, participantPassphraseTwo, objectId, false);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsTrue(viewOne.IsConnected);
            Assert.IsTrue(viewTwo.IsConnected);

            InjectRequestMessage injectRequestMessage = new InjectRequestMessage();

            injectRequestMessage.ObjectFragment.ObjectId                     = objectId;
            injectRequestMessage.ObjectFragment.ObjectIndex                  = objectIndex;
            injectRequestMessage.ObjectFragment.ObjectName                   = objectName;
            injectRequestMessage.ObjectFragment.TypeId                       = objectTypeId;
            injectRequestMessage.ObjectFragment.TypeName                     = objectTypeName;
            injectRequestMessage.ObjectFragment.OwnerId                      = viewOne.ParticipantId;
            injectRequestMessage.ObjectFragment.ParentObjectId               = objectParentObjectId;
            injectRequestMessage.ObjectFragment.Mass                         = objectMass;
            injectRequestMessage.ObjectFragment.BoundingSphereRadius         = objectBoundingSphereRadius;
            injectRequestMessage.ObjectFragment.Location.X                   = objectLocationX;
            injectRequestMessage.ObjectFragment.Location.Y                   = objectLocationY;
            injectRequestMessage.ObjectFragment.Location.Z                   = objectLocationZ;
            injectRequestMessage.ObjectFragment.Velocity.X                   = objectVelocityX;
            injectRequestMessage.ObjectFragment.Velocity.Y                   = objectVelocityY;
            injectRequestMessage.ObjectFragment.Velocity.Z                   = objectVelocityZ;
            injectRequestMessage.ObjectFragment.Acceleration.X               = objectAccelerationX;
            injectRequestMessage.ObjectFragment.Acceleration.Y               = objectAccelerationY;
            injectRequestMessage.ObjectFragment.Acceleration.Z               = objectAccelerationZ;
            injectRequestMessage.ObjectFragment.Orientation.X                = objectOrientationX;
            injectRequestMessage.ObjectFragment.Orientation.Y                = objectOrientationY;
            injectRequestMessage.ObjectFragment.Orientation.Z                = objectOrientationZ;
            injectRequestMessage.ObjectFragment.Orientation.W                = objectOrientationW;
            injectRequestMessage.ObjectFragment.AngularVelocity.X            = objectAngularVelocityX;
            injectRequestMessage.ObjectFragment.AngularVelocity.Y            = objectAngularVelocityY;
            injectRequestMessage.ObjectFragment.AngularVelocity.Z            = objectAngularVelocityZ;
            injectRequestMessage.ObjectFragment.AngularVelocity.W            = objectAngularVelocityW;
            injectRequestMessage.ObjectFragment.AngularAcceleration.X        = objectAngularAccelerationX;
            injectRequestMessage.ObjectFragment.AngularAcceleration.Y        = objectAngularAccelerationY;
            injectRequestMessage.ObjectFragment.AngularAcceleration.Z        = objectAngularAccelerationZ;
            injectRequestMessage.ObjectFragment.AngularAcceleration.W        = objectAngularAccelerationW;
            injectRequestMessage.ObjectFragment.ExtensionDialect             = objectExtensionDialect;
            injectRequestMessage.ObjectFragment.ExtensionDialectMajorVersion = objectExtensionDialectMajorVersion;
            injectRequestMessage.ObjectFragment.ExtensionDialectMinorVersion = objectExtensionDialectMinorVersion;
            injectRequestMessage.ObjectFragment.SetExtensionData(objectExtensionData);
            viewOne.InjectObject(injectRequestMessage);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();


            CloudObject bubbleOneCloudObject = bubbleOne.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleOneCloudObject);

            CloudObject bubbleTwoCloudObject = bubbleTwo.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleTwoCloudObject);

            CloudObject bubbleThreeCloudObject = bubbleThree.CloudCache.GetObject(objectId);

            Assert.IsNotNull(bubbleThreeCloudObject);

            CloudObject viewOneCloudObject = viewOne.CloudCache.GetObject(objectId);

            Assert.IsNotNull(viewOneCloudObject);

            CloudObject viewTwoCloudObject = viewTwo.CloudCache.GetObject(objectId);

            Assert.IsNotNull(viewTwoCloudObject);

            ActionEventMessage originalAction = new ActionEventMessage();

            originalAction.ActionFragment.ActionName                   = actionName;
            originalAction.ActionFragment.ObservationRadius            = actionObservationRadius;
            originalAction.ActionFragment.SourceObjectId               = objectId;
            originalAction.ActionFragment.ExtensionDialect             = actionExtensionDialect;
            originalAction.ActionFragment.ExtensionDialectMajorVersion = actionExtensionDialectMajorVersion;
            originalAction.ActionFragment.ExtensionDialectMinorVersion = actionExtensionDialectMinorVersion;
            originalAction.ActionFragment.SetExtensionData(actionExtensionData);

            viewOne.ExecuteAction(originalAction);

            ActionEventMessage receivedAction = null;

            viewTwo.ServerAction += delegate(ActionEventMessage actionEvent)
            {
                receivedAction = actionEvent;
                Assert.AreEqual(actionName, receivedAction.ActionFragment.ActionName);
                Assert.AreEqual(objectId, receivedAction.ActionFragment.SourceObjectId);
                Assert.AreEqual(actionObservationRadius, receivedAction.ActionFragment.ObservationRadius);
                Assert.AreEqual(actionExtensionDialect, receivedAction.ActionFragment.ExtensionDialect);
                Assert.AreEqual(actionExtensionDialectMajorVersion, receivedAction.ActionFragment.ExtensionDialectMajorVersion);
                Assert.AreEqual(actionExtensionDialectMinorVersion, receivedAction.ActionFragment.ExtensionDialectMinorVersion);
                Assert.AreEqual(ASCIIEncoding.ASCII.GetString(actionExtensionData),
                                ASCIIEncoding.ASCII.GetString(receivedAction.ActionFragment.GetExtensionData()));
            };

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsNotNull(receivedAction);

            EjectRequestMessage ejectRequestMessage = new EjectRequestMessage();

            ejectRequestMessage.ObjectId = objectId;
            viewOne.EjectObject(ejectRequestMessage);

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            Assert.IsNull(bubbleOne.CloudCache.GetObject(objectId));
            Assert.IsNull(bubbleTwo.CloudCache.GetObject(objectId));
            Assert.IsNull(bubbleThree.CloudCache.GetObject(objectId));
            Assert.IsNull(viewOne.CloudCache.GetObject(objectId));
            Assert.IsNull(viewTwo.CloudCache.GetObject(objectId));

            viewOne.Disconnect();
            viewTwo.Disconnect();

            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();
            Thread.Sleep(10);
            serviceAlpha.Process(); serviceBeta.Process(); viewOne.Process(); viewTwo.Process();

            serviceAlpha.Shutdown();
            serviceBeta.Shutdown();
        }