本文整理汇总了Java中org.jboss.arquillian.container.spi.Container.getContainerConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java Container.getContainerConfiguration方法的具体用法?Java Container.getContainerConfiguration怎么用?Java Container.getContainerConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.arquillian.container.spi.Container
的用法示例。
在下文中一共展示了Container.getContainerConfiguration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureArquillianForRemoteWildfly
import org.jboss.arquillian.container.spi.Container; //导入方法依赖的package包/类
private void configureArquillianForRemoteWildfly(GenericContainer dockerContainer, ContainerRegistry registry) {
Integer wildflyHttpPort = dockerContainer.getMappedPort(WILDFLY_HTTP_PORT);
Integer wildflyManagementPort = dockerContainer.getMappedPort(WILDFLY_MANAGEMENT_PORT);
String containerIpAddress = dockerContainer.getContainerIpAddress();
Container arquillianContainer = registry.getContainers().iterator().next();
ContainerDef containerConfiguration = arquillianContainer.getContainerConfiguration();
containerConfiguration.property(ContainerConfiguration.MANAGEMENT_ADDRESS_KEY, containerIpAddress);
containerConfiguration.property(ContainerConfiguration.MANAGEMENT_PORT_KEY,
String.valueOf(wildflyManagementPort));
containerConfiguration.property(ContainerConfiguration.USERNAME_KEY, "admin");
containerConfiguration.property(ContainerConfiguration.PASSWORD_KEY, "Admin#007");
ProtocolDef protocolConfiguration = arquillianContainer
.getProtocolConfiguration(new ProtocolDescription(ServletProtocolDefinition.NAME));
protocolConfiguration.property(ServletProtocolDefinition.HOST_KEY, containerIpAddress);
protocolConfiguration.property(ServletProtocolDefinition.PORT_KEY, String.valueOf(wildflyHttpPort));
}
示例2: applyDockerServerIpChange
import org.jboss.arquillian.container.spi.Container; //导入方法依赖的package包/类
public void applyDockerServerIpChange(@Observes BeforeSetup event, CubeRegistry cubeRegistry,
ContainerRegistry containerRegistry)
throws InstantiationException, IllegalAccessException, MalformedURLException {
Container container = ContainerUtil.getContainerByDeployableContainer(containerRegistry,
event.getDeployableContainer());
if (container == null) {
return;
}
Cube<?> cube = cubeRegistry.getCube(org.arquillian.cube.impl.util.ContainerUtil.getCubeIDForContainer(container));
if (cube == null) {
return; // No Cube found matching Container name, not managed by Cube
}
HasPortBindings portBindings = cube.getMetadata(HasPortBindings.class);
if (portBindings == null) {
return;
}
ContainerDef containerConfiguration = container.getContainerConfiguration();
boolean foundAttribute =
resolveConfigurationPropertiesWithDockerServerIp(containerConfiguration, portBindings.getContainerIP());
//if user doesn't configured in arquillian.xml the host then we can override the default value.
if (!foundAttribute) {
Class<?> configurationClass = container.getDeployableContainer().getConfigurationClass();
List<PropertyDescriptor> configurationClassHostOrAddressFields =
filterConfigurationClassPropertiesByHostOrAddressAttribute(configurationClass);
for (PropertyDescriptor propertyDescriptor : configurationClassHostOrAddressFields) {
//we get default address value and we replace to boot2docker ip
containerConfiguration.overrideProperty(propertyDescriptor.getName(), portBindings.getContainerIP());
}
}
}
示例3: remapContainer
import org.jboss.arquillian.container.spi.Container; //导入方法依赖的package包/类
public void remapContainer(@Observes BeforeSetup event, CubeRegistry cubeRegistry,
ContainerRegistry containerRegistry) throws InstantiationException, IllegalAccessException {
Container container = ContainerUtil.getContainerByDeployableContainer(containerRegistry,
event.getDeployableContainer());
if (container == null) {
return;
}
Cube<?> cube = cubeRegistry.getCube(ContainerUtil.getCubeIDForContainer(container));
if (cube == null) {
return; // No Cube found matching Container name, not managed by Cube
}
HasPortBindings bindings = cube.getMetadata(HasPortBindings.class);
if (bindings == null) {
return;
}
ContainerDef containerConfiguration = container.getContainerConfiguration();
//Get the port property
List<String> portPropertiesFromArquillianConfigurationFile =
filterArquillianConfigurationPropertiesByPortAttribute(containerConfiguration);
//Get the AddressProperty property
List<String> addressPropertiesFromArquillianConfigurationFile =
filterArquillianConfigurationPropertiesByAddressAttribute(containerConfiguration);
Class<?> configurationClass = container.getDeployableContainer().getConfigurationClass();
//Get the port property
List<PropertyDescriptor> configurationClassPortFields =
filterConfigurationClassPropertiesByPortAttribute(configurationClass);
//Get the Address property
List<PropertyDescriptor> configurationClassAddressFields =
filterConfigurationClassPropertiesByAddressAttribute(configurationClass);
Object newConfigurationInstance = configurationClass.newInstance();
for (PropertyDescriptor configurationClassPortField : configurationClassPortFields) {
int containerPort = getDefaultPortFromConfigurationInstance(newConfigurationInstance,
configurationClass, configurationClassPortField);
mappingForPort = bindings.getMappedAddress(containerPort);
if (!portPropertiesFromArquillianConfigurationFile.contains(configurationClassPortField.getName()) && (
configurationClassPortField.getPropertyType().equals(Integer.class)
|| configurationClassPortField.getPropertyType().equals(int.class))) {
// This means that port has not configured in arquillian.xml and it will use default value.
// In this case is when remapping should be activated to adequate the situation according to
// Arquillian Cube exposed ports.
if (mappingForPort != null) {
containerConfiguration.overrideProperty(configurationClassPortField.getName(),
Integer.toString(mappingForPort.getPort()));
}
}
}
for (PropertyDescriptor configurationClassAddressField : configurationClassAddressFields) {
if (!addressPropertiesFromArquillianConfigurationFile.contains(configurationClassAddressField.getName()) && (
configurationClassAddressField.getPropertyType().equals(String.class)
|| configurationClassAddressField.getPropertyType().equals(String.class))) {
// If a property called portForwardBindAddress on openshift qualifier on arquillian.xml exists it will overrides the
// arquillian default|defined managementAddress with the IP address given on this property.
if (mappingForPort != null) {
containerConfiguration.overrideProperty(configurationClassAddressField.getName(),
mappingForPort.getIP());
}
}
}
}