Package org.apache.sling.discovery.impl.setup

Examples of org.apache.sling.discovery.impl.setup.PropertyProviderImpl


        logger.info("testPropertyProviders: 2nd 2s sleep");
        Thread.sleep(2000);

        property1Value = UUID.randomUUID().toString();
        property1Name = UUID.randomUUID().toString();
        PropertyProviderImpl pp1 = new PropertyProviderImpl();
        pp1.setProperty(property1Name, property1Value);
        instance1.bindPropertyProvider(pp1, property1Name);

        property2Value = UUID.randomUUID().toString();
        property2Name = UUID.randomUUID().toString();
        PropertyProviderImpl pp2 = new PropertyProviderImpl();
        pp2.setProperty(property2Name, property2Value);
        instance2.bindPropertyProvider(pp2, property2Name);

        assertPropertyValues();

        property1Value = UUID.randomUUID().toString();
View Full Code Here


    @Test
    public void testPropertyProviders() throws Throwable {
        logger.info("testPropertyProviders: start");
        final String propertyName = UUID.randomUUID().toString();
        propertyValue = UUID.randomUUID().toString();
        PropertyProviderImpl pp = new PropertyProviderImpl();
        pp.setProperty(propertyName, propertyValue);
        instance.bindPropertyProvider(pp, propertyName);

        assertEquals(propertyValue,
                instance.getClusterViewService().getClusterView()
                        .getInstances().get(0).getProperty(propertyName));

        propertyValue = UUID.randomUUID().toString();
        pp.setProperty(propertyName, propertyValue);
        instance.runHeartbeatOnce();

        assertEquals(propertyValue,
                instance.getClusterViewService().getClusterView()
                        .getInstances().get(0).getProperty(propertyName));
View Full Code Here

    }

  private void doTestProperty(final String propertyName,
      final String propertyValue,
      final String expectedPropertyValue) throws Throwable {
    PropertyProviderImpl pp = new PropertyProviderImpl();
        pp.setProperty(propertyName, propertyValue);
        instance.bindPropertyProvider(pp, propertyName);
        assertEquals(expectedPropertyValue,
                instance.getClusterViewService().getClusterView()
                        .getInstances().get(0).getProperty(propertyName));
  }
View Full Code Here

        instance.bindTopologyEventListener(assertingTopologyEventListener);
        assertEquals(0, assertingTopologyEventListener.getRemainingExpectedCount());

        final String propertyName = UUID.randomUUID().toString();
        propertyValue = UUID.randomUUID().toString();
        PropertyProviderImpl pp = new PropertyProviderImpl();
        pp.setProperty(propertyName, propertyValue);

        assertingTopologyEventListener.addExpected(Type.PROPERTIES_CHANGED);

        assertEquals(1, assertingTopologyEventListener.getRemainingExpectedCount());
        assertEquals(0, pp.getGetCnt());
        instance.bindPropertyProvider(pp, propertyName);
        logger.info("testTopologyEventListeners: 3rd sleep 1.5s");
        Thread.sleep(1500);
        assertEquals(0, assertingTopologyEventListener.getRemainingExpectedCount());
        // we can only assume that the getProperty was called at least once - it
        // could be called multiple times though..
        assertTrue(pp.getGetCnt() > 0);

        assertingTopologyEventListener.addExpected(Type.PROPERTIES_CHANGED);

        assertEquals(1, assertingTopologyEventListener.getRemainingExpectedCount());
        pp.setGetCnt(0);
        propertyValue = UUID.randomUUID().toString();
        pp.setProperty(propertyName, propertyValue);
        assertEquals(0, pp.getGetCnt());
        instance.runHeartbeatOnce();
        logger.info("testTopologyEventListeners: 4th sleep 2s");
        Thread.sleep(2000);
        assertEquals(0, assertingTopologyEventListener.getRemainingExpectedCount());
        assertEquals(2, pp.getGetCnt());

        // a heartbeat repeat should not result in another call though
        instance.runHeartbeatOnce();
        logger.info("testTopologyEventListeners: 5th sleep 2s");
        Thread.sleep(2000);
        assertEquals(0, assertingTopologyEventListener.getRemainingExpectedCount());
        assertEquals(3, pp.getGetCnt());
        logger.info("testTopologyEventListeners: done");
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.discovery.impl.setup.PropertyProviderImpl

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.