01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19:
20: package org.apache.geronimo.mavenplugins.car;
21:
22: import java.io.StringReader;
23:
24: import junit.framework.TestCase;
25: import org.apache.geronimo.system.plugin.PluginXmlUtil;
26: import org.apache.geronimo.system.plugin.model.PluginArtifactType;
27:
28: /**
29: * @version $Rev: 575143 $ $Date: 2007-09-12 19:12:11 -0700 (Wed, 12 Sep 2007) $
30: */
31: public class PluginMetadataTest extends TestCase {
32:
33: // private static final String PROLOGUE = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
34: private static final String INSTANCE1 = "<plugin-artifact>\n"
35: + " <jvm-version>1.5</jvm-version>\n"
36: + " <jvm-version>1.5.2</jvm-version>\n"
37: + " <prerequisite>\n"
38: + " <id>\n"
39: + " <groupId>commons-logging</groupId>\n"
40: + " <artifactId>commons-logging</artifactId>\n"
41: + " </id>\n"
42: + " <resource-type>joke</resource-type>\n"
43: + " <description>this is an explanation</description>\n"
44: + " </prerequisite>\n"
45: + " <obsoletes>\n"
46: + " <groupId>commons-logging</groupId>\n"
47: + " <artifactId>commons-logging</artifactId>\n"
48: + " </obsoletes>\n"
49: + " <source-repository>http://foo.com</source-repository>\n"
50: + " <source-repository>http://bar.com</source-repository>\n"
51: + " <copy-file dest-dir=\"bar\" relative-to=\"WEB-INF\">META-INF/foo.xml</copy-file>\n"
52: + " <artifact-alias key=\"org.apache.geronimo.test/foo//car\">org.apache.geronimo.test/bar/1.0/car</artifact-alias>\n"
53: + " <config-substitution key=\"key2\">value2</config-substitution>\n"
54: + " <config-substitution key=\"key1\">value1</config-substitution>\n"
55: + "</plugin-artifact>";
56:
57: //TODO test #{ to ${ replacement
58: public void testReadInstance() throws Exception {
59: PluginArtifactType instance = PluginXmlUtil
60: .loadPluginArtifactMetadata(new StringReader(INSTANCE1));
61: assertEquals(2, instance.getConfigSubstitution().size());
62: }
63: }
|