1/*2 * Copyright 2015 The Apache Software Foundation.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package org.apache.juddi.config;
1718import org.apache.commons.configuration.Configuration;
19import org.apache.commons.configuration.MapConfiguration;
20import org.junit.*;
21import org.uddi.repl_v3.ReplicationConfiguration;
2223import javax.xml.bind.JAXB;
24import java.io.InputStream;
25import java.io.StringWriter;
26import java.util.Properties;
27import org.apache.juddi.v3.client.cryptor.XmlUtils;
2829/**30 *31 * @author alex32 */33publicclassInstallTest {
3435publicInstallTest() {
36 }
3738 @BeforeClass
39publicstaticvoid setUpClass() {
40 }
4142 @AfterClass
43publicstaticvoid tearDownClass() {
44 }
4546 @Before
47publicvoid setUp() {
48 }
4950 @After
51publicvoid tearDown() {
52 }
5354/**55 * Test of applyReplicationTokenChanges method, of class Install.56 */57 @Test
58publicvoid testApplyReplicationTokenChanges() throws Exception {
59 System.out.println("applyReplicationTokenChanges");
60 InputStream fis = getClass().getClassLoader().getResourceAsStream("juddi_install_data/root_replicationConfiguration.xml");
6162 ReplicationConfiguration replicationCfg = (ReplicationConfiguration) XmlUtils.unmarshal(fis, ReplicationConfiguration.class);
63 Properties props = new Properties();
64 props.put(Property.JUDDI_NODE_ID, "uddi:a_custom_node");
65 props.put(Property.JUDDI_BASE_URL, "http://juddi.apache.org");
66 props.put(Property.JUDDI_BASE_URL_SECURE, "https://juddi.apache.org");
6768 Configuration config = new MapConfiguration(props);
69 String thisnode = "uddi:a_custom_node";
7071 ReplicationConfiguration result = Install.applyReplicationTokenChanges(replicationCfg, config, thisnode);
72 StringWriter sw = new StringWriter();
73 JAXB.marshal(result, sw);
74 Assert.assertFalse(sw.toString().contains("${juddi.nodeId}"));
75 Assert.assertFalse(sw.toString().contains("${juddi.server.baseurlsecure}"));
76 Assert.assertFalse(sw.toString().contains("${juddi.server.baseurl}"));
7778 }
7980 }