本文整理汇总了Java中org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription类的典型用法代码示例。如果您正苦于以下问题:Java DeploymentDescription类的具体用法?Java DeploymentDescription怎么用?Java DeploymentDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeploymentDescription类属于org.jboss.arquillian.container.spi.client.deployment包,在下文中一共展示了DeploymentDescription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:jboss-openshift,项目名称:ce-arq,代码行数:19,代码来源:LegacyDeploymentScenarioGenerator.java
示例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);
}
}
开发者ID:forge,项目名称:furnace,代码行数:23,代码来源:FurnaceDeploymentScenarioGenerator.java
示例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;
}
开发者ID:windup,项目名称:windup,代码行数:19,代码来源:WindupFurnaceAddonDeploymentEnhancer.java
示例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?
}
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:16,代码来源:ArquillianCoreReporterLifecycleManager.java
示例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);
}
}
开发者ID:jboss-openshift,项目名称:ce-arq,代码行数:8,代码来源:ExternalDeploymentScenarioGenerator.java
示例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);
}
}
}
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:40,代码来源:ReporterLifecycleObserver.java
示例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))));
}
}
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:10,代码来源:ServerGroupDeploymentObserver.java
示例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;
}
开发者ID:koentsje,项目名称:forge-furnace,代码行数:16,代码来源:ForgeDeploymentScenarioGenerator.java
示例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;
}
开发者ID:koentsje,项目名称:forge-furnace,代码行数:40,代码来源:ForgeDeploymentScenarioGenerator.java
示例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();
}
开发者ID:windup,项目名称:windup,代码行数:35,代码来源:WindupFurnaceAddonDeploymentEnhancer.java
示例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"));
}
开发者ID:liferay-labs,项目名称:arquillian-liferay,代码行数:58,代码来源:BndDeploymentScenarioGeneratorTest.java
示例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"));
}
开发者ID:liferay-labs,项目名称:arquillian-liferay,代码行数:66,代码来源:BndDeploymentScenarioGeneratorTest.java
示例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"));
}
开发者ID:liferay-labs,项目名称:arquillian-liferay,代码行数:66,代码来源:BndDeploymentScenarioGeneratorTest.java
示例15: generateDummyDeployment
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
public static DeploymentDescription generateDummyDeployment(String name) {
return new DeploymentDescription("_DEFAULT_", generateDummyWebArchive(name));
}
开发者ID:jboss-openshift,项目名称:ce-arq,代码行数:4,代码来源:Archives.java
示例16: createLiferayPluginDeployment
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; //导入依赖的package包/类
private DeploymentDescription createLiferayPluginDeployment() {
log.debug("Building Liferay Plugin from project pom.xml");
File pomFile = new File("pom.xml");
if ((pomFile != null) && pomFile.exists()) {
log.debug(
"Loading project from pom file:" + pomFile.getAbsolutePath());
String globalSettings = System.getProperty(
"maven.execution.global-settings");
String userSettings = System.getProperty(
"maven.execution.user-settings");
String profilesString = System.getProperty(
"maven.execution.active-profiles");
PomlessMavenImporter mavenImporter = ShrinkWrap.create(
MavenImporter.class);
if (globalSettings != null) {
mavenImporter =
((MavenImporter)mavenImporter).configureFromFile(
globalSettings);
}
if (userSettings != null) {
mavenImporter =
((MavenImporter)mavenImporter).configureFromFile(
userSettings);
}
String[] profiles = new String[0];
if (profilesString != null) {
profiles = profilesString.split(",");
}
WebArchive archive = mavenImporter.loadPomFromFile(
pomFile, profiles).importBuildOutput().as(WebArchive.class);
DeploymentDescription deploymentDescription =
new DeploymentDescription("_DEFAULT", archive);
deploymentDescription.shouldBeTestable(true);
return deploymentDescription;
}
return null;
}
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:53,代码来源:MavenDeploymentScenarioGenerator.java
示例17: 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(
"org.arquillian.liferay.test.extras.a"));
assertFalse(
"Package from the classes must not be imported",
importPackageValue.contains(
"org.arquillian.liferay.test.extras.b"));
assertTrue(
"Should contain org.osgi.framework",
importPackageValue.contains("org.osgi.framework"));
assertNotNull(
"Classes must be included",
archive.get("org/arquillian/liferay/test/extras/a/A.class"));
assertNotNull(
"Classes must be included",
archive.get("org/arquillian/liferay/test/extras/b/B.class"));
}
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:57,代码来源:BndDeploymentScenarioGeneratorTest.java
示例18: 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(
"org.arquillian.liferay.test.extras.a"));
assertFalse(
"Package from the classes must not be imported",
importPackageValue.contains(
"org.arquillian.liferay.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("org/arquillian/liferay/test/extras/a/A.class"));
assertNotNull(
"Classes must be included",
archive.get("org/arquillian/liferay/test/extras/b/B.class"));
}
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:65,代码来源:BndDeploymentScenarioGeneratorTest.java
示例19: 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(
"org.arquillian.liferay.test.extras.a"));
assertFalse(
"Package from the classes must not be imported",
importPackageValue.contains(
"org.arquillian.liferay.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("org/arquillian/liferay/test/extras/a/A.class"));
assertNotNull(
"Classes must be included",
archive.get("org/arquillian/liferay/test/extras/b/B.class"));
}
开发者ID:arquillian,项目名称:arquillian-extension-liferay,代码行数:65,代码来源:BndDeploymentScenarioGeneratorTest.java
示例20: 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);
if (deploymentMethods.length == 0)
{
// FURNACE-58: Add a default deployment if no deployment is specified
addDefaultDeployments(testClass, deployments);
}
else
{
for (Method deploymentMethod : deploymentMethods)
{
validate(deploymentMethod);
DeploymentDescription primaryDeployment = null;
try
{
primaryDeployment = generateDeployment(deploymentMethod);
if (deploymentMethod.isAnnotationPresent(AddonDeployments.class)
|| deploymentMethod.isAnnotationPresent(AddonDependencies.class)
|| deploymentMethod.isAnnotationPresent(Dependencies.class))
{
deployments.addAll(generateAnnotatedDeployments(primaryDeployment, testClass.getJavaClass(),
deploymentMethod));
}
}
catch (Exception e)
{
throw new RuntimeException("Could not generate @Deployment for " + testClass.getName() + "."
+ deploymentMethod.getName() + "()", e);
}
deployments.add(primaryDeployment);
}
}
for (AddonDeploymentScenarioEnhancer enhancer : ServiceLoader.load(AddonDeploymentScenarioEnhancer.class))
{
deployments = enhancer.enhance(testClass, deployments);
Assert.notNull(deployments,
String.format("Cannot return a null deployment. Check %s for more details",
enhancer.getClass()));
}
return deployments;
}
开发者ID:forge,项目名称:furnace,代码行数:47,代码来源:FurnaceDeploymentScenarioGenerator.java
注:本文中的org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论