From 237251cc183ae72b3598730d1f3cd465c158e363 Mon Sep 17 00:00:00 2001 From: Mateus Molina Date: Wed, 4 Sep 2024 12:19:39 +0200 Subject: [PATCH] Fix minor issues --- .../TestInMemorySubmodelService.java | 50 +++++++++++++++++++ .../TestMongoDBSubmodelService.java | 27 ---------- .../pom.xml | 5 -- .../TestMongoDBSubmodelService.java | 2 - 4 files changed, 50 insertions(+), 34 deletions(-) create mode 100644 basyx.submodelservice/basyx.submodelservice-backend-inmemory/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestInMemorySubmodelService.java delete mode 100644 basyx.submodelservice/basyx.submodelservice-backend-inmemory/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestMongoDBSubmodelService.java diff --git a/basyx.submodelservice/basyx.submodelservice-backend-inmemory/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestInMemorySubmodelService.java b/basyx.submodelservice/basyx.submodelservice-backend-inmemory/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestInMemorySubmodelService.java new file mode 100644 index 000000000..736d3e8a1 --- /dev/null +++ b/basyx.submodelservice/basyx.submodelservice-backend-inmemory/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestInMemorySubmodelService.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (C) 2023 the Eclipse BaSyx Authors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * SPDX-License-Identifier: MIT + ******************************************************************************/ + + +package org.eclipse.digitaltwin.basyx.submodelservice; + +import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; +import org.eclipse.digitaltwin.basyx.core.filerepository.InMemoryFileRepository; + +/** + * + * @author schnicke + * + */ +public class TestInMemorySubmodelService extends SubmodelServiceSuite { + + @Override + protected SubmodelService getSubmodelService(Submodel submodel) { + return new InMemorySubmodelServiceFactory(new InMemoryFileRepository()).create(submodel); + } + + @Override + protected boolean fileExistsInStorage(String fileValue) { + java.io.File file = new java.io.File(fileValue); + + return file.exists(); + } +} \ No newline at end of file diff --git a/basyx.submodelservice/basyx.submodelservice-backend-inmemory/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestMongoDBSubmodelService.java b/basyx.submodelservice/basyx.submodelservice-backend-inmemory/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestMongoDBSubmodelService.java deleted file mode 100644 index 55727121d..000000000 --- a/basyx.submodelservice/basyx.submodelservice-backend-inmemory/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestMongoDBSubmodelService.java +++ /dev/null @@ -1,27 +0,0 @@ - - - -package org.eclipse.digitaltwin.basyx.submodelservice; - -import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; -import org.eclipse.digitaltwin.basyx.core.filerepository.InMemoryFileRepository; - -/** - * - * @author zhangzai - * - */ -public class TestMongoDBSubmodelService extends SubmodelServiceSuite { - - @Override - protected SubmodelService getSubmodelService(Submodel submodel) { - return new InMemorySubmodelServiceFactory(new InMemoryFileRepository()).create(submodel); - } - - @Override - protected boolean fileExistsInStorage(String fileValue) { - java.io.File file = new java.io.File(fileValue); - - return file.exists(); - } -} diff --git a/basyx.submodelservice/basyx.submodelservice-backend-mongodb/pom.xml b/basyx.submodelservice/basyx.submodelservice-backend-mongodb/pom.xml index 16cdb12db..621d3b62a 100644 --- a/basyx.submodelservice/basyx.submodelservice-backend-mongodb/pom.xml +++ b/basyx.submodelservice/basyx.submodelservice-backend-mongodb/pom.xml @@ -30,17 +30,12 @@ org.eclipse.digitaltwin.basyx basyx.mongodbcore - - org.apache.tika - tika-core - org.eclipse.digitaltwin.basyx basyx.filerepository-backend-mongodb - org.springframework spring-context diff --git a/basyx.submodelservice/basyx.submodelservice-backend-mongodb/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestMongoDBSubmodelService.java b/basyx.submodelservice/basyx.submodelservice-backend-mongodb/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestMongoDBSubmodelService.java index c13bee13e..ccd30dcaf 100644 --- a/basyx.submodelservice/basyx.submodelservice-backend-mongodb/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestMongoDBSubmodelService.java +++ b/basyx.submodelservice/basyx.submodelservice-backend-mongodb/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/TestMongoDBSubmodelService.java @@ -58,8 +58,6 @@ public void clear() { MongoDBUtilities.clearCollection(TEMPLATE, COLLECTION); } - - @Override protected SubmodelService getSubmodelService(Submodel submodel) { BasyxMongoMappingContext mappingContext = new BasyxMongoMappingContext();