Package com.nokia.dempsy.config

Examples of com.nokia.dempsy.config.ClusterId


      Set<ClusterRouter> routers = routerFactory.getRouter(java.lang.Exception.class);
      Assert.assertNotNull(routers);
      Assert.assertEquals(false, routerFactory.missingMsgTypes.containsKey(java.lang.Exception.class));
      Set<ClusterRouter> routers1 = routerFactory.getRouter(ClassNotFoundException.class);
      Assert.assertEquals(routers, routers1);
      Assert.assertEquals(new ClusterId("test", "test-slot"), routerFactory.getThisClusterId());
   }
View Full Code Here


            "testDempsy/Dempsy.xml", "testDempsy/ClusterInfo-LocalActx.xml", "testDempsy/Serializer-KryoActx.xml",
            "testDempsy/Transport-PassthroughActx.xml", "testDempsy/SimpleMultistageApplicationActx.xml" );
      Dempsy dempsy = (Dempsy)context.getBean("dempsy");
      ClusterInfoSessionFactory factory = dempsy.getClusterSessionFactory();
      ClusterInfoSession session = factory.createSession();
      ClusterId curCluster = new ClusterId("test-app", "test-cluster1");
      TestUtils.createClusterLevel(curCluster, session);
      session.setData(curCluster.asPath(), new DecentralizedRoutingStrategy.DefaultRouterClusterInfo(20,2));
      session.stop();
      dempsy.stop();
   }
View Full Code Here

                  }
               });

         dempsy.start();

         Dempsy.Application.Cluster cluster = dempsy.getCluster(new ClusterId(FullApplication.class.getSimpleName(),MyAdaptor.class.getSimpleName()));
         Dempsy.Application.Cluster.Node node = cluster.getNodes().get(0);
         final StatsCollector collector = node.getStatsCollector();

         // this checks that the throughput works.
         assertTrue(poll(baseTimeoutMillis * 5, app, new Condition<Object>()
         {
            @Override
            public boolean conditionMet(Object o)
            {
               return app.finalMessageCount.get() > 10;
            }
         }));

         assertNotNull(zookeeperCluster);

         assertEquals(0,((MetricGetters)collector).getDiscardedMessageCount());
         assertEquals(0,((MetricGetters)collector).getMessageFailedCount());

         // ok ... so now we have stuff going all the way through. let's kick
         // the middle Mp's zookeeper cluster and see what happens.
         ZooKeeper origZk = zookeeperCluster.zkref.get();
         long sessionid = origZk.getSessionId();
         ZooKeeper killer = new ZooKeeper(System.getProperty("zk_connect"),5000, new Watcher() { @Override public void process(WatchedEvent arg0) { } }, sessionid, null);
         killer.close(); // tricks the server into expiring the other session

//         // we should be getting failures now ...
//         // but it's possible that it can reconnect prior to actually seeing an error so if this
//         //   fails frequently we need to remove this test.
//         assertTrue(poll(baseTimeoutMillis, app, new Condition()
//         {
//            @Override
//            public boolean conditionMet(Object o)
//            {
//               return collector.getMessageFailedCount() > 1;
//            }
//         }));

         //... and then recover.

         // get the MyMp prototype
         cluster = dempsy.getCluster(new ClusterId(FullApplication.class.getSimpleName(),MyMp.class.getSimpleName()));
         node = cluster.getNodes().get(0);
         final MyMp prototype = (MyMp)node.getMpContainer().getPrototype();

         // so let's see where we are
         final long interimMessageCount = prototype.myMpReceived.get();
View Full Code Here

                  }
               });

         dempsy.start();

         Dempsy.Application.Cluster cluster = dempsy.getCluster(new ClusterId(FullApplication.class.getSimpleName(),MyAdaptor.class.getSimpleName()));
         Dempsy.Application.Cluster.Node node = cluster.getNodes().get(0);
         final StatsCollector collector = node.getStatsCollector();
        
         // we are going to create another node of the MyMp via a test hack
         cluster = dempsy.getCluster(new ClusterId(FullApplication.class.getSimpleName(),MyMp.class.getSimpleName()));
         Dempsy.Application.Cluster.Node mpnode = cluster.getNodes().get(0);
         // this actually hoses the output schedule. It moves it to the new node due
         //  to a second call to setOutputInvoker.
         cluster.instantiateAndStartAnotherNodeForTesting(); // the code for start instantiates a new node

         assertNotNull(zookeeperCluster);

         assertEquals(0,((MetricGetters)collector).getDiscardedMessageCount());
         assertEquals(0,((MetricGetters)collector).getMessageFailedCount());

         // ok ... so now we have stuff going all the way through. let's kick
         // the middle Mp's zookeeper cluster and see what happens.
         ZooKeeper origZk = zookeeperCluster.zkref.get();
         origZk.close(); // this should kill it.
        
         // but just to be sure actually stop the node.
         mpnode.stop();

         // we should be getting failures now ... and then recover.

         // get the MyMp prototype
         cluster = dempsy.getCluster(new ClusterId(FullApplication.class.getSimpleName(),MyMp.class.getSimpleName()));
         node = cluster.getNodes().get(1); // notice, we're getting the SECOND node.
         final MyMp prototype = (MyMp)node.getMpContainer().getPrototype();

         // so let's see where we are
         final long interimMessageCount = prototype.myMpReceived.get();
