Search in sources :

Example 1 with IBundleProject

use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.

the class AllBladeSamplesPublishTest method testPublishAllBladeSamples.

@Test
public void testPublishAllBladeSamples() throws Exception {
    IServer server = ServerUtil.getServer(WORKSPACE_SERVER_NAME);
    IServerWorkingCopy serverWC = server.createWorkingCopy();
    List<IProject> bladeProjects = getAllBladeProjects();
    List<IModule> modules = new ArrayList<>();
    for (IProject bladeProject : bladeProjects) {
        final String name = bladeProject.getName();
        IModule module = new Module(null, name, name, "liferay.bundle", "1.0", bladeProject);
        modules.add(module);
    }
    IProgressMonitor monitor = new NullProgressMonitor();
    serverWC.modifyModules(modules.toArray(new IModule[0]), null, monitor);
    server = serverWC.save(true, monitor);
    Util.waitForBuildAndValidation();
    IModule[] serverModules = server.getModules();
    assertEquals(35, serverModules.length);
    String[] retval = BladeCLI.execute("sh lb -s blade");
    for (IModule serverModule : serverModules) {
        IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, serverModule.getProject());
        String bsn = bundleProject.getSymbolicName();
        boolean foundBundle = false;
        for (String bundleString : retval) {
            if (bundleString.contains(bsn)) {
                foundBundle = true;
                if (!bundleString.contains("blade.hook.jsp")) {
                    assertTrue("Error in bundle state: " + bundleString, bundleString.contains("Active"));
                } else {
                    assertTrue("Error in bundle state: " + bundleString, bundleString.contains("Resolved"));
                }
                break;
            }
        }
        assertTrue(foundBundle);
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServer(org.eclipse.wst.server.core.IServer) IModule(org.eclipse.wst.server.core.IModule) IBundleProject(com.liferay.ide.core.IBundleProject) ArrayList(java.util.ArrayList) IProject(org.eclipse.core.resources.IProject) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) Module(org.eclipse.wst.server.core.internal.Module) IModule(org.eclipse.wst.server.core.IModule) Test(org.junit.Test)

Example 2 with IBundleProject

use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.

the class GradleModuleProjectTests method testProjectTemplateServiceBuilder.

@Test
public void testProjectTemplateServiceBuilder() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
    op.setProjectName("service-builder-test");
    op.setProjectProvider("gradle-module");
    op.setProjectTemplateName("service-builder");
    op.setPackageName("com.liferay.test");
    IProject parent = create(op);
    assertTrue(parent != null && parent.exists());
    IProject api = CoreUtil.getProject("service-builder-test-api");
    assertTrue(api != null && api.exists());
    IProject service = CoreUtil.getProject("service-builder-test-service");
    assertTrue(service != null && service.exists());
    api.build(IncrementalProjectBuilder.FULL_BUILD, _monitor);
    service.build(IncrementalProjectBuilder.FULL_BUILD, _monitor);
    IBundleProject apiBundle = LiferayCore.create(IBundleProject.class, api);
    assertNotNull(apiBundle);
    IPath apiOutput = apiBundle.getOutputBundle(true, _monitor);
    assertNotNull(apiOutput);
    assertTrue(apiOutput.toFile().exists());
    assertEquals("com.liferay.test.api-1.0.0.jar", apiOutput.lastSegment());
    IBundleProject serviceBundle = LiferayCore.create(IBundleProject.class, service);
    IPath serviceOutput = serviceBundle.getOutputBundle(true, _monitor);
    assertNotNull(serviceOutput);
    assertTrue(serviceOutput.toFile().exists());
    assertEquals("com.liferay.test.service-1.0.0.jar", serviceOutput.lastSegment());
}
Also used : IBundleProject(com.liferay.ide.core.IBundleProject) IPath(org.eclipse.core.runtime.IPath) NewLiferayModuleProjectOp(com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 3 with IBundleProject

use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.

the class GradleModuleProjectTests method verifyProject.

private void verifyProject(IProject project) throws Exception {
    assertNotNull(project);
    assertTrue(project.exists());
    assertTrue(project.getFile("build.gradle").exists());
    project.build(IncrementalProjectBuilder.CLEAN_BUILD, _monitor);
    Util.waitForBuildAndValidation();
    project.build(IncrementalProjectBuilder.FULL_BUILD, _monitor);
    Util.waitForBuildAndValidation();
    IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, project);
    assertNotNull(bundleProject);
    IPath outputBundle = bundleProject.getOutputBundle(true, _monitor);
    assertNotNull(outputBundle);
    assertTrue(outputBundle.toFile().exists());
}
Also used : IBundleProject(com.liferay.ide.core.IBundleProject) IPath(org.eclipse.core.runtime.IPath)

