use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class ProjectHelperTest method inferContentProjectContentMissingJcrRoot.
@Test
public void inferContentProjectContentMissingJcrRoot() throws CoreException, InterruptedException {
// create faceted project
IProject contentProject = projectRule.getProject();
ProjectAdapter project = new ProjectAdapter(contentProject);
project.addNatures("org.eclipse.wst.common.project.facet.core.nature");
// install content facet
project.installFacet("sling.content", "1.0");
// create files
project.createOrUpdateFile(Path.fromPortableString("src/main/content/META-INF/vault/filter.xml"), new ByteArrayInputStream("<workspaceFilter version=\"1.0\"/>".getBytes()));
assertThat(ProjectHelper.getInferredContentProjectContentRoot(contentProject), CoreMatchers.nullValue());
}
use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class ProjectUtilTest method createEmptyContentProject.
@Before
public void createEmptyContentProject() throws Exception {
// create faceted project
contentProject = projectRule.getProject();
project = new ProjectAdapter(contentProject);
project.addNatures("org.eclipse.wst.common.project.facet.core.nature");
// install bundle facet
project.installFacet("sling.content", "1.0");
// create filter file
project.createVltFilterWithRoots();
// create content sync dir
project.ensureDirectoryExists(Path.fromPortableString("jcr_root"));
}
use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class JcrFullCoverageAggregatesDeploymentTest method deleteNodeFromNestedFullCoverageAggreate.
@Test
public void deleteNodeFromNestedFullCoverageAggreate() throws Exception {
wstServer.waitForServerToStart();
// create faceted project
IProject contentProject = projectRule.getProject();
ProjectAdapter project = new ProjectAdapter(contentProject);
project.addNatures("org.eclipse.wst.common.project.facet.core.nature");
// install content facet
project.installFacet("sling.content", "1.0");
ServerAdapter server = new ServerAdapter(wstServer.getServer());
server.installModule(contentProject);
// create filter.xml
project.createVltFilterWithRoots("/content");
// create .content.xml structure
InputStream contentXml = getClass().getResourceAsStream("content-nested-structure.xml");
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en.xml"), contentXml);
Matcher<Node> postConditions = allOf(hasPath("/content/test-root/en"), hasPrimaryType("sling:Folder"), hasMixinTypes("mix:language"), hasChildrenCount(3));
final RepositoryAccessor repo = new RepositoryAccessor(config);
Poller poller = new Poller();
poller.pollUntil(new Callable<Node>() {
@Override
public Node call() throws RepositoryException {
return repo.getNode("/content/test-root/en");
}
}, postConditions);
// update .content.xml structure
InputStream updatedContentXml = getClass().getResourceAsStream("content-nested-structure-deleted-node.xml");
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en.xml"), updatedContentXml);
// poll until we only have 2 child nodes left
postConditions = allOf(hasPath("/content/test-root/en"), hasPrimaryType("sling:Folder"), hasMixinTypes("mix:language"), hasChildrenCount(2));
poller.pollUntil(new Callable<Node>() {
@Override
public Node call() throws RepositoryException {
return repo.getNode("/content/test-root/en");
}
}, postConditions);
}
use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class JcrFullCoverageAggregatesDeploymentTest method deleteFullCoverageAggregate.
@Test
public void deleteFullCoverageAggregate() throws Exception {
wstServer.waitForServerToStart();
// create faceted project
IProject contentProject = projectRule.getProject();
ProjectAdapter project = new ProjectAdapter(contentProject);
project.addNatures("org.eclipse.wst.common.project.facet.core.nature");
// install content facet
project.installFacet("sling.content", "1.0");
ServerAdapter server = new ServerAdapter(wstServer.getServer());
server.installModule(contentProject);
final String baseName = "com.example.some.Component";
// create filter.xml
project.createVltFilterWithRoots("/content");
// create .content.xml structure
InputStream contentXml = getClass().getResourceAsStream(baseName + ".xml");
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/" + baseName + ".xml"), contentXml);
Matcher<Node> postConditions = allOf(hasPath("/content/test-root/" + baseName), hasPrimaryType("sling:OsgiConfig"));
final RepositoryAccessor repo = new RepositoryAccessor(config);
Poller poller = new Poller();
poller.pollUntil(new Callable<Node>() {
@Override
public Node call() throws RepositoryException {
return repo.getNode("/content/test-root/" + baseName);
}
}, postConditions);
// Remove file from disk
project.deleteMember(Path.fromPortableString("jcr_root/content/test-root/" + baseName + ".xml"));
// poll until the node no longer exists
poller.pollUntil(new Callable<Boolean>() {
@Override
public Boolean call() throws RepositoryException {
return repo.hasNode("/content/test-root/" + baseName);
}
}, equalTo(false));
}
use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class JcrFullCoverageAggregatesDeploymentTest method deployNestedFullCoverageAggregate.
@Test
public void deployNestedFullCoverageAggregate() throws Exception {
wstServer.waitForServerToStart();
// create faceted project
IProject contentProject = projectRule.getProject();
ProjectAdapter project = new ProjectAdapter(contentProject);
project.addNatures("org.eclipse.wst.common.project.facet.core.nature");
// install content facet
project.installFacet("sling.content", "1.0");
ServerAdapter server = new ServerAdapter(wstServer.getServer());
server.installModule(contentProject);
// create filter.xml
project.createVltFilterWithRoots("/content");
// create .content.xml structure
InputStream contentXml = getClass().getResourceAsStream("content-nested-structure.xml");
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en.xml"), contentXml);
Matcher<Node> postConditions = allOf(hasPath("/content/test-root/en"), hasPrimaryType("sling:Folder"), hasMixinTypes("mix:language"), hasChildrenCount(3));
final RepositoryAccessor repo = new RepositoryAccessor(config);
Poller poller = new Poller();
poller.pollUntil(new Callable<Node>() {
@Override
public Node call() throws RepositoryException {
return repo.getNode("/content/test-root/en");
}
}, postConditions);
}
Aggregations