1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.common.assembly.dictionary.old;
17
18 import static org.junit.Assert.assertTrue;
19
20 import java.util.Map;
21
22 import org.junit.Test;
23 import org.kuali.student.common.assembly.data.Metadata;
24 import org.kuali.student.common.assembly.dictionary.old.MetadataServiceImpl;
25 import org.kuali.student.common.dictionary.service.impl.old.DictionaryServiceSpringImpl;
26
27
28
29
30
31
32
33 public class TestMetadataServiceImpl {
34
35 public static final String DICTIONARY_CONFIG_LOCATION = "classpath:messages-test-dictionary-config.xml";
36 public static final String ORCH_DICTIONARY_CONFIG_LOCATION = "classpath:test-orchestration-dictionary.xml";
37
38
39 @Test
40 public void testDictionaryBasedMetadata(){
41 MockDictionaryService mockDictionaryService = new MockDictionaryService();
42 mockDictionaryService.setDictionaryServiceDelegate(new DictionaryServiceSpringImpl(DICTIONARY_CONFIG_LOCATION));
43
44 MetadataServiceImpl metadataService = new MetadataServiceImpl(mockDictionaryService);
45 Metadata metadata = metadataService.getMetadata("Message", "default", "default");
46
47 Map<String, Metadata> properties = metadata.getProperties();
48 assertTrue(properties.containsKey("groupName"));
49 assertTrue(properties.containsKey("locale"));
50 assertTrue(properties.containsKey("value"));
51
52 }
53
54 @Test
55 public void testOrchestrationDictionaryMetadata(){
56 MetadataServiceImpl metadataService = new MetadataServiceImpl(ORCH_DICTIONARY_CONFIG_LOCATION);
57
58 Metadata metadata = metadataService.getMetadata("CreditCourseProposal", "default", "default");
59
60 Map<String, Metadata> properties = metadata.getProperties();
61 assertTrue(properties.containsKey("course"));
62 metadata = properties.get("course");
63
64 properties = metadata.getProperties();
65 assertTrue(properties.containsKey("formats"));
66 metadata = properties.get("formats");
67
68 properties = metadata.getProperties();
69 assertTrue(properties.containsKey("*"));
70 metadata = properties.get("*");
71
72 properties = metadata.getProperties();
73 assertTrue(properties.containsKey("activities"));
74
75 metadata = metadataService.getMetadata("joints", "default", "default");
76 properties = metadata.getProperties();
77
78 metadata = properties.get("_runtimeData");
79 properties = metadata.getProperties();
80 assertTrue(properties.containsKey("created"));
81 }
82 }