use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class JcrNodeCreationTest method createFullCoverageNodeUnderPartialCoverageNode.
@Test
public void createFullCoverageNodeUnderPartialCoverageNode() throws Exception {
IProject project = projectRule.getProject();
new ProjectAdapter(project).createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/holder/.content.xml"), getClass().getResourceAsStream("nt-unstructured-nodetype.xml"));
JcrNode contentNode = syncDirNode.getNode("/content/test-root/holder");
contentNode.createChild("org.apache.sling.SomeComponent", "sling:OsgiConfig");
assertThat(project, hasFile("/jcr_root/content/test-root/holder/org.apache.sling.SomeComponent.xml"));
}
use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class JcrNodeCreationTest method prepareProjectAndContent.
@Before
public void prepareProjectAndContent() 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 .content.xml structure
InputStream contentXml = getClass().getResourceAsStream("content-nested-structure.xml");
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/en.xml"), contentXml);
// directly create the root node
syncDirNode = new SyncDir((IFolder) contentProject.findMember("jcr_root"));
}
use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class SightlyNatureTesterTest method prepare.
@Before
public void prepare() throws Exception {
final IProject project = projectRule.getProject();
projectAdapter = new ProjectAdapter(project);
projectAdapter.addNatures("org.eclipse.wst.common.project.facet.core.nature");
projectAdapter.installFacet("sling.content", "1.0");
tester = new SightlyNatureTester();
}
use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class SlingContentModuleAdapterTest method projectMembersContainContentXmlFirst.
@Test
public void projectMembersContainContentXmlFirst() throws Exception {
// create faceted project
IProject contentProject = projectRule.getProject();
ProjectAdapter project = new ProjectAdapter(contentProject);
project.addNatures(JavaCore.NATURE_ID, "org.eclipse.wst.common.project.facet.core.nature");
// install bundle facet
project.installFacet("sling.content", "1.0");
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/1_file.txt"), new ByteArrayInputStream(new byte[0]));
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/2_folder/filler.txt"), new ByteArrayInputStream(new byte[0]));
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/3_file.txt"), new ByteArrayInputStream(new byte[0]));
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/4_folder/filler.txt"), new ByteArrayInputStream(new byte[0]));
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/5_file.txt"), new ByteArrayInputStream(new byte[0]));
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/.content.xml"), new ByteArrayInputStream(new byte[0]));
IModule module = ServerUtil.getModule(contentProject);
SlingContentModuleFactory moduleFactory = new SlingContentModuleFactory();
ModuleDelegate moduleDelegate = moduleFactory.getModuleDelegate(module);
IModuleResource[] members = moduleDelegate.members();
assertThat("members[0].path", members[0].getModuleRelativePath().toPortableString(), equalTo(""));
assertThat("members[1].path", members[1].getModuleRelativePath().toPortableString(), equalTo("content"));
assertThat("members[2].path", members[2].getModuleRelativePath().toPortableString(), equalTo("content/.content.xml"));
}
use of org.apache.sling.ide.test.impl.helpers.ProjectAdapter in project sling by apache.
the class ServiceComponentHeaderValidatorTest method createJavaProject.
private void createJavaProject(String serviceComponentHeader) throws CoreException, IOException, InterruptedException {
project = new ProjectAdapter(projectRule.getProject());
project.addNatures(JavaCore.NATURE_ID);
project.configureAsJavaProject();
OsgiBundleManifest mf = new OsgiBundleManifest("com.example.bundle001").version("1.0.0").serviceComponent(serviceComponentHeader);
project.createOsgiBundleManifest(mf);
poller = new Poller();
poller.pollUntil(new Callable<IProject>() {
@Override
public IProject call() throws Exception {
return projectRule.getProject();
}
}, hasFile("bin/META-INF/MANIFEST.MF"));
}
Aggregations