use of org.apache.sling.ide.eclipse.m2e.impl.helpers.MavenProjectAdapter in project sling by apache.
the class MavenProjectUtilsTest method inferDefaultProvisioningModelDirectories.
@Test
public void inferDefaultProvisioningModelDirectories() throws Exception {
IPath modelsDir = Path.fromPortableString("src/main/provisioning");
// create project
final IProject launchpadProject = projectRule.getProject();
MavenProjectAdapter project = new MavenProjectAdapter(launchpadProject);
project.createOrUpdateFile(Path.fromPortableString("pom.xml"), getClass().getResourceAsStream("slingstart-simple-pom.xml"));
project.ensureDirectoryExists(modelsDir);
project.convertToMavenProject();
// conversion should enable the slingstart configurator and set the provisioning model path
new Poller(TimeUnit.MINUTES.toMillis(1)).pollUntil(new Callable<IPath>() {
@Override
public IPath call() throws Exception {
return ProjectUtil.getProvisioningModelPath(launchpadProject);
}
}, equalTo(modelsDir));
}
use of org.apache.sling.ide.eclipse.m2e.impl.helpers.MavenProjectAdapter in project sling by apache.
the class LegacyMavenBundleProjectTest method testLegacyMavenBundleProjectHasErrorMarker.
@Test
public void testLegacyMavenBundleProjectHasErrorMarker() throws Exception {
// create project
final IProject bundleProject = projectRule.getProject();
MavenProjectAdapter project = new MavenProjectAdapter(bundleProject);
project.createOrUpdateFile(Path.fromPortableString("pom.xml"), getClass().getResourceAsStream("legacy-pom.xml"));
project.convertToMavenProject();
// wait up to 1 minute for the build to succeed due to time needed to retrieve dependencies
Poller markerPoller = new Poller(TimeUnit.MINUTES.toMillis(1));
markerPoller.pollUntilSuccessful(new Runnable() {
@Override
public void run() {
try {
IMarker[] markers = bundleProject.findMarkers(null, true, IResource.DEPTH_ONE);
for (IMarker marker : markers) {
if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) != IMarker.SEVERITY_ERROR) {
continue;
}
if (marker.getAttribute(IMarker.MESSAGE, "").startsWith("Missing m2e incremental build support")) {
return;
}
}
throw new RuntimeException("Did not find error message starting with 'Missing m2e incremental support'");
} catch (CoreException e) {
throw new RuntimeException(e);
}
}
});
}
Aggregations