use of com.amazonaws.xray.plugins.ElasticBeanstalkPlugin in project aws-xray-sdk-java by aws.
the class AWSXRayRecorderBuilder method withDefaultPlugins.
/**
* Adds all implemented plugins to the builder instance rather than requiring them to be individually added. The recorder will
* only reflect metadata from plugins that are enabled, which is checked in the build method below.
*
* @return
* The builder instance, for chaining
*/
public AWSXRayRecorderBuilder withDefaultPlugins() {
plugins.add(new EC2Plugin());
plugins.add(new ECSPlugin());
plugins.add(new EKSPlugin());
plugins.add(new ElasticBeanstalkPlugin());
return this;
}
use of com.amazonaws.xray.plugins.ElasticBeanstalkPlugin in project aws-xray-sdk-java by aws.
the class AWSXRayRecorderTest method testPluginEquality.
@Test
public void testPluginEquality() {
Collection<Plugin> plugins = new HashSet<>();
plugins.add(new EC2Plugin());
// should be deduped
plugins.add(new EC2Plugin());
plugins.add(new ECSPlugin());
plugins.add(new EKSPlugin());
plugins.add(new ElasticBeanstalkPlugin());
Assert.assertEquals(4, plugins.size());
}
use of com.amazonaws.xray.plugins.ElasticBeanstalkPlugin in project aws-xray-sdk-java by aws.
the class AWSXRayRecorderTest method testOriginResolutionWithAllPlugins.
@Test
public void testOriginResolutionWithAllPlugins() {
// given
EC2Plugin ec2Plugin = Mockito.mock(EC2Plugin.class);
ECSPlugin ecsPlugin = Mockito.mock(ECSPlugin.class);
ElasticBeanstalkPlugin ebPlugin = Mockito.mock(ElasticBeanstalkPlugin.class);
EKSPlugin eksPlugin = Mockito.mock(EKSPlugin.class);
List<Plugin> plugins = new ArrayList<>();
plugins.add(ec2Plugin);
plugins.add(ecsPlugin);
plugins.add(ebPlugin);
plugins.add(eksPlugin);
List<String> origins = new ArrayList<>();
origins.add(EC2Plugin.ORIGIN);
origins.add(ECSPlugin.ORIGIN);
origins.add(ElasticBeanstalkPlugin.ORIGIN);
origins.add(EKSPlugin.ORIGIN);
Map<String, Object> runtimeContext = new HashMap<>();
runtimeContext.put("key", "value");
for (int i = 0; i < 4; i++) {
Mockito.doReturn(true).when(plugins.get(i)).isEnabled();
Mockito.doReturn(runtimeContext).when(plugins.get(i)).getRuntimeContext();
Mockito.doReturn("serviceName").when(plugins.get(i)).getServiceName();
Mockito.doReturn(origins.get(i)).when(plugins.get(i)).getOrigin();
}
AWSXRayRecorder recorder = AWSXRayRecorderBuilder.standard().withPlugin(ec2Plugin).withPlugin(ecsPlugin).withPlugin(ebPlugin).withPlugin(eksPlugin).build();
// when
Assert.assertEquals(ElasticBeanstalkPlugin.ORIGIN, recorder.getOrigin());
}
Aggregations