View Full Code Here

            cur.dempsy.start();
            dempsys.put(cluster.getClusterId(), cur);
         }

         // get the last FullApplication in the processing chain.
         ClassPathXmlApplicationContext actx = dempsys.get(new ClusterId(FullApplication.class.getSimpleName(),MyRankMp.class.getSimpleName())).actx;
         final FullApplication app = (FullApplication)actx.getBean("app");

         // this checks that the throughput works.
         assertTrue(poll(baseTimeoutMillis * 5, app, new Condition<Object>()
         {
View Full Code Here

   @Test
   public void testConfiguration() throws Exception
   {
      // this assertion is superfluous, since we deref container in setUp()
      assertNotNull("did not create container", container);
      assertEquals(new ClusterId("test", "test"),container.getClusterId());
     
      TestProcessor prototype = context.getBean(TestProcessor.class);
      assertEquals(1,prototype.startCalled.get());
     
      assertNotNull(prototype.clusterId);
View Full Code Here

            cur.dempsy.start();
            dempsys.put(cluster.getClusterId(), cur);
         }
        
         // get the last FullApplication in the processing chain.
         ClassPathXmlApplicationContext actx = dempsys.get(new ClusterId(FullApplication.class.getSimpleName(),MyRankMp.class.getSimpleName())).actx;
         final FullApplication app = (FullApplication)actx.getBean("app");

         // this checks that the throughput works.
         assertTrue(poll(baseTimeoutMillis * 5, app, new Condition<Object>()
         {
            @Override
            public boolean conditionMet(Object o)
            {
               return app.finalMessageCount.get() > 100;
            }
         }));
        
         // now start another MyMp cluster.
         spare = new DempsyHolder();
         spare.clusterid = new ClusterId(FullApplication.class.getSimpleName(),MyMp.class.getSimpleName());
         CheckCluster.toCheckAgainst = spare.clusterid;
         spare.actx = new ClassPathXmlApplicationContext(ctx);
         spare.dempsy = (Dempsy)spare.actx.getBean("dempsy");
         spare.dempsy.start();

         Dempsy.Application.Cluster cluster = spare.dempsy.getCluster(spare.clusterid);
         Dempsy.Application.Cluster.Node node = cluster.getNodes().get(0);
         final StatsCollector collector = node.getStatsCollector();
        
         // we are going to create another node of the MyMp via a test hack
         cluster = spare.dempsy.getCluster(new ClusterId(FullApplication.class.getSimpleName(),MyMp.class.getSimpleName()));
         node = cluster.getNodes().get(0);
         final MyMp spareprototype = (MyMp)node.getMpContainer().getPrototype();

         // TODO, see if we really need that check, and if so, implement
         // an alternate way to get it, since with the stats collector rework
View Full Code Here

                 
               };

         try
         {
            session.getSubdirs(new ClusterId("test","test").asPath(), null);
         }
         catch(Exception e)
         {
            receivedException = e.getCause();
         }
View Full Code Here

      runAllCombinations(new Checker()
      {
         @Override
         public void check(String pass, ClusterInfoSessionFactory factory) throws Throwable
         {
            ClusterId cid = new ClusterId("test-app1","test-cluster");
           
            ClusterInfoSession session = factory.createSession();
            assertNotNull(pass,session);
            sessionsToClose.add(session);
            String clusterPath = createClusterLevel(cid, session);
           
            assertEquals(clusterPath,cid.asPath());
           
            assertNotNull(pass,clusterPath);
            assertTrue(pass,session.exists(clusterPath, null));
           
            // there should be nothing currently registered
View Full Code Here

      runAllCombinations(new Checker()
      {
         @Override
         public void check(String pass, ClusterInfoSessionFactory factory) throws Throwable
         {
            ClusterId cid = new ClusterId("test-app2","test-cluster");
           
            ClusterInfoSession session = factory.createSession();
            assertNotNull(pass,session);
            sessionsToClose.add(session);
            String clusterPath = createClusterLevel(cid,session);
View Full Code Here

TOP

Related Classes of com.nokia.dempsy.config.ClusterId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.