本文整理汇总了Java中org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription类的典型用法代码示例。如果您正苦于以下问题:Java DeploymentDescription类的具体用法?Java DeploymentDescription怎么用?Java DeploymentDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeploymentDescription类属于org.jboss.arquillian.container.spi.client.deployment包,在下文中一共展示了DeploymentDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
public List<DeploymentDescription> generate(TestClass testClass) {
List<DeploymentDescription> descriptions = delegate(testClass);
boolean inCeContainer = isDeployedInCeContainer();
List<DeploymentDescription> copy = new ArrayList<>();
for (DeploymentDescription description : descriptions) {
Archive<?> archive = description.getArchive();
// only wrap in war, if it's in CE container
if (inCeContainer && JavaArchive.class.isInstance(archive)) {
JavaArchive jar = JavaArchive.class.cast(archive);
copy.add(new DeploymentDescription(description.getName(), toWar(jar)));
} else {
copy.add(description);
}
}
return copy;
}
示例2: generate
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
/**
* (non-Javadoc)
* @see org.jboss.arquillian.container.test.impl.client.deployment.
* AnnotationDeploymentScenarioGenerator
* #generate(org.jboss.arquillian.test.spi.TestClass)
*/
@Override
public List<DeploymentDescription> generate(TestClass testClass) {
containerDef();
List<DeploymentDescription> descriptions = super.generate(testClass);
if (descriptions == null) {
descriptions = new ArrayList<>();
}
log.info("Generating Deployment for Liferay Plugin ");
DeploymentDescription deploymentDecription =
createLiferayPluginDeployment();
if (deploymentDecription != null) {
descriptions.add(deploymentDecription);
}
return descriptions;
}
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:28,代码来源:MavenDeploymentScenarioGenerator.java
示例3: addAutomaticDependencies
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void addAutomaticDependencies(DeploymentDescription primaryDeployment, Class<?> classUnderTest,
Method deploymentMethod, Collection<DeploymentDescription> deployments)
{
for (AddonDependencyEntry dependency : getAddonSet(classUnderTest))
{
createAnnotatedDeployment(primaryDeployment,
classUnderTest,
deploymentMethod,
deployments,
dependency.getName(),
dependency.getVersionRange().toString(),
AddonDependency.class.getSimpleName(),
true,
dependency.isExported(),
dependency.isOptional(),
new Class[0],
10000,
TimeUnit.MILLISECONDS,
NullException.class);
}
}
示例4: enhance
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
@Override public List<DeploymentDescription> enhance(TestClass testClass, List<DeploymentDescription> deployments)
{
if(Boolean.getBoolean("maven.surefire.debug")) {
String version = getWindupVersion(deployments);
if(version != null) {
// AddonId id = AddonId.from("org.jboss.windup.rexster:windup-rexster", version);
// AddonDeploymentArchive archive = ShrinkWrap.create(AddonDeploymentArchive.class).setAddonId(id);
//
// archive.setDeploymentTimeoutUnit(TimeUnit.MILLISECONDS);
// archive.setDeploymentTimeoutQuantity(10000);
//
// DeploymentDescription deploymentDescription = new DeploymentDescription(id.toCoordinates(), archive);
// deploymentDescription.shouldBeTestable(false);
// deployments.add(deploymentDescription);
}
}
return deployments;
}
示例5: reportDeployment
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
public void reportDeployment(@Observes BeforeDeploy event) {
DeploymentDescription description = event.getDeployment();
// String targetContainer = description.getTarget().getName();
Reporter
.createReport(DEPLOYMENT_IN_TEST_CLASS_REPORT)
.addKeyValueEntry(DEPLOYMENT_IN_TEST_CLASS_NAME, description.getName())
.addKeyValueEntry(ARCHIVE_NAME_OF_DEPLOYMENT, description.getArchive().getName())
.addKeyValueEntry(ORDER_OF_DEPLOYMENT, description.getOrder())
.addKeyValueEntry(PROTOCOL_USED_FOR_DEPLOYMENT, description.getProtocol().getName())
.inSection(new TestClassConfigurationDeploymentSection(description.getName()))
.fire(sectionEvent);
// todo add info into container report - optimally keep oll deployments in a table - to do so we need to have functionality of merging tables. Or is there any better way?
}
示例6: generate
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
public List<DeploymentDescription> generate(TestClass testClass) {
if (Archives.isExternalDeployment(testClass.getJavaClass())) {
return Collections.singletonList(Archives.generateDummyDeployment("ROOT.war"));
} else {
return DELEGATE.generate(testClass);
}
}
示例7: observeBeforeDeploy
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
public void observeBeforeDeploy(@Observes BeforeDeploy event) {
DeploymentReport deploymentReport = new DeploymentReport();
DeploymentDescription description = event.getDeployment();
deploymentReport.setArchiveName(description.getArchive().getName());
deploymentReport.setName(description.getName());
int order = description.getOrder();
if (order > 0) {
deploymentReport.setOrder(order);
}
String protocol = description.getProtocol().getName();
if (!protocol.equals("_DEFAULT_")) {
deploymentReport.setProtocol(protocol);
} else {
deploymentReport.setProtocol("_DEFAULT_");
}
deploymentReport.setTarget(description.getTarget().getName());
boolean reported = false;
for (ContainerReport containerReport : reporter.get().getLastTestSuiteReport().getContainerReports()) {
if (containerReport.getQualifier().equals(deploymentReport.getTarget())) {
containerReport.getDeploymentReports().add(deploymentReport);
reported = true;
break;
}
}
if (!reported) {
if (reporter.get().getLastTestSuiteReport().getContainerReports().size() == 1) {
reporter.get().getLastTestSuiteReport().getContainerReports().get(0).getDeploymentReports().add(deploymentReport);
}
}
}
示例8: setTargetServerGroups
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
public synchronized void setTargetServerGroups(@Observes BeforeDeploy event) {
final String deploymentName = event.getDeployment().getName();
if (serverGroupTargets.containsKey(deploymentName)) {
final DeploymentDescription deploymentDescription = event.getDeployment();
final Archive<?> delegate = deploymentDescription.getArchive();
// Note that this breaks if anything else replaces this archive
deploymentDescription.setTestableArchive(new ServerGroupArchive<>(delegate, Collections.unmodifiableSet(serverGroupTargets.get(deploymentName))));
}
}
示例9: generate
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
@Override
public List<DeploymentDescription> generate(TestClass testClass)
{
List<DeploymentDescription> deployments = new ArrayList<DeploymentDescription>();
Method[] deploymentMethods = testClass.getMethods(Deployment.class);
for (Method deploymentMethod : deploymentMethods)
{
validate(deploymentMethod);
if (deploymentMethod.isAnnotationPresent(Dependencies.class))
deployments.addAll(generateDependencyDeployments(testClass.getJavaClass(), deploymentMethod));
deployments.add(generateDeployment(deploymentMethod));
}
return deployments;
}
示例10: generateDependencyDeployments
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
private Collection<DeploymentDescription> generateDependencyDeployments(Class<?> classUnderTest,
Method deploymentMethod)
{
Dependencies dependency = deploymentMethod.getAnnotation(Dependencies.class);
Collection<DeploymentDescription> deployments = new ArrayList<DeploymentDescription>();
if (dependency.value() != null)
for (AddonDependency addon : dependency.value())
{
String version;
if (addon.version().isEmpty())
{
version = resolveVersionFromPOM(classUnderTest, addon.name());
if (version == null)
{
throw new IllegalStateException("Could not resolve the version for [" + addon.name()
+ "]. Either specify the version for this @" + AddonDependency.class.getSimpleName()
+ " in [" + classUnderTest.getName() + "] or add it to pom.xml located at ["
+ getPomFileFor(classUnderTest) + "]");
}
}
else
{
version = addon.version();
}
AddonId id = AddonId.from(addon.name(), version);
ForgeRemoteAddon remoteAddon = ShrinkWrap.create(ForgeRemoteAddon.class).setAddonId(id);
if (Annotations.isAnnotationPresent(deploymentMethod, DeployToRepository.class))
remoteAddon.setAddonRepository(Annotations.getAnnotation(deploymentMethod, DeployToRepository.class)
.value());
DeploymentDescription deploymentDescription = new DeploymentDescription(id.toCoordinates(), remoteAddon);
deploymentDescription.shouldBeTestable(false);
deployments.add(deploymentDescription);
}
return deployments;
}
示例11: getWindupVersion
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
/**
* Take the windup-config version and if not found, take the most frequent version of windup addons.
* @param deployments
* @return
*/
private String getWindupVersion(List<DeploymentDescription> deployments) {
Map<String,Integer> versionOccurences = new HashMap<>();
for (DeploymentDescription deployment : deployments)
{
if(deployment.toString().contains("windup")) {
String version = deployment.toString().split(",")[1];
if(deployment.toString().contains("windup-config")) {
return version;
}
if(versionOccurences.containsKey(deployment.toString().split(",")[1])) {
versionOccurences.put(version,versionOccurences.get(version) +1);
} else {
versionOccurences.put(version,1);
}
}
}
Map.Entry<String, Integer> maxEntry = null;
for (Map.Entry<String, Integer> stringIntegerEntry : versionOccurences.entrySet())
{
if(maxEntry == null || stringIntegerEntry.getValue() > maxEntry.getValue()) {
maxEntry = stringIntegerEntry;
}
}
return maxEntry == null ? null : maxEntry.getKey();
}
示例12: testBundleGeneration
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
@Test
public void testBundleGeneration() throws IOException {
BndDeploymentScenarioGenerator bndDeploymentScenarioGenerator =
new BndDeploymentScenarioGenerator() {
@Override
protected DeploymentScenarioGenerator
getDefaultDeploymentScenarioGenerator() {
return null;
}
};
bndDeploymentScenarioGenerator.setBndFile(
new File("target/test-classes/test.bnd"));
List<DeploymentDescription> deploymentDescriptions =
bndDeploymentScenarioGenerator.generate(new TestClass(ATest.class));
assertEquals(1, deploymentDescriptions.size());
DeploymentDescription deploymentDescription =
deploymentDescriptions.get(0);
Archive<?> archive = deploymentDescription.getArchive();
Node object = archive.get("META-INF/MANIFEST.MF");
assertNotNull("We must have a MANIFEST.MF", object);
Manifest manifest = new Manifest(object.getAsset().openStream());
Attributes mainAttributes = manifest.getMainAttributes();
String importPackageValue = mainAttributes.getValue("Import-Package");
assertFalse(
"Package from the classes must not be imported",
importPackageValue.contains(
"com.liferay.arquillian.test.extras.a"));
assertFalse(
"Package from the classes must not be imported",
importPackageValue.contains(
"com.liferay.arquillian.test.extras.b"));
assertTrue(
"Should contain org.osgi.framework",
importPackageValue.contains("org.osgi.framework"));
assertNotNull(
"Classes must be included",
archive.get("com/liferay/arquillian/test/extras/a/A.class"));
assertNotNull(
"Classes must be included",
archive.get("com/liferay/arquillian/test/extras/b/B.class"));
}
示例13: testBundleGenerationWithCommonBnd
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
@Test
public void testBundleGenerationWithCommonBnd() throws IOException {
BndDeploymentScenarioGenerator bndDeploymentScenarioGenerator =
new BndDeploymentScenarioGenerator() {
@Override
protected DeploymentScenarioGenerator
getDefaultDeploymentScenarioGenerator() {
return null;
}
};
bndDeploymentScenarioGenerator.setBndFile(
new File("target/test-classes/test.bnd"));
File commonBndFile = new File("target/test-classes/common.bnd");
bndDeploymentScenarioGenerator.setCommonBndFile(commonBndFile);
List<DeploymentDescription> deploymentDescriptions =
bndDeploymentScenarioGenerator.generate(new TestClass(ATest.class));
assertEquals(1, deploymentDescriptions.size());
DeploymentDescription deploymentDescription =
deploymentDescriptions.get(0);
Archive<?> archive = deploymentDescription.getArchive();
Node object = archive.get("META-INF/MANIFEST.MF");
assertNotNull("We must have a MANIFEST.MF", object);
Manifest manifest = new Manifest(object.getAsset().openStream());
Attributes mainAttributes = manifest.getMainAttributes();
String importPackageValue = mainAttributes.getValue("Import-Package");
assertFalse(
"Package from the classes must not be imported",
importPackageValue.contains(
"com.liferay.arquillian.test.extras.a"));
assertFalse(
"Package from the classes must not be imported",
importPackageValue.contains(
"com.liferay.arquillian.test.extras.b"));
String fooProperty = mainAttributes.getValue("Foo-Property");
assertEquals("test", fooProperty);
String fooBadProperty = mainAttributes.getValue("Foo-Bad-Property");
assertEquals("${a.non.existant.property}", fooBadProperty);
assertNotNull(
"Classes must be included",
archive.get("com/liferay/arquillian/test/extras/a/A.class"));
assertNotNull(
"Classes must be included",
archive.get("com/liferay/arquillian/test/extras/b/B.class"));
}
示例14: testBundleGenerationWithCommonBndFromSystemProperty
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
@Test
public void testBundleGenerationWithCommonBndFromSystemProperty()
throws IOException {
System.setProperty("sdk.dir", "target/test-classes");
BndDeploymentScenarioGenerator bndDeploymentScenarioGenerator =
new BndDeploymentScenarioGenerator() {
@Override
protected DeploymentScenarioGenerator
getDefaultDeploymentScenarioGenerator() {
return null;
}
};
bndDeploymentScenarioGenerator.setBndFile(
new File("target/test-classes/test.bnd"));
List<DeploymentDescription> deploymentDescriptions =
bndDeploymentScenarioGenerator.generate(new TestClass(ATest.class));
assertEquals(1, deploymentDescriptions.size());
DeploymentDescription deploymentDescription =
deploymentDescriptions.get(0);
Archive<?> archive = deploymentDescription.getArchive();
Node object = archive.get("META-INF/MANIFEST.MF");
assertNotNull("We must have a MANIFEST.MF", object);
Manifest manifest = new Manifest(object.getAsset().openStream());
Attributes mainAttributes = manifest.getMainAttributes();
String importPackageValue = mainAttributes.getValue("Import-Package");
assertFalse(
"Package from the classes must not be imported",
importPackageValue.contains(
"com.liferay.arquillian.test.extras.a"));
assertFalse(
"Package from the classes must not be imported",
importPackageValue.contains(
"com.liferay.arquillian.test.extras.b"));
String fooProperty = mainAttributes.getValue("Foo-Property");
assertEquals("test", fooProperty);
String fooBadProperty = mainAttributes.getValue("Foo-Bad-Property");
assertEquals("${a.non.existant.property}", fooBadProperty);
assertNotNull(
"Classes must be included",
archive.get("com/liferay/arquillian/test/extras/a/A.class"));
assertNotNull(
"Classes must be included",
archive.get("com/liferay/arquillian/test/extras/b/B.class"));
}
示例15: generateDummyDeployment
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
public static DeploymentDescription generateDummyDeployment(String name) {
return new DeploymentDescription("_DEFAULT_", generateDummyWebArchive(name));
}