You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/07/06 00:30:26 UTC
svn commit: r419366 [7/7] - in /incubator/activemq/trunk:
activeio/activeio-core/src/main/java/org/apache/activeio/journal/active/
activemq-core/src/main/java/org/apache/activemq/broker/
activemq-core/src/main/java/org/apache/activemq/command/ activemq...
Modified: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java Wed Jul 5 15:30:19 2006
@@ -1,346 +1,346 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed 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.activemq.tool;
-
-import junit.framework.TestCase;
-
-import java.util.Properties;
-import java.io.File;
-
-import org.apache.activemq.tool.properties.ReflectionUtil;
-import org.apache.activemq.tool.properties.ReflectionConfigurable;
-
-public class ReflectionUtilTest extends TestCase {
- public void testConfigurableOption() {
- TestClass5 data = new TestClass5();
-
- data.willIntercept = true;
- ReflectionUtil.configureClass(data, "this-should-not-matter", "this-should-not-matter");
- assertTrue(data.intercepted);
-
- data.willIntercept = false;
- data.nest = new TestClass5();
- data.nest.willIntercept = true;
- ReflectionUtil.configureClass(data, "nest.this-should-not-matter", "this-should-not-matter");
- assertTrue(data.intercepted);
- assertTrue(data.nest.intercepted);
-
- data.willIntercept = false;
- data.nest = new TestClass5();
- data.nest.willIntercept = false;
- data.nest.nest = new TestClass5();
- data.nest.nest.willIntercept = true;
- ReflectionUtil.configureClass(data, "nest.nest.this-should-not-matter", "this-should-not-matter");
- assertTrue(data.intercepted);
- assertTrue(data.nest.intercepted);
- assertTrue(data.nest.nest.intercepted);
-
- TestClass6 data2 = new TestClass6();
- data2.nestConfig = new TestClass5();
- data2.nestConfig.willIntercept = true;
- ReflectionUtil.configureClass(data2, "nestConfig.this-should-not-matter", "this-should-not-matter");
- assertTrue(data2.nestConfig.intercepted);
-
- data2.nestNotConfig = new TestClass6();
- data2.nestNotConfig.nestConfig = new TestClass5();
- data2.nestNotConfig.nestConfig.willIntercept = true;
- ReflectionUtil.configureClass(data2, "nestNotConfig.nestConfig.this-should-not-matter", "this-should-not-matter");
- assertTrue(data2.nestNotConfig.nestConfig.intercepted);
- }
-
- public void testDataTypeConfig() {
- TestClass3 targetObj = new TestClass3();
-
- // Initialize variables;
- targetObj.setBooleanData(false);
- targetObj.setIntData(0);
- targetObj.setLongData(0);
- targetObj.setShortData((short)0);
- targetObj.setDoubleData(0.0);
- targetObj.setFloatData(0.0F);
- targetObj.setByteData((byte)0);
- targetObj.setCharData('0');
- targetObj.setStringData("false");
-
- // Set properties
- Properties props = new Properties();
- props.setProperty("booleanData", "true");
- props.setProperty("intData", "1000");
- props.setProperty("longData", "2000");
- props.setProperty("shortData", "3000");
- props.setProperty("doubleData", "1234.567");
- props.setProperty("floatData", "9876.543");
- props.setProperty("byteData", "127");
- props.setProperty("charData", "A");
- props.setProperty("stringData", "true");
-
- ReflectionUtil.configureClass(targetObj, props);
-
- // Check config
- assertEquals(true, targetObj.isBooleanData());
- assertEquals(1000, targetObj.getIntData());
- assertEquals(2000, targetObj.getLongData());
- assertEquals(3000, targetObj.getShortData());
- assertEquals(1234.567, targetObj.getDoubleData(), 0.0001);
- assertEquals(9876.543, targetObj.getFloatData(), 0.0001);
- assertEquals(127, targetObj.getByteData());
- assertEquals('A', targetObj.getCharData());
- assertEquals("true", targetObj.getStringData());
- }
-
- public void testValueOfMethod() {
- TestClass4 targetObj = new TestClass4();
-
- ReflectionUtil.configureClass(targetObj, "testFile", "TEST.FOO.BAR");
-
- assertEquals("TEST.FOO.BAR", targetObj.testFile.toString());
- }
-
- public void testGetProperties() {
-
- TestClass3 testData = new TestClass3();
- testData.setBooleanData(false);
- testData.setByteData((byte)15);
- testData.setCharData('G');
- testData.setDoubleData(765.43);
- testData.setFloatData(543.21F);
- testData.setIntData(654321);
- testData.setLongData(987654321);
- testData.setShortData((short)4321);
- testData.setStringData("BAR.TEST.FOO");
-
- TestClass3 targetObj = new TestClass3();
- targetObj.setBooleanData(true);
- targetObj.setByteData((byte)10);
- targetObj.setCharData('D');
- targetObj.setDoubleData(1234.567);
- targetObj.setFloatData(4567.89F);
- targetObj.setIntData(123456);
- targetObj.setLongData(1234567890);
- targetObj.setShortData((short)1234);
- targetObj.setStringData("Test.FOO.BAR");
- targetObj.setTestData(testData);
-
- Properties p = ReflectionUtil.retrieveObjectProperties(targetObj);
- assertEquals("true", p.getProperty("booleanData"));
- assertEquals("10", p.getProperty("byteData"));
- assertEquals("D", p.getProperty("charData"));
- assertEquals("1234.567", p.getProperty("doubleData"));
- assertEquals("4567.89", p.getProperty("floatData"));
- assertEquals("123456", p.getProperty("intData"));
- assertEquals("1234567890", p.getProperty("longData"));
- assertEquals("1234", p.getProperty("shortData"));
- assertEquals("Test.FOO.BAR", p.getProperty("stringData"));
- assertEquals("false", p.getProperty("testData.booleanData"));
- assertEquals("15", p.getProperty("testData.byteData"));
- assertEquals("G", p.getProperty("testData.charData"));
- assertEquals("765.43", p.getProperty("testData.doubleData"));
- assertEquals("543.21", p.getProperty("testData.floatData"));
- assertEquals("654321", p.getProperty("testData.intData"));
- assertEquals("987654321", p.getProperty("testData.longData"));
- assertEquals("4321", p.getProperty("testData.shortData"));
- assertEquals("BAR.TEST.FOO", p.getProperty("testData.stringData"));
-
- }
-
- public void testNestedConfig() {
- TestClass3 t1 = new TestClass3();
- TestClass3 t2 = new TestClass3();
- TestClass3 t3 = new TestClass3();
- TestClass3 t4 = new TestClass3();
- TestClass3 t5 = new TestClass3();
-
- ReflectionUtil.configureClass(t1, "stringData", "t1");
- assertEquals("t1", t1.getStringData());
-
- t1.setTestData(t2);
- ReflectionUtil.configureClass(t1, "testData.stringData", "t2");
- assertEquals("t2", t2.getStringData());
-
- t2.setTestData(t3);
- ReflectionUtil.configureClass(t1, "testData.testData.stringData", "t3");
- assertEquals("t3", t3.getStringData());
-
- t3.setTestData(t4);
- ReflectionUtil.configureClass(t1, "testData.testData.testData.stringData", "t4");
- assertEquals("t4", t4.getStringData());
-
- t4.setTestData(t5);
- ReflectionUtil.configureClass(t1, "testData.testData.testData.testData.stringData", "t5");
- assertEquals("t5", t5.getStringData());
- }
-
- public class TestClass1 {
- private boolean booleanData;
- private int intData;
- private long longData;
-
- public boolean isBooleanData() {
- return booleanData;
- }
-
- public void setBooleanData(boolean booleanData) {
- this.booleanData = booleanData;
- }
-
- public int getIntData() {
- return intData;
- }
-
- public void setIntData(int intData) {
- this.intData = intData;
- }
-
- public long getLongData() {
- return longData;
- }
-
- public void setLongData(long longData) {
- this.longData = longData;
- }
- }
-
- public class TestClass2 extends TestClass1 {
- private float floatData;
- private byte byteData;
- private char charData;
-
- public float getFloatData() {
- return floatData;
- }
-
- public void setFloatData(float floatData) {
- this.floatData = floatData;
- }
-
- public byte getByteData() {
- return byteData;
- }
-
- public void setByteData(byte byteData) {
- this.byteData = byteData;
- }
-
- public char getCharData() {
- return charData;
- }
-
- public void setCharData(char charData) {
- this.charData = charData;
- }
- }
-
- public class TestClass3 extends TestClass2 {
- private short shortData;
- private double doubleData;
- private String stringData;
- private TestClass3 testData;
-
- public short getShortData() {
- return shortData;
- }
-
- public void setShortData(short shortData) {
- this.shortData = shortData;
- }
-
- public double getDoubleData() {
- return doubleData;
- }
-
- public void setDoubleData(double doubleData) {
- this.doubleData = doubleData;
- }
-
- public String getStringData() {
- return stringData;
- }
-
- public void setStringData(String stringData) {
- this.stringData = stringData;
- }
-
- public TestClass3 getTestData() {
- return testData;
- }
-
- public void setTestData(TestClass3 testData) {
- this.testData = testData;
- }
- }
-
- public class TestClass4 {
- private File testFile;
-
- public String getTestFile() {
- return testFile.toString();
- }
-
- public void setTestFile(String testFile) {
- this.testFile = new File(testFile);
- }
- }
-
- public class TestClass5 implements ReflectionConfigurable {
- public boolean intercepted = false;
- public boolean willIntercept = true;
- public TestClass5 nest = null;
-
- public void configureProperties(Properties props) {
- // Do nothing
- }
-
- public Properties retrieveProperties(Properties props) {
- return null;
- }
-
- public boolean acceptConfig(String key, String val) {
- intercepted = true;
-
- return !willIntercept;
- }
-
- public TestClass5 getNest() {
- return nest;
- }
-
- public void setNest(TestClass5 nest) {
- this.nest = nest;
- }
- }
-
- public class TestClass6 {
- public TestClass6 nestNotConfig = null;
- public TestClass5 nestConfig = null;
-
- public TestClass6 getNestNotConfig() {
- return nestNotConfig;
- }
-
- public void setNestNotConfig(TestClass6 nestNotConfig) {
- this.nestNotConfig = nestNotConfig;
- }
-
- public TestClass5 getNestConfig() {
- return nestConfig;
- }
-
- public void setNestConfig(TestClass5 nestConfig) {
- this.nestConfig = nestConfig;
- }
- }
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.activemq.tool;
+
+import junit.framework.TestCase;
+
+import java.util.Properties;
+import java.io.File;
+
+import org.apache.activemq.tool.properties.ReflectionUtil;
+import org.apache.activemq.tool.properties.ReflectionConfigurable;
+
+public class ReflectionUtilTest extends TestCase {
+ public void testConfigurableOption() {
+ TestClass5 data = new TestClass5();
+
+ data.willIntercept = true;
+ ReflectionUtil.configureClass(data, "this-should-not-matter", "this-should-not-matter");
+ assertTrue(data.intercepted);
+
+ data.willIntercept = false;
+ data.nest = new TestClass5();
+ data.nest.willIntercept = true;
+ ReflectionUtil.configureClass(data, "nest.this-should-not-matter", "this-should-not-matter");
+ assertTrue(data.intercepted);
+ assertTrue(data.nest.intercepted);
+
+ data.willIntercept = false;
+ data.nest = new TestClass5();
+ data.nest.willIntercept = false;
+ data.nest.nest = new TestClass5();
+ data.nest.nest.willIntercept = true;
+ ReflectionUtil.configureClass(data, "nest.nest.this-should-not-matter", "this-should-not-matter");
+ assertTrue(data.intercepted);
+ assertTrue(data.nest.intercepted);
+ assertTrue(data.nest.nest.intercepted);
+
+ TestClass6 data2 = new TestClass6();
+ data2.nestConfig = new TestClass5();
+ data2.nestConfig.willIntercept = true;
+ ReflectionUtil.configureClass(data2, "nestConfig.this-should-not-matter", "this-should-not-matter");
+ assertTrue(data2.nestConfig.intercepted);
+
+ data2.nestNotConfig = new TestClass6();
+ data2.nestNotConfig.nestConfig = new TestClass5();
+ data2.nestNotConfig.nestConfig.willIntercept = true;
+ ReflectionUtil.configureClass(data2, "nestNotConfig.nestConfig.this-should-not-matter", "this-should-not-matter");
+ assertTrue(data2.nestNotConfig.nestConfig.intercepted);
+ }
+
+ public void testDataTypeConfig() {
+ TestClass3 targetObj = new TestClass3();
+
+ // Initialize variables;
+ targetObj.setBooleanData(false);
+ targetObj.setIntData(0);
+ targetObj.setLongData(0);
+ targetObj.setShortData((short)0);
+ targetObj.setDoubleData(0.0);
+ targetObj.setFloatData(0.0F);
+ targetObj.setByteData((byte)0);
+ targetObj.setCharData('0');
+ targetObj.setStringData("false");
+
+ // Set properties
+ Properties props = new Properties();
+ props.setProperty("booleanData", "true");
+ props.setProperty("intData", "1000");
+ props.setProperty("longData", "2000");
+ props.setProperty("shortData", "3000");
+ props.setProperty("doubleData", "1234.567");
+ props.setProperty("floatData", "9876.543");
+ props.setProperty("byteData", "127");
+ props.setProperty("charData", "A");
+ props.setProperty("stringData", "true");
+
+ ReflectionUtil.configureClass(targetObj, props);
+
+ // Check config
+ assertEquals(true, targetObj.isBooleanData());
+ assertEquals(1000, targetObj.getIntData());
+ assertEquals(2000, targetObj.getLongData());
+ assertEquals(3000, targetObj.getShortData());
+ assertEquals(1234.567, targetObj.getDoubleData(), 0.0001);
+ assertEquals(9876.543, targetObj.getFloatData(), 0.0001);
+ assertEquals(127, targetObj.getByteData());
+ assertEquals('A', targetObj.getCharData());
+ assertEquals("true", targetObj.getStringData());
+ }
+
+ public void testValueOfMethod() {
+ TestClass4 targetObj = new TestClass4();
+
+ ReflectionUtil.configureClass(targetObj, "testFile", "TEST.FOO.BAR");
+
+ assertEquals("TEST.FOO.BAR", targetObj.testFile.toString());
+ }
+
+ public void testGetProperties() {
+
+ TestClass3 testData = new TestClass3();
+ testData.setBooleanData(false);
+ testData.setByteData((byte)15);
+ testData.setCharData('G');
+ testData.setDoubleData(765.43);
+ testData.setFloatData(543.21F);
+ testData.setIntData(654321);
+ testData.setLongData(987654321);
+ testData.setShortData((short)4321);
+ testData.setStringData("BAR.TEST.FOO");
+
+ TestClass3 targetObj = new TestClass3();
+ targetObj.setBooleanData(true);
+ targetObj.setByteData((byte)10);
+ targetObj.setCharData('D');
+ targetObj.setDoubleData(1234.567);
+ targetObj.setFloatData(4567.89F);
+ targetObj.setIntData(123456);
+ targetObj.setLongData(1234567890);
+ targetObj.setShortData((short)1234);
+ targetObj.setStringData("Test.FOO.BAR");
+ targetObj.setTestData(testData);
+
+ Properties p = ReflectionUtil.retrieveObjectProperties(targetObj);
+ assertEquals("true", p.getProperty("booleanData"));
+ assertEquals("10", p.getProperty("byteData"));
+ assertEquals("D", p.getProperty("charData"));
+ assertEquals("1234.567", p.getProperty("doubleData"));
+ assertEquals("4567.89", p.getProperty("floatData"));
+ assertEquals("123456", p.getProperty("intData"));
+ assertEquals("1234567890", p.getProperty("longData"));
+ assertEquals("1234", p.getProperty("shortData"));
+ assertEquals("Test.FOO.BAR", p.getProperty("stringData"));
+ assertEquals("false", p.getProperty("testData.booleanData"));
+ assertEquals("15", p.getProperty("testData.byteData"));
+ assertEquals("G", p.getProperty("testData.charData"));
+ assertEquals("765.43", p.getProperty("testData.doubleData"));
+ assertEquals("543.21", p.getProperty("testData.floatData"));
+ assertEquals("654321", p.getProperty("testData.intData"));
+ assertEquals("987654321", p.getProperty("testData.longData"));
+ assertEquals("4321", p.getProperty("testData.shortData"));
+ assertEquals("BAR.TEST.FOO", p.getProperty("testData.stringData"));
+
+ }
+
+ public void testNestedConfig() {
+ TestClass3 t1 = new TestClass3();
+ TestClass3 t2 = new TestClass3();
+ TestClass3 t3 = new TestClass3();
+ TestClass3 t4 = new TestClass3();
+ TestClass3 t5 = new TestClass3();
+
+ ReflectionUtil.configureClass(t1, "stringData", "t1");
+ assertEquals("t1", t1.getStringData());
+
+ t1.setTestData(t2);
+ ReflectionUtil.configureClass(t1, "testData.stringData", "t2");
+ assertEquals("t2", t2.getStringData());
+
+ t2.setTestData(t3);
+ ReflectionUtil.configureClass(t1, "testData.testData.stringData", "t3");
+ assertEquals("t3", t3.getStringData());
+
+ t3.setTestData(t4);
+ ReflectionUtil.configureClass(t1, "testData.testData.testData.stringData", "t4");
+ assertEquals("t4", t4.getStringData());
+
+ t4.setTestData(t5);
+ ReflectionUtil.configureClass(t1, "testData.testData.testData.testData.stringData", "t5");
+ assertEquals("t5", t5.getStringData());
+ }
+
+ public class TestClass1 {
+ private boolean booleanData;
+ private int intData;
+ private long longData;
+
+ public boolean isBooleanData() {
+ return booleanData;
+ }
+
+ public void setBooleanData(boolean booleanData) {
+ this.booleanData = booleanData;
+ }
+
+ public int getIntData() {
+ return intData;
+ }
+
+ public void setIntData(int intData) {
+ this.intData = intData;
+ }
+
+ public long getLongData() {
+ return longData;
+ }
+
+ public void setLongData(long longData) {
+ this.longData = longData;
+ }
+ }
+
+ public class TestClass2 extends TestClass1 {
+ private float floatData;
+ private byte byteData;
+ private char charData;
+
+ public float getFloatData() {
+ return floatData;
+ }
+
+ public void setFloatData(float floatData) {
+ this.floatData = floatData;
+ }
+
+ public byte getByteData() {
+ return byteData;
+ }
+
+ public void setByteData(byte byteData) {
+ this.byteData = byteData;
+ }
+
+ public char getCharData() {
+ return charData;
+ }
+
+ public void setCharData(char charData) {
+ this.charData = charData;
+ }
+ }
+
+ public class TestClass3 extends TestClass2 {
+ private short shortData;
+ private double doubleData;
+ private String stringData;
+ private TestClass3 testData;
+
+ public short getShortData() {
+ return shortData;
+ }
+
+ public void setShortData(short shortData) {
+ this.shortData = shortData;
+ }
+
+ public double getDoubleData() {
+ return doubleData;
+ }
+
+ public void setDoubleData(double doubleData) {
+ this.doubleData = doubleData;
+ }
+
+ public String getStringData() {
+ return stringData;
+ }
+
+ public void setStringData(String stringData) {
+ this.stringData = stringData;
+ }
+
+ public TestClass3 getTestData() {
+ return testData;
+ }
+
+ public void setTestData(TestClass3 testData) {
+ this.testData = testData;
+ }
+ }
+
+ public class TestClass4 {
+ private File testFile;
+
+ public String getTestFile() {
+ return testFile.toString();
+ }
+
+ public void setTestFile(String testFile) {
+ this.testFile = new File(testFile);
+ }
+ }
+
+ public class TestClass5 implements ReflectionConfigurable {
+ public boolean intercepted = false;
+ public boolean willIntercept = true;
+ public TestClass5 nest = null;
+
+ public void configureProperties(Properties props) {
+ // Do nothing
+ }
+
+ public Properties retrieveProperties(Properties props) {
+ return null;
+ }
+
+ public boolean acceptConfig(String key, String val) {
+ intercepted = true;
+
+ return !willIntercept;
+ }
+
+ public TestClass5 getNest() {
+ return nest;
+ }
+
+ public void setNest(TestClass5 nest) {
+ this.nest = nest;
+ }
+ }
+
+ public class TestClass6 {
+ public TestClass6 nestNotConfig = null;
+ public TestClass5 nestConfig = null;
+
+ public TestClass6 getNestNotConfig() {
+ return nestNotConfig;
+ }
+
+ public void setNestNotConfig(TestClass6 nestNotConfig) {
+ this.nestNotConfig = nestNotConfig;
+ }
+
+ public TestClass5 getNestConfig() {
+ return nestConfig;
+ }
+
+ public void setNestConfig(TestClass5 nestConfig) {
+ this.nestConfig = nestConfig;
+ }
+ }
+}
Propchange: incubator/activemq/trunk/tooling/maven-activemq-perf-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/tooling/maven-activemq-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-activemq-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-activemq-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java (original)
+++ incubator/activemq/trunk/tooling/maven-activemq-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java Wed Jul 5 15:30:19 2006
@@ -1,116 +1,116 @@
-package org.apache.activemq.maven;
-
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
-
-import org.apache.activemq.console.Main;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.MappedByteBuffer;
-import java.nio.channels.FileChannel;
-
-/**
- * Goal which starts activemq broker.
- *
- * @goal run
- * @phase process-sources
- */
-public class BrokerMojo
- extends AbstractMojo {
- /**
- * Location of the output directory. Defaults to target.
- *
- * @parameter expression="${project.build.directory}"
- * @required
- */
- private File outputDirectory;
-
- /**
- * Location of activemq xml config file.
- *
- * @parameter expression="${configFile}"
- */
- private File configFile;
-
- /**
- * Broker URL.
- *
- * @parameter expression="${url}" default-value="broker:(tcp://localhost:61616)?useJmx=false"
- */
- private String url;
-
- public void execute()
- throws MojoExecutionException {
-
- File out = outputDirectory;
-
- // Create output directory if it doesn't exist.
- if (!out.exists()) {
- out.mkdirs();
- }
-
- String[] args = new String[2];
- if (configFile != null) {
- File config;
- try {
- config = copy(configFile);
- } catch (IOException e) {
- throw new MojoExecutionException(e.getMessage());
- }
-
- args[0] = "start";
- args[1] = "xbean:" + (config.toURI()).toString();
- } else {
- args[0] = "start";
- args[1] = url;
- }
-
- Main.main(args);
- }
-
- /**
- * Copy activemq configuration file to output directory.
- *
- * @param source
- * @return
- * @throws java.io.IOException
- */
- public File copy(File source) throws IOException {
- FileChannel in = null, out = null;
- File dest = new File(outputDirectory.getAbsolutePath() + File.separator + source.getName());
-
- try {
- in = new FileInputStream(source).getChannel();
- out = new FileOutputStream(dest).getChannel();
-
- long size = in.size();
- MappedByteBuffer buf = in.map(FileChannel.MapMode.READ_ONLY, 0, size);
-
- out.write(buf);
-
- } finally {
- if (in != null) in.close();
- if (out != null) out.close();
- }
-
- return dest;
- }
+package org.apache.activemq.maven;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.activemq.console.Main;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+
+/**
+ * Goal which starts activemq broker.
+ *
+ * @goal run
+ * @phase process-sources
+ */
+public class BrokerMojo
+ extends AbstractMojo {
+ /**
+ * Location of the output directory. Defaults to target.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private File outputDirectory;
+
+ /**
+ * Location of activemq xml config file.
+ *
+ * @parameter expression="${configFile}"
+ */
+ private File configFile;
+
+ /**
+ * Broker URL.
+ *
+ * @parameter expression="${url}" default-value="broker:(tcp://localhost:61616)?useJmx=false"
+ */
+ private String url;
+
+ public void execute()
+ throws MojoExecutionException {
+
+ File out = outputDirectory;
+
+ // Create output directory if it doesn't exist.
+ if (!out.exists()) {
+ out.mkdirs();
+ }
+
+ String[] args = new String[2];
+ if (configFile != null) {
+ File config;
+ try {
+ config = copy(configFile);
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage());
+ }
+
+ args[0] = "start";
+ args[1] = "xbean:" + (config.toURI()).toString();
+ } else {
+ args[0] = "start";
+ args[1] = url;
+ }
+
+ Main.main(args);
+ }
+
+ /**
+ * Copy activemq configuration file to output directory.
+ *
+ * @param source
+ * @return
+ * @throws java.io.IOException
+ */
+ public File copy(File source) throws IOException {
+ FileChannel in = null, out = null;
+ File dest = new File(outputDirectory.getAbsolutePath() + File.separator + source.getName());
+
+ try {
+ in = new FileInputStream(source).getChannel();
+ out = new FileOutputStream(dest).getChannel();
+
+ long size = in.size();
+ MappedByteBuffer buf = in.map(FileChannel.MapMode.READ_ONLY, 0, size);
+
+ out.write(buf);
+
+ } finally {
+ if (in != null) in.close();
+ if (out != null) out.close();
+ }
+
+ return dest;
+ }
}
Propchange: incubator/activemq/trunk/tooling/maven-activemq-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java?rev=419366&r1=419365&r2=419366&view=diff
==============================================================================
--- incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java (original)
+++ incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java Wed Jul 5 15:30:19 2006
@@ -1,151 +1,151 @@
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed 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.activemq.maven;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.deployer.ArtifactDeployer;
-import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-
-/**
- * This is a useful little mojo that allows you to copy all the transitive
- * dependencies to a specified deployment repository. Great if you want to create
- * a new repo for your project's dependencies.
- *
- * @goal deploy-dependencies
- * @requiresDependencyResolution compile
- * @phase process-sources
- */
-public class DeployDependenciesMojo extends AbstractMojo {
-
- /**
- * @parameter expression="${project}"
- * @readonly
- * @required
- */
- private MavenProject project;
-
- /**
- * @parameter expression="${reactorProjects}"
- * @required
- * @readonly
- */
- private List reactorProjects;
-
- /**
- * @parameter expression="${component.org.apache.maven.artifact.deployer.ArtifactDeployer}"
- * @required
- * @readonly
- */
- private ArtifactDeployer deployer;
-
- /**
- * @parameter expression="${localRepository}"
- * @required
- * @readonly
- */
- private ArtifactRepository localRepository;
-
- /**
- * @parameter
- */
- private ArtifactRepository deploymentRepository;
-
- /**
- * @parameter
- */
- private String deploymentRepositoryId;
-
- /**
- * @parameter
- */
- private String deploymentRepositoryUrl;
-
- /**
- * @parameter
- */
- private ArtifactRepositoryLayout deploymentRepositoryLayout = new DefaultRepositoryLayout();
-
-
- /**
- *
- */
- public void execute() throws MojoExecutionException {
-
- if ( deploymentRepository == null )
- {
- deploymentRepository = new DefaultArtifactRepository(deploymentRepositoryId, deploymentRepositoryUrl, deploymentRepositoryLayout);
- }
-
-
- getLog().info("repo type="+deploymentRepository.getClass());
-
- String protocol = deploymentRepository.getProtocol();
-
- if( protocol.equals( "scp" ) )
- {
- File sshFile = new File( System.getProperty( "user.home" ), ".ssh" );
-
- if( !sshFile.exists() )
- {
- sshFile.mkdirs();
- }
- }
-
- Set dependencies = new HashSet();
-
- for (Iterator i = reactorProjects.iterator(); i.hasNext();) {
- MavenProject p = (MavenProject) i.next();
- List dependencyArtifacts = p.getTestArtifacts();
-
- if( dependencyArtifacts !=null )
- dependencies.addAll(dependencyArtifacts);
- }
-
- for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
- Artifact artifact = (Artifact) iter.next();
- deploy( artifact );
- }
-
- }
-
- private void deploy(Artifact artifact) throws MojoExecutionException {
- try
- {
- getLog().info( "Copying " + artifact.getFile().getAbsolutePath() + " to " + deploymentRepository );
- deployer.deploy( artifact.getFile(), artifact, deploymentRepository, localRepository );
- }
- catch ( ArtifactDeploymentException e )
- {
- throw new MojoExecutionException( e.getMessage(), e );
- }
- }
-
-
-}
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.activemq.maven;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.deployer.ArtifactDeployer;
+import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * This is a useful little mojo that allows you to copy all the transitive
+ * dependencies to a specified deployment repository. Great if you want to create
+ * a new repo for your project's dependencies.
+ *
+ * @goal deploy-dependencies
+ * @requiresDependencyResolution compile
+ * @phase process-sources
+ */
+public class DeployDependenciesMojo extends AbstractMojo {
+
+ /**
+ * @parameter expression="${project}"
+ * @readonly
+ * @required
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression="${reactorProjects}"
+ * @required
+ * @readonly
+ */
+ private List reactorProjects;
+
+ /**
+ * @parameter expression="${component.org.apache.maven.artifact.deployer.ArtifactDeployer}"
+ * @required
+ * @readonly
+ */
+ private ArtifactDeployer deployer;
+
+ /**
+ * @parameter expression="${localRepository}"
+ * @required
+ * @readonly
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * @parameter
+ */
+ private ArtifactRepository deploymentRepository;
+
+ /**
+ * @parameter
+ */
+ private String deploymentRepositoryId;
+
+ /**
+ * @parameter
+ */
+ private String deploymentRepositoryUrl;
+
+ /**
+ * @parameter
+ */
+ private ArtifactRepositoryLayout deploymentRepositoryLayout = new DefaultRepositoryLayout();
+
+
+ /**
+ *
+ */
+ public void execute() throws MojoExecutionException {
+
+ if ( deploymentRepository == null )
+ {
+ deploymentRepository = new DefaultArtifactRepository(deploymentRepositoryId, deploymentRepositoryUrl, deploymentRepositoryLayout);
+ }
+
+
+ getLog().info("repo type="+deploymentRepository.getClass());
+
+ String protocol = deploymentRepository.getProtocol();
+
+ if( protocol.equals( "scp" ) )
+ {
+ File sshFile = new File( System.getProperty( "user.home" ), ".ssh" );
+
+ if( !sshFile.exists() )
+ {
+ sshFile.mkdirs();
+ }
+ }
+
+ Set dependencies = new HashSet();
+
+ for (Iterator i = reactorProjects.iterator(); i.hasNext();) {
+ MavenProject p = (MavenProject) i.next();
+ List dependencyArtifacts = p.getTestArtifacts();
+
+ if( dependencyArtifacts !=null )
+ dependencies.addAll(dependencyArtifacts);
+ }
+
+ for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
+ Artifact artifact = (Artifact) iter.next();
+ deploy( artifact );
+ }
+
+ }
+
+ private void deploy(Artifact artifact) throws MojoExecutionException {
+ try
+ {
+ getLog().info( "Copying " + artifact.getFile().getAbsolutePath() + " to " + deploymentRepository );
+ deployer.deploy( artifact.getFile(), artifact, deploymentRepository, localRepository );
+ }
+ catch ( ArtifactDeploymentException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
+ }
+
+
+}
Propchange: incubator/activemq/trunk/tooling/maven-dependency-plugin/src/main/java/org/apache/activemq/maven/DeployDependenciesMojo.java
------------------------------------------------------------------------------
svn:eol-style = native