Example 4 with IBundleProject

use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.

the class GradleProjectTests method testThemeProjectPluginDetection.

@Test
public void testThemeProjectPluginDetection() throws Exception {
    NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
    op.setProjectName("gradle-theme-test");
    op.setProjectProvider("gradle-module");
    op.setProjectTemplateName("theme");
    op.execute(ProgressMonitorBridge.create(new NullProgressMonitor()));
    IProject project = CoreUtil.getProject("gradle-theme-test");
    assertNotNull(project);
    Util.waitForBuildAndValidation();
    IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, project);
    assertNotNull(bundleProject);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IBundleProject(com.liferay.ide.core.IBundleProject) NewLiferayModuleProjectOp(com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 5 with IBundleProject

use of com.liferay.ide.core.IBundleProject in project liferay-ide by liferay.

the class NewLiferayComponentWizard method init.

@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
    if ((selection != null) && !selection.isEmpty()) {
        final Object element = selection.getFirstElement();
        if (element instanceof IResource) {
            _initialProject = ((IResource) element).getProject();
        } else if (element instanceof IJavaProject) {
            _initialProject = ((IJavaProject) element).getProject();
        } else if (element instanceof IPackageFragment) {
            _initialPackage = (IPackageFragment) element;
            _initialProject = ((IJavaElement) element).getResource().getProject();
        } else if (element instanceof IPackageFragmentRoot) {
            _initialPackageRoot = (IPackageFragmentRoot) element;
            _initialProject = _initialPackageRoot.getJavaProject().getProject();
        } else if (element instanceof IJavaElement) {
            _initialProject = ((IJavaElement) element).getResource().getProject();
        }
        if (_initialProject != null) {
            final IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, _initialProject);
            if ((bundleProject != null) && "jar".equals(bundleProject.getBundleShape()) && !bundleProject.isFragmentBundle()) {
                element().setProjectName(_initialProject.getName());
                if (_initialPackage != null) {
                    element().setPackageName(_initialPackage.getElementName());
                }
            }
        }
    }
}
Also used : IJavaElement(org.eclipse.jdt.core.IJavaElement) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) IJavaProject(org.eclipse.jdt.core.IJavaProject) IBundleProject(com.liferay.ide.core.IBundleProject) IResource(org.eclipse.core.resources.IResource) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot)

Aggregations

IBundleProject (com.liferay.ide.core.IBundleProject)18 IProject (org.eclipse.core.resources.IProject)11 IPath (org.eclipse.core.runtime.IPath)8 Test (org.junit.Test)7 IModule (org.eclipse.wst.server.core.IModule)6 NewLiferayModuleProjectOp (com.liferay.ide.project.core.modules.NewLiferayModuleProjectOp)5 CoreException (org.eclipse.core.runtime.CoreException)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4 ArrayList (java.util.ArrayList)3 IOException (java.io.IOException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStatus (org.eclipse.core.runtime.IStatus)2 IServer (org.eclipse.wst.server.core.IServer)2 IModuleResource (org.eclipse.wst.server.core.model.IModuleResource)2 ILiferayProject (com.liferay.ide.core.ILiferayProject)1 LiferayGradleProject (com.liferay.ide.gradle.core.LiferayGradleProject)1 IProjectBuilder (com.liferay.ide.project.core.IProjectBuilder)1 PluginsSDKBundleProject (com.liferay.ide.project.core.PluginsSDKBundleProject)1 SDK (com.liferay.ide.sdk.core.SDK)1 GogoBundleDeployer (com.liferay.ide.server.core.gogo.GogoBundleDeployer)1