You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ge...@apache.org on 2011/06/20 11:37:14 UTC
svn commit: r1137564 - in /servicemix/maven-plugins/jbi-maven-plugin/trunk:
./ pom.xml
src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java
src/test/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojoTest.java
Author: gertv
Date: Mon Jun 20 09:37:14 2011
New Revision: 1137564
URL: http://svn.apache.org/viewvc?rev=1137564&view=rev
Log:
SM-2098: jbi-maven-plugin should allow interacting with ServiceMix running in WebSphere
Added:
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/test/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojoTest.java
Modified:
servicemix/maven-plugins/jbi-maven-plugin/trunk/ (props changed)
servicemix/maven-plugins/jbi-maven-plugin/trunk/pom.xml
servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java
Propchange: servicemix/maven-plugins/jbi-maven-plugin/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Jun 20 09:37:14 2011
@@ -1,4 +1,4 @@
-*.iml
+*.i??
target
.settings
.classpath
Modified: servicemix/maven-plugins/jbi-maven-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/maven-plugins/jbi-maven-plugin/trunk/pom.xml?rev=1137564&r1=1137563&r2=1137564&view=diff
==============================================================================
--- servicemix/maven-plugins/jbi-maven-plugin/trunk/pom.xml (original)
+++ servicemix/maven-plugins/jbi-maven-plugin/trunk/pom.xml Mon Jun 20 09:37:14 2011
@@ -84,7 +84,7 @@
<dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-core</artifactId>
- <version>3.3.2</version>
+ <version>3.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix</groupId>
Modified: servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java
URL: http://svn.apache.org/viewvc/servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java?rev=1137564&r1=1137563&r2=1137564&view=diff
==============================================================================
--- servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java (original)
+++ servicemix/maven-plugins/jbi-maven-plugin/trunk/src/main/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojo.java Mon Jun 20 09:37:14 2011
@@ -61,6 +61,16 @@ public abstract class AbstractDeployable
*/
protected String password;
+ /**
+ * @parameter expression="${serviceUrl}
+ */
+ protected String serviceUrl;
+
+ /**
+ * @parameter expression=${environment}
+ */
+ protected String environment;
+
protected JbiTask initializeJbiTask(JbiTask task) {
Project antProject = new Project();
@@ -75,6 +85,8 @@ public abstract class AbstractDeployable
task.setJndiPath(jndiPath);
task.setUsername(username);
task.setPassword(password);
+ task.setServiceUrl(serviceUrl);
+ task.setEnvironment(environment);
task.setTaskName("JBITask");
task.setTaskType("JBITask");
Added: servicemix/maven-plugins/jbi-maven-plugin/trunk/src/test/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojoTest.java
URL: http://svn.apache.org/viewvc/servicemix/maven-plugins/jbi-maven-plugin/trunk/src/test/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojoTest.java?rev=1137564&view=auto
==============================================================================
--- servicemix/maven-plugins/jbi-maven-plugin/trunk/src/test/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojoTest.java (added)
+++ servicemix/maven-plugins/jbi-maven-plugin/trunk/src/test/java/org/apache/servicemix/maven/plugin/jbi/AbstractDeployableMojoTest.java Mon Jun 20 09:37:14 2011
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.maven.plugin.jbi;
+
+import junit.framework.TestCase;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.servicemix.jbi.framework.AdminCommandsServiceMBean;
+import org.apache.servicemix.jbi.management.task.JbiTask;
+
+/**
+ * Test cases for {@link AbstractDeployableMojo}
+ */
+public class AbstractDeployableMojoTest extends TestCase {
+
+ private static final String CONTAINER_NAME = "someContainerName";
+ private static final String HOST = "someHostName";
+ private static final String JNDI_PATH = "someJndiPath";
+ private static final String JMX_DOMAIN_NAME = "someJmxDomainName";
+ private static final String PASSWORD = "somePassword";
+ private static final Integer PORT = 1001;
+ private static final String SERVER_PROTOCOL = "someProtocolName";
+ private static final String SERVICE_URL = "someServiceUrl";
+ private static final String USERNAME = "someUserName";
+
+ public void testInitializeAntTask() {
+ JbiTask task = new JbiTask() {
+ @Override
+ protected void doExecute(AdminCommandsServiceMBean adminCommandsServiceMBean) throws Exception {
+ //graciously do nothing;
+ }
+ };
+
+ AbstractDeployableMojo mojo = new AbstractDeployableMojo() {
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ //graciously do nothing
+ }
+ };
+
+ mojo.containerName = CONTAINER_NAME;
+ mojo.environment = "someEnvironmentKey=someEnvironmentValue";
+ mojo.host = HOST;
+ mojo.jndiPath = JNDI_PATH;
+ mojo.jmxDomainName = JMX_DOMAIN_NAME;
+ mojo.password = PASSWORD;
+ mojo.port = PORT.toString();
+ mojo.serverProtocol = SERVER_PROTOCOL;
+ mojo.serviceUrl = SERVICE_URL;
+ mojo.username = USERNAME;
+
+ mojo.initializeJbiTask(task);
+ assertNotNull("Initialization should have injected the Ant project", task.getProject());
+ assertEquals(CONTAINER_NAME, task.getContainerName());
+ assertEquals(HOST, task.getHost());
+ assertEquals(JNDI_PATH, task.getJndiPath());
+ assertEquals(JMX_DOMAIN_NAME, task.getJmxDomainName());
+ assertEquals(PASSWORD, task.getPassword());
+ assertEquals(PORT, (Integer) task.getPort());
+ assertEquals(SERVER_PROTOCOL, task.getServerProtocol());
+ assertEquals(SERVICE_URL, task.getServiceUrl());
+ assertEquals(USERNAME, task.getUsername());
+ }
+
+}