File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
src/test/java/cloud/localstack/awssdkv2 Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -174,4 +174,39 @@ public void testCWPutMetrics() throws Exception {
174174 PutMetricDataResponse response = clientCW .putMetricData (request ).get ();
175175 Assert .assertNotNull (response );
176176 }
177+
178+ @ Test
179+ public void testCWMultipleDimentionsAndMetrics () throws Exception {
180+ final CloudWatchAsyncClient clientCW = TestUtils .getClientCloudWatchAsyncV2 ();
181+
182+ List <Dimension > awsDimensionList = new ArrayList <>();
183+ for (int i = 0 ; i < 10 ; i ++) {
184+ awsDimensionList .add (Dimension .builder ()
185+ .name ("UNIQUE_PAGES" +i )
186+ .value ("URLS" +i )
187+ .build ());
188+ };
189+
190+ // Set an Instant object
191+ String time = ZonedDateTime .now ( ZoneOffset .UTC ).format ( DateTimeFormatter .ISO_INSTANT );
192+ Instant instant = Instant .parse (time );
193+ double dataPoint = 1.23423 ;
194+
195+ List <MetricDatum > metrics = new ArrayList ();
196+ for (int i = 0 ; i < 20 ; i ++) {
197+ metrics .add (MetricDatum .builder ()
198+ .metricName ("PAGES_VISITED" )
199+ .unit (StandardUnit .NONE )
200+ .value (dataPoint )
201+ .timestamp (instant )
202+ .dimensions (awsDimensionList ).build ());
203+ };
204+
205+ PutMetricDataRequest request = PutMetricDataRequest .builder ()
206+ .namespace ("SITE/TRAFFIC" )
207+ .metricData (metrics ).build ();
208+
209+ PutMetricDataResponse response = clientCW .putMetricData (request ).get ();
210+ Assert .assertNotNull (response );
211+ }
177212}
You can’t perform that action at this time.
0 commit comments