It is easier to use the ConfigurableService properties when it's possible to annotate classes using a ComponentPropertyType.
Signed-off-by: Wouter Born <github@maindrain.net>
* Migrate to JAX-RS Whiteboard
* Upgrade Jackson and Swagger TP feature dependencies
The upstream JAX-RS Whiteboard feature is not used because the version ranges currently do not work with Karaf on Windows.
See: https://issues.apache.org/jira/browse/KARAF-6536
* Update Felix logback to 1.0.2
This version adds the jul-to-slf4j bridge (FELIX-6027).
JUL is used by CXF and using the bridge we can use logback to reduce the verbosity of the info logging whenever org.apache.cxf.endpoint.ServerImpl creates endpoints.
* Update Aries Whiteboard to 1.0.8
* Removes the hated default web application (ARIES-1931)
* Improves performance
* Uses CXF 3.2.12
* Don't reuse SSE event builders
SSE event builders are not thread-safe.
It also causes the wrong default values being used.
Also-by: Markus Rathgeb <maggu2810@gmail.com>
Signed-off-by: Wouter Born <github@maindrain.net>
* Add and fix more null annotations
* Add more @NonNullByDefault and @Nullable annotations
* Remove unnecessary @NonNull annotations
* Fix a few other trivial SAT issues
* Add constructor injection for MDNSDiscoveryService
Signed-off-by: Wouter Born <github@maindrain.net>
* Clarify return values for implementation
* Dynamic state/command provider should not return original descritpion
* Added ERROR log message
* Added integration test for CommandDescriptionProvider
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* removed ThingLinkManager and with it the auto-linking feature and "Simple Mode"
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* removed feature from REST API as well
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* removed tests
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* [voice] Simplify lifecycle by using constructor injection
* Removed usage of org.apache.commons.lang.ArrayUtils
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* Added public method to remove all members from a group
* Spelling in itest method names
* File encoding
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* replaced Joda Time by Java Time
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* removed joda from target platform feature
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* updated tests
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* fixed persistence extension tests
Signed-off-by: Kai Kreuzer <kai@openhab.org>
If you would like to use the runblacklist bnd instruction in an
integration test it will not work as expected.
In my current test case it is not used at all.
This is caused because an included file overrides this instruction.
IMHO it would be better to use the "Merged Instructions" feature and use
a postfix in the included file. This way you can use the non postfixed
instruction as usual.
See: https://bnd.bndtools.org/chapters/820-instructions.html#merged-instructions
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
Use the same Pax Web and Jetty version for the runtime dependencies
(used by the demo application) as is used in the Karaf distribution.
This PR needs to be merged synchron to the updated bndrun in the openHAB
demo repository.
Related to: https://github.com/openhab/openhab-core/pull/1197#issuecomment-553029014
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
Every connection to the LSP server failed because it always threw a org.eclipse.smarthome.model.ide.SitemapIdeSetup NoClassDefFoundError.
Which is caused by the SitemapIdeSetup residing in a package that is split between both the org.openhab.core.model.item.ide and the org.openhab.core.model.sitemap.ide bundles.
The SitemapIdeSetup class is also using classes from the org.eclipse.smarthome.model package which is also a package split between the org.openhab.core.model.items and org.openhab.core.model.sitemap bundles.
After renaming the packages used for the sitemap classes the NoClassDefFoundError is resolved and LSP works properly again.
Many imports were updated for the sitemap model package changes.
Fixes#1030
Signed-off-by: Wouter Born <github@maindrain.net>
Fixes SAT errors/warnings in resources and tests reported by SAT 0.8.0-SNAPSHOT.
Related to openhab/static-code-analysis#363
Signed-off-by: Wouter Born <github@maindrain.net>
waitForAssert doesn't catch NPEs so this PR fixes that by also checking the localized modules for null.
Related to #1089
Signed-off-by: Wouter Born <github@maindrain.net>
* Added nullness annotations to 'RuleTemplateI18nUtil'
* Added nullness annotations to 'ConfigDescriptionGroupI18nUtil'
* Moved 'ConfigDescriptionI18nUtil' into internal package
* Moved 'ConfigDescriptionGroupI18nUtil' into internal package
* Moved 'ThingTypeI18nUtil' into internal package
* Use 'ConfigI18nLocalizationService' instead of 'ConfigDescriptionI18nUtil'
* Use default labels / descriptions if application of localization is not successful
* Resolved itest.bndrun files
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Adds null annotations to all registries, the interfaces they implement and a few other classes.
Also-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Wouter Born <github@maindrain.net>
* Minor code improvements in profile factory
* Added integration test to check if factory creates all available profiles
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
When waitForAssert uses ruleEvents.stream() the ruleEventHandler may add an event to ruleEvents at the same time causing a ConcurrentModificationException.
Using a CopyOnWriteArrayList instead of an ArrayList should fix this.
Signed-off-by: Wouter Born <github@maindrain.net>
The test now makes sure the models and items are removed and the removal events have been processed during tearDown so these events don't interfere with subsequent tests.
Also merges the GenericItemProviderTest and GenericItemProvider2Test together which was still a Groovy leftover.
Fixes#1140
Signed-off-by: Wouter Born <github@maindrain.net>
Most likely the test is unstable because the ChannelGroupTypeProvider is still processing the bundle XML. So using waitForAssert may fix this. It's also used like this to assert the channel types got added by the ChannelTypeProvider.
Fixes#1090
Signed-off-by: Wouter Born <github@maindrain.net>
Mockito 3 does not introduce any breaking API changes, but now requires Java 8 over Java 6 for Mockito 2.
Signed-off-by: Wouter Born <github@maindrain.net>
* Changed pid from 'org.eclipse.smarthome.core.i18nprovider' to 'org.eclipse.smarthome.i18n'
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Fixes wrong names identified by the following rules:
* ConstantNameCheck
* LocalFinalVariableNameCheck
* LocalVariableNameCheck
* StaticVariableNameCheck
Most mismatches identified by the MemberNameCheck have also been fixed except for those where the variables are used in events/DTOs etc which would cause issues.
Signed-off-by: Wouter Born <github@maindrain.net>
Fixes the SAT warning: First javadoc author should have "Initial contribution" contribution description.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move IO HTTP unit tests
All IO HTTP tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move thing XML unit tests
Moves the thing XML unit tests from the itests project to the bundle project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move compat1x unit tests
All compat1x tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move model LSP unit tests
All model LSP tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move semantics unit tests
All semantics tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move transform unit tests
All transform tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Move UI icon unit tests
All UI icon tests are unit tests so there is no need for an itests project.
Signed-off-by: Wouter Born <github@maindrain.net>
* Use constructor injection to simplify lifecycle
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* PR extended by ItemStateConverter
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
* Use constructor injection to simplify lifecycle
* Added nullness annotations to PersistenceManager
* Removed declaration with null
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
After adding the nullness annotations to the automation stuff, we need
to fix the usage to use a correct nullness handling.
Related to: https://github.com/openhab/openhab-core/pull/910
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
If a component should be activated an instance is constructed and that
object is activated.
Let's split the construction and activation logic also if constructor
injection is used.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
The test suite for the audio servlet contains a test that will fail on
systems under heavy load (or just imperformant systems).
An audio stream should be added for 1 (streamTimeout) second.
The stream is requested and it is tested that it can be accessed.
After that the test waits until the stream is no more available (this
will be the cause after "streamTimeout").
If the "add stream" and "get request for stream" operations already
exceed the "streamTimeout" limit, the test will fail.
This can be handled in the test case itself if we check the timespan we
need to get the stream and if we know that the stream is allowed to be
non present already, we continue with the next step without failing.
Fixes: https://github.com/openhab/openhab-core/issues/799
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
There is a recommended ordering for all Maven POM files.
See: https://maven.apache.org/developers/conventions/code.html
The POM files has been "fixed" by using the "sortpom-maven-plugin".
The blank lines has been kept to keep the element separation for
readability.
The plugin also fixes indentation etc.
Have a look at: https://github.com/Ekryd/sortpom/wiki
The profile has been set to "recommended_2008_06" that states:
The POM Code Convention that was chosen by Maven developers in 2008
Command that has been executed:
mvn \
com.github.ekryd.sortpom:sortpom-maven-plugin:sort \
-Dsort.keepBlankLines=true \
-Dsort.predefinedSortOrder=recommended_2008_06
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
* channel groups should not require static channels
* Added unit tests
Also-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Adds the following bundles required for building on Java 11 by default to the run requirements:
* org.apache.servicemix.specs.activation-api-1.1
* org.apache.servicemix.specs.annotation-api-1.3
* org.apache.servicemix.specs.jaxb-api-2.2
Signed-off-by: Wouter Born <github@maindrain.net>
Incompatible code can be used/generated when using JDK8 on the command line and JDK11 in Eclipse (or vice versa).
The explanation for this is given in https://github.com/apache/felix/pull/114 :
Java 9 introduces overridden methods with covariant return types for the following methods in java.nio.ByteBuffer:
* position(int newPosition)
* limit(int newLimit)
* flip()
* clear()
* mark()
* reset()
* rewind()
In Java 9 they all now return ByteBuffer, whereas the methods they override return Buffer,
resulting in exceptions like this when executing on Java 8 and lower:
java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer
This is because the generated byte code includes the static return type of the method, which is not found on Java 8 and lower because the overloaded methods with covariant return types don't exist (the issue appears even with source and target 8 or lower in compilation parameters).
The solution is to cast ByteBuffer instances to Buffer before calling the method.
Signed-off-by: Wouter Born <github@maindrain.net>
As long as we depend on the internal Gson packages, we need to use the
Gson bundle provided by Eclipse Orbit instead of the official one.
Related to: https://github.com/openhab/openhab-core/pull/641
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
For the runtime dependencies a template from the EnRoute project has
been used. To allow further customization and usages of different Maven
scopes, we migrate the template to this repo.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
This addresses https://github.com/eclipse/smarthome/issues/5099 by adding a command description with command options along with the state description.
Command options will give a hint to UIs about the specific commands a channel provides. Command options could be rendered as a drop down and also represent the current state or rendered as push buttons to simply send a command to the ThingHandler.
The infrstructure basically copies the StateDescription infrastructure with CommandDescriptionProviders and an `DynamicCommandDescriptionProvider` interface for bindings to hook in and provide dynamic command options.
Signed-off-by: Henning Treu <henning.treu@googlemail.com>
The io.rest.sitemap integration test has already been moved to a pure
JUnit test of the respective bundle.
Related to: https://github.com/openhab/openhab-core/pull/499
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
The ready marker logic is created to hide the real usage. The ready
marker uses an "identifier" that is not specific or limited to bundles.
Currently the bundle symbolic name is used as bundle identifier.
That "convention" needs to be known at several different places.
There should be one method that created an identifier for a bundle and
"no one" needs to care about the implementation details.
Another point is that the bundle symbolic name that has been used is
optional. It may be null e.g. for bundles that has been installed by the
synthetic bundle installer mechanism etc.
The runtime assigns a bundle ID to an installed bundle that remains the
same for the bundle (see JavaDoc). The bundle ID is present all the
time.
The implementation of the "get identifier for bundle" has been choosen
to use the BSN -- if available -- (as before) but fallback to a custom
one using also the bundle ID (to be unique).
So we can provide always a non null identifier for a bundle.
It should be easily to change the identifier creation now if there is
every any need for.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
If a bundle misses a BSN the bundle cannot be installed.
We should provide a method to uninstall the bundle that has been created
by the synthetic installer itself.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
This commit move the files to the correct directories and prepare the
whole infrastructure. After that hopefully small changes needs to be
done only to get tests running.
Some tests has been already enabled, too.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
For better differentiation between different USB devices `UsbSerialDiscoveryService` is extended to add `usb_vendor_id` and `usb_product_id` properties to every thing which represents USB device.
Also-by: YordanDZhelev <zhelev.yordan@gmail.com>
Signed-off-by: Kai Kreuzer <kai@openhab.org>