allowed = new HashSet<>();
91 | for (StereotypeIdentifier to : outgoingDependencies.keySet()) {
92 | if (isAllowed(to)) {
93 | allowed.add(to);
94 | }
95 | }
96 | return allowed;
97 | }
98 |
99 | /**
100 | * Merges this {@link DependencyConfiguration} with the given.
101 | *
102 | * If the given {@link DependencyConfiguration} has a value for a
103 | * {@link StereotypeIdentifier} it overrides the value in this
104 | * {@link DependencyConfiguration}.
105 | *
106 | * If the given {@link DependencyConfiguration} has a to-stereotype that is
107 | * not part of this {@link DependencyConfiguration} an error is thrown.
108 | *
109 | * @param dependencyConfigurationAdditional
110 | * the {@link DependencyConfiguration} to merge.
111 | */
112 | public void merge(DependencyConfiguration dependencyConfigurationAdditional) {
113 | if (!from.equals(dependencyConfigurationAdditional.getFrom())) {
114 | throw new IllegalArgumentException("The merge of the central Dependency-Configuration " + from
115 | + " with the additional Dependency-Configuration " + dependencyConfigurationAdditional.getFrom()
116 | + " is not possible");
117 | }
118 | for (StereotypeIdentifier stereotypeIdOutgoingDependencyOfAdditionalConfig : dependencyConfigurationAdditional.outgoingDependencies.keySet()) {
119 | if (!outgoingDependencies.containsKey(stereotypeIdOutgoingDependencyOfAdditionalConfig)) {
120 | throw new IllegalArgumentException(
121 | "The additional configuration for from dependency " + from + " contains a dependency to "
122 | + stereotypeIdOutgoingDependencyOfAdditionalConfig + " that is not part of the central configuration.");
123 | }
124 | }
125 | outgoingDependencies.putAll(dependencyConfigurationAdditional.outgoingDependencies);
126 | }
127 |
128 | @Override
129 | public String toString() {
130 | return "DependencyConfiguration [from=" + from + ", toAllowed=" + outgoingDependencies + "]";
131 | }
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/stereotype.check.plugin.test/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
20 | 4.0.0
21 |
22 | info.novatec.ita
23 | stereotype.check
24 | 4.0.0
25 |
26 | stereotype.check.plugin.test
27 |
28 |
29 |
30 |
31 | org.jacoco
32 | jacoco-maven-plugin
33 |
34 |
35 |
36 | prepare-agent
37 |
38 |
39 |
40 |
41 |
42 | org.apache.maven.plugins
43 | maven-antrun-plugin
44 |
45 |
46 | jacoco-report
47 | test
48 |
49 | run
50 |
51 |
52 |
53 |
54 |
56 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
72 |
73 |
74 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | org.apache.maven.plugins
94 | maven-surefire-plugin
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 | javax.ejb
104 | javax.ejb-api
105 |
106 |
107 | javax.enterprise
108 | cdi-api
109 |
110 |
111 | javax.persistence
112 | persistence-api
113 |
114 |
115 | org.apache.commons
116 | commons-collections4
117 |
118 |
119 |
120 |
121 | info.novatec.ita
122 | stereotype.check.plugin
123 | ${project.version}
124 | test
125 |
126 |
127 | com.puppycrawl.tools
128 | checkstyle
129 | test
130 |
131 |
132 | org.assertj
133 | assertj-core
134 | test
135 |
136 |
137 | com.puppycrawl.tools
138 | checkstyle
139 | tests
140 | test
141 |
142 |
143 | org.springframework.restdocs
144 | spring-restdocs-mockmvc
145 | 1.1.2.RELEASE
146 |
147 |
148 | junit
149 | junit
150 | test
151 |
152 |
153 |
154 |
--------------------------------------------------------------------------------