Package org.jclouds.cloudwatch.domain

Examples of org.jclouds.cloudwatch.domain.Metric


      response = api().list(new ListMetricsOptions());

      performDefaultMetricsTests(response);

      if (Iterables.size(response) > 0) {
         Metric metric = response.iterator().next();

         testMetricName = metric.getMetricName();
         testNamespace = metric.getNamespace();

         if (metric.getDimensions().size() > 0) {
            Dimension dimension = metric.getDimensions().iterator().next();

            testDimensionName = dimension.getName();
            testDimensionValue = dimension.getValue();
         }

         if (testDimensionName == null) {
            for (Metric metric1 : response) {
               Set<Dimension> dimensions = metric1.getDimensions();

               if (dimensions.size() > 0) {
                  Dimension dimension = metric.getDimensions().iterator().next();

                  testDimensionName = dimension.getName();
                  testDimensionValue = dimension.getValue();

                  break;
               }
            }
         }
      }

      // Test with a NextToken, even if it's null
      response = api().list(ListMetricsOptions.Builder.afterMarker(response.nextMarker().orNull()));

      performDefaultMetricsTests(response);

      // Test with a Namespace
      response = api().list(ListMetricsOptions.Builder.namespace(testNamespace));

      performDefaultMetricsTests(response);

      for (Metric metric : response) {
         checkArgument(metric.getNamespace().equals(testNamespace),
                       "All metrics should have the " + testNamespace + " Namespace.");
      }

      // Test with a MetricName
      response = api().list(ListMetricsOptions.Builder.metricName(testMetricName));

      performDefaultMetricsTests(response);

      for (Metric metric : response) {
         checkArgument(metric.getMetricName().equals(testMetricName),
                       "All metrics should have the " + testMetricName + " MetricName.");
      }

      // Test with a Dimension
      if (testDimensionName != null) {
         Dimension testDimension = new Dimension(testDimensionName, testDimensionValue);

         response = api().list(ListMetricsOptions.Builder.dimension(testDimension));

         performDefaultMetricsTests(response);

         for (Metric metric : response) {
            Set<Dimension> dimensions = metric.getDimensions();
            boolean dimensionFound = false;

            for (Dimension dimension : dimensions) {
               if (dimension.getName().equals(testDimensionName)) {
                  dimensionFound = true;
View Full Code Here


   /**
    * {@inheritDoc}
    */
   @Override
   public Metric getResult() {
      Metric metric = new Metric(metricName, namespace, dimensions);

      // Reset since this handler is created once but produces N results
      dimensions = Sets.newLinkedHashSet();
      metricName = null;
      namespace = null;
View Full Code Here

      response = api().list(new ListMetricsOptions());

      performDefaultMetricsTests(response);

      if (Iterables.size(response) > 0) {
         Metric metric = response.iterator().next();

         testMetricName = metric.getMetricName();
         testNamespace = metric.getNamespace();

         if (metric.getDimensions().size() > 0) {
            Dimension dimension = metric.getDimensions().iterator().next();

            testDimensionName = dimension.getName();
            testDimensionValue = dimension.getValue();
         }

         if (testDimensionName == null) {
            for (Metric metric1 : response) {
               Set<Dimension> dimensions = metric1.getDimensions();

               if (dimensions.size() > 0) {
                  Dimension dimension = metric.getDimensions().iterator().next();

                  testDimensionName = dimension.getName();
                  testDimensionValue = dimension.getValue();

                  break;
               }
            }
         }
      }

      // Test with a NextToken, even if it's null
      response = api().list(ListMetricsOptions.Builder.afterMarker(response.nextMarker().orNull()));

      performDefaultMetricsTests(response);

      // Test with a Namespace
      response = api().list(ListMetricsOptions.Builder.namespace(testNamespace));

      performDefaultMetricsTests(response);

      for (Metric metric : response) {
         checkArgument(metric.getNamespace().equals(testNamespace),
                       "All metrics should have the " + testNamespace + " Namespace.");
      }

      // Test with a MetricName
      response = api().list(ListMetricsOptions.Builder.metricName(testMetricName));

      performDefaultMetricsTests(response);

      for (Metric metric : response) {
         checkArgument(metric.getMetricName().equals(testMetricName),
                       "All metrics should have the " + testMetricName + " MetricName.");
      }

      // Test with a Dimension
      if (testDimensionName != null) {
         Dimension testDimension = new Dimension(testDimensionName, testDimensionValue);

         response = api().list(ListMetricsOptions.Builder.dimension(testDimension));

         performDefaultMetricsTests(response);

         for (Metric metric : response) {
            Set<Dimension> dimensions = metric.getDimensions();
            boolean dimensionFound = false;

            for (Dimension dimension : dimensions) {
               if (dimension.getName().equals(testDimensionName)) {
                  dimensionFound = true;
View Full Code Here

   /**
    * {@inheritDoc}
    */
   @Override
   public Metric getResult() {
      Metric metric = new Metric(metricName, namespace, dimensions);

      // Reset since this handler is created once but produces N results
      dimensions = Sets.newLinkedHashSet();
      metricName = null;
      namespace = null;
View Full Code Here

   /**
    * {@inheritDoc}
    */
   @Override
   public Metric getResult() {
      Metric metric = new Metric(metricName, namespace, dimensions);

      // Reset since this handler is created once but produces N results
      dimensions = Sets.newLinkedHashSet();
      metricName = null;
      namespace = null;
View Full Code Here

      response = api().list(new ListMetricsOptions());

      performDefaultMetricsTests(response);

      if (Iterables.size(response) > 0) {
         Metric metric = response.iterator().next();

         testMetricName = metric.getMetricName();
         testNamespace = metric.getNamespace();

         if (metric.getDimensions().size() > 0) {
            Dimension dimension = metric.getDimensions().iterator().next();

            testDimensionName = dimension.getName();
            testDimensionValue = dimension.getValue();
         }

         if (testDimensionName == null) {
            for (Metric metric1 : response) {
               Set<Dimension> dimensions = metric1.getDimensions();

               if (dimensions.size() > 0) {
                  Dimension dimension = metric.getDimensions().iterator().next();

                  testDimensionName = dimension.getName();
                  testDimensionValue = dimension.getValue();

                  break;
               }
            }
         }
      }

      // Test with a NextToken, even if it's null
      response = api().list(ListMetricsOptions.Builder.afterMarker(response.nextMarker().orNull()));

      performDefaultMetricsTests(response);

      // Test with a Namespace
      response = api().list(ListMetricsOptions.Builder.namespace(testNamespace));

      performDefaultMetricsTests(response);

      for (Metric metric : response) {
         checkArgument(metric.getNamespace().equals(testNamespace),
                       "All metrics should have the " + testNamespace + " Namespace.");
      }

      // Test with a MetricName
      response = api().list(ListMetricsOptions.Builder.metricName(testMetricName));

      performDefaultMetricsTests(response);

      for (Metric metric : response) {
         checkArgument(metric.getMetricName().equals(testMetricName),
                       "All metrics should have the " + testMetricName + " MetricName.");
      }

      // Test with a Dimension
      if (testDimensionName != null) {
         Dimension testDimension = new Dimension(testDimensionName, testDimensionValue);

         response = api().list(ListMetricsOptions.Builder.dimension(testDimension));

         performDefaultMetricsTests(response);

         for (Metric metric : response) {
            Set<Dimension> dimensions = metric.getDimensions();
            boolean dimensionFound = false;

            for (Dimension dimension : dimensions) {
               if (dimension.getName().equals(testDimensionName)) {
                  dimensionFound = true;
View Full Code Here

      response = api().list(new ListMetricsOptions());

      performDefaultMetricsTests(response);

      if (!Iterables.isEmpty(response)) {
         Metric metric = response.iterator().next();

         testMetricName = metric.getMetricName();
         testNamespace = metric.getNamespace();

         if (!metric.getDimensions().isEmpty()) {
            Dimension dimension = metric.getDimensions().iterator().next();

            testDimensionName = dimension.getName();
            testDimensionValue = dimension.getValue();
         }

         if (testDimensionName == null) {
            for (Metric metric1 : response) {
               Set<Dimension> dimensions = metric1.getDimensions();

               if (!dimensions.isEmpty()) {
                  Dimension dimension = metric.getDimensions().iterator().next();

                  testDimensionName = dimension.getName();
                  testDimensionValue = dimension.getValue();

                  break;
               }
            }
         }
      }

      // Test with a NextToken, even if it's null
      response = api().list(ListMetricsOptions.Builder.afterMarker(response.nextMarker().orNull()));

      performDefaultMetricsTests(response);

      // Test with a Namespace
      response = api().list(ListMetricsOptions.Builder.namespace(testNamespace));

      performDefaultMetricsTests(response);

      for (Metric metric : response) {
         checkArgument(metric.getNamespace().equals(testNamespace),
                       "All metrics should have the " + testNamespace + " Namespace.");
      }

      // Test with a MetricName
      response = api().list(ListMetricsOptions.Builder.metricName(testMetricName));

      performDefaultMetricsTests(response);

      for (Metric metric : response) {
         checkArgument(metric.getMetricName().equals(testMetricName),
                       "All metrics should have the " + testMetricName + " MetricName.");
      }

      // Test with a Dimension
      if (testDimensionName != null) {
         Dimension testDimension = new Dimension(testDimensionName, testDimensionValue);

         response = api().list(ListMetricsOptions.Builder.dimension(testDimension));

         performDefaultMetricsTests(response);

         for (Metric metric : response) {
            Set<Dimension> dimensions = metric.getDimensions();
            boolean dimensionFound = false;

            for (Dimension dimension : dimensions) {
               if (dimension.getName().equals(testDimensionName)) {
                  dimensionFound = true;
View Full Code Here

   /**
    * {@inheritDoc}
    */
   @Override
   public Metric getResult() {
      Metric metric = new Metric(metricName, namespace, dimensions);

      // Reset since this handler is created once but produces N results
      dimensions = Sets.newLinkedHashSet();
      metricName = null;
      namespace = null;
View Full Code Here

TOP

Related Classes of org.jclouds.cloudwatch.domain.Metric

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.