Author: ljelinko
Date: 2012-01-12 09:56:49 -0500 (Thu, 12 Jan 2012)
New Revision: 37788
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/core/CreateJavaPortlet.java
Log:
Added fix for issue occurring when running via Maven
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/core/CreateJavaPortlet.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/core/CreateJavaPortlet.java 2012-01-12
14:26:15 UTC (rev 37787)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/core/CreateJavaPortlet.java 2012-01-12
14:56:49 UTC (rev 37788)
@@ -5,11 +5,16 @@
import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.baseadaptor.BaseData;
+import org.eclipse.osgi.framework.internal.core.BundleHost;
import org.jboss.tools.portlet.ui.bot.entity.XMLNode;
import org.jboss.tools.portlet.ui.bot.task.wizard.web.jboss.AbstractPortletCreationTask;
import org.jboss.tools.portlet.ui.bot.task.wizard.web.jboss.JavaPortletCreationTask;
import
org.jboss.tools.portlet.ui.bot.task.wizard.web.jboss.JavaPortletWizardPageFillingTask;
import org.jboss.tools.portlet.ui.bot.test.template.CreatePortletTemplate;
+import org.junit.Before;
+import org.osgi.framework.Bundle;
/**
* Creates a new java portlet and checks if the right files are generated.
@@ -29,6 +34,37 @@
private static final String FULL_CLASS_NAME = PACKAGE_NAME + "." +
CLASS_NAME;
+ /**
+ * An ugly fix of Eclipse issue:
+ * ID: Bug 368436
+ * URL:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=368436
+ */
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ removeSlash("org.eclipse.jst.j2ee");
+ removeSlash("org.eclipse.jst.j2ee.web");
+ removeSlash("org.jboss.tools.portlet.ui");
+ }
+
+ private void removeSlash(String pluginName){
+ Bundle bundle = Platform.getBundle(pluginName);
+ if (bundle instanceof BundleHost){
+ BundleHost bundleHost = (BundleHost) bundle;
+ if (bundleHost.getBundleData() instanceof BaseData){
+ BaseData baseData = (BaseData) bundleHost.getBundleData();
+ if (baseData.getLocation().endsWith("/")){
+ baseData.setLocation(baseData.getLocation().substring(0,
baseData.getLocation().length() - 1));
+ }
+ System.out.println("Location of bundle is: " + bundle.getLocation());
+ } else {
+ System.out.println("The BundleHost data is not of type BaseData");
+ }
+ } else {
+ System.out.println("The bundle is not of type BundleHost");
+ }
+ }
+
@Override
protected String getProjectName() {
return PROJECT_NAME;