This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit e5f21733494029eed4e98af86a5b518d821eb03d Author: Christofer Dutz <[email protected]> AuthorDate: Wed Oct 26 16:33:30 2022 +0200 Applied some of the suggestions by the sourceformatter. --- components/camel-plc4x/pom.xml | 22 +++-- .../java/org/apache/plc4x/camel/Constants.java | 33 ++++--- .../org/apache/plc4x/camel/Plc4XComponent.java | 27 +++--- .../java/org/apache/plc4x/camel/Plc4XConsumer.java | 30 +++---- .../java/org/apache/plc4x/camel/Plc4XEndpoint.java | 33 ++++--- .../java/org/apache/plc4x/camel/Plc4XProducer.java | 26 +++--- .../main/java/org/apache/plc4x/camel/TagData.java | 98 +++++++++++++++------ .../services/org/apache/camel/component/plc4x | 26 +++--- .../java/org/apache/plc4x/camel/ConstantsTest.java | 26 +++--- .../java/org/apache/plc4x/camel/ManualTest.java | 26 +++--- .../java/org/apache/plc4x/camel/MockDriver.java | 32 +++---- .../org/apache/plc4x/camel/Plc4XComponentTest.java | 26 +++--- .../org/apache/plc4x/camel/Plc4XConsumerTest.java | 26 +++--- .../org/apache/plc4x/camel/Plc4XEndpointTest.java | 36 ++++---- .../org/apache/plc4x/camel/Plc4XProducerTest.java | 57 ++++++------ .../services/org.apache.plc4x.java.api.PlcDriver | 26 +++--- .../src/test/resources/log4j2.properties | 26 +++--- .../src/test/resources/logback-test.xml | 30 +++---- .../src/test/resources/data/sfny-j48.model | Bin 7824 -> 7824 bytes components/pom.xml | 1 + 20 files changed, 317 insertions(+), 290 deletions(-) diff --git a/components/camel-plc4x/pom.xml b/components/camel-plc4x/pom.xml index 0c86170b193..1c72eeb3ec6 100644 --- a/components/camel-plc4x/pom.xml +++ b/components/camel-plc4x/pom.xml @@ -78,6 +78,12 @@ <groupId>org.apache.plc4x</groupId> <artifactId>plc4j-scraper</artifactId> <version>${plc4x.version}</version> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + </exclusions> </dependency> <!-- Include all drivers --> @@ -86,6 +92,16 @@ <artifactId>plc4j-driver-ab-eth</artifactId> <version>${plc4x.version}</version> <scope>runtime</scope> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.woodstox</groupId> + <artifactId>woodstox-core</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.plc4x</groupId> @@ -149,12 +165,6 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.plc4x</groupId> - <artifactId>plc4j-spi</artifactId> - <version>${plc4x.version}</version> - <scope>test</scope> - </dependency> <dependency> <!-- avoids java.lang.NoClassDefFoundError: javax/activation/DataHandler in Plc4XProducerTest on Java 11--> <groupId>javax.activation</groupId> diff --git a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Constants.java b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Constants.java index 805b59b6622..a12db73c2da 100644 --- a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Constants.java +++ b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Constants.java @@ -1,30 +1,29 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; -public class Constants { +public final class Constants { public static final String FIELD_NAME_HEADER = "fieldName"; public static final String FIELD_QUERY_HEADER = "fieldQuery"; - public final static String TRIGGER = "TRIGGER_VAR"; - public final static String PLC_NAME = "PLC"; + public static final String TRIGGER = "TRIGGER_VAR"; + public static final String PLC_NAME = "PLC"; private Constants() { throw new IllegalStateException("Utility class!"); } + } diff --git a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XComponent.java b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XComponent.java index 7d84c4672d3..f75c0d0d38b 100644 --- a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XComponent.java +++ b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XComponent.java @@ -1,27 +1,24 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; import org.apache.camel.Endpoint; import org.apache.camel.support.DefaultComponent; import org.apache.camel.util.PropertiesHelper; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java index 45f4a41f3e1..431ca62e8f3 100644 --- a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java +++ b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XConsumer.java @@ -1,20 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; @@ -136,7 +134,9 @@ public class Plc4XConsumer extends DefaultConsumer { if (map.size() != tags.size()) { LOGGER.error("At least one entry does not match the format : Map.Entry<String,String> "); return null; - } else return map; + } else { + return map; + } } private ScraperConfigurationTriggeredImpl getScraperConfig(Map<String, String> tagList) { diff --git a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XEndpoint.java b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XEndpoint.java index 262a0184668..580acfe1ab0 100644 --- a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XEndpoint.java +++ b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XEndpoint.java @@ -1,37 +1,36 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; -import org.apache.camel.*; +import org.apache.camel.Component; +import org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; import org.apache.camel.support.DefaultEndpoint; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; -import org.apache.commons.math3.util.Pair; import org.apache.plc4x.java.PlcDriverManager; import org.apache.plc4x.java.api.PlcConnection; import org.apache.plc4x.java.api.exceptions.PlcConnectionException; import org.apache.plc4x.java.api.exceptions.PlcRuntimeException; import org.apache.plc4x.java.utils.connectionpool.PooledPlcDriverManager; -import java.util.List; import java.util.Map; import java.util.Objects; diff --git a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XProducer.java b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XProducer.java index 6adfab3700c..af418de5dc1 100644 --- a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XProducer.java +++ b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/Plc4XProducer.java @@ -1,20 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; diff --git a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/TagData.java b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/TagData.java index 6974ead775b..218ebcd7c49 100644 --- a/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/TagData.java +++ b/components/camel-plc4x/src/main/java/org/apache/plc4x/camel/TagData.java @@ -1,20 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; @@ -23,6 +21,7 @@ import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Predicate; public class TagData { @@ -75,17 +74,13 @@ public class TagData { } if(canParse.get(Short.TYPE).test(val)){ value = Short.parseShort(val); - } - else if(canParse.get(Integer.TYPE).test(val)){ + } else if(canParse.get(Integer.TYPE).test(val)){ value = Integer.parseInt(val); - } - else if(canParse.get(Long.TYPE).test(val)){ + } else if(canParse.get(Long.TYPE).test(val)){ value = Long.parseLong(val); - } - else if(canParse.get(Double.TYPE).test(val)){ + } else if(canParse.get(Double.TYPE).test(val)){ value = Double.parseDouble(val); - } - else if(canParse.get(Float.TYPE).test(val)){ + } else if(canParse.get(Float.TYPE).test(val)){ value = Float.parseFloat(val); } @@ -94,12 +89,54 @@ public class TagData { private Map<Class<?>, Predicate<String>> canParse = new HashMap<>(); { - canParse.put(Integer.TYPE, s -> {try {Integer.parseInt(s); return true;} catch(Exception e) {return false;}}); - canParse.put(Long.TYPE, s -> {try {Long.parseLong(s); return true;} catch(Exception e) {return false;}}); - canParse.put(Short.TYPE, s -> {try {Short.parseShort(s); return true;} catch(Exception e) {return false;}}); - canParse.put(Boolean.TYPE, s -> {try {Boolean.parseBoolean(s); return true;} catch(Exception e) {return false;}}); - canParse.put(Double.TYPE, s -> {try {Double.parseDouble(s); return true;} catch(Exception e) {return false;}}); - canParse.put(Float.TYPE, s -> {try {Float.parseFloat(s); return true;} catch(Exception e) {return false;}}); + canParse.put(Integer.TYPE, s -> { + try { + Integer.parseInt(s); + return true; + } catch(Exception e) { + return false; + } + }); + canParse.put(Long.TYPE, s -> { + try { + Long.parseLong(s); + return true; + } catch(Exception e) { + return false; + } + }); + canParse.put(Short.TYPE, s -> { + try { + Short.parseShort(s); + return true; + } catch(Exception e) { + return false; + } + }); + canParse.put(Boolean.TYPE, s -> { + try { + Boolean.parseBoolean(s); + return true; + } catch(Exception e) { + return false; + } + }); + canParse.put(Double.TYPE, s -> { + try { + Double.parseDouble(s); + return true; + } catch(Exception e) { + return false; + } + }); + canParse.put(Float.TYPE, s -> { + try { + Float.parseFloat(s); + return true; + } catch(Exception e) { + return false; + } + }); }; @Override @@ -114,8 +151,11 @@ public class TagData { && ((TagData)tag).getQuery().equals(query) : ((TagData)tag).getTagName().equals(tagName) && ((TagData)tag).getQuery().equals(query); + } - + @Override + public int hashCode() { + return Objects.hash(tagName, query, value, canParse); } public static Map<String,String> toMap(List<TagData> tags){ diff --git a/components/camel-plc4x/src/main/resources/META-INF/services/org/apache/camel/component/plc4x b/components/camel-plc4x/src/main/resources/META-INF/services/org/apache/camel/component/plc4x index 5fd13a9798b..e634230703a 100644 --- a/components/camel-plc4x/src/main/resources/META-INF/services/org/apache/camel/component/plc4x +++ b/components/camel-plc4x/src/main/resources/META-INF/services/org/apache/camel/component/plc4x @@ -1,19 +1,17 @@ # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # class=org.apache.plc4x.camel.Plc4XComponent \ No newline at end of file diff --git a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/ConstantsTest.java b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/ConstantsTest.java index 68d36bfc5b1..4ade527ca22 100644 --- a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/ConstantsTest.java +++ b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/ConstantsTest.java @@ -1,20 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; diff --git a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/ManualTest.java b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/ManualTest.java index 46f27041aa7..7c9301b4b37 100644 --- a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/ManualTest.java +++ b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/ManualTest.java @@ -1,20 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; diff --git a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/MockDriver.java b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/MockDriver.java index 542b1132f8a..446f58711e0 100644 --- a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/MockDriver.java +++ b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/MockDriver.java @@ -1,27 +1,29 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; import org.apache.plc4x.java.api.PlcConnection; import org.apache.plc4x.java.api.authentication.PlcAuthentication; import org.apache.plc4x.java.api.exceptions.PlcConnectionException; -import org.apache.plc4x.java.api.messages.*; +import org.apache.plc4x.java.api.messages.PlcReadRequest; +import org.apache.plc4x.java.api.messages.PlcSubscriptionRequest; +import org.apache.plc4x.java.api.messages.PlcSubscriptionResponse; +import org.apache.plc4x.java.api.messages.PlcUnsubscriptionRequest; +import org.apache.plc4x.java.api.messages.PlcWriteRequest; import org.apache.plc4x.java.spi.messages.DefaultPlcSubscriptionResponse; import org.apache.plc4x.java.spi.messages.PlcSubscriber; import org.apache.plc4x.java.api.PlcDriver; diff --git a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XComponentTest.java b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XComponentTest.java index bc66944b3fb..62d9e90ceb1 100644 --- a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XComponentTest.java +++ b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XComponentTest.java @@ -1,20 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; diff --git a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XConsumerTest.java b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XConsumerTest.java index 8611cf08061..e8aa5d633b1 100644 --- a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XConsumerTest.java +++ b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XConsumerTest.java @@ -1,20 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; diff --git a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XEndpointTest.java b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XEndpointTest.java index 94e120f6de3..ca6ea8408c5 100644 --- a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XEndpointTest.java +++ b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XEndpointTest.java @@ -1,20 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; @@ -31,29 +29,29 @@ import static org.mockito.Mockito.*; public class Plc4XEndpointTest { - Plc4XEndpoint SUT; + Plc4XEndpoint sut; @BeforeEach public void setUp() throws Exception { Component mockComponent = mock(Component.class, RETURNS_DEEP_STUBS); when(mockComponent.getCamelContext()).thenReturn(new DefaultCamelContext()); - SUT = new Plc4XEndpoint("plc4x:mock:10.10.10.1/1/1", mockComponent); + sut = new Plc4XEndpoint("plc4x:mock:10.10.10.1/1/1", mockComponent); } // TODO: figure out what this is @Test public void createProducer() throws Exception { - assertThat(SUT.createProducer(), notNullValue()); + assertThat(sut.createProducer(), notNullValue()); } @Test public void createConsumer() throws Exception { - assertThat(SUT.createConsumer(mock(Processor.class)), notNullValue()); + assertThat(sut.createConsumer(mock(Processor.class)), notNullValue()); } @Test public void isSingleton() { - assertThat(SUT.isSingleton(), is(true)); + assertThat(sut.isSingleton(), is(true)); } } \ No newline at end of file diff --git a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XProducerTest.java b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XProducerTest.java index a201fd36729..d9b840f2ff8 100644 --- a/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XProducerTest.java +++ b/components/camel-plc4x/src/test/java/org/apache/plc4x/camel/Plc4XProducerTest.java @@ -1,20 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.plc4x.camel; @@ -26,7 +24,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.lang.reflect.Field; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -36,7 +33,7 @@ import static org.mockito.Mockito.*; public class Plc4XProducerTest { - private Plc4XProducer SUT; + private Plc4XProducer sut; private Exchange testExchange; @@ -52,7 +49,7 @@ public class Plc4XProducerTest { .thenReturn(mock(PlcWriteRequest.Builder.class, RETURNS_DEEP_STUBS)); when(endpointMock.getConnection()).thenReturn(mockConnection); - SUT = new Plc4XProducer(endpointMock); + sut = new Plc4XProducer(endpointMock); testExchange = mock(Exchange.class, RETURNS_DEEP_STUBS); Map<String, Map<String,Object>> tags = new HashMap(); tags.put("test1", Collections.singletonMap("testAddress1",0)); @@ -65,47 +62,47 @@ public class Plc4XProducerTest { @Test public void process() throws Exception { when(testExchange.getPattern()).thenReturn(ExchangePattern.InOnly); - SUT.process(testExchange); + sut.process(testExchange); when(testExchange.getPattern()).thenReturn(ExchangePattern.InOut); - SUT.process(testExchange); + sut.process(testExchange); when(testExchange.getIn().getBody()).thenReturn(2); } @Test - public void process_Async() { - SUT.process(testExchange, doneSync -> { + public void processAsync() { + sut.process(testExchange, doneSync -> { }); when(testExchange.getPattern()).thenReturn(ExchangePattern.InOnly); - SUT.process(testExchange, doneSync -> { + sut.process(testExchange, doneSync -> { }); when(testExchange.getPattern()).thenReturn(ExchangePattern.InOut); - SUT.process(testExchange, doneSync -> { + sut.process(testExchange, doneSync -> { }); } @Test public void doStop() throws Exception { - SUT.doStop(); + sut.doStop(); } @Test public void doStopOpenRequest() throws Exception { - Field openRequests = SUT.getClass().getDeclaredField("openRequests"); + Field openRequests = sut.getClass().getDeclaredField("openRequests"); openRequests.setAccessible(true); - AtomicInteger atomicInteger = (AtomicInteger) openRequests.get(SUT); + AtomicInteger atomicInteger = (AtomicInteger) openRequests.get(sut); atomicInteger.incrementAndGet(); - SUT.doStop(); + sut.doStop(); } @Test public void doStopBadConnection() throws Exception { - Field openRequests = SUT.getClass().getDeclaredField("plcConnection"); + Field openRequests = sut.getClass().getDeclaredField("plcConnection"); openRequests.setAccessible(true); PlcConnection plcConnectionMock = mock(PlcConnection.class); doThrow(new RuntimeException("oh noes")).when(plcConnectionMock).close(); - openRequests.set(SUT, plcConnectionMock); - SUT.doStop(); + openRequests.set(sut, plcConnectionMock); + sut.doStop(); } } \ No newline at end of file diff --git a/components/camel-plc4x/src/test/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver b/components/camel-plc4x/src/test/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver index 981a9f1938d..f3e1faab034 100644 --- a/components/camel-plc4x/src/test/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver +++ b/components/camel-plc4x/src/test/resources/META-INF/services/org.apache.plc4x.java.api.PlcDriver @@ -1,19 +1,17 @@ # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # org.apache.plc4x.camel.MockDriver \ No newline at end of file diff --git a/components/camel-plc4x/src/test/resources/log4j2.properties b/components/camel-plc4x/src/test/resources/log4j2.properties index bd94d40a452..114baa6aab1 100644 --- a/components/camel-plc4x/src/test/resources/log4j2.properties +++ b/components/camel-plc4x/src/test/resources/log4j2.properties @@ -1,20 +1,18 @@ # -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # appender.out.type=Console appender.out.name=out diff --git a/components/camel-plc4x/src/test/resources/logback-test.xml b/components/camel-plc4x/src/test/resources/logback-test.xml index 2b9cea25dc8..052d9bc0935 100644 --- a/components/camel-plc4x/src/test/resources/logback-test.xml +++ b/components/camel-plc4x/src/test/resources/logback-test.xml @@ -1,22 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - https://www.apache.org/licenses/LICENSE-2.0 + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. - --> + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> <configuration xmlns="http://ch.qos.logback/xml/ns/logback" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" diff --git a/components/camel-weka/src/test/resources/data/sfny-j48.model b/components/camel-weka/src/test/resources/data/sfny-j48.model index 48cf857ea7d..3af41f554c3 100644 Binary files a/components/camel-weka/src/test/resources/data/sfny-j48.model and b/components/camel-weka/src/test/resources/data/sfny-j48.model differ diff --git a/components/pom.xml b/components/pom.xml index f4722eff281..cd488fed7f5 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -251,6 +251,7 @@ <module>camel-pgevent</module> <module>camel-platform-http</module> <module>camel-platform-http-vertx</module> + <module>camel-plc4x</module> <module>camel-printer</module> <module>camel-protobuf</module> <module>camel-pubnub</module>
