SammyVimes commented on a change in pull request #714: URL: https://github.com/apache/ignite-3/pull/714#discussion_r829827388
########## File path: modules/network/src/integrationTest/java/org/apache/ignite/internal/network/processor/ItTransferableObjectProcessorIncrementalTest.java ########## @@ -0,0 +1,339 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.network.processor; + +import static org.apache.ignite.internal.network.processor.InMemoryJavaFileManager.uriForFileObject; +import static org.apache.ignite.internal.network.processor.InMemoryJavaFileManager.uriForJavaFileObject; +import static org.apache.ignite.internal.network.processor.IncrementalCompilationConfig.CONFIG_FILE_NAME; +import static org.apache.ignite.internal.network.processor.IncrementalCompilationConfig.readClassName; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.google.testing.compile.JavaFileObjects; +import com.squareup.javapoet.ClassName; +import java.io.BufferedReader; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import javax.tools.DiagnosticCollector; +import javax.tools.JavaCompiler; +import javax.tools.JavaCompiler.CompilationTask; +import javax.tools.JavaFileObject; +import javax.tools.JavaFileObject.Kind; +import javax.tools.StandardJavaFileManager; +import javax.tools.StandardLocation; +import javax.tools.ToolProvider; +import org.intellij.lang.annotations.Language; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Integration tests for the {@link TransferableObjectProcessor} incremental compilation. + */ +public class ItTransferableObjectProcessorIncrementalTest { + /** + * Package name of the test sources. + */ + private static final String RESOURCE_PACKAGE_NAME = "org.apache.ignite.internal.network.processor"; + + /** File manager for incremental compilation. */ + private InMemoryJavaFileManager fileManager; + + /** Javac diagnostic collector. */ + private DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<>(); + + @BeforeEach + void setUp() { + JavaCompiler systemJavaCompiler = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager standardFileManager = systemJavaCompiler.getStandardFileManager(diagnosticCollector, Locale.getDefault(), + StandardCharsets.UTF_8); + + this.fileManager = new InMemoryJavaFileManager(standardFileManager); + } + + @Test + public void testIncrementalRemoveTransferable() throws Exception { + String testMessageGroup = "MsgGroup"; + String testMessageGroupName = "GroupName"; + String testMessageClass = "TestMessage"; + String testMessageClass2 = "SomeMessage"; + + var compilationObjects1 = new ArrayList<JavaFileObject>(); + JavaFileObject messageGroupObject = createMessageGroup(testMessageGroup, testMessageGroupName); + compilationObjects1.add(messageGroupObject); + compilationObjects1.add(createTransferable(testMessageClass, 0)); + + Map<URI, JavaFileObject> compilation1 = compile(compilationObjects1); + + JavaFileObject messageRegistry1 = compilation1.get(uriForMessagesFile()); + try (BufferedReader bufferedReader = new BufferedReader(messageRegistry1.openReader(true))) { Review comment: Sounds legit -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
