private static File resolveVersion(String warVersion) { try { return getResolver().resolve(warVersion).withoutTransitivity().asSingleFile(); } catch (NoResolvedResultException e) { LOG.warn("Could not find version", e); return null; } }
private static File resolveVersion(String warVersion) { try { return getResolver().resolve(warVersion).withoutTransitivity().asSingleFile(); } catch (NoResolvedResultException e) { LOG.warn("Could not find version", e); return null; } }
private File shrinkwrapResolve(MavenCoordinates artefact) { File[] resolved = Maven.resolver().resolve(artefact.toString()).withoutTransitivity().asFile(); if (resolved == null || resolved.length == 0) throw new IllegalStateException("Cannot obtain maven artefact: " + artefact); if (resolved.length > 1) throw new IllegalStateException("Multiple maven artefacts for: " + artefact); return resolved[0]; }
private File shrinkwrapResolve(MavenCoordinates artefact) { File[] resolved = Maven.resolver().resolve(artefact.toString()).withoutTransitivity().asFile(); if (resolved == null || resolved.length == 0) throw new IllegalStateException("Cannot obtain maven artefact: " + artefact); if (resolved.length > 1) throw new IllegalStateException("Multiple maven artefacts for: " + artefact); return resolved[0]; }
/** * Resolves the given artifact by it's name with help of maven build system. * * @param artifact the fully qualified artifact name * * @return the resolved files */ private File[] resolveArtifact(String artifact) { return Maven.resolver() .resolve(artifact) .withTransitivity() .asFile(); } }
public void unpackContainerConfigurationFiles(@Observes ConfigureContainer event) { Validate.notNull(configuration, "fundamental test configuration is not setup"); String configurationFiles = configuration.getContainerConfiguration(); if (configurationFiles == null || configurationFiles.isEmpty()) { return; } Validate.notNull(configuration.getContainerHome(), "container home must be set"); File containerHome = new File(configuration.getContainerHome()); InputStream artifactStream = Maven.resolver().resolve(configurationFiles).withClassPathResolution(false).withoutTransitivity().asSingleInputStream(); unzip(artifactStream, containerHome, true); log.info(String.format("The container configuration '%s' was unpacked into '%s'", configurationFiles, containerHome.getAbsolutePath())); }
/** * Deploy the apps to test. * * @return the Deployed apps */ public static WebArchive createDeployment() { File[] files = Maven.resolver() .resolve( "io.opentracing:opentracing-api:0.31.0", "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.9.0" ) .withTransitivity().asFile(); WebArchive war = ShrinkWrap.create(WebArchive.class, "opentracing.war") .addPackages(true, OpenTracingClientBaseTests.class.getPackage()) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsLibraries(files); return war; }
@Override public File call() throws Exception { return Maven.resolver().resolve(distributableCoordinate.toCanonicalForm()) .withoutTransitivity() .asSingle(GenericArchive.class) .as(ExplodedExporter.class) .exportExploded(targetDirectory, "."); } });
/** * Obtains JavaArchive with phantomjs binary */ protected File getJavaArchive(String version) { String v = version; if (v == null) { v = ResolverConfiguration.get().version(); } final String gav = getArtifactCanonicalForm(v); return Maven.resolver().resolve(gav).withoutTransitivity().asSingleFile(); }
@Override public File call() throws Exception { return Maven.resolver().resolve(distributableCoordinate.toCanonicalForm()) .withoutTransitivity() .asSingle(GenericArchive.class) .as(ExplodedExporter.class) .exportExploded(targetDirectory, "."); } });
private static Collection<File> dependency(String gav, boolean transitive) { MavenStrategyStage mavenStrategyStage = Maven.resolver().resolve( gav ); MavenFormatStage mavenFormatStage; if ( transitive ) { mavenFormatStage = mavenStrategyStage.withTransitivity(); } else { mavenFormatStage = mavenStrategyStage.withoutTransitivity(); } return Arrays.asList( mavenFormatStage.asFile() ); } }
private static Collection<File> dependency(String gav, boolean transitive) { MavenStrategyStage mavenStrategyStage = Maven.resolver().resolve( gav ); MavenFormatStage mavenFormatStage; if ( transitive ) { mavenFormatStage = mavenStrategyStage.withTransitivity(); } else { mavenFormatStage = mavenStrategyStage.withoutTransitivity(); } return Arrays.asList( mavenFormatStage.asFile() ); } }
/** * @return the Maven coordinates of all archives returned by {@link #hibernateSearchLibraries()} */ private static String[] coordinatesOfHibernateSearchLibraries() { return Maven.resolver() .resolve( "org.hibernate:hibernate-search-orm:" + getCurrentVersion() ) .using( new RejectDependenciesStrategy( false, exclusions ) ) .asList( MavenResolvedArtifact.class ) .stream().map( m -> m.getCoordinate().getGroupId().toString() + ":" + m.getCoordinate().getArtifactId().toString() ) .toArray( String[]::new ); }
@Deployment public static WebArchive createDeployment() throws Exception { File rootDir = new File(System.getProperty("user.dir")); File file = new File(rootDir, "gradle.properties"); Properties props = new Properties(); props.load(new FileInputStream(file)); File[] files = Maven.resolver() .resolve("junit:junit:" + props.getProperty("junitVersion"), "org.hamcrest:hamcrest-library:" + props.getProperty("hamcrestVersion"), "io.rest-assured:rest-assured:" + props.getProperty("restassuredVersion")) .withTransitivity() .asFile(); WebArchive war = ShrinkWrap.create(EmbeddedGradleImporter.class, "application.war") .forThisProjectDirectory() .importBuildOutput() .as(WebArchive.class) .addAsWebInfResource("context.xml") .setWebXML(new File(rootDir, "src/main/webapp/WEB-INF/web.xml")) .addAsLibraries(files); System.out.println(war.toString(true)); return war; }
@Override public Archive<?> createAuxiliaryArchive() { final JavaArchive arquillianPactConsumer = ShrinkWrap.create(JavaArchive.class, "arquillian-pact-consumer.jar") // Add Core classes required in container part .addClasses(AbstractConsumerPactTest.class, RemoteConsumerPactTest.class, PactConsumerConfiguration.class, MockProviderConfigCreator.class, PactConsumerConfigurator.class, PactConsumerRemoteExtension.class, PactFilesCommand.class, ConsumerProviderPair.class, ResolveClassAnnotation.class) .addPackages(true, Pact.class.getPackage()) .addAsServiceProvider(RemoteLoadableExtension.class, PactConsumerRemoteExtension.class); final Properties properties = pactConsumerConfigurationInstance.get().asProperties(); String configuration = toString(properties); arquillianPactConsumer.add(new StringAsset(configuration), "/pact-consumer-configuration.properties"); final JavaArchive[] pactConsumerDeps = Maven.resolver() .resolve("au.com.dius:pact-jvm-consumer_2.11:" + getVersion()) .withTransitivity().as(JavaArchive.class); final JavaArchive merge = merge(arquillianPactConsumer, pactConsumerDeps); return merge; }
@Override public Archive<?> createAuxiliaryArchive() { final JavaArchive arquillianPactConsumer = ShrinkWrap.create(JavaArchive.class, "arquillian-pact-consumer.jar") // Add Core classes required in container part .addClasses(AbstractConsumerPactTest.class, RemoteConsumerPactTest.class, PactConsumerConfiguration.class, MockProviderConfigCreator.class, PactConsumerConfigurator.class, PactConsumerRemoteExtension.class, PactFilesCommand.class, ConsumerProviderPair.class, ResolveClassAnnotation.class, StubServer.class, StubServerEnricher.class) .addPackages(true, Pact.class.getPackage()) .addAsServiceProvider(RemoteLoadableExtension.class, PactConsumerRemoteExtension.class); final Properties properties = pactConsumerConfigurationInstance.get().asProperties(); String configuration = toString(properties); arquillianPactConsumer.add(new StringAsset(configuration), "/pact-consumer-configuration.properties"); final JavaArchive[] pactConsumerDeps = Maven.resolver() .resolve("au.com.dius:pact-jvm-consumer_2.11:" + getVersion()) .withTransitivity().as(JavaArchive.class); final JavaArchive merge = merge(arquillianPactConsumer, pactConsumerDeps); return merge; }
protected final WebArchive baseApplicationArchive(final String archiveName) { final File[] files = Maven. configureResolver(). fromClassloaderResource("settings.xml"). resolve(GROUP_ID+":"+ARTIFACT_ID+":"+PACKAGING+":"+VERSION). withoutTransitivity(). as(File.class); final WebArchive archive = ShrinkWrap. create(WebArchive.class,archiveName). merge(ShrinkWrap.createFromZipFile(WebArchive.class,files[0])); return archive; } }
/** * Returns the set of dependencies defined as org.hibernate:hibernate-search-orm at * the version being built. We use transitive dependencies to include the version * of hibernate-search-engine and Apache Lucene at the currently built version, but * then need to exclude the packages already provided by the application server such * as Hibernate ORM. * * @return the set of dependencies a user would need to bundle in a web app */ public static JavaArchive[] hibernateSearchLibraries() { return Maven.resolver() .resolve( "org.hibernate:hibernate-search-orm:" + getCurrentVersion() ) // we need some dependencies at the right version: Lucene, search-engine, etc.. .using( new RejectDependenciesStrategy( false, exclusions ) ) .as( JavaArchive.class ); }
/** * Returns the set of dependencies defined as org.hibernate:hibernate-search-testing at * the version being built, including transitive dependencies but strictly excluding * anything which would be provided by {@link #hibernateSearchLibraries()} so that * the two combined would not contain duplicates. */ public static JavaArchive[] hibernateSearchTestingLibraries() { return Maven.resolver() .resolve( "org.hibernate:hibernate-search-testing:" + getCurrentVersion() ) .using( new RejectDependenciesStrategy( false, coordinatesOfHibernateSearchLibraries() ) ) .as( JavaArchive.class ); }
@Deployment(testable = false) public static JavaArchive createDeployment() { JavaArchive[] undertow = Maven.resolver().resolve("io.undertow:undertow-core:1.1.1.Final").withTransitivity().as(JavaArchive.class); JavaArchive jar = ShrinkWrap .create(JavaArchive.class, "daytime.jar") .addClass(DaytimeServer.class); for (JavaArchive javaArchive : undertow) { jar.merge(javaArchive); } jar.addAsManifestResource( new StringAsset( "Main-Class: org.arquillian.cube.impl.containerless.DaytimeServer" + LINE_SEPARATOR), "MANIFEST.MF"); return jar; }