SammyVimes commented on a change in pull request #7792: URL: https://github.com/apache/ignite/pull/7792#discussion_r431002801
########## File path: modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataMoveLegacyFolderTest.java ########## @@ -0,0 +1,225 @@ +/* + * 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.processors.cache.binary; + +import java.io.File; +import java.nio.file.Files; +import java.util.Collection; +import java.util.UUID; +import org.apache.ignite.IgniteBinary; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.binary.BinaryObject; +import org.apache.ignite.binary.BinaryObjectBuilder; +import org.apache.ignite.binary.BinaryType; +import org.apache.ignite.configuration.DataRegionConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.binary.BinaryMetadata; +import org.apache.ignite.internal.binary.BinaryTypeImpl; +import org.apache.ignite.internal.util.typedef.internal.U; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Test for moving binary metadata folder to PDS + */ +public class BinaryMetadataMoveLegacyFolderTest extends GridCommonAbstractTest { + /** {@inheritDoc} */ + @Before + @Override public void beforeTest() throws Exception { + super.beforeTest(); + + stopAllGrids(); + + cleanPersistenceDir(); + } + + /** {@inheritDoc} */ + @After + @Override public void afterTest() throws Exception { + super.afterTest(); + + stopAllGrids(); + + cleanPersistenceDir(); + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + IgniteConfiguration configuration = super.getConfiguration(igniteInstanceName); + + configuration.setConsistentId(UUID.randomUUID()); + + DataStorageConfiguration dsCfg = new DataStorageConfiguration(); + + configuration.setDataStorageConfiguration(dsCfg); + + dsCfg.setDefaultDataRegionConfiguration( + new DataRegionConfiguration() + .setPersistenceEnabled(true)); + + return configuration; + } + + /** {@inheritDoc} */ + @Override protected IgniteEx startGrid(IgniteConfiguration cfg) throws Exception { + IgniteEx grid = super.startGrid(cfg); + grid.active(true); + return grid; + } + + /** + * Get byte representation of simple binary type with one field + * + * @param typeName Type name. + * @param fieldName Field name. + */ + private byte[] createBinaryType(String typeName, String fieldName) throws Exception { + IgniteConfiguration configuration = getConfiguration(); + + IgniteEx grid = startGrid(configuration); + + IgniteBinary binary = grid.binary(); + + BinaryObjectBuilder builder = binary.builder("TestBinaryType"); + + builder.setField(fieldName, 1); + + builder.build(); + + BinaryMetadata metadata = ((BinaryTypeImpl)binary.type(typeName)).metadata(); + + byte[] marshalled = U.marshal(grid.context(), metadata); + + stopAllGrids(); + + cleanPersistenceDir(); + + return marshalled; + } + + /** + * Test that binary_meta directory, that was previously located in workdir's root, is successfully moving to PDS + * folder. + */ + @Test + public void testBinaryMetadataDirectoryMigration() throws Exception { Review comment: Added compatibility test in newest commit (testing against version 2.8.0) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
