diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index f90afdad46..0894c04cdc 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -7,6 +7,7 @@ - https://github.com/eclipse-sirius/sirius-components/issues/1311[#1311] [releng] Allow reusing `sirius-components-emf` without dependencies to the domain or view DSL. As a result, two new projects `sirius-components-domain-emf` and `sirius-components-view-emf` have been introduced in order to connect the EMF compatibility layer with the domain and view DSL. Consumers of `sirius-components-emf` may have to update their import. The behavior of the code has not been modified - https://github.com/eclipse-sirius/sirius-components/issues/1311[#1311] [releng] Allow reusing `sirius-component-emf` without dependencies to Sirius Desktop. As a result, a new project `sirius-components-compatibility-emf` has been added in order to provide EMF support for the Sirius desktop compatibility layer. Consumers of `sirius-components-emf` may have to update their import. The behavior of the code has not been modified - https://github.com/eclipse-sirius/sirius-components/issues/1237[#1237] [releng] Remove the two hardcoded dependencies to Spring MVC from Sirius Components. As such, reusing most components from Sirius Components without Spring MVC will be easier. The only projects with a dependency to Spring MVC are located in the `web` package +- https://github.com/eclipse-sirius/sirius-components/issues/1312[#1312] [graphql] Provide the datafetchers used by the representations. Starting with the validation representation, we will provide datafetchers directly in Sirius Components to simplify the integration of Sirius Components in various applications. The project `sirius-components-graphql-utils` has been merged into `sirius-components-graphql-utils` since they had similar dependencies. === Improvements diff --git a/packages/core/backend/sirius-components-graphql-api/pom.xml b/packages/core/backend/sirius-components-graphql-api/pom.xml index 132dbd4a7b..a907826c0a 100644 --- a/packages/core/backend/sirius-components-graphql-api/pom.xml +++ b/packages/core/backend/sirius-components-graphql-api/pom.xml @@ -46,11 +46,25 @@ graphql-java ${graphql-java.version} + + io.projectreactor + reactor-core + org.eclipse.sirius sirius-components-annotations-spring 2022.7.1 + + org.eclipse.sirius + sirius-components-core + 2022.7.0 + + + org.eclipse.sirius + sirius-components-collaborative + 2022.7.0 + diff --git a/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/IEventProcessorSubscriptionProvider.java b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/IEventProcessorSubscriptionProvider.java new file mode 100644 index 0000000000..eab312f11d --- /dev/null +++ b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/IEventProcessorSubscriptionProvider.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2022 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.components.graphql.api; + +import org.eclipse.sirius.components.collaborative.api.IRepresentationConfiguration; +import org.eclipse.sirius.components.collaborative.api.IRepresentationEventProcessor; +import org.eclipse.sirius.components.core.api.IInput; +import org.eclipse.sirius.components.core.api.IPayload; + +import reactor.core.publisher.Flux; + +/** + * Used to retrieve subscriptions. + * + * @author sbegaudeau + */ +public interface IEventProcessorSubscriptionProvider { + Flux getSubscription(String editingContextId, Class representationEventProcessorClass, + IRepresentationConfiguration representationConfiguration, IInput input); + + /** + * Implementation which does nothing, used for mocks in unit tests. + * + * @author sbegaudeau + */ + class NoOp implements IEventProcessorSubscriptionProvider { + + @Override + public Flux getSubscription(String editingContextId, Class representationEventProcessorClass, + IRepresentationConfiguration representationConfiguration, IInput input) { + return Flux.empty(); + } + + } +} diff --git a/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/IExceptionWrapper.java b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/IExceptionWrapper.java new file mode 100644 index 0000000000..354b2793a9 --- /dev/null +++ b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/IExceptionWrapper.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2022 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.components.graphql.api; + +import java.util.List; +import java.util.Optional; +import java.util.function.Supplier; + +import org.eclipse.sirius.components.core.api.IInput; +import org.eclipse.sirius.components.core.api.IPayload; + +import graphql.relay.Connection; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Used to encapsulate calls to methods which may throw exceptions. This wrapper will make sure that a default result is + * properly returned instead of having to repeat a default response in all the data fetchers. + * + * @author sbegaudeau + */ +public interface IExceptionWrapper { + Flux wrapFlux(Supplier> supplier, IInput input); + + IPayload wrap(Supplier supplier, IInput input); + + List wrapList(Supplier> supplier); + + Optional wrapOptional(Supplier> supplier); + + Connection wrapConnection(Supplier> supplier); + + Mono wrapMono(Supplier> supplier, IInput input); + + /** + * Implementation which does nothing, used for mocks in unit tests. + * + * @author sbegaudeau + */ + class NoOp implements IExceptionWrapper { + + @Override + public Flux wrapFlux(Supplier> supplier, IInput input) { + return Flux.empty(); + } + + @Override + public IPayload wrap(Supplier supplier, IInput input) { + return null; + } + + @Override + public List wrapList(Supplier> supplier) { + return List.of(); + } + + @Override + public Optional wrapOptional(Supplier> supplier) { + return Optional.empty(); + } + + @Override + public Connection wrapConnection(Supplier> supplier) { + return null; + } + + @Override + public Mono wrapMono(Supplier> supplier, IInput input) { + return Mono.empty(); + } + + } +} diff --git a/packages/core/backend/sirius-components-graphql-utils/src/main/java/org/eclipse/sirius/components/graphql/utils/typeresolvers/ReflectiveTypeResolver.java b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/ReflectiveTypeResolver.java similarity index 91% rename from packages/core/backend/sirius-components-graphql-utils/src/main/java/org/eclipse/sirius/components/graphql/utils/typeresolvers/ReflectiveTypeResolver.java rename to packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/ReflectiveTypeResolver.java index c82857d987..cb0c685738 100644 --- a/packages/core/backend/sirius-components-graphql-utils/src/main/java/org/eclipse/sirius/components/graphql/utils/typeresolvers/ReflectiveTypeResolver.java +++ b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/ReflectiveTypeResolver.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Obeo. + * Copyright (c) 2019, 2022 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -10,7 +10,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.components.graphql.utils.typeresolvers; +package org.eclipse.sirius.components.graphql.api; import graphql.TypeResolutionEnvironment; import graphql.schema.GraphQLObjectType; diff --git a/packages/core/backend/sirius-components-graphql-utils/src/main/java/org/eclipse/sirius/components/graphql/utils/types/UploadScalarCoercing.java b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/UploadScalarCoercing.java similarity index 92% rename from packages/core/backend/sirius-components-graphql-utils/src/main/java/org/eclipse/sirius/components/graphql/utils/types/UploadScalarCoercing.java rename to packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/UploadScalarCoercing.java index 25a3cbeb1e..c3269ffcaa 100644 --- a/packages/core/backend/sirius-components-graphql-utils/src/main/java/org/eclipse/sirius/components/graphql/utils/types/UploadScalarCoercing.java +++ b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/UploadScalarCoercing.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Obeo. + * Copyright (c) 2019, 2022 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -10,7 +10,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.components.graphql.utils.types; +package org.eclipse.sirius.components.graphql.api; import graphql.schema.Coercing; import graphql.schema.CoercingParseLiteralException; diff --git a/packages/core/backend/sirius-components-graphql-utils/src/main/java/org/eclipse/sirius/components/graphql/utils/types/UploadScalarType.java b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/UploadScalarType.java similarity index 91% rename from packages/core/backend/sirius-components-graphql-utils/src/main/java/org/eclipse/sirius/components/graphql/utils/types/UploadScalarType.java rename to packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/UploadScalarType.java index d8d0285575..bb474df536 100644 --- a/packages/core/backend/sirius-components-graphql-utils/src/main/java/org/eclipse/sirius/components/graphql/utils/types/UploadScalarType.java +++ b/packages/core/backend/sirius-components-graphql-api/src/main/java/org/eclipse/sirius/components/graphql/api/UploadScalarType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Obeo. + * Copyright (c) 2019, 2022 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -10,7 +10,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.components.graphql.utils.types; +package org.eclipse.sirius.components.graphql.api; import graphql.schema.GraphQLScalarType; diff --git a/packages/core/backend/sirius-components-graphql-utils/.mvn/wrapper/maven-wrapper.properties b/packages/core/backend/sirius-components-graphql-utils/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index cd0d451ccd..0000000000 --- a/packages/core/backend/sirius-components-graphql-utils/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/packages/core/backend/sirius-components-graphql-utils/README.adoc b/packages/core/backend/sirius-components-graphql-utils/README.adoc deleted file mode 100644 index 7bc02df033..0000000000 --- a/packages/core/backend/sirius-components-graphql-utils/README.adoc +++ /dev/null @@ -1,10 +0,0 @@ -= sirius-components-graphql-utils - -== Goal - -This project provides some utility services to help creating GraphQL schema and perform some queries. - -== Dependencies - -- GraphQL Java -- Sirius Web Annotations \ No newline at end of file diff --git a/packages/releng/backend/sirius-components-test-coverage/pom.xml b/packages/releng/backend/sirius-components-test-coverage/pom.xml index eb90f1a43d..a1e28832d0 100644 --- a/packages/releng/backend/sirius-components-test-coverage/pom.xml +++ b/packages/releng/backend/sirius-components-test-coverage/pom.xml @@ -120,11 +120,6 @@ sirius-components-forms 2022.7.1 - - org.eclipse.sirius - sirius-components-graphql-utils - 2022.7.1 - org.eclipse.sirius sirius-components-interpreter @@ -175,6 +170,11 @@ sirius-components-collaborative-validation 2022.7.1 + + org.eclipse.sirius + sirius-components-validation-graphql + 2022.7.0 + org.eclipse.sirius sirius-components-graphql diff --git a/packages/starters/backend/sirius-components-starter/pom.xml b/packages/starters/backend/sirius-components-starter/pom.xml index 91f8bfbfba..52744e709d 100644 --- a/packages/starters/backend/sirius-components-starter/pom.xml +++ b/packages/starters/backend/sirius-components-starter/pom.xml @@ -115,6 +115,11 @@ sirius-components-collaborative-validation 2022.7.1 + + org.eclipse.sirius + sirius-components-validation-graphql + 2022.7.0 + org.eclipse.sirius sirius-components-emf diff --git a/packages/starters/backend/sirius-components-starter/src/main/java/org/eclipse/sirius/components/starter/SiriusWebStarterConfiguration.java b/packages/starters/backend/sirius-components-starter/src/main/java/org/eclipse/sirius/components/starter/SiriusWebStarterConfiguration.java index b75aec1f81..ad69c95bb5 100644 --- a/packages/starters/backend/sirius-components-starter/src/main/java/org/eclipse/sirius/components/starter/SiriusWebStarterConfiguration.java +++ b/packages/starters/backend/sirius-components-starter/src/main/java/org/eclipse/sirius/components/starter/SiriusWebStarterConfiguration.java @@ -14,12 +14,20 @@ import java.util.concurrent.Executors; +import org.eclipse.sirius.components.collaborative.api.IEditingContextEventProcessorRegistry; +import org.eclipse.sirius.components.collaborative.api.IRepresentationConfiguration; +import org.eclipse.sirius.components.collaborative.api.IRepresentationEventProcessor; import org.eclipse.sirius.components.collaborative.api.ISubscriptionManagerFactory; import org.eclipse.sirius.components.collaborative.editingcontext.api.IEditingContextEventProcessorExecutorServiceProvider; import org.eclipse.sirius.components.collaborative.forms.WidgetSubscriptionManager; import org.eclipse.sirius.components.collaborative.forms.api.IWidgetSubscriptionManagerFactory; import org.eclipse.sirius.components.collaborative.representations.SubscriptionManager; +import org.eclipse.sirius.components.core.api.IInput; +import org.eclipse.sirius.components.core.api.IPayload; +import org.eclipse.sirius.components.graphql.api.IEventProcessorSubscriptionProvider; +import org.eclipse.sirius.components.graphql.api.IExceptionWrapper; import org.eclipse.sirius.components.graphql.ws.api.IGraphQLWebSocketHandlerListener; +import org.eclipse.sirius.components.starter.services.ExceptionWrapper; import org.eclipse.sirius.components.web.concurrent.DelegatingRequestContextExecutorService; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; @@ -30,6 +38,8 @@ import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; +import reactor.core.publisher.Flux; + /** * Projects which depend on this starter project will automatically get all the components required to create a Sirius * Web application. @@ -98,4 +108,27 @@ public void afterConnectionClosed(WebSocketSession session, CloseStatus status) } }; } + + @Bean + @ConditionalOnMissingBean + public IEventProcessorSubscriptionProvider eventProcessorSubscriptionProvider(IEditingContextEventProcessorRegistry editingContextEventProcessorRegistry) { + return new IEventProcessorSubscriptionProvider() { + @Override + public Flux getSubscription(String editingContextId, Class representationEventProcessorClass, + IRepresentationConfiguration representationConfiguration, IInput input) { + // @formatter:off + return editingContextEventProcessorRegistry.getOrCreateEditingContextEventProcessor(editingContextId) + .flatMap(processor -> processor.acquireRepresentationEventProcessor(representationEventProcessorClass, representationConfiguration, input)) + .map(representationEventProcessor -> representationEventProcessor.getOutputEvents(input)) + .orElse(Flux.empty()); + // @formatter:on + } + }; + } + + @Bean + @ConditionalOnMissingBean + public IExceptionWrapper exceptionWrapper() { + return new ExceptionWrapper(); + } } diff --git a/packages/starters/backend/sirius-components-starter/src/main/java/org/eclipse/sirius/components/starter/services/ExceptionWrapper.java b/packages/starters/backend/sirius-components-starter/src/main/java/org/eclipse/sirius/components/starter/services/ExceptionWrapper.java new file mode 100644 index 0000000000..17a3a1f413 --- /dev/null +++ b/packages/starters/backend/sirius-components-starter/src/main/java/org/eclipse/sirius/components/starter/services/ExceptionWrapper.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2022 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.components.starter.services; + +import java.util.List; +import java.util.Optional; +import java.util.function.Supplier; + +import org.eclipse.sirius.components.core.api.IInput; +import org.eclipse.sirius.components.core.api.IPayload; +import org.eclipse.sirius.components.graphql.api.IExceptionWrapper; + +import graphql.relay.Connection; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Used to encapsulate calls to methods which can throw exceptions. + * + * @author sbegaudeau + */ +public class ExceptionWrapper implements IExceptionWrapper { + + @Override + public Flux wrapFlux(Supplier> supplier, IInput input) { + return supplier.get(); + } + + @Override + public IPayload wrap(Supplier supplier, IInput input) { + return supplier.get(); + } + + @Override + public List wrapList(Supplier> supplier) { + return supplier.get(); + } + + @Override + public Optional wrapOptional(Supplier> supplier) { + return supplier.get(); + } + + @Override + public Connection wrapConnection(Supplier> supplier) { + return supplier.get(); + } + + @Override + public Mono wrapMono(Supplier> supplier, IInput input) { + return supplier.get(); + } + +} diff --git a/packages/core/backend/sirius-components-graphql-utils/.checkstyle b/packages/validation/backend/sirius-components-validation-graphql/.checkstyle similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/.checkstyle rename to packages/validation/backend/sirius-components-validation-graphql/.checkstyle diff --git a/packages/core/backend/sirius-components-graphql-utils/.classpath b/packages/validation/backend/sirius-components-validation-graphql/.classpath similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/.classpath rename to packages/validation/backend/sirius-components-validation-graphql/.classpath diff --git a/packages/core/backend/sirius-components-graphql-utils/.mvn/wrapper/MavenWrapperDownloader.java b/packages/validation/backend/sirius-components-validation-graphql/.mvn/wrapper/MavenWrapperDownloader.java similarity index 68% rename from packages/core/backend/sirius-components-graphql-utils/.mvn/wrapper/MavenWrapperDownloader.java rename to packages/validation/backend/sirius-components-validation-graphql/.mvn/wrapper/MavenWrapperDownloader.java index 72308aa479..e76d1f3241 100644 --- a/packages/core/backend/sirius-components-graphql-utils/.mvn/wrapper/MavenWrapperDownloader.java +++ b/packages/validation/backend/sirius-components-validation-graphql/.mvn/wrapper/MavenWrapperDownloader.java @@ -1,38 +1,31 @@ /* -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 - -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. -*/ - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URL; -import java.nio.channels.Channels; -import java.nio.channels.ReadableByteChannel; + * Copyright 2007-present the original author or authors. + * + * Licensed 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 + * + * 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. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; import java.util.Properties; public class MavenWrapperDownloader { + private static final String WRAPPER_VERSION = "0.5.6"; /** * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. */ - private static final String DEFAULT_DOWNLOAD_URL = - "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; /** * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to @@ -80,13 +73,13 @@ public static void main(String args[]) { } } } - System.out.println("- Downloading from: : " + url); + System.out.println("- Downloading from: " + url); File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); if(!outputFile.getParentFile().exists()) { if(!outputFile.getParentFile().mkdirs()) { System.out.println( - "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); } } System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); @@ -102,6 +95,16 @@ public static void main(String args[]) { } private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } URL website = new URL(urlString); ReadableByteChannel rbc; rbc = Channels.newChannel(website.openStream()); diff --git a/packages/validation/backend/sirius-components-validation-graphql/.mvn/wrapper/maven-wrapper.properties b/packages/validation/backend/sirius-components-validation-graphql/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..ffdc10e59f --- /dev/null +++ b/packages/validation/backend/sirius-components-validation-graphql/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/packages/core/backend/sirius-components-graphql-utils/.project b/packages/validation/backend/sirius-components-validation-graphql/.project similarity index 94% rename from packages/core/backend/sirius-components-graphql-utils/.project rename to packages/validation/backend/sirius-components-validation-graphql/.project index d0e08debf0..d54020e666 100644 --- a/packages/core/backend/sirius-components-graphql-utils/.project +++ b/packages/validation/backend/sirius-components-validation-graphql/.project @@ -1,6 +1,6 @@ - sirius-components-graphql-utils + sirius-components-validation-graphql diff --git a/packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.core.resources.prefs b/packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.core.resources.prefs similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.core.resources.prefs rename to packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.core.resources.prefs diff --git a/packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.core.runtime.prefs b/packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.core.runtime.prefs similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.core.runtime.prefs rename to packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.core.runtime.prefs diff --git a/packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.jdt.apt.core.prefs b/packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.jdt.apt.core.prefs similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.jdt.apt.core.prefs rename to packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.jdt.apt.core.prefs diff --git a/packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.jdt.core.prefs b/packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.jdt.core.prefs similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.jdt.core.prefs rename to packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.jdt.core.prefs diff --git a/packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.jdt.ui.prefs b/packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.jdt.ui.prefs similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.jdt.ui.prefs rename to packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.jdt.ui.prefs diff --git a/packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.m2e.core.prefs b/packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.m2e.core.prefs similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/.settings/org.eclipse.m2e.core.prefs rename to packages/validation/backend/sirius-components-validation-graphql/.settings/org.eclipse.m2e.core.prefs diff --git a/packages/validation/backend/sirius-components-validation-graphql/.settings/org.springframework.ide.eclipse.boot.prefs b/packages/validation/backend/sirius-components-validation-graphql/.settings/org.springframework.ide.eclipse.boot.prefs new file mode 100644 index 0000000000..b5811b137d --- /dev/null +++ b/packages/validation/backend/sirius-components-validation-graphql/.settings/org.springframework.ide.eclipse.boot.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +spring.boot.launch.profile.history=dev; diff --git a/packages/core/backend/sirius-components-graphql-utils/.settings/org.springframework.ide.eclipse.prefs b/packages/validation/backend/sirius-components-validation-graphql/.settings/org.springframework.ide.eclipse.prefs similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/.settings/org.springframework.ide.eclipse.prefs rename to packages/validation/backend/sirius-components-validation-graphql/.settings/org.springframework.ide.eclipse.prefs diff --git a/packages/core/backend/sirius-components-graphql-utils/mvnw b/packages/validation/backend/sirius-components-validation-graphql/mvnw old mode 100755 new mode 100644 similarity index 88% rename from packages/core/backend/sirius-components-graphql-utils/mvnw rename to packages/validation/backend/sirius-components-validation-graphql/mvnw index 8b9da3b8b6..a16b5431b4 --- a/packages/core/backend/sirius-components-graphql-utils/mvnw +++ b/packages/validation/backend/sirius-components-validation-graphql/mvnw @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script +# Maven Start Up Batch script # # Required ENV vars: # ------------------ @@ -114,7 +114,6 @@ if $mingw ; then M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then @@ -212,7 +211,11 @@ else if [ "$MVNW_VERBOSE" = true ]; then echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; esac @@ -221,22 +224,38 @@ else echo "Downloading from: $jarUrl" fi wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi if command -v wget > /dev/null; then if [ "$MVNW_VERBOSE" = true ]; then echo "Found wget ... using wget" fi - wget "$jarUrl" -O "$wrapperJarPath" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi elif command -v curl > /dev/null; then if [ "$MVNW_VERBOSE" = true ]; then echo "Found curl ... using curl" fi - curl -o "$wrapperJarPath" "$jarUrl" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + else if [ "$MVNW_VERBOSE" = true ]; then echo "Falling back to using Java to download" fi javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi if [ -e "$javaClass" ]; then if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then if [ "$MVNW_VERBOSE" = true ]; then @@ -277,6 +296,11 @@ if $cygwin; then MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` fi +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ diff --git a/packages/core/backend/sirius-components-graphql-utils/mvnw.cmd b/packages/validation/backend/sirius-components-validation-graphql/mvnw.cmd similarity index 78% rename from packages/core/backend/sirius-components-graphql-utils/mvnw.cmd rename to packages/validation/backend/sirius-components-validation-graphql/mvnw.cmd index fef5a8f7f9..c8d43372c9 100644 --- a/packages/core/backend/sirius-components-graphql-utils/mvnw.cmd +++ b/packages/validation/backend/sirius-components-validation-graphql/mvnw.cmd @@ -18,7 +18,7 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script +@REM Maven Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @@ -26,7 +26,7 @@ @REM Optional ENV vars @REM M2_HOME - location of maven2's installed home dir @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @@ -37,7 +37,7 @@ @echo off @REM set title of command window title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% @REM set %HOME% to equivalent of $HOME @@ -120,23 +120,44 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B ) @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @REM This allows using the maven wrapper in projects that prohibit checking in binary data. if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) ) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) ) @REM End of extension +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* if ERRORLEVEL 1 goto error goto end diff --git a/packages/core/backend/sirius-components-graphql-utils/pom.xml b/packages/validation/backend/sirius-components-validation-graphql/pom.xml similarity index 77% rename from packages/core/backend/sirius-components-graphql-utils/pom.xml rename to packages/validation/backend/sirius-components-validation-graphql/pom.xml index 7b93412d4c..67ea54c0da 100644 --- a/packages/core/backend/sirius-components-graphql-utils/pom.xml +++ b/packages/validation/backend/sirius-components-validation-graphql/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework.boot @@ -22,10 +22,10 @@ org.eclipse.sirius - sirius-components-graphql-utils - 2022.7.1 - sirius-components-graphql-utils - Sirius Components GraphQL Utils + sirius-components-validation-graphql + 2022.7.0 + sirius-components-validation-graphql + Sirius Components Validation GraphQL 11 @@ -41,16 +41,25 @@ - - org.eclipse.sirius - sirius-components-annotations - 2022.7.1 - com.graphql-java graphql-java ${graphql-java.version} + + com.fasterxml.jackson.core + jackson-databind + + + org.eclipse.sirius + sirius-components-graphql-api + 2022.7.0 + + + org.eclipse.sirius + sirius-components-annotations-spring + 2022.7.0 + org.eclipse.sirius sirius-components-tests @@ -62,6 +71,12 @@ spring-boot-starter-test test + + org.eclipse.sirius + sirius-components-tests + 2022.7.0 + test + @@ -119,4 +134,5 @@ + diff --git a/packages/validation/backend/sirius-components-validation-graphql/src/main/java/org/eclipse/sirius/components/validation/graphql/datafetchers/subscription/SubscriptionValidationEventDataFetcher.java b/packages/validation/backend/sirius-components-validation-graphql/src/main/java/org/eclipse/sirius/components/validation/graphql/datafetchers/subscription/SubscriptionValidationEventDataFetcher.java new file mode 100644 index 0000000000..af1f0308ca --- /dev/null +++ b/packages/validation/backend/sirius-components-validation-graphql/src/main/java/org/eclipse/sirius/components/validation/graphql/datafetchers/subscription/SubscriptionValidationEventDataFetcher.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2021, 2022 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.components.validation.graphql.datafetchers.subscription; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.util.Objects; + +import org.eclipse.sirius.components.annotations.spring.graphql.SubscriptionDataFetcher; +import org.eclipse.sirius.components.collaborative.validation.api.IValidationEventProcessor; +import org.eclipse.sirius.components.collaborative.validation.api.ValidationConfiguration; +import org.eclipse.sirius.components.collaborative.validation.dto.ValidationEventInput; +import org.eclipse.sirius.components.core.api.IPayload; +import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; +import org.eclipse.sirius.components.graphql.api.IEventProcessorSubscriptionProvider; +import org.eclipse.sirius.components.graphql.api.IExceptionWrapper; +import org.reactivestreams.Publisher; + +import graphql.schema.DataFetchingEnvironment; + +/** + * The data fetcher used to send the refreshed validation to a subscription. + * + * @author sbegaudeau + */ +@SubscriptionDataFetcher(type = "Subscription", field = "validationEvent") +public class SubscriptionValidationEventDataFetcher implements IDataFetcherWithFieldCoordinates> { + + private static final String INPUT_ARGUMENT = "input"; //$NON-NLS-1$ + + private final ObjectMapper objectMapper; + + private final IExceptionWrapper exceptionWrapper; + + private final IEventProcessorSubscriptionProvider eventProcessorSubscriptionProvider; + + public SubscriptionValidationEventDataFetcher(ObjectMapper objectMapper, IExceptionWrapper exceptionWrapper, IEventProcessorSubscriptionProvider eventProcessorSubscriptionProvider) { + this.objectMapper = Objects.requireNonNull(objectMapper); + this.exceptionWrapper = Objects.requireNonNull(exceptionWrapper); + this.eventProcessorSubscriptionProvider = Objects.requireNonNull(eventProcessorSubscriptionProvider); + } + + @Override + public Publisher get(DataFetchingEnvironment environment) throws Exception { + Object argument = environment.getArgument(INPUT_ARGUMENT); + var input = this.objectMapper.convertValue(argument, ValidationEventInput.class); + var validationConfiguration = new ValidationConfiguration(input.getEditingContextId()); + + return this.exceptionWrapper + .wrapFlux(() -> this.eventProcessorSubscriptionProvider.getSubscription(input.getEditingContextId(), IValidationEventProcessor.class, validationConfiguration, input), input); + } +} diff --git a/packages/core/backend/sirius-components-graphql-utils/src/main/resources/.gitkeep b/packages/validation/backend/sirius-components-validation-graphql/src/main/resources/.gitkeep similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/src/main/resources/.gitkeep rename to packages/validation/backend/sirius-components-validation-graphql/src/main/resources/.gitkeep diff --git a/packages/core/backend/sirius-components-graphql-utils/src/test/java/org/eclipse/sirius/components/graphql/utils/architecture/ArchitectureConstants.java b/packages/validation/backend/sirius-components-validation-graphql/src/test/java/org/eclipse/sirius/components/validation/graphql/architecture/ArchitectureConstants.java similarity index 72% rename from packages/core/backend/sirius-components-graphql-utils/src/test/java/org/eclipse/sirius/components/graphql/utils/architecture/ArchitectureConstants.java rename to packages/validation/backend/sirius-components-validation-graphql/src/test/java/org/eclipse/sirius/components/validation/graphql/architecture/ArchitectureConstants.java index a2a4b79557..8d0d0788e0 100644 --- a/packages/core/backend/sirius-components-graphql-utils/src/test/java/org/eclipse/sirius/components/graphql/utils/architecture/ArchitectureConstants.java +++ b/packages/validation/backend/sirius-components-validation-graphql/src/test/java/org/eclipse/sirius/components/validation/graphql/architecture/ArchitectureConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Obeo. + * Copyright (c) 2022 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -10,25 +10,25 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.components.graphql.utils.architecture; +package org.eclipse.sirius.components.validation.graphql.architecture; import com.tngtech.archunit.core.domain.JavaClasses; import com.tngtech.archunit.core.importer.ClassFileImporter; import com.tngtech.archunit.core.importer.ImportOption; /** - * Constants shared accross multiple tests. + * Constants shared across multiple tests. * - * @author sbegaudeau + * @author gcoutable */ public final class ArchitectureConstants { - public static final String SIRIUS_COMPONENTS_GRAPHQL_UTILS_ROOT_PACKAGE = "org.eclipse.sirius.components.graphql.utils.."; //$NON-NLS-1$ + public static final String SIRIUS_COMPONENTS_VALIDATION_GRAPHQL_ROOT_PACKAGE = "org.eclipse.sirius.components.validation.graphql.."; //$NON-NLS-1$ // @formatter:off public static final JavaClasses CLASSES = new ClassFileImporter() .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_JARS) .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) - .importPackages(SIRIUS_COMPONENTS_GRAPHQL_UTILS_ROOT_PACKAGE); + .importPackages(SIRIUS_COMPONENTS_VALIDATION_GRAPHQL_ROOT_PACKAGE); // @formatter:on private ArchitectureConstants() { diff --git a/packages/core/backend/sirius-components-graphql-utils/src/test/java/org/eclipse/sirius/components/graphql/utils/architecture/CodingRulesTests.java b/packages/validation/backend/sirius-components-validation-graphql/src/test/java/org/eclipse/sirius/components/validation/graphql/architecture/CodingRulesTests.java similarity index 85% rename from packages/core/backend/sirius-components-graphql-utils/src/test/java/org/eclipse/sirius/components/graphql/utils/architecture/CodingRulesTests.java rename to packages/validation/backend/sirius-components-validation-graphql/src/test/java/org/eclipse/sirius/components/validation/graphql/architecture/CodingRulesTests.java index 1d0d0998e4..1173869bf2 100644 --- a/packages/core/backend/sirius-components-graphql-utils/src/test/java/org/eclipse/sirius/components/graphql/utils/architecture/CodingRulesTests.java +++ b/packages/validation/backend/sirius-components-validation-graphql/src/test/java/org/eclipse/sirius/components/validation/graphql/architecture/CodingRulesTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Obeo. + * Copyright (c) 2022 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -10,7 +10,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.components.graphql.utils.architecture; +package org.eclipse.sirius.components.validation.graphql.architecture; import com.tngtech.archunit.core.domain.JavaClasses; @@ -20,13 +20,13 @@ /** * Coding rules tests. * - * @author sbegaudeau + * @author gcoutable */ public class CodingRulesTests extends AbstractCodingRulesTests { @Override protected String getProjectRootPackage() { - return ArchitectureConstants.SIRIUS_COMPONENTS_GRAPHQL_UTILS_ROOT_PACKAGE; + return ArchitectureConstants.SIRIUS_COMPONENTS_VALIDATION_GRAPHQL_ROOT_PACKAGE; } @Override diff --git a/packages/validation/backend/sirius-components-validation-graphql/src/test/java/org/eclipse/sirius/components/validation/graphql/architecture/ImmutableTests.java b/packages/validation/backend/sirius-components-validation-graphql/src/test/java/org/eclipse/sirius/components/validation/graphql/architecture/ImmutableTests.java new file mode 100644 index 0000000000..f5d4e73899 --- /dev/null +++ b/packages/validation/backend/sirius-components-validation-graphql/src/test/java/org/eclipse/sirius/components/validation/graphql/architecture/ImmutableTests.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2022 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.components.validation.graphql.architecture; + +import com.tngtech.archunit.core.domain.JavaClasses; + +import org.eclipse.sirius.components.tests.architecture.AbstractImmutableTests; + +/** + * Architectural tests of the @Immutable classes. + * + * @author gcoutable + */ +public class ImmutableTests extends AbstractImmutableTests { + @Override + protected String getProjectRootPackage() { + return ArchitectureConstants.SIRIUS_COMPONENTS_VALIDATION_GRAPHQL_ROOT_PACKAGE; + } + + @Override + protected JavaClasses getClasses() { + return ArchitectureConstants.CLASSES; + } +} diff --git a/packages/core/backend/sirius-components-graphql-utils/src/test/resources/logback-test.xml b/packages/validation/backend/sirius-components-validation-graphql/src/test/resources/logback-test.xml similarity index 100% rename from packages/core/backend/sirius-components-graphql-utils/src/test/resources/logback-test.xml rename to packages/validation/backend/sirius-components-validation-graphql/src/test/resources/logback-test.xml diff --git a/packages/web/backend/sirius-components-graphql/pom.xml b/packages/web/backend/sirius-components-graphql/pom.xml index 521f9c940f..84736ec946 100644 --- a/packages/web/backend/sirius-components-graphql/pom.xml +++ b/packages/web/backend/sirius-components-graphql/pom.xml @@ -67,11 +67,6 @@ sirius-components-annotations 2022.7.1 - - org.eclipse.sirius - sirius-components-graphql-utils - 2022.7.1 - org.eclipse.sirius sirius-components-graphql-api diff --git a/packages/web/backend/sirius-components-graphql/src/test/java/org/eclipse/sirius/components/graphql/controllers/GraphQLControllerTests.java b/packages/web/backend/sirius-components-graphql/src/test/java/org/eclipse/sirius/components/graphql/controllers/GraphQLControllerTests.java index c43a574e0b..6fb59a5d60 100644 --- a/packages/web/backend/sirius-components-graphql/src/test/java/org/eclipse/sirius/components/graphql/controllers/GraphQLControllerTests.java +++ b/packages/web/backend/sirius-components-graphql/src/test/java/org/eclipse/sirius/components/graphql/controllers/GraphQLControllerTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 Obeo. + * Copyright (c) 2019, 2022 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ import java.util.Map; -import org.eclipse.sirius.components.graphql.utils.types.UploadScalarType; +import org.eclipse.sirius.components.graphql.api.UploadScalarType; import org.junit.jupiter.api.Test; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity;