Search in sources :

Example 1 with Module

use of org.eclipse.wst.server.core.internal.Module 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 Module

use of org.eclipse.wst.server.core.internal.Module in project liferay-ide by liferay.

the class ServerCoreBase method publishToServer.

protected void publishToServer(IProject project) {
    ServerBehaviourDelegate delegate = (ServerBehaviourDelegate) server.loadAdapter(ServerBehaviourDelegate.class, null);
    Module[] moduleTree = { new Module(null, project.getName(), project.getName(), "jst.web", "3.0", project) };
    LiferayPublishHelper.prePublishModule(delegate, 1, 1, moduleTree, null, null);
}
Also used : ServerBehaviourDelegate(org.eclipse.wst.server.core.model.ServerBehaviourDelegate) Module(org.eclipse.wst.server.core.internal.Module)

Aggregations

Module (org.eclipse.wst.server.core.internal.Module)2 IBundleProject (com.liferay.ide.core.IBundleProject)1 ArrayList (java.util.ArrayList)1 IProject (org.eclipse.core.resources.IProject)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IModule (org.eclipse.wst.server.core.IModule)1 IServer (org.eclipse.wst.server.core.IServer)1 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)1 ServerBehaviourDelegate (org.eclipse.wst.server.core.model.ServerBehaviourDelegate)1 Test (org.junit.Test)1