Skip to content

Commit 1d46778

Browse files
committed
[assertj,cm] Assertions and Conditions on CofigurationEvent
Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
1 parent fa6f674 commit 1d46778

34 files changed

+2859
-0
lines changed

org.osgi.test.assertj.cm/.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>org.osgi.test.assertj.cm</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/test/java=UTF-8
4+
encoding/<project>=UTF-8
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
line.separator=\n

org.osgi.test.assertj.cm/.settings/org.eclipse.jdt.core.prefs

Lines changed: 517 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
cleanup.add_default_serial_version_id=true
2+
cleanup.add_generated_serial_version_id=false
3+
cleanup.add_missing_annotations=true
4+
cleanup.add_missing_deprecated_annotations=true
5+
cleanup.add_missing_methods=false
6+
cleanup.add_missing_nls_tags=false
7+
cleanup.add_missing_override_annotations=true
8+
cleanup.add_missing_override_annotations_interface_methods=true
9+
cleanup.add_serial_version_id=true
10+
cleanup.always_use_blocks=true
11+
cleanup.always_use_parentheses_in_expressions=false
12+
cleanup.always_use_this_for_non_static_field_access=false
13+
cleanup.always_use_this_for_non_static_method_access=false
14+
cleanup.convert_functional_interfaces=true
15+
cleanup.convert_to_enhanced_for_loop=false
16+
cleanup.correct_indentation=false
17+
cleanup.format_source_code=false
18+
cleanup.format_source_code_changes_only=false
19+
cleanup.insert_inferred_type_arguments=false
20+
cleanup.make_local_variable_final=true
21+
cleanup.make_parameters_final=false
22+
cleanup.make_private_fields_final=true
23+
cleanup.make_type_abstract_if_missing_method=false
24+
cleanup.make_variable_declarations_final=false
25+
cleanup.never_use_blocks=false
26+
cleanup.never_use_parentheses_in_expressions=true
27+
cleanup.organize_imports=false
28+
cleanup.qualify_static_field_accesses_with_declaring_class=false
29+
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
30+
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
31+
cleanup.qualify_static_member_accesses_with_declaring_class=true
32+
cleanup.qualify_static_method_accesses_with_declaring_class=false
33+
cleanup.remove_private_constructors=true
34+
cleanup.remove_redundant_modifiers=true
35+
cleanup.remove_redundant_semicolons=true
36+
cleanup.remove_redundant_type_arguments=true
37+
cleanup.remove_trailing_whitespaces=true
38+
cleanup.remove_trailing_whitespaces_all=true
39+
cleanup.remove_trailing_whitespaces_ignore_empty=false
40+
cleanup.remove_unnecessary_casts=true
41+
cleanup.remove_unnecessary_nls_tags=true
42+
cleanup.remove_unused_imports=true
43+
cleanup.remove_unused_local_variables=false
44+
cleanup.remove_unused_private_fields=true
45+
cleanup.remove_unused_private_members=true
46+
cleanup.remove_unused_private_methods=true
47+
cleanup.remove_unused_private_types=true
48+
cleanup.sort_members=false
49+
cleanup.sort_members_all=false
50+
cleanup.use_anonymous_class_creation=false
51+
cleanup.use_blocks=false
52+
cleanup.use_blocks_only_for_return_and_throw=false
53+
cleanup.use_lambda=true
54+
cleanup.use_parentheses_in_expressions=false
55+
cleanup.use_this_for_non_static_field_access=false
56+
cleanup.use_this_for_non_static_field_access_only_if_necessary=true
57+
cleanup.use_this_for_non_static_method_access=false
58+
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
59+
cleanup.use_type_arguments=false
60+
cleanup_profile=_bnd
61+
cleanup_settings_version=2
62+
eclipse.preferences.version=1
63+
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
64+
formatter_profile=_bnd
65+
formatter_settings_version=16
66+
org.eclipse.jdt.ui.exception.name=e
67+
org.eclipse.jdt.ui.gettersetter.use.is=true
68+
org.eclipse.jdt.ui.ignorelowercasenames=true
69+
org.eclipse.jdt.ui.importorder=java;javax;org;com;
70+
org.eclipse.jdt.ui.javadoc=false
71+
org.eclipse.jdt.ui.keywordthis=false
72+
org.eclipse.jdt.ui.ondemandthreshold=99
73+
org.eclipse.jdt.ui.overrideannotation=true
74+
org.eclipse.jdt.ui.staticondemandthreshold=99
75+
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
76+
sp_cleanup.add_default_serial_version_id=true
77+
sp_cleanup.add_generated_serial_version_id=false
78+
sp_cleanup.add_missing_annotations=true
79+
sp_cleanup.add_missing_deprecated_annotations=true
80+
sp_cleanup.add_missing_methods=false
81+
sp_cleanup.add_missing_nls_tags=false
82+
sp_cleanup.add_missing_override_annotations=true
83+
sp_cleanup.add_missing_override_annotations_interface_methods=true
84+
sp_cleanup.add_serial_version_id=false
85+
sp_cleanup.always_use_blocks=true
86+
sp_cleanup.always_use_parentheses_in_expressions=false
87+
sp_cleanup.always_use_this_for_non_static_field_access=false
88+
sp_cleanup.always_use_this_for_non_static_method_access=false
89+
sp_cleanup.convert_functional_interfaces=false
90+
sp_cleanup.convert_to_enhanced_for_loop=false
91+
sp_cleanup.correct_indentation=false
92+
sp_cleanup.format_source_code=true
93+
sp_cleanup.format_source_code_changes_only=true
94+
sp_cleanup.insert_inferred_type_arguments=false
95+
sp_cleanup.make_local_variable_final=false
96+
sp_cleanup.make_parameters_final=false
97+
sp_cleanup.make_private_fields_final=true
98+
sp_cleanup.make_type_abstract_if_missing_method=false
99+
sp_cleanup.make_variable_declarations_final=false
100+
sp_cleanup.never_use_blocks=false
101+
sp_cleanup.never_use_parentheses_in_expressions=true
102+
sp_cleanup.on_save_use_additional_actions=true
103+
sp_cleanup.organize_imports=true
104+
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
105+
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
106+
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
107+
sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
108+
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
109+
sp_cleanup.remove_private_constructors=true
110+
sp_cleanup.remove_redundant_modifiers=true
111+
sp_cleanup.remove_redundant_semicolons=true
112+
sp_cleanup.remove_redundant_type_arguments=false
113+
sp_cleanup.remove_trailing_whitespaces=true
114+
sp_cleanup.remove_trailing_whitespaces_all=true
115+
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
116+
sp_cleanup.remove_unnecessary_casts=true
117+
sp_cleanup.remove_unnecessary_nls_tags=true
118+
sp_cleanup.remove_unused_imports=true
119+
sp_cleanup.remove_unused_local_variables=false
120+
sp_cleanup.remove_unused_private_fields=true
121+
sp_cleanup.remove_unused_private_members=false
122+
sp_cleanup.remove_unused_private_methods=true
123+
sp_cleanup.remove_unused_private_types=true
124+
sp_cleanup.sort_members=false
125+
sp_cleanup.sort_members_all=false
126+
sp_cleanup.use_anonymous_class_creation=false
127+
sp_cleanup.use_blocks=false
128+
sp_cleanup.use_blocks_only_for_return_and_throw=false
129+
sp_cleanup.use_lambda=true
130+
sp_cleanup.use_parentheses_in_expressions=false
131+
sp_cleanup.use_this_for_non_static_field_access=false
132+
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
133+
sp_cleanup.use_this_for_non_static_method_access=false
134+
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
135+
sp_cleanup.use_type_arguments=false
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

