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);
}
}
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());
}
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());
}
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);
}
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());
}
}
}
}
}
Aggregations