1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.properties.tutorial.property.metadata;
17
18 import static org.hamcrest.MatcherAssert.assertThat;
19 import static org.hamcrest.Matchers.empty;
20 import static org.hamcrest.Matchers.is;
21 import static org.hamcrest.Matchers.nullValue;
22
23 import org.junit.Before;
24 import org.junit.Test;
25
26 import de.smartics.projectdoc.annotations.DocCategory;
27 import de.smartics.projectdoc.annotations.Document;
28 import de.smartics.projectdoc.annotations.topic.DocChapter;
29 import de.smartics.properties.api.config.domain.ConfigurationProperties;
30 import de.smartics.properties.api.core.domain.DocumentMetaData;
31 import de.smartics.properties.api.core.domain.PropertyDescriptor;
32 import de.smartics.properties.impl.config.classpath.ClasspathConfigurationProperties;
33 import de.smartics.properties.impl.config.classpath.ClasspathConfigurationPropertiesFactory;
34
35
36
37
38
39 @Document(title = "Property Metadata", sortKey = "basics0040")
40 @DocCategory({ "basics" })
41
42 public class PropertyMetaDataTutorial
43 {
44 private ConfigurationProperties config;
45
46 private MetaDataProperties properties;
47
48 @Before
49 public void setUp()
50 {
51 config = createConfiguration();
52 properties = config.getProperties(MetaDataProperties.class);
53 }
54
55 private static ConfigurationProperties createConfiguration()
56 {
57 final ClasspathConfigurationPropertiesFactory factory =
58 new ClasspathConfigurationPropertiesFactory();
59 final ClasspathConfigurationProperties config = factory.create();
60 config.addClassPathProperties(MetaDataProperties.class);
61 return config;
62 }
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77 @DocChapter
78 @Test
79 public void defaultMetaData()
80 {
81 final PropertyDescriptor descriptor = properties.hostPropertyDescriptor();
82
83 final DocumentMetaData metaData = descriptor.getDocumentMetaData();
84 assertThat(metaData.getCategories(), is(empty()));
85 assertThat(metaData.getTags(), is(empty()));
86 assertThat(metaData.getParents(), is(empty()));
87 assertThat(metaData.getAudience(), is(empty()));
88
89 assertThat(metaData.getNotes(), is(empty()));
90 assertThat(metaData.getShortDescription(), is(nullValue()));
91 assertThat(metaData.getSummary(), is(nullValue()));
92 assertThat(metaData.getTitle(), is("tutorial.property.metadata.host"));
93 assertThat(metaData.getSortKey(), is(nullValue()));
94
95 assertThat(
96 metaData.getSpace(),
97 is("property:de.smartics.properties.tutorial.property.metadata.MetaDataProperties"));
98 assertThat(metaData.getName(), is("tutorial.property.metadata.host"));
99 }
100
101
102
103
104 @DocChapter
105 @Test
106 public void documentationMetaData()
107 {
108 }
109 }