org.osgi.test.assertj.cm/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# org.osgi.test.assertj.cm
2+
3+
This artifact provides support classes for OSGi testing with [AssertJ](https://github.com/joel-costigliola/assertj-core) ConfigurationAdmin
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!--
2+
Copyright (c) Contributors to the Eclipse Foundation
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
SPDX-License-Identifier: Apache-2.0
17+
-->
18+
19+
<configuration>
20+
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
21+
<resetJUL>true</resetJUL>
22+
</contextListener>
23+
24+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
25+
<encoder>
26+
<pattern>%-4relative [%.15thread] %-5level %logger{36}:%line - %msg%n</pattern>
27+
</encoder>
28+
</appender>
29+
30+
<logger name="org.osgi.test" level="DEBUG"/>
31+
32+
<root level="WARN">
33+
<appender-ref ref="STDOUT" />
34+
</root>
35+
</configuration>

org.osgi.test.assertj.cm/pom.xml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright (c) Contributors to the Eclipse Foundation
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
17+
SPDX-License-Identifier: Apache-2.0
18+
-->
19+
<project xmlns="http://maven.apache.org/POM/4.0.0"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
22+
<modelVersion>4.0.0</modelVersion>
23+
24+
<parent>
25+
<groupId>org.osgi</groupId>
26+
<artifactId>org.osgi.test.parent</artifactId>
27+
<version>${revision}</version>
28+
<relativePath>../pom.xml</relativePath>
29+
</parent>
30+
31+
<artifactId>org.osgi.test.assertj.cm</artifactId>
32+
<description>OSGi Testing AssertJ Support for Configuration Admin</description>
33+
<name>${project.groupId}:${project.artifactId}</name>
34+
<url>https://www.osgi.org</url>
35+
<scm>
36+
<url>https://github.com/osgi/osgi-test</url>
37+
<connection>scm:git:https://github.com/osgi/osgi-test.git</connection>
38+
<developerConnection>scm:git:git@github.com:osgi/osgi-test.git</developerConnection>
39+
</scm>
40+
41+
<dependencies>
42+
<dependency>
43+
<groupId>org.osgi</groupId>
44+
<artifactId>osgi.annotation</artifactId>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.osgi</groupId>
48+
<artifactId>org.osgi.test.assertj.framework</artifactId>
49+
<version>${revision}</version>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.osgi</groupId>
53+
<artifactId>org.osgi.test.assertj.framework</artifactId>
54+
<version>${revision}</version>
55+
<classifier>tests</classifier>
56+
<scope>test</scope>
57+
</dependency>
58+
<dependency>
59+
<groupId>org.osgi</groupId>
60+
<artifactId>org.osgi.service.cm</artifactId>
61+
</dependency>
62+
<dependency>
63+
<groupId>org.osgi</groupId>
64+
<artifactId>org.osgi.test.common</artifactId>
65+
<version>${revision}</version>
66+
</dependency>
67+
<dependency>
68+
<groupId>org.assertj</groupId>
69+
<artifactId>assertj-core</artifactId>
70+
<scope>compile</scope>
71+
</dependency>
72+
<dependency>
73+
<groupId>org.osgi</groupId>
74+
<artifactId>org.osgi.framework</artifactId>
75+
</dependency>
76+
<dependency>
77+
<groupId>org.mockito</groupId>
78+
<artifactId>mockito-core</artifactId>
79+
</dependency>
80+
<dependency>
81+
<groupId>org.junit.jupiter</groupId>
82+
<artifactId>junit-jupiter-api</artifactId>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.junit.jupiter</groupId>
86+
<artifactId>junit-jupiter-params</artifactId>
87+
</dependency>
88+
</dependencies>
89+
</project>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*******************************************************************************
2+
* Copyright (c) Contributors to the Eclipse Foundation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
*******************************************************************************/
18+
19+
package org.osgi.test.assertj.cm;
20+
21+
import org.osgi.test.assertj.cm.configuration.ConfigurationAssert;
22+
import org.osgi.test.assertj.cm.configurationevent.ConfigurationEventAssert;
23+
24+
/**
25+
* Entry point for BDD assertions of different data types.
26+
*/
27+
public class ConfigurationBddAssertions {
28+
29+
/**
30+
* Creates a new instance of
31+
* <code>{@link org.osgi.test.assertj.cm.configuration.ConfigurationAssert}</code>.
32+
*
33+
* @param actual the actual value.
34+
* @return the created assertion object.
35+
*/
36+
37+
public static ConfigurationAssert then(org.osgi.service.cm.Configuration actual) {
38+
return new ConfigurationAssert(actual);
39+
}
40+
41+
/**
42+
* Creates a new instance of
43+
* <code>{@link org.osgi.test.assertj.cm.configurationevent.ConfigurationEventAssert}</code>.
44+
*
45+
* @param actual the actual value.
46+
* @return the created assertion object.
47+
*/
48+
49+
public static ConfigurationEventAssert then(org.osgi.service.cm.ConfigurationEvent actual) {
50+
return new ConfigurationEventAssert(actual);
51+
}
52+
53+
/**
54+
* Creates a new <code>{@link ConfigurationBddAssertions}</code>.
55+
*/
56+
protected ConfigurationBddAssertions() {
57+
// empty
58+
}
59+
}

0 commit comments

Comments
 (0)