1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.config.service;
17
18 import java.io.File;
19 import java.util.ArrayList;
20 import java.util.Arrays;
21 import java.util.List;
22 import java.util.Properties;
23
24 import org.junit.Ignore;
25 import org.junit.Test;
26
27 @Deprecated
28 public class DefaultProjectConfigServiceTest {
29
30 @Test
31 public void testIt() {
32
33 try {
34 String groupId = "org.kuali.common";
35 String artifactId = "kuali-util";
36 String contextId = "scm";
37 String configId = org.kuali.common.util.config.ConfigUtils.getConfigId(groupId, artifactId, contextId);
38 org.kuali.common.util.Project project = org.kuali.common.util.ProjectUtils.loadProject(groupId, artifactId);
39 ConfigService service = new DefaultConfigService();
40 Properties properties = service.getProperties(configId, project.getProperties());
41 System.out.println("scm.service=" + properties.getProperty("scm.service"));
42 } catch (Exception e) {
43 e.printStackTrace();
44 }
45 }
46
47 @Test
48 @Ignore
49 public void test() {
50
51 try {
52 org.kuali.common.util.config.ContextConfig mpx = new org.kuali.common.util.config.ContextConfig("mpx", Arrays.asList(new org.kuali.common.util.config.Location("${metainf.common}/mpx.properties")));
53 org.kuali.common.util.config.ContextConfig sql = new org.kuali.common.util.config.ContextConfig("sql", Arrays.asList(new org.kuali.common.util.config.Location("${metainf.common}/sql.properties")));
54 org.kuali.common.util.config.ContextConfig metainf = new org.kuali.common.util.config.ContextConfig("metainf");
55 metainf.setContexts(Arrays.asList(mpx, sql));
56 List<org.kuali.common.util.config.ContextConfig> contexts = new ArrayList<org.kuali.common.util.config.ContextConfig>();
57 contexts.add(metainf);
58
59 List<org.kuali.common.util.config.Location> locations = new ArrayList<org.kuali.common.util.config.Location>();
60 locations.add(new org.kuali.common.util.config.Location("${classpath.prefix}/sql.xml"));
61 org.kuali.common.util.config.ProjectConfigContainer config = new org.kuali.common.util.config.ProjectConfigContainer();
62 config.setGroupId("org.kuali.common");
63 config.setArtifactId("kuali-util");
64 config.setLocations(locations);
65 config.setContexts(contexts);
66 DefaultConfigService service = new DefaultConfigService();
67 File file = new File("/tmp/metadata.xml");
68 service.store(file, config);
69 } catch (Exception e) {
70 e.printStackTrace();
71 }
72 }
73
74 }