Search in sources :

Example 1 with IRemoteServerPublisher

use of com.liferay.ide.server.remote.IRemoteServerPublisher in project liferay-ide by liferay.

the class LiferayMavenProjectTests method testNewLiferayRemoteServiceBuilderProject.

@Test
public void testNewLiferayRemoteServiceBuilderProject() throws Exception {
    if (shouldSkipBundleTests())
        return;
    NewLiferayPluginProjectOp op = NewLiferayPluginProjectOp.TYPE.instantiate();
    op.setProjectName("servicebuilder");
    op.setProjectProvider("maven");
    op.setPluginType(PluginType.servicebuilder);
    createTestBundleProfile(op);
    final IProject project = base.createProject(op, op.getProjectName() + "-portlet");
    assertEquals(project.getName(), op.getProjectName() + "-portlet");
    assertNotNull(project);
    String pomContents = CoreUtil.readStreamToString(project.getFile("pom.xml").getContents());
    assertTrue(pomContents.contains("<artifactId>servicebuilder-portlet</artifactId>"));
    assertTrue(pomContents.contains("<artifactId>liferay-maven-plugin</artifactId>"));
    assertTrue(pomContents.contains("<name>servicebuilder Portlet</name>"));
    waitForJobsToComplete();
    project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
    waitForJobsToComplete();
    IVirtualComponent projectComponent = ComponentCore.createComponent(project);
    assertEquals("servicebuilder-portlet", projectComponent.getDeployedName());
    final ILiferayProject liferayProject = LiferayCore.create(project);
    final IRemoteServerPublisher publisher = liferayProject.adapt(IRemoteServerPublisher.class);
    final IPath warPath = publisher.publishModuleFull(monitor);
    assertTrue(warPath.toFile().exists());
}
Also used : IPath(org.eclipse.core.runtime.IPath) ILiferayProject(com.liferay.ide.core.ILiferayProject) IRemoteServerPublisher(com.liferay.ide.server.remote.IRemoteServerPublisher) NewLiferayPluginProjectOp(com.liferay.ide.project.core.model.NewLiferayPluginProjectOp) IVirtualComponent(org.eclipse.wst.common.componentcore.resources.IVirtualComponent) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 2 with IRemoteServerPublisher

use of com.liferay.ide.server.remote.IRemoteServerPublisher in project liferay-ide by liferay.

the class LiferayMavenProject method adapt.

@Override
public <T> T adapt(Class<T> adapterType) {
    T adapter = super.adapt(adapterType);
    if (adapter != null) {
        return adapter;
    }
    IMavenProjectFacade facade = MavenUtil.getProjectFacade(getProject(), new NullProgressMonitor());
    if (facade != null) {
        if (IProjectBuilder.class.equals(adapterType)) {
            IProjectBuilder projectBuilder = new MavenProjectBuilder(getProject());
            return adapterType.cast(projectBuilder);
        } else if (IRemoteServerPublisher.class.equals(adapterType)) {
            IRemoteServerPublisher remoteServerPublisher = new MavenProjectRemoteServerPublisher(getProject());
            return adapterType.cast(remoteServerPublisher);
        }
    }
    return null;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IRemoteServerPublisher(com.liferay.ide.server.remote.IRemoteServerPublisher) IMavenProjectFacade(org.eclipse.m2e.core.project.IMavenProjectFacade) IProjectBuilder(com.liferay.ide.project.core.IProjectBuilder)

Example 3 with IRemoteServerPublisher

use of com.liferay.ide.server.remote.IRemoteServerPublisher in project liferay-ide by liferay.

the class MavenBundlePluginProject method adapt.

@Override
public <T> T adapt(Class<T> adapterType) {
    T adapter = super.adapt(adapterType);
    if (adapter != null) {
        return adapter;
    }
    IMavenProjectFacade facade = MavenUtil.getProjectFacade(getProject(), new NullProgressMonitor());
    if (facade != null) {
        if (IProjectBuilder.class.equals(adapterType)) {
            IProjectBuilder projectBuilder = new MavenProjectBuilder(getProject());
            return adapterType.cast(projectBuilder);
        } else if (IRemoteServerPublisher.class.equals(adapterType)) {
            IRemoteServerPublisher remoteServerPublisher = new MavenProjectRemoteServerPublisher(getProject());
            return adapterType.cast(remoteServerPublisher);
        } else if (IBundleProject.class.equals(adapterType)) {
            return adapterType.cast(this);
        }
    }
    return null;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IRemoteServerPublisher(com.liferay.ide.server.remote.IRemoteServerPublisher) IMavenProjectFacade(org.eclipse.m2e.core.project.IMavenProjectFacade) IProjectBuilder(com.liferay.ide.project.core.IProjectBuilder)

Aggregations

IRemoteServerPublisher (com.liferay.ide.server.remote.IRemoteServerPublisher)3 IProjectBuilder (com.liferay.ide.project.core.IProjectBuilder)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 IMavenProjectFacade (org.eclipse.m2e.core.project.IMavenProjectFacade)2 ILiferayProject (com.liferay.ide.core.ILiferayProject)1 NewLiferayPluginProjectOp (com.liferay.ide.project.core.model.NewLiferayPluginProjectOp)1 IProject (org.eclipse.core.resources.IProject)1 IPath (org.eclipse.core.runtime.IPath)1 IVirtualComponent (org.eclipse.wst.common.componentcore.resources.IVirtualComponent)1 Test (org.junit.Test)1