| 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 |
|
@author |
| 31 |
|
|
| 32 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (28) |
Complexity: 2 |
Complexity Density: 0.08 |
|
| 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 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1
PASS
|
|
| 39 |
1
|
@Test... |
| 40 |
|
public void testDictionaryBasedMetadata(){ |
| 41 |
1
|
MockDictionaryService mockDictionaryService = new MockDictionaryService(); |
| 42 |
1
|
mockDictionaryService.setDictionaryServiceDelegate(new DictionaryServiceSpringImpl(DICTIONARY_CONFIG_LOCATION)); |
| 43 |
|
|
| 44 |
1
|
MetadataServiceImpl metadataService = new MetadataServiceImpl(mockDictionaryService); |
| 45 |
1
|
Metadata metadata = metadataService.getMetadata("Message", "default", "default"); |
| 46 |
|
|
| 47 |
1
|
Map<String, Metadata> properties = metadata.getProperties(); |
| 48 |
1
|
assertTrue(properties.containsKey("groupName")); |
| 49 |
1
|
assertTrue(properties.containsKey("locale")); |
| 50 |
1
|
assertTrue(properties.containsKey("value")); |
| 51 |
|
|
| 52 |
|
} |
| 53 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1
PASS
|
|
| 54 |
1
|
@Test... |
| 55 |
|
public void testOrchestrationDictionaryMetadata(){ |
| 56 |
1
|
MetadataServiceImpl metadataService = new MetadataServiceImpl(ORCH_DICTIONARY_CONFIG_LOCATION); |
| 57 |
|
|
| 58 |
1
|
Metadata metadata = metadataService.getMetadata("CreditCourseProposal", "default", "default"); |
| 59 |
|
|
| 60 |
1
|
Map<String, Metadata> properties = metadata.getProperties(); |
| 61 |
1
|
assertTrue(properties.containsKey("course")); |
| 62 |
1
|
metadata = properties.get("course"); |
| 63 |
|
|
| 64 |
1
|
properties = metadata.getProperties(); |
| 65 |
1
|
assertTrue(properties.containsKey("formats")); |
| 66 |
1
|
metadata = properties.get("formats"); |
| 67 |
|
|
| 68 |
1
|
properties = metadata.getProperties(); |
| 69 |
1
|
assertTrue(properties.containsKey("*")); |
| 70 |
1
|
metadata = properties.get("*"); |
| 71 |
|
|
| 72 |
1
|
properties = metadata.getProperties(); |
| 73 |
1
|
assertTrue(properties.containsKey("activities")); |
| 74 |
|
|
| 75 |
1
|
metadata = metadataService.getMetadata("joints", "default", "default"); |
| 76 |
1
|
properties = metadata.getProperties(); |
| 77 |
|
|
| 78 |
1
|
metadata = properties.get("_runtimeData"); |
| 79 |
1
|
properties = metadata.getProperties(); |
| 80 |
1
|
assertTrue(properties.containsKey("created")); |
| 81 |
|
} |
| 82 |
|
} |