本文整理汇总了Java中org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData类的典型用法代码示例。如果您正苦于以下问题:Java ProtocolMetaData类的具体用法?Java ProtocolMetaData怎么用?Java ProtocolMetaData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProtocolMetaData类属于org.jboss.arquillian.container.spi.client.protocol.metadata包,在下文中一共展示了ProtocolMetaData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolve
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
private URL resolve(String portletId) {
ProtocolMetaData metaData = protocolMetadata.get();
if (metaData == null) {
return null;
}
if (metaData.hasContext(HTTPContext.class)) {
HTTPContext context = metaData.getContexts(
HTTPContext.class).iterator().next();
try {
URL url = new URI(
"http", null, context.getHost(), context.getPort(), null,
null, null).toURL();
return new URL(
url, "/o/install-portlet-servlet?portlet-id="+portletId);
}
catch (Exception e) {
throw new RuntimeException("Can't obtain URL, " + context, e);
}
}
return null;
}
示例2: shouldUpdateWithPortFromDocker
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Test // equal ip, different ports
public void shouldUpdateWithPortFromDocker() throws Exception {
Binding binding = new Binding(LOCALHOST);
binding.addPortBinding(EXPOSED_PORT, BOUND_PORT);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(new TestPortBindings(binding));
bind(ContainerScoped.class,
Container.class,
new ContainerImpl(CUBE_CONTAINER_NAME, deployableContainer, new ContainerDefImpl("arquillian.xml")));
ProtocolMetaData metadata = new ProtocolMetaData();
metadata.addContext(new HTTPContext(LOCALHOST, EXPOSED_PORT).add(new Servlet("A", "B")));
bind(DeploymentScoped.class, ProtocolMetaData.class, metadata);
fire(metadata);
ProtocolMetaData updated = getManager().getContext(DeploymentContext.class)
.getObjectStore().get(ProtocolMetaData.class);
Assert.assertEquals(BOUND_PORT.intValue(), updated.getContexts(HTTPContext.class).iterator().next().getPort());
Assert.assertEquals(LOCALHOST, updated.getContexts(HTTPContext.class).iterator().next().getHost());
assertEventFired(ProtocolMetaData.class, 1); // twice, but original fire is intercepted and never hit the Counter
}
示例3: shouldUpdateWithIPFromDocker
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Test // equal ports, different ip
public void shouldUpdateWithIPFromDocker() throws Exception {
Binding binding = new Binding(GATEWAY_IP);
binding.addPortBinding(EXPOSED_PORT, EXPOSED_PORT);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(new TestPortBindings(binding));
bind(ContainerScoped.class,
Container.class,
new ContainerImpl(CUBE_CONTAINER_NAME, deployableContainer, new ContainerDefImpl("arquillian.xml")));
ProtocolMetaData metadata = new ProtocolMetaData();
metadata.addContext(new HTTPContext(LOCALHOST, EXPOSED_PORT).add(new Servlet("A", "B")));
bind(DeploymentScoped.class, ProtocolMetaData.class, metadata);
fire(metadata);
ProtocolMetaData updated = getManager().getContext(DeploymentContext.class)
.getObjectStore().get(ProtocolMetaData.class);
Assert.assertEquals(EXPOSED_PORT.intValue(), updated.getContexts(HTTPContext.class).iterator().next().getPort());
Assert.assertEquals(GATEWAY_IP, updated.getContexts(HTTPContext.class).iterator().next().getHost());
assertEventFired(ProtocolMetaData.class, 1); // twice, but original fire is intercepted and never hit the Counter
}
示例4: shouldNotUpdateIfContainerNotMapped
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Test
public void shouldNotUpdateIfContainerNotMapped() throws Exception {
Binding binding = new Binding(GATEWAY_IP);
binding.addPortBinding(EXPOSED_PORT, EXPOSED_PORT);
Mockito.when(cube.getMetadata(HasPortBindings.class)).thenReturn(new TestPortBindings(binding));
bind(ContainerScoped.class,
Container.class,
new ContainerImpl("_UNMAPPED_", deployableContainer, new ContainerDefImpl("arquillian.xml")));
ProtocolMetaData metadata = new ProtocolMetaData();
metadata.addContext(new HTTPContext(LOCALHOST, EXPOSED_PORT).add(new Servlet("A", "B")));
bind(DeploymentScoped.class, ProtocolMetaData.class, metadata);
fire(metadata);
ProtocolMetaData updated = getManager().getContext(DeploymentContext.class)
.getObjectStore().get(ProtocolMetaData.class);
Assert.assertEquals(metadata.getContexts(HTTPContext.class).iterator().next(),
updated.getContexts(HTTPContext.class).iterator().next());
assertEventFired(ProtocolMetaData.class, 1);
}
示例5: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
// Get all the server groups we're deploying to
final Set<String> serverGroups = getServerGroups(archive);
if (!serverGroups.isEmpty()) {
final ProtocolMetaData metaData = new ProtocolMetaData();
final ArchiveDeployer deployer = archiveDeployerInst.get();
final String uniqueName = deployer.deploy(archive, serverGroups);
final Domain domain = domainInst.get();
for (String serverGroupName : serverGroups) {
for (Server server : domain.getServersInGroup(serverGroupName)) {
metaData.addContext(new LazyHttpContext(server, uniqueName, managementClient));
}
}
return metaData;
}
throw new DeploymentException("Could not determine the server-group to deploy the archive to.");
}
示例6: getExecutor
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Override
public ContainerMethodExecutor getExecutor(FurnaceProtocolConfiguration protocolConfiguration,
ProtocolMetaData metaData, CommandCallback callback)
{
if (metaData == null)
{
return new ContainerMethodExecutor()
{
@Override
public TestResult invoke(TestMethodExecutor arg0)
{
return TestResult.skipped();
}
};
}
Collection<FurnaceHolder> contexts = metaData.getContexts(FurnaceHolder.class);
if (contexts.size() == 0)
{
throw new IllegalArgumentException(
"No " + Furnace.class.getName() + " found in " + ProtocolMetaData.class.getName() + ". " +
"Furnace protocol can not be used");
}
return new FurnaceTestMethodExecutor(protocolConfiguration, contexts.iterator().next());
}
示例7: getExecutor
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Override
public ContainerMethodExecutor getExecutor(ForgeProtocolConfiguration protocolConfiguration,
ProtocolMetaData metaData, CommandCallback callback)
{
if (metaData == null)
{
return new ContainerMethodExecutor()
{
@Override
public TestResult invoke(TestMethodExecutor arg0)
{
return new TestResult(Status.SKIPPED);
}
};
}
Collection<FurnaceHolder> contexts = metaData.getContexts(FurnaceHolder.class);
if (contexts.size() == 0)
{
throw new IllegalArgumentException(
"No " + Furnace.class.getName() + " found in " + ProtocolMetaData.class.getName() + ". " +
"Furnace protocol can not be used");
}
return new ForgeTestMethodExecutor(protocolConfiguration, contexts.iterator().next());
}
示例8: getExecutor
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.jboss.arquillian.container.test.spi.client.protocol.Protocol#getExecutor(org.jboss.arquillian.container.test.spi.client.protocol.ProtocolConfiguration,
* org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData,
* org.jboss.arquillian.container.test.spi.command.CommandCallback)
*/
@Override
public ContainerMethodExecutor getExecutor(final DaemonProtocolConfiguration protocolConfiguration,
final ProtocolMetaData metaData, final CommandCallback callback) {
final Collection<DeploymentContext> contexts = metaData.getContexts(DeploymentContext.class);
assert contexts.size() == 1 : "Should be exactly one deployment context";
final DeploymentContext context = contexts.iterator().next();
return new DaemonMethodExecutor(context);
}
示例9: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Override
public synchronized ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
StartupTimeout startupTimeout = this.testClass.getAnnotation(StartupTimeout.class);
if (startupTimeout != null) {
setTimeout(startupTimeout.value());
}
this.delegateContainer = new UberjarSimpleContainer(this.containerContext.get(), this.deploymentContext.get(), this.testClass);
try {
this.delegateContainer
.setJavaVmArguments(this.getJavaVmArguments())
.requestedMavenArtifacts(this.requestedMavenArtifacts)
.start(archive);
// start wants to connect to the remote container, which isn't up until now, so
// we override start above and call it here instead
super.start();
ProtocolMetaData metaData = new ProtocolMetaData();
metaData.addContext(createDeploymentContext(archive.getId()));
return metaData;
} catch (Throwable e) {
if (e instanceof LifecycleException) {
e = e.getCause();
}
throw new DeploymentException(e.getMessage(), e);
}
}
示例10: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive)
throws DeploymentException {
LiferayRemoteContainerConfiguration config =
_configurationInstance.get();
ProtocolMetaData protocolMetaData = super.deploy(archive);
protocolMetaData.addContext(
new HTTPContext(config.getHttpHost(), config.getHttpPort()));
return protocolMetaData;
}
示例11: execute
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
public InputStream execute(int pod, int port, String path) throws Exception {
ProtocolMetaData pmd = pmdInstance.get();
if (pmd != null) {
Map<String, String> labels = DeploymentContext.getDeploymentContext(pmd).getLabels();
return execute(labels, pod, port, path);
} else {
throw new IllegalStateException("No ProtocolMetaData set!");
}
}
示例12: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
StartupTimeout startupTimeout = this.testClass.getAnnotation(StartupTimeout.class);
if (startupTimeout != null) {
setTimeout(startupTimeout.value());
}
if (this.testClass.getAnnotation(InVM.class) != null) {
this.delegateContainer = new InVMSimpleContainer(this.testClass);
} else {
this.delegateContainer = new UberjarSimpleContainer(this.testClass);
}
try {
this.delegateContainer
.requestedMavenArtifacts(this.requestedMavenArtifacts)
.start(archive);
// start wants to connect to the remote container, which isn't up until now, so
// we override start above and call it here instead
super.start();
ProtocolMetaData metaData = new ProtocolMetaData();
metaData.addContext(createDeploymentContext(archive.getId()));
return metaData;
} catch (Exception e) {
throw new DeploymentException(e.getMessage(), e);
}
}
示例13: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive)
throws DeploymentException {
ProtocolMetaData protocolMetaData = super.deploy(archive);
protocolMetaData.addContext(
new HTTPContext(config.getHttpHost(), config.getHttpPort()));
return protocolMetaData;
}
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:12,代码来源:LiferayRemoteDeployableContainer.java
示例14: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
public ProtocolMetaData deploy(final Archive<?> archive) throws DeploymentException {
return deployment(new Callable<ProtocolMetaData>() {
@SuppressWarnings("unchecked")
@Override
public ProtocolMetaData call() throws Exception {
return delegate.deploy(archive);
}
});
}
示例15: deploy
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
final CubeRegistry cubeRegistry = cubeRegistryInstance.get();
Cube<?> cube = resolveMainCube(cubeRegistry);
if (cube.hasMetadata(IsBuildable.class)) {
File location = new File(cube.getMetadata(IsBuildable.class).getTemplatePath());
if (location.isDirectory()) {
//Because ShrinkWrap may create different jar files depending on what we are testing in this case
//we need a template which is the responsible to copy the jar to desired location
try {
createDockerfileFromTemplate(archive, location);
// fire events as usually.
controlEvent.fire(new CreateCube(cube));
controlEvent.fire(new StartCube(cube));
return createProtocolMetadata(cube, archive);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("Containerless Docker container requires a file named "
+ DOCKERFILE_TEMPLATE);
}
} else {
throw new IllegalArgumentException(
"Dockerfile Template of containerless Docker container must be in a directory.");
}
} else {
throw new IllegalArgumentException(
"Containerless container should be built using a Dockerfile, and no templatePath property found for container.");
}
}