diff --git a/check/api/pom.xml b/check/api/pom.xml new file mode 100644 index 0000000000..0b4daf00fa --- /dev/null +++ b/check/api/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + + org.eclipse.daanse + org.eclipse.daanse.check + ${revision} + + org.eclipse.daanse.check.api + jar + + + + org.assertj + assertj-core + compile + ${assertj.version} + + + org.eclipse.daanse + org.eclipse.daanse.olap.api + 0.0.1-SNAPSHOT + + + org.eclipse.daanse + org.eclipse.daanse.check.assertj + 0.0.1-SNAPSHOT + + + diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/Check.java b/check/api/src/main/java/org/eclipse/daanse/check/api/Check.java new file mode 100644 index 0000000000..40f24a1897 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/Check.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api; + +import org.assertj.core.api.Condition; + +public interface Check{ + + Condition condition(); + +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/Selector.java b/check/api/src/main/java/org/eclipse/daanse/check/api/Selector.java new file mode 100644 index 0000000000..104143f819 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/Selector.java @@ -0,0 +1,9 @@ +package org.eclipse.daanse.check.api; + +import java.util.List; + +public interface Selector { + + List> checkList(); + +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/cube/CaptionCheck.java b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/CaptionCheck.java new file mode 100644 index 0000000000..646fdc12f6 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/CaptionCheck.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.cube; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.olap.api.element.Cube; + +public interface CaptionCheck extends Check { + +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/cube/CubeSelector.java b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/CubeSelector.java new file mode 100644 index 0000000000..580f9897e1 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/CubeSelector.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.cube; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.check.api.Selector; +import org.eclipse.daanse.olap.api.element.Cube; + +public interface CubeSelector extends Selector>{ + + String name(); //it's enough to take cube from context + +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/cube/DescriptionCheck.java b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/DescriptionCheck.java new file mode 100644 index 0000000000..f80d49bfe1 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/DescriptionCheck.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.cube; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.olap.api.element.Cube; + +public interface DescriptionCheck extends Check { + +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/cube/DimensionCheck.java b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/DimensionCheck.java new file mode 100644 index 0000000000..9c9ee29b31 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/DimensionCheck.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.cube; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.olap.api.element.Cube; + +public interface DimensionCheck extends Check { + +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/cube/DimensionCountCheck.java b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/DimensionCountCheck.java new file mode 100644 index 0000000000..d63bf9cb25 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/DimensionCountCheck.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.cube; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.olap.api.element.Cube; + +public interface DimensionCountCheck extends Check { + + int count(); + +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/cube/NameCheck.java b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/NameCheck.java new file mode 100644 index 0000000000..e9ac16ce5a --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/NameCheck.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.cube; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.olap.api.element.Cube; + +public interface NameCheck extends Check{ +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/cube/package-info.java b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/package-info.java new file mode 100644 index 0000000000..072e506577 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/cube/package-info.java @@ -0,0 +1,16 @@ +/* +* Copyright (c) 2025 Contributors to the Eclipse Foundation. +* +* 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/ +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* SmartCity Jena - initial +*/ + +@org.osgi.annotation.bundle.Export +@org.osgi.annotation.versioning.Version("0.0.1") +package org.eclipse.daanse.check.api.cube; diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/CaptionCheck.java b/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/CaptionCheck.java new file mode 100644 index 0000000000..62368803c1 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/CaptionCheck.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.dimension; + +import java.awt.Dimension; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.olap.api.element.Cube; + +public interface CaptionCheck extends Check { + + void captionCheck(Dimension cube); + +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/DescriptionCheck.java b/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/DescriptionCheck.java new file mode 100644 index 0000000000..c51527ec0a --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/DescriptionCheck.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.dimension; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.olap.api.element.Cube; +import org.eclipse.daanse.olap.api.element.Dimension; + +public interface DescriptionCheck extends Check { + +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/DimensionSelector.java b/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/DimensionSelector.java new file mode 100644 index 0000000000..83e0abd766 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/DimensionSelector.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.dimension; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.check.api.Selector; +import org.eclipse.daanse.olap.api.element.Dimension; + +public interface DimensionSelector extends Selector>{ + //it's enough to take cube from context + String cubeName(); + String name(); +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/NameCheck.java b/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/NameCheck.java new file mode 100644 index 0000000000..12093f3ec3 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/dimension/NameCheck.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.api.dimension; + +import org.eclipse.daanse.check.api.Check; +import org.eclipse.daanse.olap.api.element.Dimension; + +public interface NameCheck extends Check{ +} diff --git a/check/api/src/main/java/org/eclipse/daanse/check/api/package-info.java b/check/api/src/main/java/org/eclipse/daanse/check/api/package-info.java new file mode 100644 index 0000000000..2a4285ecb8 --- /dev/null +++ b/check/api/src/main/java/org/eclipse/daanse/check/api/package-info.java @@ -0,0 +1,16 @@ +/* +* Copyright (c) 2025 Contributors to the Eclipse Foundation. +* +* 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/ +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* SmartCity Jena - initial +*/ + +@org.osgi.annotation.bundle.Export +@org.osgi.annotation.versioning.Version("0.0.1") +package org.eclipse.daanse.check.api; diff --git a/check/assertj/pom.xml b/check/assertj/pom.xml new file mode 100644 index 0000000000..8fbab3e679 --- /dev/null +++ b/check/assertj/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + + org.eclipse.daanse + org.eclipse.daanse.check + ${revision} + + org.eclipse.daanse.check.assertj + jar + + + + org.assertj + assertj-core + compile + ${assertj.version} + + + org.eclipse.daanse + org.eclipse.daanse.olap.api + 0.0.1-SNAPSHOT + + + org.eclipse.daanse + org.eclipse.daanse.check.predicate + 0.0.1-SNAPSHOT + + + diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CatalogConditions.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CatalogConditions.java new file mode 100644 index 0000000000..849dc3024e --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CatalogConditions.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.CatalogPredicates; +import org.eclipse.daanse.olap.api.element.Catalog; + +public class CatalogConditions { + + public static Condition isExist = new Condition<>(CatalogPredicates.isExist(), "is exist"); + + public static Condition hasCubes = new Condition<>(CatalogPredicates.hasCubes(), "has cubes"); + + public static Condition hasDatabaseSchemas = new Condition<>(CatalogPredicates.hasDatabaseSchemas(), "has database schemas"); + + public static Condition hasDescription = new Condition<>(CatalogPredicates.hasDescription(), "has description"); + + public static Condition hasId = new Condition<>(CatalogPredicates.hasId(), "has id"); + + public static Condition hasMetaData = new Condition<>(CatalogPredicates.hasMetaData(), "has meta data"); + + public static Condition hasName = new Condition<>(CatalogPredicates.hasName(), "has name"); + + public static Condition hasParameters = new Condition<>(CatalogPredicates.hasParameters(), "has parameters"); + + public static Condition hasWarnings = new Condition<>(CatalogPredicates.hasWarnings(), "has warnings"); +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/ConnectionConditions.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/ConnectionConditions.java new file mode 100644 index 0000000000..2de298d02e --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/ConnectionConditions.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.ConnectionPredicates; +import org.eclipse.daanse.olap.api.Connection; + +public class ConnectionConditions { + + public static Condition isExist = new Condition<>(ConnectionPredicates.isExist(), "is exist"); + + public static Condition hasCatalog = new Condition<>(ConnectionPredicates.hasCatalog(), "has catalog"); + + public static Condition hasCatalogReader = new Condition<>(ConnectionPredicates.hasCatalogReader(), "has catalog reader"); + + public static Condition hasContext = new Condition<>(ConnectionPredicates.hasContext(), "has context"); + + public static Condition hasDataSource = new Condition<>(ConnectionPredicates.hasDataSource(), "has data source"); + + public static Condition hasRole = new Condition<>(ConnectionPredicates.hasRole(), "has role"); +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CubeCondition.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CubeCondition.java new file mode 100644 index 0000000000..d633080c6a --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CubeCondition.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.CubePredicates; +import org.eclipse.daanse.olap.api.element.Cube; + +public class CubeCondition extends Condition { + + public CubeCondition() { + super("valid cube"); + } + + @Override + public boolean matches(Cube cube) { + return CubePredicates.isExist().test(cube) + && CubePredicates.hasName().test(cube) + && CubePredicates.hasCaption().test(cube) + && CubePredicates.hasDescription().test(cube) + && CubePredicates.hasCatalog().test(cube); + } +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CubeConditions.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CubeConditions.java new file mode 100644 index 0000000000..997088a97c --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CubeConditions.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.CubePredicates; +import org.eclipse.daanse.olap.api.element.Cube; + +public class CubeConditions { + + public static Condition isExist = new Condition<>(CubePredicates.isExist(), "has cube"); + + public static Condition hasName = new Condition<>(CubePredicates.hasName(), "has name"); + + public static Condition hasDescription = new Condition<>(CubePredicates.hasDescription(), "has description"); + + public static Condition hasCaption = new Condition<>(CubePredicates.hasCaption(), "has caption"); + + public static Condition hasCatalog = new Condition<>(CubePredicates.hasCatalog(), "has catalog"); + + public static Condition hasHierarchies = new Condition<>(CubePredicates.hasHierarchies(), "has hierarchies"); + + public static Condition hasDimensions = new Condition<>(CubePredicates.hasDimensions(), "has dimensions"); + +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CubeWithNameExistInCatalogCondition.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CubeWithNameExistInCatalogCondition.java new file mode 100644 index 0000000000..9ff72a923f --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/CubeWithNameExistInCatalogCondition.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.CatalogPredicates; +import org.eclipse.daanse.olap.api.element.Catalog; + + +public class CubeWithNameExistInCatalogCondition extends Condition { + + public CubeWithNameExistInCatalogCondition(String name) { + super(CatalogPredicates.hasCubeWithName(name), "cube %s exist", name); + } +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/DimensionConditions.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/DimensionConditions.java new file mode 100644 index 0000000000..4f1e4c846d --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/DimensionConditions.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.DimensionPredicates; +import org.eclipse.daanse.olap.api.element.Dimension; + +public class DimensionConditions { + public static Condition isExist = new Condition<>(DimensionPredicates.isExist(), "has dimension"); + + public static Condition hasName = new Condition<>(DimensionPredicates.hasName(), "has name"); + + public static Condition hasDescription = new Condition<>(DimensionPredicates.hasDescription(), "has description"); + + public static Condition hasCatalog = new Condition<>(DimensionPredicates.hasCatalog(), "has catalog"); + + public static Condition hasHierarchies = new Condition<>(DimensionPredicates.hasHierarchies(), "has hierarchies"); + + public static Condition hasDimension = new Condition<>(DimensionPredicates.hasDimension(), "has dimension"); + + public static Condition hasCube = new Condition<>(DimensionPredicates.hasCube(), "has cube"); + + public static Condition hasDimensionType = new Condition<>(DimensionPredicates.hasDimensionType(), "has dimensionType"); + + public static Condition hasHierarchy = new Condition<>(DimensionPredicates.hasHierarchy(), "has hierarchy"); + + public static Condition hasMetaData = new Condition<>(DimensionPredicates.hasMetaData(), "has meta data"); + + public static Condition hasQualifiedName = new Condition<>(DimensionPredicates.hasQualifiedName(), "has qualified name"); + + public static Condition hasUniqueName = new Condition<>(DimensionPredicates.hasUniqueName(), "has unique name"); +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/DimensionCountInCubeCondition.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/DimensionCountInCubeCondition.java new file mode 100644 index 0000000000..4677ea93a7 --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/DimensionCountInCubeCondition.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.CubePredicates; +import org.eclipse.daanse.olap.api.element.Cube; + + +public class DimensionCountInCubeCondition extends Condition { + + public DimensionCountInCubeCondition(Integer count) { + super(CubePredicates.hasDimensionsCount(count), "Dimension count %d", count); + } +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/DimensionWithNameExistInCubeCondition.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/DimensionWithNameExistInCubeCondition.java new file mode 100644 index 0000000000..41a7ef5802 --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/DimensionWithNameExistInCubeCondition.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.CatalogPredicates; +import org.eclipse.daanse.check.predicate.CubePredicates; +import org.eclipse.daanse.olap.api.element.Catalog; +import org.eclipse.daanse.olap.api.element.Cube; + + +public class DimensionWithNameExistInCubeCondition extends Condition { + + public DimensionWithNameExistInCubeCondition(String name) { + super(CubePredicates.hasDimensionWithName(name), "Dimension %s exist", name); + } +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/HierarchyConditions.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/HierarchyConditions.java new file mode 100644 index 0000000000..18fac5bed7 --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/HierarchyConditions.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.HierarchyPredicates; +import org.eclipse.daanse.olap.api.element.Hierarchy; + +public class HierarchyConditions { + + public static Condition isExist = new Condition<>(HierarchyPredicates.isExist(), "is exist"); + + public static Condition hasCaption = new Condition<>(HierarchyPredicates.hasCaption(), "has caption"); + + public static Condition hasDescription = new Condition<>(HierarchyPredicates.hasDescription(), "has description"); + + public static Condition hasDimension = new Condition<>(HierarchyPredicates.hasDimension(), "has dimension"); + + public static Condition hasDisplayFolder = new Condition<>(HierarchyPredicates.hasDisplayFolder(), "has display folder"); + + public static Condition hasHierarchy = new Condition<>(HierarchyPredicates.hasHierarchy(), "has hierarchy"); + + public static Condition hasLevels = new Condition<>(HierarchyPredicates.hasLevels(), "has levels"); + + public static Condition hasMetaData = new Condition<>(HierarchyPredicates.hasMetaData(), "has meta data"); + + public static Condition hasName = new Condition<>(HierarchyPredicates.hasName(), "has name"); + + public static Condition hasNullMember = new Condition<>(HierarchyPredicates.hasNullMember(), "has null member"); + + public static Condition hasQualifiedName = new Condition<>(HierarchyPredicates.hasQualifiedName(), "has qualified name"); + + public static Condition hasUniqueName = new Condition<>(HierarchyPredicates.hasUniqueName(), "has unique name"); + + public static Condition hasRootMembers = new Condition<>(HierarchyPredicates.hasRootMembers(), "has root members"); + +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/HierarchyWithNameExistInDimensionCondition.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/HierarchyWithNameExistInDimensionCondition.java new file mode 100644 index 0000000000..100689df0f --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/HierarchyWithNameExistInDimensionCondition.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.DimensionPredicates; +import org.eclipse.daanse.olap.api.element.Dimension; + + +public class HierarchyWithNameExistInDimensionCondition extends Condition { + + public HierarchyWithNameExistInDimensionCondition(String name) { + super(DimensionPredicates.hasHierarchyWithName(name), "Hierarchy %s exist", name); + } +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/LevelConditions.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/LevelConditions.java new file mode 100644 index 0000000000..1c87d616c8 --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/LevelConditions.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.LevelPredicates; +import org.eclipse.daanse.olap.api.element.Level; + +public class LevelConditions { + + public static Condition isExist = new Condition<>(LevelPredicates.isExist(), "is exist"); + + public static Condition hasName = new Condition<>(LevelPredicates.hasName(), "has name"); + + public static Condition hasCaption = new Condition<>(LevelPredicates.hasCaption(), "has caption"); + + public static Condition hasChaildLevel = new Condition<>(LevelPredicates.hasChaildLevel(), "has chaild level"); + + public static Condition hasDescription = new Condition<>(LevelPredicates.hasDescription(), "has description"); + + public static Condition hasDimension = new Condition<>(LevelPredicates.hasDimension(), "has dimension"); + + public static Condition hasHierarchy = new Condition<>(LevelPredicates.hasHierarchy(), "has hierarchy"); + + public static Condition hasInheritedProperties = new Condition<>(LevelPredicates.hasInheritedProperties(), "has inherited properties"); + + public static Condition hasLevelType = new Condition<>(LevelPredicates.hasLevelType(), "has level type"); + + public static Condition hasMemberFormatter = new Condition<>(LevelPredicates.hasMemberFormatter(), "has member formatter"); + + public static Condition hasMembers = new Condition<>(LevelPredicates.hasMembers(), "has members"); + + public static Condition hasMetaData = new Condition<>(LevelPredicates.hasMetaData(), "has meta data"); + + public static Condition hasOrdinalExp = new Condition<>(LevelPredicates.hasOrdinalExp(), "has ordinal exp"); + + public static Condition hasParentAsLeafNameFormat = new Condition<>(LevelPredicates.hasParentAsLeafNameFormat(), "has parent as leaf name format"); + + public static Condition hasProperties = new Condition<>(LevelPredicates.hasProperties(), "has properties"); + + public static Condition hasQualifiedName = new Condition<>(LevelPredicates.hasQualifiedName(), "has qualified name"); + + public static Condition hasUniqueName = new Condition<>(LevelPredicates.hasUniqueName(), "has unique name"); + //... +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/LevelWithNameExistInHierarchyCondition.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/LevelWithNameExistInHierarchyCondition.java new file mode 100644 index 0000000000..83bf9632a9 --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/LevelWithNameExistInHierarchyCondition.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.assertj; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.predicate.HierarchyPredicates; +import org.eclipse.daanse.olap.api.element.Hierarchy; + + +public class LevelWithNameExistInHierarchyCondition extends Condition { + + public LevelWithNameExistInHierarchyCondition(String name) { + super(HierarchyPredicates.hasLevelWithName(name), "Hierarchy %s exist", name); + } +} diff --git a/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/package-info.java b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/package-info.java new file mode 100644 index 0000000000..bdf98df4d4 --- /dev/null +++ b/check/assertj/src/main/java/org/eclipse/daanse/check/assertj/package-info.java @@ -0,0 +1,16 @@ +/* +* Copyright (c) 2025 Contributors to the Eclipse Foundation. +* +* 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/ +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* SmartCity Jena - initial +*/ + +@org.osgi.annotation.bundle.Export +@org.osgi.annotation.versioning.Version("0.0.1") +package org.eclipse.daanse.check.assertj; diff --git a/check/emf/pom.xml b/check/emf/pom.xml new file mode 100644 index 0000000000..9f3c9ebe48 --- /dev/null +++ b/check/emf/pom.xml @@ -0,0 +1,13 @@ + + 4.0.0 + + org.eclipse.daanse + org.eclipse.daanse.check + ${revision} + + org.eclipse.daanse.check.emf + jar + + diff --git a/check/emf/src/main/java/org/eclipse/daanse/check/emf/package-info.java b/check/emf/src/main/java/org/eclipse/daanse/check/emf/package-info.java new file mode 100644 index 0000000000..96d508df5b --- /dev/null +++ b/check/emf/src/main/java/org/eclipse/daanse/check/emf/package-info.java @@ -0,0 +1,16 @@ +/* +* Copyright (c) 2025 Contributors to the Eclipse Foundation. +* +* 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/ +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* SmartCity Jena - initial +*/ + +@org.osgi.annotation.bundle.Export +@org.osgi.annotation.versioning.Version("0.0.1") +package org.eclipse.daanse.check.emf; diff --git a/check/impl/pom.xml b/check/impl/pom.xml new file mode 100644 index 0000000000..1a5432e1b3 --- /dev/null +++ b/check/impl/pom.xml @@ -0,0 +1,36 @@ + + 4.0.0 + + org.eclipse.daanse + org.eclipse.daanse.check + ${revision} + + org.eclipse.daanse.check.impl + jar + + + + org.assertj + assertj-core + compile + ${assertj.version} + + + org.eclipse.daanse + org.eclipse.daanse.olap.api + 0.0.1-SNAPSHOT + + + org.eclipse.daanse + org.eclipse.daanse.check.api + 0.0.1-SNAPSHOT + + + org.eclipse.daanse + org.eclipse.daanse.check.assertj + 0.0.1-SNAPSHOT + + + diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/CaptionCheckR.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/CaptionCheckR.java new file mode 100644 index 0000000000..cb82ccd541 --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/CaptionCheckR.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.impl.cube; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.api.cube.CaptionCheck; +import org.eclipse.daanse.check.assertj.CubeConditions; +import org.eclipse.daanse.olap.api.element.Cube; + +public record CaptionCheckR() implements CaptionCheck { + + @Override + public Condition condition() { + return CubeConditions.hasCaption; + } +} diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/CubeSelectorR.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/CubeSelectorR.java new file mode 100644 index 0000000000..8b2b27f030 --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/CubeSelectorR.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.impl.cube; + +import java.util.List; + +import org.eclipse.daanse.check.api.cube.CubeSelector; + + +public record CubeSelectorR(String name, List checkList) implements CubeSelector{ + + public CubeSelectorR(String name) { + this(name, List.of(new NameCheckR(), + new DescriptionCheckR(), + new DimensionCheckR(), + new NameCheckR(), + new CaptionCheckR() + )); + } + +} diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/DescriptionCheckR.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/DescriptionCheckR.java new file mode 100644 index 0000000000..ec9f3013e8 --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/DescriptionCheckR.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.impl.cube; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.api.cube.DescriptionCheck; +import org.eclipse.daanse.check.assertj.CubeConditions; +import org.eclipse.daanse.olap.api.element.Cube; + +public record DescriptionCheckR() implements DescriptionCheck{ + + @Override + public Condition condition() { + return CubeConditions.hasDescription; + } + +} diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/DimensionCheckR.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/DimensionCheckR.java new file mode 100644 index 0000000000..f244bbc113 --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/DimensionCheckR.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.impl.cube; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.api.cube.DimensionCheck; +import org.eclipse.daanse.check.assertj.CubeConditions; +import org.eclipse.daanse.olap.api.element.Cube; + +public record DimensionCheckR() implements DimensionCheck{ + + @Override + public Condition condition() { + return CubeConditions.hasDimensions; + } + +} diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/DimensionCountCheckR.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/DimensionCountCheckR.java new file mode 100644 index 0000000000..0091025fba --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/DimensionCountCheckR.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.impl.cube; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.assertj.DimensionCountInCubeCondition; +import org.eclipse.daanse.check.api.cube.DimensionCountCheck; +import org.eclipse.daanse.olap.api.element.Cube; + +public record DimensionCountCheckR(int count) implements DimensionCountCheck { + + @Override + public Condition condition() { + return new DimensionCountInCubeCondition(count()); + } + +} diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/NameCheckR.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/NameCheckR.java new file mode 100644 index 0000000000..4bfe65437a --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/NameCheckR.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.impl.cube; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.api.cube.NameCheck; +import org.eclipse.daanse.check.assertj.CubeConditions; +import org.eclipse.daanse.olap.api.element.Cube; + +public record NameCheckR() implements NameCheck { + + @Override + public Condition condition() { + return CubeConditions.hasName; + } +} diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/package-info.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/package-info.java new file mode 100644 index 0000000000..51774068dd --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/cube/package-info.java @@ -0,0 +1,16 @@ +/* +* Copyright (c) 2025 Contributors to the Eclipse Foundation. +* +* 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/ +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* SmartCity Jena - initial +*/ + +@org.osgi.annotation.bundle.Export +@org.osgi.annotation.versioning.Version("0.0.1") +package org.eclipse.daanse.check.impl.cube; diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/DescriptionCheckR.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/DescriptionCheckR.java new file mode 100644 index 0000000000..aadf1302b9 --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/DescriptionCheckR.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.impl.dimension; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.api.dimension.DescriptionCheck; +import org.eclipse.daanse.check.assertj.DimensionConditions; +import org.eclipse.daanse.olap.api.element.Dimension; + +public record DescriptionCheckR() implements DescriptionCheck{ + + @Override + public Condition condition() { + return DimensionConditions.hasDescription; + } + +} diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/DimensionSelectorR.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/DimensionSelectorR.java new file mode 100644 index 0000000000..846a9af1bf --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/DimensionSelectorR.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.impl.dimension; + +import java.util.List; + +import org.eclipse.daanse.check.api.dimension.DimensionSelector; + + +public record DimensionSelectorR(String cubeName, String name, List checkList) implements DimensionSelector{ + + public DimensionSelectorR(String cubeName, String name) { + this(cubeName, name, List.of( + new DescriptionCheckR(), + new NameCheckR() + //... + )); + } + +} diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/NameCheckR.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/NameCheckR.java new file mode 100644 index 0000000000..0c38135139 --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/NameCheckR.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.impl.dimension; + +import org.assertj.core.api.Condition; +import org.eclipse.daanse.check.api.dimension.NameCheck; +import org.eclipse.daanse.check.assertj.DimensionConditions; +import org.eclipse.daanse.olap.api.element.Dimension; + +public record NameCheckR() implements NameCheck { + + @Override + public Condition condition() { + return DimensionConditions.hasName; + } +} diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/package-info.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/package-info.java new file mode 100644 index 0000000000..ea4aa16fba --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/dimension/package-info.java @@ -0,0 +1,16 @@ +/* +* Copyright (c) 2025 Contributors to the Eclipse Foundation. +* +* 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/ +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* SmartCity Jena - initial +*/ + +@org.osgi.annotation.bundle.Export +@org.osgi.annotation.versioning.Version("0.0.1") +package org.eclipse.daanse.check.impl.dimension; diff --git a/check/impl/src/main/java/org/eclipse/daanse/check/impl/package-info.java b/check/impl/src/main/java/org/eclipse/daanse/check/impl/package-info.java new file mode 100644 index 0000000000..6d7b9256d7 --- /dev/null +++ b/check/impl/src/main/java/org/eclipse/daanse/check/impl/package-info.java @@ -0,0 +1,16 @@ +/* +* Copyright (c) 2025 Contributors to the Eclipse Foundation. +* +* 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/ +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* SmartCity Jena - initial +*/ + +@org.osgi.annotation.bundle.Export +@org.osgi.annotation.versioning.Version("0.0.1") +package org.eclipse.daanse.check.impl; diff --git a/check/pom.xml b/check/pom.xml new file mode 100644 index 0000000000..8439f09e3f --- /dev/null +++ b/check/pom.xml @@ -0,0 +1,32 @@ + + + + 4.0.0 + + org.eclipse.daanse + org.eclipse.daanse.pom.parent + ${revision} + + org.eclipse.daanse.check + pom + + 3.24.2 + + + api + emf + predicate + assertj + impl + + diff --git a/check/predicate/pom.xml b/check/predicate/pom.xml new file mode 100644 index 0000000000..a3810bb32d --- /dev/null +++ b/check/predicate/pom.xml @@ -0,0 +1,20 @@ + + 4.0.0 + + org.eclipse.daanse + org.eclipse.daanse.check + ${revision} + + org.eclipse.daanse.check.predicate + jar + + + + org.eclipse.daanse + org.eclipse.daanse.olap.api + 0.0.1-SNAPSHOT + + + diff --git a/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/CatalogPredicates.java b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/CatalogPredicates.java new file mode 100644 index 0000000000..dabd994f0d --- /dev/null +++ b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/CatalogPredicates.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.predicate; + +import java.util.function.Predicate; + +import org.eclipse.daanse.olap.api.element.Catalog; + +public class CatalogPredicates { + + public static Predicate isExist() { + return c -> c != null; + } + + public static Predicate hasCubes() { + return c -> c.getCubes() != null && c.getCubes().size() > 0; + } + + public static Predicate hasDatabaseSchemas() { + return c -> c.getDatabaseSchemas() != null && c.getDatabaseSchemas().size() > 0; + } + + public static Predicate hasDescription() { + return c -> c.getDescription() != null; + } + + public static Predicate hasId() { + return c -> c.getId() != null; + } + + public static Predicate hasMetaData() { + return c -> c.getMetaData() != null; + } + + public static Predicate hasName() { + return c -> c.getName() != null; + } + + public static Predicate hasParameters() { + return c -> c.getParameters() != null && c.getParameters().length > 0; + } + + public static Predicate hasWarnings() { + return c -> c.getWarnings() != null && c.getWarnings().size() > 0; + } + + public static Predicate hasCubeWithName(String name) { + return c -> c != null && c.getCubes() != null && c.getCubes().stream().anyMatch(cube -> name.equals(cube.getName())); + } + +} diff --git a/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/ConnectionPredicates.java b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/ConnectionPredicates.java new file mode 100644 index 0000000000..45d53ad77a --- /dev/null +++ b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/ConnectionPredicates.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.predicate; + +import java.util.function.Predicate; + +import org.eclipse.daanse.olap.api.Connection; + +public class ConnectionPredicates { + + public static Predicate isExist() { + return c -> c != null; + } + + public static Predicate hasCatalog() { + return c -> c.getCatalog() != null; + } + + public static Predicate hasCatalogReader() { + return c -> c.getCatalogReader() != null; + } + + public static Predicate hasContext() { + return c -> c.getContext() != null; + } + + public static Predicate hasDataSource() { + return c -> c.getDataSource() != null; + } + + public static Predicate hasRole() { + return c -> c.getRole() != null; + } + + //... +} diff --git a/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/ContextPredicates.java b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/ContextPredicates.java new file mode 100644 index 0000000000..ed5da67be9 --- /dev/null +++ b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/ContextPredicates.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.predicate; + +import java.util.function.Predicate; + +import org.eclipse.daanse.olap.api.Context; + +public class ContextPredicates { + + public static Predicate> isExist() { + return c -> c != null; + } + + public static Predicate> hasDataSource() { + return c -> c.getDataSource() != null; + } + + public static Predicate> hasDescription() { + return c -> c.getDescription() != null; + } + + public static Predicate> hasDialect() { + return c -> c.getDialect() != null; + } + + public static Predicate> hasExpressionCompilerFactory() { + return c -> c.getExpressionCompilerFactory() != null; + } + + public static Predicate> hasName() { + return c -> c.getName() != null; + } + + public static Predicate> hasMdxParserProvider() { + return c -> c.getMdxParserProvider() != null; + } + + public static Predicate> hasSqlGuardFactory() { + return c -> c.getSqlGuardFactory() != null && c.getSqlGuardFactory().isPresent(); + } + +} diff --git a/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/CubePredicates.java b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/CubePredicates.java new file mode 100644 index 0000000000..6ec782f39f --- /dev/null +++ b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/CubePredicates.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.predicate; + +import java.util.Optional; +import java.util.function.Function; +import java.util.function.Predicate; +import org.eclipse.daanse.olap.api.element.Cube; +import org.eclipse.daanse.olap.api.element.Dimension; + +public final class CubePredicates { + + public static Predicate isExist() { + return c -> c != null; + } + + public static Predicate hasName() { + return c -> c.getName() != null; + } + + public static Predicate hasCaption() { + return c -> c.getCaption() != null; + } + + public static Predicate hasCatalog() { + return c -> c.getCatalog() != null; + } + + public static Predicate hasDescription() { + return c -> c.getDescription() != null; + } + + public static Predicate hasDimensions() { + return c -> c.getDimensions() != null && !c.getDimensions().isEmpty(); + } + + public static Function> selectDimensionsByName(String name) { + return c -> c.getDimensions() != null ? c.getDimensions().stream().filter(d -> name.equals(d.getName())).findFirst() : Optional.empty(); + } + + public static Function> selectDimensionsByUniqueName(String uniqueName) { + return c -> c.getDimensions() != null ? c.getDimensions().stream().filter(d -> uniqueName.equals(d.getUniqueName())).findFirst() : Optional.empty(); + } + + public static Predicate hasHierarchies() { + return c -> c.getHierarchies() != null && !c.getHierarchies().isEmpty(); + } + + public static Predicate hasDimensionWithName(String name) { + return c -> c.getDimensions() != null && c.getDimensions().stream().anyMatch(d -> name.equals(d.getName())); + } + + public static Predicate hasDimensionsCount(Integer count) { + return c -> c.getDimensions() != null && c.getDimensions().size() == count; + } + +} diff --git a/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/DimensionPredicates.java b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/DimensionPredicates.java new file mode 100644 index 0000000000..9c1f8d5285 --- /dev/null +++ b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/DimensionPredicates.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.predicate; + +import java.util.Optional; +import java.util.function.Function; +import java.util.function.Predicate; + +import org.eclipse.daanse.olap.api.element.Dimension; +import org.eclipse.daanse.olap.api.element.Hierarchy; + +public class DimensionPredicates { + + public static Predicate isExist() { + return d -> d != null; + } + + public static Predicate hasName() { + return d -> d.getName() != null; + } + + public static Predicate hasDescription() { + return d -> d.getDescription() != null; + } + + public static Predicate hasHierarchies() { + return d -> d.getHierarchies() != null && !d.getHierarchies().isEmpty(); + } + + public static Predicate hasHierarchy() { + return d -> d.getHierarchy() != null; + } + + public static Predicate hasDimension() { + return d -> d.getDimension() != null; + } + + public static Predicate hasDimensionType() { + return d -> d.getDimensionType() != null; + } + + public static Predicate hasUniqueName() { + return d -> d.getUniqueName() != null; + } + + public static Predicate hasQualifiedName() { + return d -> d.getQualifiedName() != null; + } + + public static Predicate hasMetaData() { + return d -> d.getMetaData() != null; + } + + public static Predicate hasCatalog() { + return d -> d.getCatalog() != null; + } + + public static Predicate hasCube() { + return d -> d.getCube() != null; + } + + public static Predicate isVisible() { + return d -> d.isVisible(); + } + + public static Predicate isMeasures() { + return d -> d.isMeasures(); + } + + public static Function> selectHierarchyByName(String name) { + return d -> d.getHierarchies() != null ? d.getHierarchies().stream().filter(h -> name.equals(h.getName())).findFirst() : Optional.empty(); + } + + public static Function> selectHierarchyByUniqueName(String name) { + return d -> d.getHierarchies() != null ? d.getHierarchies().stream().filter(h -> name.equals(h.getUniqueName())).findFirst() : Optional.empty(); + } + + public static Predicate hasHierarchyWithName(String name) { + return d -> d.getHierarchies() != null && d.getHierarchies().stream().anyMatch(h -> name.equals(h.getName())); + } + +} diff --git a/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/HierarchyPredicates.java b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/HierarchyPredicates.java new file mode 100644 index 0000000000..f01707ef76 --- /dev/null +++ b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/HierarchyPredicates.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.predicate; + +import java.util.function.Predicate; + +import org.eclipse.daanse.olap.api.element.Hierarchy; +import org.eclipse.daanse.olap.api.element.Level; + +public class HierarchyPredicates { + + public static Predicate isExist() { + return h -> h != null; + } + + public static Predicate hasName() { + return h -> h.getName() != null; + } + + public static Predicate hasCaption() { + return h -> h.getCaption() != null; + } + + public static Predicate hasDescription() { + return h -> h.getDescription() != null; + } + + public static Predicate hasLevels() { + return h -> h.getLevels() != null && !h.getLevels().isEmpty(); + } + + public static Predicate hasDimension() { + return h -> h.getDimension() != null; + } + + public static Predicate hasDisplayFolder() { + return h -> h.getDisplayFolder() != null; + } + + public static Predicate hasHierarchy() { + return h -> h.getHierarchy() != null; + } + + public static Predicate hasMetaData() { + return h -> h.getMetaData() != null; + } + + public static Predicate hasNullMember() { + return h -> h.getNullMember() != null; + } + + public static Predicate isOrdinalInCube(int order) { + return h -> h.getOrdinalInCube() == order; + } + + public static Predicate hasQualifiedName() { + return h -> h.getQualifiedName() != null; + } + + public static Predicate hasRootMembers() { + return h -> h.getRootMembers() != null && !h.getRootMembers().isEmpty(); + } + + public static Predicate hasUniqueName() { + return h -> h.getUniqueName() != null; + } + + public static Predicate hasLevelWithName(String name) { + return h -> h.getLevels() != null && h.getLevels().stream().anyMatch(l -> name.equals(l.getName())); + } + +} diff --git a/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/LevelPredicates.java b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/LevelPredicates.java new file mode 100644 index 0000000000..2970f7a100 --- /dev/null +++ b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/LevelPredicates.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.predicate; + +import java.util.function.Predicate; + +import org.eclipse.daanse.olap.api.element.Level; + +public class LevelPredicates { + + public static Predicate isExist() { + return l -> l != null; + } + + public static Predicate hasName() { + return l -> l.getName() != null; + } + + public static Predicate hasCaption() { + return l -> l.getCaption() != null; + } + + public static Predicate hasChaildLevel() { + return l -> l.getChildLevel() != null; + } + + public static Predicate hasDescription() { + return l -> l.getDescription() != null; + } + + public static Predicate hasDimension() { + return l -> l.getDimension() != null; + } + + public static Predicate hasHierarchy() { + return l -> l.getHierarchy() != null; + } + + public static Predicate hasInheritedProperties() { + return l -> l.getInheritedProperties() != null && l.getInheritedProperties().length > 0; + } + + public static Predicate hasLevelType() { + return l -> l.getLevelType() != null; + } + + public static Predicate hasMemberFormatter() { + return l -> l.getMemberFormatter() != null; + } + + public static Predicate hasMembers() { + return l -> l.getMembers() != null && l.getMembers().size() > 0; + } + + public static Predicate hasMetaData() { + return l -> l.getMetaData() != null; + } + + public static Predicate hasOrdinalExp() { + return l -> l.getOrdinalExp() != null; + } + + public static Predicate hasParentAsLeafNameFormat() { + return l -> l.getParentAsLeafNameFormat() != null; + } + + public static Predicate hasProperties() { + return l -> l.getProperties() != null && l.getProperties().length > 0; + } + + public static Predicate hasQualifiedName() { + return l -> l.getQualifiedName() != null; + } + + public static Predicate hasUniqueName() { + return l -> l.getUniqueName() != null; + } +} diff --git a/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/MemberPredicates.java b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/MemberPredicates.java new file mode 100644 index 0000000000..0e37cbb9b9 --- /dev/null +++ b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/MemberPredicates.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Contributors to the Eclipse Foundation. + * + * 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/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena, Stefan Bischof - initial + * + */ +package org.eclipse.daanse.check.predicate; + +import java.util.function.Predicate; + +import org.eclipse.daanse.olap.api.element.Member; + +public class MemberPredicates { + + public static Predicate isExist() { + return m -> m != null; + } + + public static Predicate hasCaption() { + return m -> m.getCaption() != null; + } + + public static Predicate hasDataMember() { + return m -> m.getDataMember() != null; + } + + public static Predicate hasDescription() { + return m -> m.getDescription() != null; + } + + public static Predicate hasDimension() { + return m -> m.getDimension() != null; + } + + public static Predicate hasExpression() { + return m -> m.getExpression() != null; + } + + public static Predicate hasHierarchy() { + return m -> m.getHierarchy() != null; + } + + public static Predicate hasLevel() { + return m -> m.getLevel() != null; + } + + public static Predicate hasMemberType() { + return m -> m.getMemberType() != null; + } + + public static Predicate hasMetaData() { + return m -> m.getMetaData() != null; + } + + public static Predicate hasName() { + return m -> m.getName() != null; + } + + public static Predicate hasParentMember() { + return m -> m.getParentMember() != null; + } + + public static Predicate hasParentUniqueName() { + return m -> m.getParentUniqueName() != null; + } + + public static Predicate hasProperties() { + return m -> m.getProperties() != null && m.getProperties().length > 0; + } + + public static Predicate hasQualifiedName() { + return m -> m.getQualifiedName() != null; + } + + public static Predicate hasUniqueName() { + return m -> m.getUniqueName() != null; + } + +} diff --git a/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/package-info.java b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/package-info.java new file mode 100644 index 0000000000..b6c31b8928 --- /dev/null +++ b/check/predicate/src/main/java/org/eclipse/daanse/check/predicate/package-info.java @@ -0,0 +1,16 @@ +/* +* Copyright (c) 2025 Contributors to the Eclipse Foundation. +* +* 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/ +* +* SPDX-License-Identifier: EPL-2.0 +* +* Contributors: +* SmartCity Jena - initial +*/ + +@org.osgi.annotation.bundle.Export +@org.osgi.annotation.versioning.Version("0.0.1") +package org.eclipse.daanse.check.predicate; diff --git a/pom.xml b/pom.xml index c8bd84ba57..f42fa02f0f 100644 --- a/pom.xml +++ b/pom.xml @@ -959,6 +959,7 @@ demo org.eclipse.daanse.repackage.dockerjava org.eclipse.daanse.repackage.testcontainers.core + check