JBoss Tools SVN: r30724 - branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-21 16:29:43 -0400 (Thu, 21 Apr 2011)
New Revision: 30724
Modified:
branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BuiltInBeanInjectionTest.java
Log:
JBIDE-8017
https://issues.jboss.org/browse/JBIDE-8017
Modified: branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BuiltInBeanInjectionTest.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BuiltInBeanInjectionTest.java 2011-04-21 20:28:39 UTC (rev 30723)
+++ branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BuiltInBeanInjectionTest.java 2011-04-21 20:29:43 UTC (rev 30724)
@@ -13,6 +13,7 @@
import java.util.Set;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.internal.core.impl.BuiltInBean;
@@ -72,7 +73,18 @@
t = b.getBeanClass();
assertEquals("java.security.Principal", t.getFullyQualifiedName());
-
+ //javax.enterprise.inject.spi.BeanManager
+ field = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java", "manager");
+ assertNotNull(field);
+
+ beans = field.getCDIProject().getBeans(false, field);
+ assertFalse(beans.isEmpty());
+
+ b = beans.iterator().next();
+ assertTrue(b instanceof BuiltInBean);
+ t = b.getBeanClass();
+ assertEquals(CDIConstants.BEAN_MANAGER_TYPE_NAME, t.getFullyQualifiedName());
+
}
}
\ No newline at end of file
14 years, 11 months
JBoss Tools SVN: r30723 - in branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-21 16:28:39 -0400 (Thu, 21 Apr 2011)
New Revision: 30723
Modified:
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
Log:
JBIDE-8017
https://issues.jboss.org/browse/JBIDE-8017
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2011-04-21 20:14:54 UTC (rev 30722)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2011-04-21 20:28:39 UTC (rev 30723)
@@ -87,6 +87,7 @@
public String PRINCIPAL_TYPE_NAME = "java.security.Principal";
public String VALIDATION_FACTORY_TYPE_NAME = "javax.validation.ValidatorFactory";
public String VALIDATOR_TYPE_NAME = "javax.validation.Validator";
+ public String BEAN_MANAGER_TYPE_NAME = "javax.enterprise.inject.spi.BeanManager";
public String ANNOTATION_LITERAL_TYPE_NAME = "javax.enterprise.util.AnnotationLiteral";
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-04-21 20:14:54 UTC (rev 30722)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-04-21 20:28:39 UTC (rev 30723)
@@ -399,6 +399,7 @@
BUILT_IN.add(CDIConstants.PRINCIPAL_TYPE_NAME);
BUILT_IN.add(CDIConstants.VALIDATION_FACTORY_TYPE_NAME);
BUILT_IN.add(CDIConstants.VALIDATOR_TYPE_NAME);
+ BUILT_IN.add(CDIConstants.BEAN_MANAGER_TYPE_NAME);
}
static boolean isBuiltIn(IType type) {
return type != null && BUILT_IN.contains(type.getFullyQualifiedName());
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2011-04-21 20:14:54 UTC (rev 30722)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2011-04-21 20:28:39 UTC (rev 30723)
@@ -73,9 +73,9 @@
if(!hasConstructor) {
hasBeanConstructor = true;
}
- if(!hasBeanConstructor && getType().getFullyQualifiedName().equals(CDIConstants.WELD_BEAN_MANAGER_TYPE_NAME)) {
- hasBeanConstructor = true;
- }
+// if(!hasBeanConstructor && getType().getFullyQualifiedName().equals(CDIConstants.WELD_BEAN_MANAGER_TYPE_NAME)) {
+// hasBeanConstructor = true;
+// }
}
public ParametedType getSuperType() {
14 years, 11 months
JBoss Tools SVN: r30722 - in trunk/as: plugins/org.jboss.ide.eclipse.as.management.as7 and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-04-21 16:14:54 -0400 (Thu, 21 Apr 2011)
New Revision: 30722
Added:
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementIntegrationTest.java
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementTestUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManager.java
Removed:
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java
Modified:
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java
Log:
[JBIDE-8769] implementing state checking
Deleted: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java 2011-04-21 20:07:15 UTC (rev 30721)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java 2011-04-21 20:14:54 UTC (rev 30722)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.management.as7.tests;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.HttpURLConnection;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Platform;
-import org.osgi.framework.Bundle;
-
-/**
- * @author André Dietisheim
- */
-public class DeployerTestUtils {
-
- public static final String GWT_HELLOWORLD_WAR = "gwt-helloworld.war";
- public static final String MINIMALISTIC_WAR = "minimalistic.war";
-
- public static final String HOST = "localhost";
- public static final int MGMT_PORT = 9999;
- public static final int WEB_PORT = 8080;
-
- private static final String WAR_FOLDER = "/wars/";
- private static final String BUNDLE_ID = "org.jboss.ide.eclipse.as.management.as7.tests";
-
- private static final int WEBAPP_RESPONSE_TIMEOUT = 10 * 1024;
- private static final long WAIT_DEPLOYED_TIMEOUT = 10 * 1024;
-
- public static File getWarFile(String name) throws URISyntaxException, IOException {
- Bundle bundle = Platform.getBundle(BUNDLE_ID);
- URL entryUrl = bundle.getEntry(WAR_FOLDER + name);
- return new File(FileLocator.resolve(entryUrl).toURI());
- }
-
- public static String getWebappResponse(String name, String host, int port) throws IOException {
- long until = System.currentTimeMillis() + WAIT_DEPLOYED_TIMEOUT;
- while (System.currentTimeMillis() < until) {
- try {
- return getServerResponse(new URL(
- MessageFormat.format(
- "http://{0}:{1}/{2}", host, String.valueOf(port), name)));
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
-
- }
- return null;
- }
-
- public static String getServerResponse(URL url) throws IOException {
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setUseCaches(false);
- connection.setDoInput(true);
- connection.setAllowUserInteraction(false);
- connection.setConnectTimeout(WEBAPP_RESPONSE_TIMEOUT);
- connection.setInstanceFollowRedirects(true);
- connection.setDoOutput(false);
- BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
- return toString(in);
- }
-
- public static String toString(InputStream in) throws IOException {
- StringWriter writer = new StringWriter();
- for (int data = -1; ((data = in.read()) != -1);) {
- writer.write(data);
- }
- return writer.toString();
- }
-}
Modified: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java 2011-04-21 20:07:15 UTC (rev 30721)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java 2011-04-21 20:14:54 UTC (rev 30722)
@@ -40,11 +40,11 @@
@Test
public void canDeploy() throws Exception {
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
try {
- DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ DetypedDeployer.deploy(warFile, JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
- String response = DeployerTestUtils.getWebappResponse("minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
+ String response = JBossManagementTestUtils.waitForRespose("minimalistic", JBossManagementTestUtils.HOST, JBossManagementTestUtils.WEB_PORT);
assertTrue(response.indexOf("minimalistic") >= 0);
} finally {
@@ -54,10 +54,10 @@
@Test(expected = DeployerException.class)
public void cannotDeployWarTwice() throws Exception {
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
try {
- DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
- DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ DetypedDeployer.deploy(warFile, JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
+ DetypedDeployer.deploy(warFile, JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
} finally {
quietlyUndeploy(warFile);
}
@@ -65,14 +65,14 @@
@Test
public void canReplaceWar() throws Exception {
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
- File warFile2 = DeployerTestUtils.getWarFile(DeployerTestUtils.GWT_HELLOWORLD_WAR);
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
+ File warFile2 = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.GWT_HELLOWORLD_WAR);
String name = warFile.getName();
try {
- DetypedDeployer.deploy(name, warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
- DetypedDeployer.replace(name, warFile2, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
- String response = DeployerTestUtils.getWebappResponse(
- "minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
+ DetypedDeployer.deploy(name, warFile, JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
+ DetypedDeployer.replace(name, warFile2, JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
+ String response = JBossManagementTestUtils.waitForRespose(
+ "minimalistic", JBossManagementTestUtils.HOST, JBossManagementTestUtils.WEB_PORT);
assertTrue(response.indexOf("GWT") >= 0);
} finally {
quietlyUndeploy(warFile);
@@ -81,19 +81,19 @@
@Test(expected = DeployerException.class)
public void cannotUndeployNondeployed() throws DeployerException {
- DetypedDeployer.undeploy("inexistant", DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ DetypedDeployer.undeploy("inexistant", JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
}
@Test
public void canQueryDeploymentdeployedState() throws Exception {
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
- File warFile2 = DeployerTestUtils.getWarFile(DeployerTestUtils.GWT_HELLOWORLD_WAR);
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
+ File warFile2 = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.GWT_HELLOWORLD_WAR);
try {
- DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
- DetypedDeployer.deploy(warFile2, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
- List<String> deployments = DetypedDeployer.getDeployments(DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ DetypedDeployer.deploy(warFile, JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
+ DetypedDeployer.deploy(warFile2, JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
+ List<String> deployments = DetypedDeployer.getDeployments(JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
assertThat(deployments.size(), is(2));
- assertThat(deployments, hasItems(DeployerTestUtils.MINIMALISTIC_WAR, DeployerTestUtils.GWT_HELLOWORLD_WAR));
+ assertThat(deployments, hasItems(JBossManagementTestUtils.MINIMALISTIC_WAR, JBossManagementTestUtils.GWT_HELLOWORLD_WAR));
} finally {
quietlyUndeploy(warFile);
quietlyUndeploy(warFile2);
@@ -102,7 +102,7 @@
private void quietlyUndeploy(File file) {
try {
- DetypedDeployer.undeploy(file.getName(), DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ DetypedDeployer.undeploy(file.getName(), JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
} catch (Exception e) {
e.printStackTrace();
// ignore
Copied: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementIntegrationTest.java (from rev 30703, trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java)
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementIntegrationTest.java (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementIntegrationTest.java 2011-04-21 20:14:54 UTC (rev 30722)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.tests;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+import java.util.concurrent.ExecutionException;
+
+import org.jboss.ide.eclipse.as.management.as7.deployment.DeployerException;
+import org.jboss.ide.eclipse.as.management.as7.deployment.JBossManager;
+import org.jboss.ide.eclipse.as.management.as7.deployment.JBossManager.DeploymentState;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ *
+ * @author André Dietisheim
+ */
+public class JBossManagementIntegrationTest {
+
+ private JBossManager manager;
+
+ @Before
+ public void setUp() throws UnknownHostException {
+ this.manager = new JBossManager(JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
+ }
+
+ @After
+ public void tearDown() {
+ manager.dispose();
+ }
+
+ @Ignore
+ @Test
+ public void canDeploy() throws Exception {
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
+ try {
+ JBossManagementTestUtils.waitUntilFinished(manager.deploy(warFile));
+
+ String response = JBossManagementTestUtils.waitForRespose(
+ "minimalistic", JBossManagementTestUtils.HOST, JBossManagementTestUtils.WEB_PORT);
+ assertTrue(response != null
+ && response.indexOf("minimalistic") >= 0);
+ } finally {
+ JBossManagementTestUtils.quietlyUndeploy(warFile, manager);
+ }
+ }
+
+ @Ignore
+ @Test
+ public void deployedWarIsResponding() throws Exception {
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
+ try {
+ JBossManagementTestUtils.waitUntilFinished(manager.deploy(warFile));
+
+ String response = JBossManagementTestUtils.waitForRespose(
+ "minimalistic", JBossManagementTestUtils.HOST, JBossManagementTestUtils.WEB_PORT);
+ assertTrue(response != null
+ && response.indexOf("minimalistic") >= 0);
+
+ } finally {
+ JBossManagementTestUtils.quietlyUndeploy(warFile, manager);
+ }
+ }
+
+ @Ignore
+ @Test(expected = DeployerException.class)
+ public void cannotDeployWarTwice() throws Exception {
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
+ try {
+ JBossManagementTestUtils.waitUntilFinished(manager.deploy(warFile));
+ JBossManagementTestUtils.waitUntilFinished(manager.deploy(warFile));
+ } finally {
+ JBossManagementTestUtils.quietlyUndeploy(warFile, manager);
+ }
+ }
+
+ @Ignore
+ @Test(expected = DeployerException.class)
+ public void cannotUndeployNondeployed() throws DeployerException, InterruptedException, ExecutionException {
+ JBossManagementTestUtils.waitUntilFinished(manager.undeploy("inexistant"));
+ }
+
+ @Ignore
+ @Test
+ public void canReplaceWar() throws Exception {
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
+ File warFile2 = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.GWT_HELLOWORLD_WAR);
+ String name = warFile.getName();
+ try {
+ JBossManagementTestUtils.waitUntilFinished(manager.deploy(name, warFile));
+ JBossManagementTestUtils.waitUntilFinished(manager.replace(name, warFile2));
+ String response = JBossManagementTestUtils.waitForRespose(
+ "minimalistic", JBossManagementTestUtils.HOST, JBossManagementTestUtils.WEB_PORT);
+ assertTrue(response != null
+ && response.indexOf("GWT") >= 0);
+ } finally {
+ JBossManagementTestUtils.quietlyUndeploy(name, manager);
+ }
+ }
+
+ @Test
+ public void getEnabledStateIfDeploymentIsDeployed() throws URISyntaxException, IOException, DeployerException {
+ String deploymentName = "testDeployment";
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
+ try {
+ JBossManagementTestUtils.waitUntilFinished(manager.deploy(deploymentName, warFile));
+ DeploymentState state = manager.getDeploymentState(deploymentName);
+ assertNotNull(state);
+ assertThat(state, equalTo(DeploymentState.ENABLEDSTATE));
+ } finally {
+ JBossManagementTestUtils.quietlyUndeploy(deploymentName, manager);
+ }
+ }
+
+ @Test
+ public void getDisabledStateIfDeploymentIsOnlyAdded() throws URISyntaxException, IOException, DeployerException {
+ String deploymentName = "testDeployment";
+ File warFile = JBossManagementTestUtils.getWarFile(JBossManagementTestUtils.MINIMALISTIC_WAR);
+ try {
+ JBossManagementTestUtils.waitUntilFinished(manager.add(deploymentName, warFile));
+ DeploymentState state = manager.getDeploymentState(deploymentName);
+ assertNotNull(state);
+ assertThat(state, equalTo(DeploymentState.DISABLEDSTATE));
+ } finally {
+ JBossManagementTestUtils.quietlyRemove(deploymentName, manager);
+ }
+ }
+
+ @Test(expected = DeployerException.class)
+ public void getErrorIfDeploymentIsNotDeployed() throws URISyntaxException, IOException, DeployerException {
+ String deploymentName = "testDeployment";
+ try {
+ manager.getDeploymentState(deploymentName);
+ } finally {
+ JBossManagementTestUtils.quietlyUndeploy(deploymentName, manager);
+ }
+ }
+}
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementTestUtils.java (from rev 30699, trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java)
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementTestUtils.java (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementTestUtils.java 2011-04-21 20:14:54 UTC (rev 30722)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.tests;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.HttpURLConnection;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.as.management.as7.deployment.DeployerException;
+import org.jboss.ide.eclipse.as.management.as7.deployment.JBossManager;
+import org.jboss.ide.eclipse.as.management.as7.deployment.JBossManager.DeploymentPlanResult;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author André Dietisheim
+ */
+public class JBossManagementTestUtils {
+
+ public static final String GWT_HELLOWORLD_WAR = "gwt-helloworld.war";
+ public static final String MINIMALISTIC_WAR = "minimalistic.war";
+
+ public static final String HOST = "localhost";
+ public static final int MGMT_PORT = 9999;
+ public static final int WEB_PORT = 8080;
+
+ private static final String WAR_FOLDER = "/wars/";
+ private static final String BUNDLE_ID = "org.jboss.ide.eclipse.as.management.as7.tests";
+
+ private static final int RESPONSE_TIMEOUT = 10 * 1024;
+ private static final long WAIT_TIMEOUT = 10 * 1024;
+
+ public static File getWarFile(String name) throws URISyntaxException, IOException {
+ Bundle bundle = Platform.getBundle(BUNDLE_ID);
+ URL entryUrl = bundle.getEntry(WAR_FOLDER + name);
+ return new File(FileLocator.resolve(entryUrl).toURI());
+ }
+
+ public static String waitForRespose(String name, String host, int port) throws IOException {
+ waitForResponseCode(200, name, host, port);
+ return getResponse(name, host, port);
+ }
+
+ public static void quietlyUndeploy(File file, JBossManager manager) {
+ quietlyUndeploy(file.getName(), manager);
+ }
+
+ public static void quietlyUndeploy(String name, JBossManager manager) {
+ try {
+ // DetypedDeployer.undeploy(name, JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
+ waitUntilFinished(manager.undeploy(name));
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ public static void quietlyRemove(String name, JBossManager manager) {
+ try {
+ //DetypedDeployer.remove(name, JBossManagementTestUtils.HOST, JBossManagementTestUtils.MGMT_PORT);
+ waitUntilFinished(manager.remove(name));
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ public static void waitUntilFinished(DeploymentPlanResult result) throws DeployerException {
+ result.getStatus(); // wait for operation to finish
+ }
+
+
+ public static String getResponse(String name, String host, int port) throws IOException {
+ URL url = new URL("http://" + host + ":" + port + "/" + name);
+ HttpURLConnection connection = connect(url);
+ return toString(new BufferedInputStream(connection.getInputStream()));
+ }
+
+ public static HttpURLConnection waitForResponseCode(int code, String name, String host, int port)
+ throws IOException {
+ URL url = new URL("http://" + host + ":" + port + "/" + name);
+ long until = System.currentTimeMillis() + WAIT_TIMEOUT;
+ while (System.currentTimeMillis() < until) {
+ HttpURLConnection connection = connect(url);
+ try {
+ if (connection.getResponseCode() == code) {
+ return connection;
+ }
+ } catch (FileNotFoundException e) {
+ if (code == 404) {
+ return connection;
+ }
+ throw e;
+ }
+ }
+ throw new RuntimeException("wait on url " + url + " for response code " + code + " timed out.");
+ }
+
+ private static HttpURLConnection connect(URL url) throws IOException {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setUseCaches(false);
+ connection.setDoInput(true);
+ connection.setAllowUserInteraction(false);
+ connection.setConnectTimeout(RESPONSE_TIMEOUT);
+ connection.setInstanceFollowRedirects(true);
+ connection.setDoOutput(false);
+ return connection;
+ }
+
+ public static String toString(InputStream in) throws IOException {
+ StringWriter writer = new StringWriter();
+ for (int data = -1; ((data = in.read()) != -1);) {
+ writer.write(data);
+ }
+ return writer.toString();
+ }
+}
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/JBossManagementTestUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java 2011-04-21 20:07:15 UTC (rev 30721)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java 2011-04-21 20:14:54 UTC (rev 30722)
@@ -1,188 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.management.as7.tests;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.UnknownHostException;
-import java.util.concurrent.ExecutionException;
-
-import org.jboss.ide.eclipse.as.management.as7.deployment.DeployerException;
-import org.jboss.ide.eclipse.as.management.as7.deployment.TypedDeployer;
-import org.jboss.ide.eclipse.as.management.as7.deployment.TypedDeployer.DeploymentPlanResult;
-import org.jboss.ide.eclipse.as.management.as7.deployment.TypedDeployer.DeploymentState;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- *
- * @author André Dietisheim
- */
-public class TypedDeployerIntegrationTest {
-
- private TypedDeployer deployer;
-
- @Before
- public void setUp() throws UnknownHostException {
- this.deployer = new TypedDeployer(DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
- }
-
- @After
- public void tearDown() {
- deployer.dispose();
- }
-
- @Ignore
- @Test
- public void canDeploy() throws Exception {
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
- try {
- waitUntilFinished(deployer.deploy(warFile));
-
- String response = DeployerTestUtils.getWebappResponse(
- "minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
- assertTrue(response != null
- && response.indexOf("minimalistic") >= 0);
-
- } finally {
- quietlyUndeploy(warFile);
- }
- }
-
- @Ignore
- @Test
- public void deployedWarIsResponding() throws Exception {
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
- try {
- waitUntilFinished(deployer.deploy(warFile));
-
- String response = DeployerTestUtils.getWebappResponse(
- "minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
- assertTrue(response != null
- && response.indexOf("minimalistic") >= 0);
-
- } finally {
- quietlyUndeploy(warFile);
- }
- }
-
- @Ignore
- @Test(expected = DeployerException.class)
- public void cannotDeployWarTwice() throws Exception {
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
- try {
- waitUntilFinished(deployer.deploy(warFile));
- waitUntilFinished(deployer.deploy(warFile));
- } finally {
- quietlyUndeploy(warFile);
- }
- }
-
- @Ignore
- @Test(expected = DeployerException.class)
- public void cannotUndeployNondeployed() throws DeployerException, InterruptedException, ExecutionException {
- waitUntilFinished(deployer.undeploy("inexistant"));
- }
-
- @Ignore
- @Test
- public void canReplaceWar() throws Exception {
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
- File warFile2 = DeployerTestUtils.getWarFile(DeployerTestUtils.GWT_HELLOWORLD_WAR);
- String name = warFile.getName();
- try {
- waitUntilFinished(deployer.deploy(name, warFile));
- waitUntilFinished(deployer.replace(name, warFile2));
- String response = DeployerTestUtils.getWebappResponse(
- "minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
- assertTrue(response != null
- && response.indexOf("GWT") >= 0);
- } finally {
- quietlyUndeploy(name);
- }
- }
-
- @Test
- public void getEnabledStateIfDeploymentIsDeployed() throws URISyntaxException, IOException, DeployerException {
- String deploymentName = "testDeployment";
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
- try {
- waitUntilFinished(deployer.deploy(deploymentName, warFile));
- DeploymentState state = deployer.getDeploymentState(deploymentName);
- assertNotNull(state);
- assertThat(state, equalTo(DeploymentState.ENABLEDSTATE));
- } finally {
- quietlyUndeploy(deploymentName);
- }
- }
-
- @Test
- public void getDisabledStateIfDeploymentIsOnlyAdded() throws URISyntaxException, IOException, DeployerException {
- String deploymentName = "testDeployment";
- File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
- try {
- waitUntilFinished(deployer.deploy(deploymentName, warFile));
- DeploymentState state = deployer.getDeploymentState(deploymentName);
- assertNotNull(state);
- assertThat(state, equalTo(DeploymentState.ENABLEDSTATE));
- } finally {
- quietlyUndeploy(deploymentName);
- }
- }
-
- @Test(expected=DeployerException.class)
- public void getErrorIfDeploymentIsNotDeployed() throws URISyntaxException, IOException, DeployerException {
- String deploymentName = "testDeployment";
- try {
- DeploymentState state = deployer.getDeploymentState(deploymentName);
- assertNotNull(state);
- assertThat(state, equalTo(DeploymentState.ENABLEDSTATE));
- } finally {
- quietlyUndeploy(deploymentName);
- }
- }
-
- private void quietlyUndeploy(String name) {
- try {
- waitUntilFinished(deployer.undeploy(name));
- } catch (Exception e) {
- e.printStackTrace();
- // ignore
- }
- }
-
- private void quietlyUndeploy(File file) {
- quietlyUndeploy(file.getName());
- }
-
- private void waitUntilFinished(DeploymentPlanResult result) throws DeployerException {
- result.getStatus(); // wait for operation to finish
- }
-}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-04-21 20:07:15 UTC (rev 30721)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/.classpath 2011-04-21 20:14:54 UTC (rev 30722)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Beta3.jar"/>
+ <classpathentry exported="true" kind="lib" path="jboss-as-controller-client-7.0.0.Beta3.jar" sourcepath="/jboss-as-controller-client"/>
<classpathentry exported="true" kind="lib" path="jboss-as-protocol-7.0.0.Beta3.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-dmr-1.0.0.Beta5.jar" sourcepath="/home/adietish/jboss-workspaces/jboss-tools/jbosstools-src/jboss-dmr-1.0.0.Beta5-sources.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-logging-3.0.0.Beta3.jar"/>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-04-21 20:07:15 UTC (rev 30721)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-04-21 20:14:54 UTC (rev 30722)
@@ -9,8 +9,8 @@
org.jboss.ide.eclipse.as.core
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ClassPath: jboss-as-controller-client-7.0.0.Beta3-SNAPSHOT.jar,
- jboss-as-protocol-7.0.0.Beta3-SNAPSHOT.jar,
+Bundle-ClassPath: jboss-as-controller-client-7.0.0.Beta3.jar,
+ jboss-as-protocol-7.0.0.Beta3.jar,
jboss-dmr-1.0.0.Beta5.jar,
jboss-logging-3.0.0.Beta3.jar,
jboss-marshalling-1.3.0.CR8.jar,
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java 2011-04-21 20:07:15 UTC (rev 30721)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/DetypedDeployer.java 2011-04-21 20:14:54 UTC (rev 30722)
@@ -21,6 +21,15 @@
*/
package org.jboss.ide.eclipse.as.management.as7.deployment;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADD;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADDRESS;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.DEPLOYMENT;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ENABLED;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.INPUT_STREAM_INDEX;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.OP;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.REMOVE;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.UNDEPLOY;
+
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -46,16 +55,30 @@
client = ModelControllerClient.Factory.create(host, port);
// undeploy
ModelNode request = new ModelNode();
- request.get("operation").set("undeploy");
- request.get("address").add("deployment", name);
+ request.get(OP).set(UNDEPLOY);
+ request.get(ADDRESS).add(DEPLOYMENT, name);
ModelNode result = client.execute(request);
throwOnFailure(result);
+ remove(name, host, port);
+
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ } finally {
+ StreamUtils.safeClose(client);
+ }
+ }
+
+ public static void remove(String name, String host, int port) throws DeployerException {
+ ModelControllerClient client = null;
+ try {
+ client = ModelControllerClient.Factory.create(host, port);
+
// remove
- request = new ModelNode();
- request.get("operation").set("remove");
- request.get("address").add("deployment", name);
- result = client.execute(request);
+ ModelNode request = new ModelNode();
+ request.get(OP).set(REMOVE);
+ request.get(ADDRESS).add(DEPLOYMENT, name);
+ ModelNode result = client.execute(request);
} catch (Exception e) {
throw new DeployerException(e);
} finally {
@@ -73,14 +96,14 @@
client = ModelControllerClient.Factory.create(host, port);
ModelNode request = new ModelNode();
- request.get("operation").set("add");
- request.get("address").add("deployment", name);
- request.get("enabled").set(true);
+ request.get(OP).set(ADD);
+ request.get(ADDRESS).add(DEPLOYMENT, name);
+ request.get(ENABLED).set(true);
OperationBuilder builder = OperationBuilder.Factory.create(request);
builder.addInputStream(new BufferedInputStream(new FileInputStream(file)));
Operation operation = builder.build();
- request.get("input-stream-index").set(0);
+ request.get(INPUT_STREAM_INDEX).set(0);
ModelNode result = client.execute(operation);
System.out.println(result);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java 2011-04-21 20:07:15 UTC (rev 30721)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossDeploymentManager.java 2011-04-21 20:14:54 UTC (rev 30722)
@@ -4,31 +4,31 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentManager;
-import org.jboss.ide.eclipse.as.management.as7.deployment.TypedDeployer.DeploymentPlanResult;
+import org.jboss.ide.eclipse.as.management.as7.deployment.JBossManager.DeploymentPlanResult;
public class JBossDeploymentManager implements IJBoss7DeploymentManager {
public DeploymentPlanResult deployAsync(String host, int port, String deploymentName,
File file, IProgressMonitor monitor) throws Exception {
- TypedDeployer deployer = new TypedDeployer(host, port);
+ JBossManager deployer = new JBossManager(host, port);
return deployer.deploy(deploymentName, file);
}
public DeploymentPlanResult deploySync(String host, int port, String deploymentName,
File file, IProgressMonitor monitor) throws Exception {
- TypedDeployer deployer = new TypedDeployer(host, port);
+ JBossManager deployer = new JBossManager(host, port);
return deployer.deploySync(deploymentName, file, monitor);
}
public DeploymentPlanResult undeployAsync(String host, int port, String deploymentName,
boolean removeFile, IProgressMonitor monitor) throws Exception {
- TypedDeployer deployer = new TypedDeployer(host, port);
+ JBossManager deployer = new JBossManager(host, port);
return deployer.undeploy(deploymentName);
}
public DeploymentPlanResult syncUndeploy(String host, int port, String deploymentName,
boolean removeFile, IProgressMonitor monitor) throws Exception {
- TypedDeployer deployer = new TypedDeployer(host, port);
+ JBossManager deployer = new JBossManager(host, port);
return deployer.undeploySync(deploymentName, monitor);
}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManager.java (from rev 30703, trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManager.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBossManager.java 2011-04-21 20:14:54 UTC (rev 30722)
@@ -0,0 +1,253 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.deployment;
+
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADDRESS;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.DEPLOYMENT;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ENABLED;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.FAILURE_DESCRIPTION;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.OP;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.READ_RESOURCE_OPERATION;
+import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.RESULT;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.text.MessageFormat;
+import java.util.concurrent.Future;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
+import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
+import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
+import org.jboss.as.protocol.StreamUtils;
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.management.as7.Activator;
+
+/**
+ * @author André Dietisheim
+ */
+public class JBossManager {
+
+ private ModelControllerClient client;
+ private ServerDeploymentManager manager;
+
+ public JBossManager(String host, int port) throws UnknownHostException {
+ this.client = ModelControllerClient.Factory.create(host, port);
+ this.manager = ServerDeploymentManager.Factory.create(client);
+ }
+
+ public DeploymentPlanResult undeploySync(String name, IProgressMonitor monitor) throws DeployerException {
+ DeploymentPlanResult result = undeploy(name);
+ result.getStatus();
+ return result;
+ }
+
+ public DeploymentPlanResult deploySync(String name, File file, IProgressMonitor monitor) throws DeployerException {
+ DeploymentPlanResult result = deploy(name, file);
+ result.getStatus();
+ return result;
+ }
+
+ public DeploymentPlanResult undeploy(String name) throws DeployerException {
+ try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ builder = builder.undeploy(name).andRemoveUndeployed();
+ return new DeploymentPlanResult(builder.getLastAction(), manager.execute(builder.build()));
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ public DeploymentPlanResult remove(String name) throws DeployerException {
+ try {
+ DeploymentPlanBuilder builder = manager.newDeploymentPlan();
+ builder = builder.remove(name);
+ return new DeploymentPlanResult(builder.getLastAction(), manager.execute(builder.build()));
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ public DeploymentPlanResult deploy(File file) throws DeployerException {
+ return deploy(file.getName(), file);
+ }
+
+ public DeploymentPlanResult add(String name, File file) throws DeployerException {
+ try {
+ return execute(manager.newDeploymentPlan().add(name, file));
+ } catch (IOException e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ public DeploymentPlanResult deploy(String name, File file) throws DeployerException {
+ try {
+ return execute(manager.newDeploymentPlan().add(name, file).andDeploy());
+ } catch (IOException e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ public DeploymentPlanResult replace(File file) throws DeployerException {
+ return replace(file.getName(), file);
+ }
+
+ public DeploymentPlanResult replace(String name, File file) throws DeployerException {
+ try {
+ return execute(manager.newDeploymentPlan().replace(name, file));
+ } catch (IOException e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ public DeploymentState getDeploymentState(String name) throws DeployerException {
+ ModelNode request = new ModelNode();
+ request.get(OP).set(READ_RESOURCE_OPERATION);
+ request.get(ADDRESS).add(DEPLOYMENT, name);
+ ModelNode result = execute(request);
+ return DeploymentState.getForResultNode(result);
+ }
+
+ public void dispose() {
+ StreamUtils.safeClose(client);
+ }
+
+ private ModelNode execute(ModelNode node) throws DeployerException {
+ try {
+ ModelNode response = client.execute(node);
+ if (!JBossManagementUtil.isSuccess(response)) {
+ throw new DeployerException(
+ MessageFormat.format("Could not execute {0} for {1}. Failure was {2}.", node.get(OP), node.get(ADDRESS), response.get(FAILURE_DESCRIPTION)));
+ }
+ return response.get(RESULT);
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ private DeploymentPlanResult execute(DeploymentPlanBuilder builder) throws DeployerException {
+ try {
+ DeploymentAction action = builder.getLastAction();
+ Future<ServerDeploymentPlanResult> planResult = manager.execute(builder.build());
+ return new DeploymentPlanResult(action, planResult);
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ public static class DeploymentPlanResult {
+
+ private Future<ServerDeploymentPlanResult> planResult;
+ private DeploymentAction action;
+
+ public DeploymentPlanResult(DeploymentAction action, Future<ServerDeploymentPlanResult> planResult) {
+ Assert.isNotNull(action);
+ this.action = action;
+ Assert.isNotNull(planResult);
+ this.planResult = planResult;
+ }
+
+ public IStatus getStatus() throws DeployerException {
+ try {
+ ServerDeploymentActionResult actionResult = planResult.get().getDeploymentActionResult(action.getId());
+ return createStatus(action.getDeploymentUnitUniqueName(), action.getType().name(), actionResult);
+ } catch (Exception e) {
+ throw new DeployerException(e);
+ }
+ }
+
+ private IStatus createStatus(String deploymentName, String actionName, ServerDeploymentActionResult actionResult) {
+ if (actionResult == null) {
+ return null;
+ }
+
+ IStatus status = null;
+ switch (actionResult.getResult()) {
+ case NOT_EXECUTED:
+ status = createStatus(IStatus.ERROR, "The operation {0} was not executed on unit {1}",
+ actionName, deploymentName);
+ break;
+ case EXECUTED:
+ status = Status.OK_STATUS;
+ break;
+ case FAILED:
+ status = createStatus(IStatus.ERROR, "The operation {0} failed for unit {1}",
+ actionName, deploymentName);
+ break;
+ case ROLLED_BACK:
+ status = createStatus(IStatus.ERROR, "The operation {0} for unit {1} was rolled back",
+ actionName, deploymentName);
+ break;
+ case CONFIGURATION_MODIFIED_REQUIRES_RESTART:
+ status = createStatus(
+ IStatus.WARNING,
+ "The operation {0} was not executed on unit {1}. The server configuration was changed though and the server needs to be restarted",
+ actionName, deploymentName);
+ break;
+ }
+ return status;
+ }
+
+ private IStatus createStatus(int severity, String messagePattern, Object... messageArguments) {
+ return new Status(severity, Activator.getContext().getBundle().getSymbolicName(), MessageFormat.format(
+ messagePattern, messageArguments));
+ }
+ }
+
+ public enum DeploymentState {
+ ENABLEDSTATE {
+ protected boolean matches(boolean enabled) {
+ return enabled == true;
+ }
+ },
+ DISABLEDSTATE {
+ protected boolean matches(boolean enabled) {
+ return enabled == false;
+ }
+ };
+
+ public static DeploymentState getForResultNode(ModelNode resultNode) {
+ Boolean enabled = JBossManagementUtil.getBooleanProperty(ENABLED, resultNode);
+ if (enabled == null) {
+ return null;
+ }
+
+ DeploymentState matchingState = null;
+ for(DeploymentState state : values()) {
+ if (state.matches(enabled)) {
+ matchingState = state;
+ }
+ }
+ return matchingState;
+ }
+
+ protected abstract boolean matches(boolean enabled);
+
+ }
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java 2011-04-21 20:07:15 UTC (rev 30721)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/TypedDeployer.java 2011-04-21 20:14:54 UTC (rev 30722)
@@ -1,237 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.management.as7.deployment;
-
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ADDRESS;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.DEPLOYMENT;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.ENABLED;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.FAILURE_DESCRIPTION;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.OP;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.READ_RESOURCE_OPERATION;
-import static org.jboss.ide.eclipse.as.management.as7.deployment.ModelDescriptionConstants.RESULT;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.text.MessageFormat;
-import java.util.concurrent.Future;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.helpers.standalone.DeploymentAction;
-import org.jboss.as.controller.client.helpers.standalone.DeploymentPlanBuilder;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentActionResult;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentManager;
-import org.jboss.as.controller.client.helpers.standalone.ServerDeploymentPlanResult;
-import org.jboss.as.protocol.StreamUtils;
-import org.jboss.dmr.ModelNode;
-import org.jboss.ide.eclipse.as.management.as7.Activator;
-
-/**
- *
- * @author André Dietisheim
- */
-public class TypedDeployer {
-
- private ModelControllerClient client;
- private ServerDeploymentManager manager;
-
- public TypedDeployer(String host, int port) throws UnknownHostException {
- this.client = ModelControllerClient.Factory.create(host, port);
- this.manager = ServerDeploymentManager.Factory.create(client);
- }
-
- public DeploymentPlanResult undeploySync(String name, IProgressMonitor monitor) throws DeployerException {
- DeploymentPlanResult result = undeploy(name);
- result.getStatus();
- return result;
- }
-
- public DeploymentPlanResult deploySync(String name, File file, IProgressMonitor monitor) throws DeployerException {
- DeploymentPlanResult result = deploy(name, file);
- result.getStatus();
- return result;
- }
-
- public DeploymentPlanResult undeploy(String name) throws DeployerException {
- try {
- DeploymentPlanBuilder builder = manager.newDeploymentPlan();
- builder = builder.undeploy(name).andRemoveUndeployed();
- return new DeploymentPlanResult(builder.getLastAction(), manager.execute(builder.build()));
- } catch (Exception e) {
- throw new DeployerException(e);
- }
- }
-
- public DeploymentPlanResult deploy(File file) throws DeployerException {
- return deploy(file.getName(), file);
- }
-
- public DeploymentPlanResult deploy(String name, File file) throws DeployerException {
- try {
- return execute(manager.newDeploymentPlan().add(name, file).andDeploy());
- } catch (IOException e) {
- throw new DeployerException(e);
- }
- }
-
- public DeploymentPlanResult replace(File file) throws DeployerException {
- return replace(file.getName(), file);
- }
-
- public DeploymentPlanResult replace(String name, File file) throws DeployerException {
- try {
- return execute(manager.newDeploymentPlan().replace(name, file));
- } catch (IOException e) {
- throw new DeployerException(e);
- }
- }
-
- public DeploymentState getDeploymentState(String name) throws DeployerException {
- ModelNode request = new ModelNode();
- request.get(OP).set(READ_RESOURCE_OPERATION);
- request.get(ADDRESS).add(DEPLOYMENT, name);
-
- ModelNode result = execute(request);
- return DeploymentState.getForResultNode(result);
- }
-
- public void dispose() {
- StreamUtils.safeClose(client);
- }
-
- private ModelNode execute(ModelNode node) throws DeployerException {
- try {
- ModelNode response = client.execute(node);
- if (!JBossManagementUtil.isSuccess(response)) {
- throw new DeployerException(
- MessageFormat.format("Could not execute {0} for {1}. Failure was {2}.", node.get(OP), node.get(ADDRESS), response.get(FAILURE_DESCRIPTION)));
- }
- return response.get(RESULT);
- } catch (Exception e) {
- throw new DeployerException(e);
- }
- }
-
- private DeploymentPlanResult execute(DeploymentPlanBuilder builder) throws DeployerException {
- try {
- DeploymentAction action = builder.getLastAction();
- Future<ServerDeploymentPlanResult> planResult = manager.execute(builder.build());
- return new DeploymentPlanResult(action, planResult);
- } catch (Exception e) {
- throw new DeployerException(e);
- }
- }
-
- public static class DeploymentPlanResult {
-
- private Future<ServerDeploymentPlanResult> planResult;
- private DeploymentAction action;
-
- public DeploymentPlanResult(DeploymentAction action, Future<ServerDeploymentPlanResult> planResult) {
- Assert.isNotNull(action);
- this.action = action;
- Assert.isNotNull(planResult);
- this.planResult = planResult;
- }
-
- public IStatus getStatus() throws DeployerException {
- try {
- ServerDeploymentActionResult actionResult = planResult.get().getDeploymentActionResult(action.getId());
- return createStatus(action.getDeploymentUnitUniqueName(), action.getType().name(), actionResult);
- } catch (Exception e) {
- throw new DeployerException(e);
- }
- }
-
- private IStatus createStatus(String deploymentName, String actionName, ServerDeploymentActionResult actionResult) {
- if (actionResult == null) {
- return null;
- }
-
- IStatus status = null;
- switch (actionResult.getResult()) {
- case NOT_EXECUTED:
- status = createStatus(IStatus.ERROR, "The operation {0} was not executed on unit {1}",
- actionName, deploymentName);
- break;
- case EXECUTED:
- status = Status.OK_STATUS;
- break;
- case FAILED:
- status = createStatus(IStatus.ERROR, "The operation {0} failed for unit {1}",
- actionName, deploymentName);
- break;
- case ROLLED_BACK:
- status = createStatus(IStatus.ERROR, "The operation {0} for unit {1} was rolled back",
- actionName, deploymentName);
- break;
- case CONFIGURATION_MODIFIED_REQUIRES_RESTART:
- status = createStatus(
- IStatus.WARNING,
- "The operation {0} was not executed on unit {1}. The server configuration was changed though and the server needs to be restarted",
- actionName, deploymentName);
- break;
- }
- return status;
- }
-
- private IStatus createStatus(int severity, String messagePattern, Object... messageArguments) {
- return new Status(severity, Activator.getContext().getBundle().getSymbolicName(), MessageFormat.format(
- messagePattern, messageArguments));
- }
- }
-
- public enum DeploymentState {
- ENABLEDSTATE {
- protected boolean matches(boolean enabled) {
- return enabled == true;
- }
- },
- STOPPEDSTATE {
- protected boolean matches(boolean enabled) {
- return enabled == false;
- }
- };
-
- public static DeploymentState getForResultNode(ModelNode resultNode) {
- Boolean enabled = JBossManagementUtil.getBooleanProperty(ENABLED, resultNode);
- if (enabled == null) {
- return null;
- }
-
- DeploymentState matchingState = null;
- for(DeploymentState state : values()) {
- if (state.matches(enabled)) {
- matchingState = state;
- }
- }
- return matchingState;
- }
-
- protected abstract boolean matches(boolean enabled);
-
- }
-}
14 years, 11 months
JBoss Tools SVN: r30721 - branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-21 16:07:15 -0400 (Thu, 21 Apr 2011)
New Revision: 30721
Modified:
branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
Log:
JBIDE-8771
https://issues.jboss.org/browse/JBIDE-8771
Modified: branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2011-04-21 20:05:22 UTC (rev 30720)
+++ branches/jbosstools-3.2.x/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2011-04-21 20:07:15 UTC (rev 30721)
@@ -21,6 +21,7 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
@@ -289,7 +290,10 @@
}
}
- public void testNewInterceptorBindingWizardWithBinding() {
+ public void testNewInterceptorBindingWizardWithBinding() throws CoreException {
+ IProject tck = ResourcesPlugin.getWorkspace().getRoot().getProject("tck");
+ tck.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+
WizardContext context = new WizardContext();
context.init("org.jboss.tools.cdi.ui.wizard.NewInterceptorBindingCreationWizard",
PACK_NAME, INTERCEPTOR_BINDING2_NAME);
14 years, 11 months
JBoss Tools SVN: r30720 - trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-21 16:05:22 -0400 (Thu, 21 Apr 2011)
New Revision: 30720
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
Log:
JBIDE-8771
https://issues.jboss.org/browse/JBIDE-8771
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2011-04-21 19:37:35 UTC (rev 30719)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2011-04-21 20:05:22 UTC (rev 30720)
@@ -21,6 +21,7 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
@@ -301,7 +302,10 @@
}
}
- public void testNewInterceptorBindingWizardWithBinding() {
+ public void testNewInterceptorBindingWizardWithBinding() throws CoreException {
+ IProject tck = ResourcesPlugin.getWorkspace().getRoot().getProject("tck");
+ tck.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+
WizardContext context = new WizardContext();
context.init("org.jboss.tools.cdi.ui.wizard.NewInterceptorBindingCreationWizard",
PACK_NAME, INTERCEPTOR_BINDING2_NAME);
14 years, 11 months
JBoss Tools SVN: r30719 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-21 15:37:35 -0400 (Thu, 21 Apr 2011)
New Revision: 30719
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BuiltInBeanInjectionTest.java
Log:
JBIDE-8017
https://issues.jboss.org/browse/JBIDE-8017
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2011-04-21 19:30:38 UTC (rev 30718)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2011-04-21 19:37:35 UTC (rev 30719)
@@ -87,6 +87,7 @@
public String PRINCIPAL_TYPE_NAME = "java.security.Principal";
public String VALIDATION_FACTORY_TYPE_NAME = "javax.validation.ValidatorFactory";
public String VALIDATOR_TYPE_NAME = "javax.validation.Validator";
+ public String BEAN_MANAGER_TYPE_NAME = "javax.enterprise.inject.spi.BeanManager";
public String ANNOTATION_LITERAL_TYPE_NAME = "javax.enterprise.util.AnnotationLiteral";
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-04-21 19:30:38 UTC (rev 30718)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-04-21 19:37:35 UTC (rev 30719)
@@ -412,6 +412,7 @@
BUILT_IN.add(CDIConstants.PRINCIPAL_TYPE_NAME);
BUILT_IN.add(CDIConstants.VALIDATION_FACTORY_TYPE_NAME);
BUILT_IN.add(CDIConstants.VALIDATOR_TYPE_NAME);
+ BUILT_IN.add(CDIConstants.BEAN_MANAGER_TYPE_NAME);
}
static boolean isBuiltIn(IType type) {
return type != null && BUILT_IN.contains(type.getFullyQualifiedName());
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2011-04-21 19:30:38 UTC (rev 30718)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2011-04-21 19:37:35 UTC (rev 30719)
@@ -83,9 +83,9 @@
if(!hasConstructor) {
hasBeanConstructor = true;
}
- if(!hasBeanConstructor && getType().getFullyQualifiedName().equals(CDIConstants.WELD_BEAN_MANAGER_TYPE_NAME)) {
- hasBeanConstructor = true;
- }
+// if(!hasBeanConstructor && getType().getFullyQualifiedName().equals(CDIConstants.WELD_BEAN_MANAGER_TYPE_NAME)) {
+// hasBeanConstructor = true;
+// }
}
public ParametedType getSuperType() {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BuiltInBeanInjectionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BuiltInBeanInjectionTest.java 2011-04-21 19:30:38 UTC (rev 30718)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/BuiltInBeanInjectionTest.java 2011-04-21 19:37:35 UTC (rev 30719)
@@ -13,6 +13,7 @@
import java.util.Set;
import org.eclipse.jdt.core.IType;
+import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.internal.core.impl.BuiltInBean;
@@ -72,7 +73,18 @@
t = b.getBeanClass();
assertEquals("java.security.Principal", t.getFullyQualifiedName());
-
+ //javax.enterprise.inject.spi.BeanManager
+ field = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/context/conversation/BuiltInConversation.java", "manager");
+ assertNotNull(field);
+
+ beans = field.getCDIProject().getBeans(false, field);
+ assertFalse(beans.isEmpty());
+
+ b = beans.iterator().next();
+ assertTrue(b instanceof BuiltInBean);
+ t = b.getBeanClass();
+ assertEquals(CDIConstants.BEAN_MANAGER_TYPE_NAME, t.getFullyQualifiedName());
+
}
}
\ No newline at end of file
14 years, 11 months
JBoss Tools SVN: r30718 - trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2011-04-21 15:30:38 -0400 (Thu, 21 Apr 2011)
New Revision: 30718
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizard.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage2.java
Log:
https://issues.jboss.org/browse/JBIDE-8591
Fixed project and duplicate filename checking
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizard.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizard.java 2011-04-21 19:27:02 UTC (rev 30717)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizard.java 2011-04-21 19:30:38 UTC (rev 30718)
@@ -265,7 +265,7 @@
// https://issues.jboss.org/browse/JBIDE-8591
// added to allow first and last page access to resource container
- public IResource getBPELContainer() {
+ public IContainer getBPELContainer() {
return mContainer;
}
@@ -289,7 +289,7 @@
@Override
public boolean canFinish() {
- return (fMainPage.isPageComplete() && wsdlPage.isPageComplete() && mContainer != null)
+ return (fMainPage.isPageComplete() && wsdlPage.isPageComplete() && fContainerPage.isPageComplete() && mContainer != null)
|| super.canFinish();
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java 2011-04-21 19:27:02 UTC (rev 30717)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java 2011-04-21 19:30:38 UTC (rev 30718)
@@ -60,8 +60,6 @@
/** last namespace used in creating a project, saved in dialog settings */
static final String LAST_NAMESPACE_KEY = "last.namespace.used"; //$NON-NLS-1$
- private IContainer mContainer;
-
/** Process name field */
private Text processNameField;
@@ -365,26 +363,25 @@
}
setErrorMessage(null);
+ setMessage(null);
// https://issues.jboss.org/browse/JBIDE-8591
NewFileWizard wiz = (NewFileWizard)getWizard();
// https://issues.jboss.org/browse/JBIDE-8738
- if (wiz.getBPELContainer()!=null) {
- if (!ModuleCoreNature.isFlexibleProject(wiz.getBPELContainer().getProject()))
+ IContainer container = wiz.getBPELContainer();
+ if (container!=null) {
+ if (!ModuleCoreNature.isFlexibleProject(container.getProject()))
setMessage(Messages.NewFileWizard_Not_A_Faceted_Project, WizardPage.WARNING);
+
+ if (container.findMember(processNameField.getText()+".bpel")!=null ) //$NON-NLS-1$
+ setMessage(Messages.NewFileWizardPage1_12,WARNING);
}
- else
- setMessage(null);
String namespace = processNamespaceField.getText().trim();
if (namespace.length() < 1) {
setErrorMessage(Messages.NewFileWizardPage1_11);
return false;
}
-
- if (mContainer!=null && mContainer.findMember(processNameField.getText()+".bpel")!=null ) { //$NON-NLS-1$
- setMessage(Messages.NewFileWizardPage1_12,WARNING);
- }
String bpelNamespace = (isAbstractOptionButtonChecked()) ? BPELConstants.NAMESPACE_ABSTRACT_2007
: BPELConstants.NAMESPACE;
@@ -502,9 +499,4 @@
return mArgs;
}
-
- public void setContainer(IContainer mContainer) {
- this.mContainer = mContainer;
- }
-
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage2.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage2.java 2011-04-21 19:27:02 UTC (rev 30717)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage2.java 2011-04-21 19:30:38 UTC (rev 30718)
@@ -31,16 +31,16 @@
*/
public class NewFileWizardPage2 extends WizardPage {
- private FileSelectionGroup fResourceComposite;
- private String processName;
+ private FileSelectionGroup fResourceComposite;
+ private String processName;
-/**
- * New File Wizard, page 2.
- *
- * @param pageName
- */
-
-public NewFileWizardPage2(String pageName)
+ /**
+ * New File Wizard, page 2.
+ *
+ * @param pageName
+ */
+
+ public NewFileWizardPage2(String pageName)
{
super(pageName);
setPageComplete(false);
@@ -70,12 +70,6 @@
public void handleEvent(Event event) {
IResource resource = fResourceComposite.getSelectedResource();
setPageComplete(validatePage(resource));
- // https://issues.jboss.org/browse/JBIDE-8591
- if (!ModuleCoreNature.isFlexibleProject(resource.getProject()))
- setMessage(Messages.NewFileWizard_Not_A_Faceted_Project, WizardPage.WARNING);
- else
- setMessage(null);
-
if (resource instanceof IContainer)
wiz.setBPELContainer((IContainer)resource);
}
@@ -89,17 +83,22 @@
}
private boolean validatePage(IResource resource){
- boolean validate = false;
- validate = (resource != null && resource instanceof IContainer);
- if(validate){
+ if (resource instanceof IContainer) {
IContainer container = (IContainer)resource;
+ // https://issues.jboss.org/browse/JBIDE-8591
+ if (!ModuleCoreNature.isFlexibleProject(resource.getProject())) {
+ setMessage(Messages.NewFileWizard_Not_A_Faceted_Project, WizardPage.WARNING);
+ return false;
+ }
+
if ( container.findMember(processName +".bpel") != null ) { //$NON-NLS-1$
- setMessage(Messages.NewFileWizardPage1_12,WARNING);
- } else {
- setMessage(null);
+ setMessage(Messages.NewFileWizardPage1_12, WizardPage.ERROR);
+ return false;
}
+ setMessage(null);
+ return true;
}
- return validate;
+ return false;
}
/**
@@ -118,4 +117,23 @@
public void setProcessName(String processName) {
this.processName = processName;
}
+
+ @Override
+ public boolean isPageComplete() {
+
+ IContainer container = getResourceContainer();
+ if (container==null)
+ return false;
+
+ if (!ModuleCoreNature.isFlexibleProject(container.getProject()))
+ return false;
+
+ if ( container.findMember(processName +".bpel") != null ) //$NON-NLS-1$
+ return false;
+
+ if (!super.isPageComplete())
+ return false;
+
+ return true;
+ }
}
14 years, 11 months
JBoss Tools SVN: r30717 - trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/impl.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2011-04-21 15:27:02 -0400 (Thu, 21 Apr 2011)
New Revision: 30717
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/impl/BPELExtensibleElementImpl.java
Log:
https://issues.jboss.org/browse/JBIDE-8757
Missed some changes for Bugzilla 340654
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/impl/BPELExtensibleElementImpl.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/impl/BPELExtensibleElementImpl.java 2011-04-21 18:36:04 UTC (rev 30716)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/impl/BPELExtensibleElementImpl.java 2011-04-21 19:27:02 UTC (rev 30717)
@@ -6,6 +6,9 @@
*/
package org.eclipse.bpel.model.impl;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.bpel.model.BPELExtensibleElement;
import org.eclipse.bpel.model.BPELPackage;
import org.eclipse.bpel.model.Documentation;
@@ -94,6 +97,10 @@
public NotificationChain basicSetDocumentation(
Documentation newDocumentation, NotificationChain msgs) {
Documentation oldDocumentation = documentation;
+ if (!isReconciling) {
+ ReconciliationHelper.replaceChild(this, oldDocumentation,
+ newDocumentation);
+ }
documentation = newDocumentation;
boolean oldDocumentationESet = documentationESet;
documentationESet = true;
@@ -153,6 +160,9 @@
*/
public NotificationChain basicUnsetDocumentation(NotificationChain msgs) {
Documentation oldDocumentation = documentation;
+ if (!isReconciling) {
+ ReconciliationHelper.replaceChild(this, oldDocumentation, null);
+ }
documentation = null;
boolean oldDocumentationESet = documentationESet;
documentationESet = false;
@@ -278,6 +288,72 @@
return super.eIsSet(featureID);
}
+ /**
+ * Set the DOM element which has been read and which is the facade for this EMF
+ * object.
+ *
+ * @see org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl#setElement(org.w3c.dom.Element)
+ */
+
+ @Override
+ public void setElement(Element elm) {
+ super.setElement(elm);
+
+ // a pointer back to the EMF model.
+
+ if (elm != null) {
+ elm.setUserData("emf.model", this, null); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @see org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl#getElement()
+ */
+
+ @Override
+ public Element getElement() {
+ return super.getElement();
+ }
+
+ /**
+ * @generated NOT
+ */
+
+ Map<String, Object> fTransients = null;
+
+ /**
+ * This is not part of the EMF model.
+ *
+ * @see org.eclipse.bpel.model.ExtensibleElement#getTransientProperty(java.lang.String)
+ * @generated NOT
+ */
+
+ public <T extends Object> T getTransientProperty(String key) {
+ if (fTransients == null) {
+ return null;
+ }
+ Object obj = fTransients.get(key);
+ if (obj == null) {
+ return null;
+ }
+ return (T) obj;
+ }
+
+ /**
+ * @see org.eclipse.bpel.model.ExtensibleElement#setTransientProperty(java.lang.String, java.lang.Object)
+ * @generated NOT
+ */
+ public <T extends Object> T setTransientProperty(String key, T value) {
+ if (fTransients == null) {
+ fTransients = new HashMap<String, Object>(7);
+ }
+ Object obj = fTransients.put(key, value);
+ if (obj == null) {
+ return null;
+ }
+ return (T) obj;
+ }
+
// Reconciliation stuff. Has copy in ExtensibilityElement
// TODO: (DU) remove duplication
@Override
14 years, 11 months
JBoss Tools SVN: r30716 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-04-21 14:36:04 -0400 (Thu, 21 Apr 2011)
New Revision: 30716
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
Log:
JBIDE-8768
https://issues.jboss.org/browse/JBIDE-8768
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2011-04-21 18:29:41 UTC (rev 30715)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2011-04-21 18:36:04 UTC (rev 30716)
@@ -104,12 +104,18 @@
map = new HashMap<String, ISourceRange>();
getContent();
if(content == null) return;
-
+
+ //Any disagreement between content and range means that content is obsolete
+ //and this build is obsolete (type was updated wile old build is proceeding).
+ //New build is pending, and now we only have to go smoothly around inconsistencies.
ISourceRange r = type.getNameRange();
if(r == null) return;
int b = r.getOffset() + r.getLength();
+ if(b < 0) return;
int e = content.indexOf('{', b);
if(e < 0) e = content.length();
+ if(e < b) return;
+
String sup = content.substring(b, e);
String sc = type.getSuperclassName();
if(sc != null) checkRange(b, sup, sc);
14 years, 11 months