Skip to content

Commit

Permalink
spotless run
Browse files Browse the repository at this point in the history
  • Loading branch information
akats7 committed Nov 21, 2024
1 parent 3c0acac commit 70daf4e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public void assertRequestWithMockedResponse(
if (att.getType() == AttributeType.STRING) {
attributes.add(equalTo(att.getStringKey(), att.getStringVal()));
} else if (att.getType() == AttributeType.STRING_ARRAY) {
attributes.add(equalTo(att.getStringArrayKey(), att.getStringArrayVal()));
attributes.add(
equalTo(att.getStringArrayKey(), att.getStringArrayVal()));
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@

package io.opentelemetry.instrumentation.awssdk.v1_11;

import static io.opentelemetry.instrumentation.awssdk.v1_11.AttributeKeyPair.createStringArrayKeyPair;
import static io.opentelemetry.instrumentation.awssdk.v1_11.AttributeKeyPair.createStringKeyPair;

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
import com.amazonaws.services.dynamodbv2.model.CreateTableRequest;
import io.opentelemetry.testing.internal.armeria.common.HttpResponse;
import io.opentelemetry.testing.internal.armeria.common.HttpStatus;
import io.opentelemetry.testing.internal.armeria.common.MediaType;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import static io.opentelemetry.instrumentation.awssdk.v1_11.AttributeKeyPair.createStringArrayKeyPair;
import static io.opentelemetry.instrumentation.awssdk.v1_11.AttributeKeyPair.createStringKeyPair;
import org.junit.jupiter.api.Test;

public abstract class AbstractDynamoDbClientTest extends AbstractBaseAwsClientTest {

Expand All @@ -41,19 +41,14 @@ public void sendRequestWithMockedResponse() throws Exception {

List<String> tableList = Collections.singletonList("sometable");

List<AttributeKeyPair<?>> additionalAttributes = Arrays.asList(
createStringKeyPair("aws.table.name", "sometable"),
createStringKeyPair("db.system", "dynamodb"),
createStringArrayKeyPair("aws.dynamodb.table_names", tableList)
);
List<AttributeKeyPair<?>> additionalAttributes =
Arrays.asList(
createStringKeyPair("aws.table.name", "sometable"),
createStringKeyPair("db.system", "dynamodb"),
createStringArrayKeyPair("aws.dynamodb.table_names", tableList));

Object response = client.createTable(new CreateTableRequest("sometable", null));
assertRequestWithMockedResponse(
response,
client,
"DynamoDBv2",
"CreateTable",
"POST",
additionalAttributes);
response, client, "DynamoDBv2", "CreateTable", "POST", additionalAttributes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

package io.opentelemetry.instrumentation.awssdk.v1_11;

import static io.opentelemetry.instrumentation.awssdk.v1_11.AttributeKeyPair.createStringKeyPair;

import com.amazonaws.services.kinesis.AmazonKinesis;
import com.amazonaws.services.kinesis.AmazonKinesisClientBuilder;
import com.amazonaws.services.kinesis.model.DeleteStreamRequest;

import io.opentelemetry.testing.internal.armeria.common.HttpResponse;
import io.opentelemetry.testing.internal.armeria.common.HttpStatus;
import io.opentelemetry.testing.internal.armeria.common.MediaType;
Expand All @@ -20,8 +21,6 @@
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import static io.opentelemetry.instrumentation.awssdk.v1_11.AttributeKeyPair.createStringKeyPair;

public abstract class AbstractKinesisClientTest extends AbstractBaseAwsClientTest {

public abstract AmazonKinesisClientBuilder configureClient(AmazonKinesisClientBuilder client);
Expand All @@ -45,9 +44,8 @@ public void testSendRequestWithMockedResponse(

server.enqueue(HttpResponse.of(HttpStatus.OK, MediaType.PLAIN_TEXT_UTF_8, ""));

List<AttributeKeyPair<?>> additionalAttributes = Arrays.asList(
createStringKeyPair("aws.stream.name", "somestream")
);
List<AttributeKeyPair<?>> additionalAttributes =
Arrays.asList(createStringKeyPair("aws.stream.name", "somestream"));
Object response = call.apply(client);
assertRequestWithMockedResponse(
response, client, "Kinesis", operation, "POST", additionalAttributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public void testSendRequestWithMockedResponse(Function<AmazonSNS, Object> call)

server.enqueue(HttpResponse.of(HttpStatus.OK, MediaType.PLAIN_TEXT_UTF_8, body));

List<AttributeKeyPair<?>> additionalAttributes = Arrays.asList(
createStringKeyPair(MESSAGING_DESTINATION_NAME.toString(), "somearn"));
List<AttributeKeyPair<?>> additionalAttributes =
Arrays.asList(createStringKeyPair(MESSAGING_DESTINATION_NAME.toString(), "somearn"));

Object response = call.apply(client);
assertRequestWithMockedResponse(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.awssdk.v1_11;

import groovyjarjarantlr4.v4.runtime.misc.Nullable;
Expand All @@ -19,7 +24,8 @@ public static AttributeKeyPair<String> createStringKeyPair(String keyString, Str
return new AttributeKeyPair<>(AttributeKey.stringKey(keyString), val);
}

public static AttributeKeyPair<List<String>> createStringArrayKeyPair(String keyString, List<String> val) {
public static AttributeKeyPair<List<String>> createStringArrayKeyPair(
String keyString, List<String> val) {
return new AttributeKeyPair<>(AttributeKey.stringArrayKey(keyString), val);
}

Expand All @@ -29,7 +35,7 @@ public AttributeType getType() {

@SuppressWarnings("unchecked")
public AttributeKey<String> getStringKey() {
if (key.getType() != AttributeType.STRING){
if (key.getType() != AttributeType.STRING) {
return null;
}
return (AttributeKey<String>) key;
Expand All @@ -45,19 +51,19 @@ public AttributeKey<List<String>> getStringArrayKey() {
}

@SuppressWarnings("unchecked")
public String getStringVal(){
if (key.getType() != AttributeType.STRING){
public String getStringVal() {
if (key.getType() != AttributeType.STRING) {
return null;
}
return (String) value;
}

@SuppressWarnings("unchecked")
@Nullable
public List<String> getStringArrayVal(){
if (key.getType() != AttributeType.STRING_ARRAY){
public List<String> getStringArrayVal() {
if (key.getType() != AttributeType.STRING_ARRAY) {
return null;
}
return (List<String>)value;
return (List<String>) value;
}
}

0 comments on commit 70daf4e

Please sign in to comment.