Author: fbricon
Date: 2012-10-01 08:37:48 -0400 (Mon, 01 Oct 2012)
New Revision: 44174
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/acme/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/acme/HelloWorldService.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/acme/HelloWorldServiceMBean.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/resources/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/resources/META-INF/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/resources/META-INF/jboss-service.xml
Modified:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/AbstractMavenConfiguratorTest.java
Log:
Fix some annoying test failures
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/acme/HelloWorldService.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/acme/HelloWorldService.java
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/acme/HelloWorldService.java 2012-10-01
12:37:48 UTC (rev 44174)
@@ -0,0 +1,39 @@
+package com.acme;
+
+import org.apache.commons.lang.StringUtils;
+
+
+
+public class HelloWorldService implements HelloWorldServiceMBean
+{
+ // Our message attribute
+ private String message = "Sorry no message today";
+
+ // Getters and Setters
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ // The printMessage operation
+ public void printMessage()
+ {
+ System.out.println(message);
+ }
+
+ // The lifecycle
+ public void start() throws Exception
+ {
+ System.out.println("Démarrage avec le message=" +
StringUtils.reverse(message));
+ }
+
+ public void stop()
+ {
+ System.out.println("Stopping with message=" +
StringUtils.reverse(message));
+ }
+}
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/acme/HelloWorldServiceMBean.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/acme/HelloWorldServiceMBean.java
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/java/com/acme/HelloWorldServiceMBean.java 2012-10-01
12:37:48 UTC (rev 44174)
@@ -0,0 +1,16 @@
+package com.acme;
+
+
+public interface HelloWorldServiceMBean
+{
+ // Configure getters and setters for the message attribute
+ String getMessage();
+ void setMessage(String message);
+
+ // The print message operation
+ void printMessage();
+
+ // Lifecycle callbacks
+ void start() throws Exception;
+ void stop();
+}
Added:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/resources/META-INF/jboss-service.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/resources/META-INF/jboss-service.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/src/main/resources/META-INF/jboss-service.xml 2012-10-01
12:37:48 UTC (rev 44174)
@@ -0,0 +1,20 @@
+<!-- ~ 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. -->
+<server xmlns="urn:jboss:service:7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:service:7.0 jboss-service_7_0.xsd">
+ <mbean code="com.acme.HelloWorldService"
name="acme.com:service=HelloWorld">
+ <attribute name="Message">Hello World</attribute>
+ </mbean>
+</server>
\ No newline at end of file
Modified:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/AbstractMavenConfiguratorTest.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/AbstractMavenConfiguratorTest.java 2012-10-01
12:25:42 UTC (rev 44173)
+++
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/AbstractMavenConfiguratorTest.java 2012-10-01
12:37:48 UTC (rev 44174)
@@ -11,7 +11,11 @@
package org.jboss.tools.maven.configurators.tests;
import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+import junit.framework.Assert;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
@@ -22,6 +26,7 @@
import org.eclipse.m2e.core.project.IProjectConfigurationManager;
import org.eclipse.m2e.core.project.ResolverConfiguration;
import org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase;
+import org.eclipse.m2e.tests.common.WorkspaceHelpers;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
@@ -105,7 +110,19 @@
fail("Error Message '"+ errorMessage +"' was not found on
"+project.getName());
}
- protected String getMessage(IMarker marker) throws CoreException {
+ protected static String getMessage(IMarker marker) throws CoreException {
return (String)marker.getAttribute(IMarker.MESSAGE);
}
+
+ protected static void assertNoErrors(IProject project) throws CoreException {
+ List<IMarker> markers = WorkspaceHelpers.findErrorMarkers(project);
+ Iterator<IMarker> ite = markers.iterator();
+ while (ite.hasNext()) {
+ IMarker m =ite.next();
+ if (getMessage(m).contains("Referenced file contains errors
(
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd)")) {
+ ite.remove();
+ }
+ }
+ Assert.assertEquals("Unexpected error markers " + toString(markers), 0,
markers.size());
+ }
}