This repository has been archived by the owner on May 7, 2020. It is now read-only.
Added null annotations to transformation services #5365
Merged
kaikreuzer
merged 13 commits into
eclipse-archived:master
from
triller-telekom:nullannotationsTransformation
May 25, 2018
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
44187c3
Added nullannotations to transformation services
triller-telekom 5b2263b
Integrated review comments
triller-telekom 4d38119
Mark watchService as Nullable
triller-telekom 6f78aa4
Throw TransformationException instead of returning null
triller-telekom 03ae918
Allow null as transformation result
triller-telekom 48b0f83
Remove not used import
triller-telekom 77e0013
Repair Javadocs, revert JSON service to allow null again
triller-telekom 7f2215a
resolve conflicts
triller-telekom 60eb7d1
Add transformRaw method which forwards Exceptions to the caller
triller-telekom dfd227c
Do not catch Exception twice
triller-telekom 4f660bf
Fix test and README
triller-telekom f1ccbd2
Add test projects for testing transform vs transformRaw
triller-telekom 446cde9
Reduce log level to debug
triller-telekom File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
bundles/core/org.eclipse.smarthome.core.transform.test/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src/test/java"/> | ||
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.smarthome.core.transform"/> | ||
<classpathentry kind="output" path="target/test-classes"/> | ||
</classpath> |
33 changes: 33 additions & 0 deletions
33
bundles/core/org.eclipse.smarthome.core.transform.test/.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.eclipse.smarthome.core.transform.test</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ds.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
19 changes: 19 additions & 0 deletions
19
bundles/core/org.eclipse.smarthome.core.transform.test/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ClassPath: . | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Eclipse SmartHome Core Transform Tests | ||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
Bundle-SymbolicName: org.eclipse.smarthome.core.transform.test | ||
Bundle-Vendor: Eclipse.org/SmartHome | ||
Bundle-Version: 0.10.0.qualifier | ||
Fragment-Host: org.eclipse.smarthome.core.transform | ||
Import-Package: | ||
org.eclipse.jdt.annotation;resolution:=optional, | ||
org.eclipse.smarthome.test, | ||
org.eclipse.smarthome.test.java, | ||
org.hamcrest;core=split, | ||
org.junit, | ||
org.junit.rules, | ||
org.junit.runner, | ||
org.junit.runners, | ||
org.osgi.service.cm |
19 changes: 19 additions & 0 deletions
19
bundles/core/org.eclipse.smarthome.core.transform.test/NOTICE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
This content is produced and maintained by the Eclipse SmartHome project. | ||
|
||
* Project home: https://eclipse.org/smarthome/ | ||
|
||
== Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License 2.0 which is available at | ||
https://www.eclipse.org/legal/epl-2.0/. | ||
|
||
== Source Code | ||
|
||
https://github.com/eclipse/smarthome | ||
|
||
== Copyright Holders | ||
|
||
See the NOTICE file distributed with the source code at | ||
https://github.com/eclipse/smarthome/blob/master/NOTICE | ||
for detailed information regarding copyright ownership. |
5 changes: 5 additions & 0 deletions
5
bundles/core/org.eclipse.smarthome.core.transform.test/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source.. = src/test/java/ | ||
output.. = target/test-classes/ | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
NOTICE |
106 changes: 106 additions & 0 deletions
106
bundles/core/org.eclipse.smarthome.core.transform.test/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>core</artifactId> | ||
<groupId>org.eclipse.smarthome.bundles</groupId> | ||
<version>0.10.0-SNAPSHOT</version> | ||
</parent> | ||
<groupId>org.eclipse.smarthome.core</groupId> | ||
<artifactId>org.eclipse.smarthome.core.transform.test</artifactId> | ||
|
||
<packaging>eclipse-test-plugin</packaging> | ||
|
||
<name>Eclipse SmartHome Core Transform Test</name> | ||
|
||
<properties> | ||
<bundle.symbolicName>org.eclipse.smarthome.core.transform.test</bundle.symbolicName> | ||
<bundle.namespace>org.eclipse.smarthome.core.transform.test</bundle.namespace> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>${tycho-groupid}</groupId> | ||
<artifactId>target-platform-configuration</artifactId> | ||
<configuration> | ||
<dependency-resolution> | ||
<extraRequirements> | ||
<requirement> | ||
<type>eclipse-plugin</type> | ||
<id>org.eclipse.equinox.ds</id> | ||
<versionRange>0.0.0</versionRange> | ||
</requirement> | ||
<requirement> | ||
<type>eclipse-plugin</type> | ||
<id>org.eclipse.equinox.event</id> | ||
<versionRange>0.0.0</versionRange> | ||
</requirement> | ||
<requirement> | ||
<type>eclipse-plugin</type> | ||
<id>org.eclipse.smarthome.core.thing</id> | ||
<versionRange>0.0.0</versionRange> | ||
</requirement> | ||
<requirement> | ||
<type>eclipse-plugin</type> | ||
<id>org.eclipse.smarthome.core.transform</id> | ||
<versionRange>0.0.0</versionRange> | ||
</requirement> | ||
<requirement> | ||
<type>eclipse-plugin</type> | ||
<id>org.eclipse.equinox.cm</id> | ||
<versionRange>0.0.0</versionRange> | ||
</requirement> | ||
<requirement> | ||
<type>eclipse-plugin</type> | ||
<id>org.eclipse.smarthome.core</id> | ||
<versionRange>0.0.0</versionRange> | ||
</requirement> | ||
</extraRequirements> | ||
</dependency-resolution> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>${tycho-groupid}</groupId> | ||
<artifactId>tycho-surefire-plugin</artifactId> | ||
<configuration> | ||
<bundleStartLevel> | ||
<bundle> | ||
<id>org.eclipse.equinox.ds</id> | ||
<level>1</level> | ||
<autoStart>true</autoStart> | ||
</bundle> | ||
<bundle> | ||
<id>org.eclipse.smarthome.core.transform</id> | ||
<level>4</level> | ||
<autoStart>true</autoStart> | ||
</bundle> | ||
<bundle> | ||
<id>org.eclipse.smarthome.core.thing</id> | ||
<level>4</level> | ||
<autoStart>true</autoStart> | ||
</bundle> | ||
|
||
<bundle> | ||
<id>org.eclipse.equinox.event</id> | ||
<level>2</level> | ||
<autoStart>true</autoStart> | ||
</bundle> | ||
<bundle> | ||
<id>org.eclipse.equinox.cm</id> | ||
<level>2</level> | ||
<autoStart>true</autoStart> | ||
</bundle> | ||
<bundle> | ||
<id>org.eclipse.smarthome.core</id> | ||
<level>3</level> | ||
<autoStart>true</autoStart> | ||
</bundle> | ||
</bundleStartLevel> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
36 changes: 36 additions & 0 deletions
36
...m.test/src/test/java/org/eclipse/smarthome/core/transform/actions/TransformationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) 2014,2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.smarthome.core.transform.actions; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.eclipse.smarthome.core.transform.TransformationException; | ||
import org.junit.Test; | ||
|
||
public class TransformationTest { | ||
|
||
@Test | ||
public void testTransform() { | ||
String result = Transformation.transform("UnknownTransformation", "function", "test"); | ||
assertEquals("test", result); | ||
} | ||
|
||
@Test | ||
public void testTransformRaw() { | ||
try { | ||
Transformation.transformRaw("UnknownTransformation", "function", "test"); | ||
} catch (TransformationException e) { | ||
assertEquals("No transformation service 'UnknownTransformation' could be found.", e.getMessage()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you have added the
Nullable
annotation to thecontect
argument, I tried to check the JavaDoc for that parameter. There is no such parameter in JavaDoc. As you already touched this one can you add one?