Skip to content

Commit

Permalink
Merge branch 'main' into sitemap_dynamic_icon
Browse files Browse the repository at this point in the history
  • Loading branch information
lolodomo committed Sep 4, 2023
2 parents 1be31f1 + 1c8096b commit 4379d71
Show file tree
Hide file tree
Showing 83 changed files with 505 additions and 449 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
java: [ '17' ]
maven: [ '3.8.6' ]
maven: [ '3.9.4' ]
os: [ 'ubuntu-22.04' ]
name: Build (Java ${{ matrix.java }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down
19 changes: 14 additions & 5 deletions bom/compile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<californium.version>2.7.4</californium.version>
<jetty.version>9.4.50.v20221201</jetty.version>
<pax.web.version>8.0.15</pax.web.version>
<swagger.version>2.1.9</swagger.version>
<swagger.version>2.2.15</swagger.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -202,7 +202,8 @@
<dependency>
<groupId>org.jupnp</groupId>
<artifactId>org.jupnp</artifactId>
<version>2.7.1</version>
<!-- Uses the Java 11 LinkedTransferQueue as workaround for JDK-8301341 -->
<version>2.7.1.OH1</version>
<scope>compile</scope>
</dependency>

Expand All @@ -212,7 +213,7 @@
<dependency>
<groupId>javax.measure</groupId>
<artifactId>unit-api</artifactId>
<version>2.1.3</version>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -224,7 +225,7 @@
<dependency>
<groupId>tech.units</groupId>
<artifactId>indriya</artifactId>
<version>2.1.2</version>
<version>2.2</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -421,7 +422,7 @@
<dependency>
<groupId>org.openhab.osgiify</groupId>
<artifactId>io.methvin.directory-watcher</artifactId>
<version>0.17.1</version>
<version>0.18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -436,6 +437,14 @@
<version>5.12.1</version>
<scope>compile</scope>
</dependency>

<!-- Provides the Java 11 LinkedTransferQueue used in workarounds for JDK-8301341 -->
<dependency>
<groupId>org.openhab</groupId>
<artifactId>base-fixes</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
25 changes: 17 additions & 8 deletions bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

<properties>
<californium.version>2.7.4</californium.version>
<cxf.version>3.4.5</cxf.version>
<jackson.version>2.14.1</jackson.version>
<cxf.version>3.6.1</cxf.version>
<jackson.version>2.15.2</jackson.version>
<jetty.version>9.4.50.v20221201</jetty.version>
<pax.logging.version>2.2.0</pax.logging.version>
<pax.web.version>8.0.15</pax.web.version>
<swagger.version>2.1.9</swagger.version>
<swagger.version>2.2.15</swagger.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -469,7 +469,8 @@
<dependency>
<groupId>org.jupnp</groupId>
<artifactId>org.jupnp</artifactId>
<version>2.7.1</version>
<!-- Uses the Java 11 LinkedTransferQueue as workaround for JDK-8301341 -->
<version>2.7.1.OH1</version>
<scope>compile</scope>
</dependency>

Expand All @@ -489,7 +490,7 @@
<dependency>
<groupId>javax.measure</groupId>
<artifactId>unit-api</artifactId>
<version>2.1.2</version>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<!-- The si.uom:si-units manifest has no Export-Package entry. As workaround this OSGi-ify bundle is used. -->
Expand All @@ -508,7 +509,7 @@
<dependency>
<groupId>tech.units</groupId>
<artifactId>indriya</artifactId>
<version>2.1.2</version>
<version>2.2</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -1067,15 +1068,15 @@
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.27.0-GA</version>
<version>3.29.2-GA</version>
<scope>compile</scope>
</dependency>

<!-- dirwatcher -->
<dependency>
<groupId>org.openhab.osgiify</groupId>
<artifactId>io.methvin.directory-watcher</artifactId>
<version>0.17.1</version>
<version>0.18.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -1090,6 +1091,14 @@
<version>5.12.1</version>
<scope>compile</scope>
</dependency>

<!-- Provides the Java 11 LinkedTransferQueue used in workarounds for JDK-8301341 -->
<dependency>
<groupId>org.openhab</groupId>
<artifactId>base-fixes</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
4 changes: 2 additions & 2 deletions bom/test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<name>openHAB Core :: BOM :: Test</name>

<properties>
<cxf.version>3.4.5</cxf.version>
<cxf.version>3.6.1</cxf.version>
<junit.version>5.9.2</junit.version>
<mockito.version>4.11.0</mockito.version>
</properties>
Expand Down Expand Up @@ -65,7 +65,7 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.4.0</version>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.aries.jax.rs</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -297,7 +298,7 @@ private AudioStream createClonableInputStream(AudioStream stream, String streamI
clonableAudioStreamResult = new ByteArrayAudioStream(dataBytes, stream.getFormat());
} else {
// in memory max size exceeded, sound is too long, we will use a file
File tempFile = File.createTempFile(streamId, ".snd");
File tempFile = Files.createTempFile(streamId, ".snd").toFile();
tempFile.deleteOnExit();
try (OutputStream outputStream = new FileOutputStream(tempFile)) {
// copy already read data to file :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
*/
package org.openhab.core.automation.module.script.rulesupport.loader;

import static java.nio.file.StandardWatchEventKinds.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import static org.openhab.core.OpenHAB.CONFIG_DIR_PROG_ARGUMENT;
import static org.openhab.core.service.WatchService.Kind.CREATE;
import static org.openhab.core.service.WatchService.Kind.DELETE;
import static org.openhab.core.service.WatchService.Kind.MODIFY;
import static org.openhab.core.service.WatchService.Kind.*;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public Collection<ProfileType> getProfileTypes(@Nullable Locale locale) {
public void bindScriptTransformationService(ScriptTransformationService service, Map<String, Object> properties) {
String serviceId = (String) properties.get(TransformationService.SERVICE_PROPERTY_NAME);
String serviceLabel = (String) properties.get(TransformationService.SERVICE_PROPERTY_LABEL);
services.put(serviceId, new ServiceRecord(service, serviceLabel));
if (serviceId != null && serviceLabel != null) {
services.put(serviceId, new ServiceRecord(service, serviceLabel));
}
}

public void unbindScriptTransformationService(ScriptTransformationService service, Map<String, Object> properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ public Response get(@Context SecurityContext securityContext, @Context Request r
@QueryParam("prefix") final @Nullable String prefix, @QueryParam("tags") final @Nullable List<String> tags,
@QueryParam("summary") @Parameter(description = "summary fields only") @Nullable Boolean summary,
@DefaultValue("false") @QueryParam("staticDataOnly") @Parameter(description = "provides a cacheable list of values not expected to change regularly and honors the If-Modified-Since header, all other parameters are ignored") boolean staticDataOnly) {

if ((summary == null || !summary) && !securityContext.isUserInRole(Role.ADMIN)) {
// users may only access the summary
return JSONResponse.createErrorResponse(Status.UNAUTHORIZED, "Authentication required");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ public void receive(Event event) {
module.getId());
return;
}
} else if (event instanceof ItemRemovedEvent removedEvent) {
if (itemName.equals(removedEvent.getItem().name)) {
logger.warn("Item '{}' needed for rule '{}' removed. Condition '{}' will no longer work.", itemName,
ruleUID, module.getId());
return;
}
} else if ((event instanceof ItemRemovedEvent removedEvent) && itemName.equals(removedEvent.getItem().name)) {
logger.warn("Item '{}' needed for rule '{}' removed. Condition '{}' will no longer work.", itemName,
ruleUID, module.getId());
return;
}
}

Expand Down Expand Up @@ -155,7 +153,7 @@ public boolean isSatisfied(Map<String, Object> inputs) {
return false;
}

@SuppressWarnings({ "rawtypes", "unchecked", "null" })
@SuppressWarnings("unchecked")
private boolean lessThanOrEqualsToItemState(String itemName, String state) throws ItemNotFoundException {
Item item = itemRegistry.getItem(itemName);
State compareState = TypeParser.parseState(item.getAcceptedDataTypes(), state);
Expand Down Expand Up @@ -192,7 +190,7 @@ private boolean lessThanOrEqualsToItemState(String itemName, String state) throw
return false;
}

@SuppressWarnings({ "rawtypes", "unchecked", "null" })
@SuppressWarnings("unchecked")
private boolean greaterThanOrEqualsToItemState(String itemName, String state) throws ItemNotFoundException {
Item item = itemRegistry.getItem(itemName);
State compareState = TypeParser.parseState(item.getAcceptedDataTypes(), state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.*;

import java.util.Map;

Expand All @@ -27,6 +24,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
Expand Down Expand Up @@ -56,6 +54,8 @@ public class SystemTriggerHandlerTest {

private @Mock @NonNullByDefault({}) Trigger triggerMock;

private @Captor @NonNullByDefault({}) ArgumentCaptor<Map<String, Object>> captor;

@BeforeEach
public void setup() {
when(triggerMock.getConfiguration())
Expand Down Expand Up @@ -96,10 +96,9 @@ public void testDoesTriggerIfStartLevelEventHigher() {
Event event = SystemEventFactory.createStartlevelEvent(100);
triggerHandler.receive(event);

ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
verify(callbackMock).triggered(eq(triggerMock), captor.capture());

Map<String, Object> configuration = (Map<String, Object>) captor.getValue();
Map<String, Object> configuration = captor.getValue();
assertThat(configuration.get(SystemTriggerHandler.OUT_STARTLEVEL), is(CFG_STARTLEVEL));
}

Expand All @@ -113,10 +112,9 @@ public void testDoesNotTriggerAfterEventTrigger() {
Event event = SystemEventFactory.createStartlevelEvent(100);
triggerHandler.receive(event);

ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
verify(callbackMock).triggered(eq(triggerMock), captor.capture());

Map<String, Object> configuration = (Map<String, Object>) captor.getValue();
Map<String, Object> configuration = captor.getValue();
assertThat(configuration.get(SystemTriggerHandler.OUT_STARTLEVEL), is(CFG_STARTLEVEL));

triggerHandler.receive(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public ConfigDescriptionParameterGroupBuilder withDescription(@Nullable String d
*
* @return the desired result
*/
@SuppressWarnings("deprecation")
public ConfigDescriptionParameterGroup build() throws IllegalArgumentException {
return new ConfigDescriptionParameterGroup(name, context, advanced != null ? advanced : false, label,
description);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*/
public class ConfigurationSerializer implements JsonSerializer<Configuration> {

@SuppressWarnings("unchecked")
@Override
public JsonElement serialize(Configuration src, Type typeOfSrc, JsonSerializationContext context) {
JsonObject result = new JsonObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ public class SysfsUsbSerialScanner implements UsbSerialScanner {

private static final String SYSFS_TTY_DEVICES_DIRECTORY_DEFAULT = "/sys/class/tty";
private static final String DEV_DIRECTORY_DEFAULT = "/dev";
private static final String DEV_SERIAL_BY_ID_DIRECTORY = DEV_DIRECTORY_DEFAULT + "/serial/by-id";
private static final String SERIAL_BY_ID_DIRECTORY = "/serial/by-id";

private String sysfsTtyDevicesDirectory = SYSFS_TTY_DEVICES_DIRECTORY_DEFAULT;
private String devDirectory = DEV_DIRECTORY_DEFAULT;
private String devSerialByIdDirectory = DEV_DIRECTORY_DEFAULT + SERIAL_BY_ID_DIRECTORY;

private static final String SYSFS_FILENAME_USB_VENDOR_ID = "idVendor";
private static final String SYSFS_FILENAME_USB_PRODUCT_ID = "idProduct";
Expand Down Expand Up @@ -151,7 +152,7 @@ private Set<SerialPortInfo> getSerialPortInfos() throws IOException {
}

// optionally compute links and their corresponding SerialInfo :
Path devSerialDir = Path.of(DEV_SERIAL_BY_ID_DIRECTORY);
Path devSerialDir = Path.of(devSerialByIdDirectory);
if (exists(devSerialDir) && isDirectory(devSerialDir) && isReadable(devSerialDir)) {
// browse serial/by-id directory :
try (DirectoryStream<Path> directoryStream = newDirectoryStream(devSerialDir)) {
Expand Down Expand Up @@ -284,6 +285,7 @@ private void extractConfiguration(Map<String, Object> config) {
if (configurationIsChanged) {
sysfsTtyDevicesDirectory = newSysfsTtyDevicesDirectory;
devDirectory = newDevDirectory;
devSerialByIdDirectory = devDirectory + SERIAL_BY_ID_DIRECTORY;
}

if (!canPerformScans()) {
Expand Down
4 changes: 2 additions & 2 deletions bundles/org.openhab.core.io.jetty.certificate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.52</version>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.76</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@
import org.openhab.core.config.core.ConfigurableService;
import org.openhab.core.io.rest.JSONResponse;
import org.openhab.core.io.rest.RESTConstants;
import org.openhab.core.io.rest.auth.internal.*;
import org.openhab.core.io.rest.auth.internal.ExpiringUserSecurityContextCache;
import org.openhab.core.io.rest.auth.internal.JwtHelper;
import org.openhab.core.io.rest.auth.internal.JwtSecurityContext;
import org.openhab.core.io.rest.auth.internal.UserSecurityContext;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,19 @@ public Response getTagAndSubTags(final @Context Request request,
@Operation(operationId = "createSemanticTag", summary = "Creates a new semantic tag and adds it to the registry.", security = {
@SecurityRequirement(name = "oauth2", scopes = { "admin" }) }, responses = {
@ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = EnrichedSemanticTagDTO.class))),
@ApiResponse(responseCode = "400", description = "The tag identifier is invalid."),
@ApiResponse(responseCode = "400", description = "The tag identifier is invalid or the tag label is missing."),
@ApiResponse(responseCode = "409", description = "A tag with the same identifier already exists.") })
public Response create(
@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @Parameter(description = "language") @Nullable String language,
@Parameter(description = "tag data", required = true) EnrichedSemanticTagDTO data) {
final Locale locale = localeService.getLocale(language);

if (data.uid == null) {
if (data.uid == null || data.uid.isBlank()) {
return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Tag identifier is required!");
}
if (data.label == null || data.label.isBlank()) {
return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "Tag label is required!");
}

String uid = data.uid.trim();

Expand Down
Loading

0 comments on commit 4379d71

Please sign in to comment.