Examples of SlowConsumerDetectionConfiguration


Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

    public static class SlowConsumerFactory implements VirtualHostPluginFactory
    {
        public SlowConsumerDetection newInstance(VirtualHost vhost)
        {
            SlowConsumerDetectionConfiguration config = vhost.getConfiguration().getConfiguration(SlowConsumerDetectionConfiguration.class.getName());

            if (config == null)
            {
                return null;
            }
View Full Code Here

Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

     * Ensure no exceptions are thrown and that we get the same values back that
     * were put into the configuration.
     */
    public void testConfigLoadingValidConfig()
    {
        SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();

        XMLConfiguration xmlconfig = new XMLConfiguration();

        long DELAY=10;
        String TIMEUNIT=TimeUnit.MICROSECONDS.toString();
        xmlconfig.addProperty("delay", String.valueOf(DELAY));
        xmlconfig.addProperty("timeunit", TIMEUNIT);

        // Create a CompositeConfiguration as this is what the broker uses
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlconfig);

        try
        {
            config.setConfiguration("", composite);
        }
        catch (ConfigurationException e)
        {
            e.printStackTrace();
            fail(e.getMessage());
        }

        assertEquals("Delay not correctly returned.", DELAY, config.getDelay());
        assertEquals("TimeUnit not correctly returned.",
                     TIMEUNIT, String.valueOf(config.getTimeUnit()));
    }
View Full Code Here

Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

       * the 'delay' value.
       *
       */
      public void testConfigLoadingMissingTimeUnitDefaults()
      {
          SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();

          XMLConfiguration xmlconfig = new XMLConfiguration();

          long DELAY=10;
          xmlconfig.addProperty("delay", String.valueOf(DELAY));

          // Create a CompositeConfiguration as this is what the broker uses
          CompositeConfiguration composite = new CompositeConfiguration();
          composite.addConfiguration(xmlconfig);
          try
          {
              config.setConfiguration("", composite);
          }
          catch (ConfigurationException e)
          {
              e.printStackTrace();
              fail(e.getMessage());
          }

          assertEquals("Delay not correctly returned.", DELAY, config.getDelay());
          assertEquals("Default TimeUnit incorrect", TimeUnit.SECONDS, config.getTimeUnit());
      }   
View Full Code Here

Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

     * the timeunit field is not case sensitive.
     * i.e. the toUpper is being correctly applied.
     */
    public void testConfigLoadingValidConfigStrangeTimeUnit()
    {
        SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();

        XMLConfiguration xmlconfig = new XMLConfiguration();

        long DELAY=10;

        xmlconfig.addProperty("delay", DELAY);
        xmlconfig.addProperty("timeunit", "MiCrOsEcOnDs");

        // Create a CompositeConfiguration as this is what the broker uses
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlconfig);

        try
        {
            config.setConfiguration("", composite);
        }
        catch (ConfigurationException e)
        {
            e.printStackTrace();
            fail(e.getMessage());
        }

        assertEquals("Delay not correctly returned.", DELAY, config.getDelay());
        assertEquals("TimeUnit not correctly returned.",
                     TimeUnit.MICROSECONDS.toString(), String.valueOf(config.getTimeUnit()));

    }
View Full Code Here

Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

     * verified to be the right exception, a NumberFormatException.
     *
     */
    public void testConfigLoadingInValidDelayString()
    {
        SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();

        XMLConfiguration xmlconfig = new XMLConfiguration();

        xmlconfig.addProperty("delay", "ten");
        xmlconfig.addProperty("timeunit", TimeUnit.MICROSECONDS.toString());

        // Create a CompositeConfiguration as this is what the broker uses
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlconfig);

        try
        {
            config.setConfiguration("", composite);
            fail("Configuration should fail to validate");
        }
        catch (ConfigurationException e)
        {
            Throwable cause = e.getCause();
View Full Code Here

Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

     * Configuration exception with a useful message should be thrown here.
     *
     */
    public void testConfigLoadingInValidDelayNegative()
    {
        SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();

        XMLConfiguration xmlconfig = new XMLConfiguration();

        xmlconfig.addProperty("delay", "-10");
        xmlconfig.addProperty("timeunit", TimeUnit.MICROSECONDS.toString());

        // Create a CompositeConfiguration as this is what the broker uses
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlconfig);

        try
        {
            config.setConfiguration("", composite);
            fail("Configuration should fail to validate");
        }
        catch (ConfigurationException e)
        {
            Throwable cause = e.getCause();
View Full Code Here

Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

     * Same test as 'testConfigLoadingInValidDelayNegative' but with a 0 value.
     *
     */
    public void testConfigLoadingInValidDelayZero()
    {
        SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();

        XMLConfiguration xmlconfig = new XMLConfiguration();

        xmlconfig.addProperty("delay", "0");
        xmlconfig.addProperty("timeunit", TimeUnit.MICROSECONDS.toString());

        // Create a CompositeConfiguration as this is what the broker uses
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlconfig);

        try
        {
            config.setConfiguration("", composite);
            fail("Configuration should fail to validate");
        }
        catch (ConfigurationException e)
        {
            Throwable cause = e.getCause();
View Full Code Here

Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

     * Exception is thrown.
     *
     * */
    public void testConfigLoadingInValidMissingDelay()
    {
        SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();

        XMLConfiguration xmlconfig = new XMLConfiguration();

        xmlconfig.addProperty("timeunit", TimeUnit.SECONDS.toString());

        // Create a CompositeConfiguration as this is what the broker uses
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlconfig);
        try
        {
            config.setConfiguration("", composite);
            fail("Configuration should fail to validate");
        }
        catch (ConfigurationException e)
        {
            assertEquals("Incorrect message.", "SlowConsumerDetectionConfiguration: unable to configure invalid delay:null", e.getMessage());
View Full Code Here

Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

     * We test with 'foo', which will never be a TimeUnit
     *
     */
    public void testConfigLoadingInValidTimeUnit()
    {
        SlowConsumerDetectionConfiguration config = new SlowConsumerDetectionConfiguration();

        String TIMEUNIT = "foo";
        XMLConfiguration xmlconfig = new XMLConfiguration();

        xmlconfig.addProperty("delay", "10");
        xmlconfig.addProperty("timeunit", TIMEUNIT);

        // Create a CompositeConfiguration as this is what the broker uses
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlconfig);
        try
        {
            config.setConfiguration("", composite);
            fail("Configuration should fail to validate");
        }
        catch (ConfigurationException e)
        {
            assertEquals("Incorrect message.", "Unable to configure Slow Consumer Detection invalid TimeUnit:" + TIMEUNIT, e.getMessage());
View Full Code Here

Examples of org.apache.qpid.server.configuration.plugins.SlowConsumerDetectionConfiguration

    public static class SlowConsumerFactory implements VirtualHostPluginFactory
    {
        public SlowConsumerDetection newInstance(VirtualHost vhost)
        {
            SlowConsumerDetectionConfiguration config = vhost.getConfiguration().getConfiguration(SlowConsumerDetectionConfiguration.class.getName());

            if (config == null)
            {
                return null;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.