http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java index 8b8c600..703eb85 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java @@ -86,8 +86,8 @@ public class MultiPartitionLSMIndexTest { private static final IAType[] KEY_TYPES = { BuiltinType.AINT32 }; private static final ARecordType RECORD_TYPE = new ARecordType("TestRecordType", new String[] { "key", "value" }, new IAType[] { BuiltinType.AINT32, BuiltinType.AINT64 }, false); - private static final GenerationFunction[] RECORD_GEN_FUNCTION = - { GenerationFunction.DETERMINISTIC, GenerationFunction.DETERMINISTIC }; + private static final GenerationFunction[] RECORD_GEN_FUNCTION = { GenerationFunction.DETERMINISTIC, + GenerationFunction.DETERMINISTIC }; private static final boolean[] UNIQUE_RECORD_FIELDS = { true, false }; private static final ARecordType META_TYPE = null; private static final GenerationFunction[] META_GEN_FUNCTION = null; @@ -104,8 +104,8 @@ public class MultiPartitionLSMIndexTest { private static final String DATA_TYPE_NAME = "DUMMY"; private static final String NODE_GROUP_NAME = "DEFAULT"; private static final IndexType INDEX_TYPE = IndexType.BTREE; - private static final List<List<String>> INDEX_FIELD_NAMES = - Arrays.asList(Arrays.asList(RECORD_TYPE.getFieldNames()[1])); + private static final List<List<String>> INDEX_FIELD_NAMES = Arrays + .asList(Arrays.asList(RECORD_TYPE.getFieldNames()[1])); private static final List<Integer> INDEX_FIELD_INDICATORS = Arrays.asList(Index.RECORD_INDICATOR); private static final List<IAType> INDEX_FIELD_TYPES = Arrays.asList(BuiltinType.AINT64); private static final StorageComponentProvider storageManager = new StorageComponentProvider(); @@ -129,7 +129,7 @@ public class MultiPartitionLSMIndexTest { System.out.println("SetUp: "); TestHelper.deleteExistingInstanceFiles(); String configPath = System.getProperty("user.dir") + File.separator + "src" + File.separator + "test" - + File.separator + "resources" + File.separator + "multi-partition-test-configuration.xml"; + + File.separator + "resources" + File.separator + "cc-multipart.conf"; nc = new TestNodeController(configPath, false); nc.init(); ncAppCtx = nc.getAppRuntimeContext(); @@ -147,11 +147,10 @@ public class MultiPartitionLSMIndexTest { public void createIndex() throws Exception { List<List<String>> partitioningKeys = new ArrayList<>(); partitioningKeys.add(Collections.singletonList("key")); - dataset = - new TestDataset(DATAVERSE_NAME, DATASET_NAME, DATAVERSE_NAME, DATA_TYPE_NAME, NODE_GROUP_NAME, - NoMergePolicyFactory.NAME, null, new InternalDatasetDetails(null, PartitioningStrategy.HASH, - partitioningKeys, null, null, null, false, null), - null, DatasetType.INTERNAL, DATASET_ID, 0); + dataset = new TestDataset(DATAVERSE_NAME, DATASET_NAME, DATAVERSE_NAME, DATA_TYPE_NAME, NODE_GROUP_NAME, + NoMergePolicyFactory.NAME, null, new InternalDatasetDetails(null, PartitioningStrategy.HASH, + partitioningKeys, null, null, null, false, null), + null, DatasetType.INTERNAL, DATASET_ID, 0); secondaryIndex = new Index(DATAVERSE_NAME, DATASET_NAME, INDEX_NAME, INDEX_TYPE, INDEX_FIELD_NAMES, INDEX_FIELD_INDICATORS, INDEX_FIELD_TYPES, false, false, false, 0); taskCtxs = new IHyracksTaskContext[NUM_PARTITIONS]; @@ -168,18 +167,18 @@ public class MultiPartitionLSMIndexTest { taskCtxs[i] = nc.createTestContext(jobId, i, false); PrimaryIndexInfo primaryIndexInfo = nc.createPrimaryIndex(dataset, KEY_TYPES, RECORD_TYPE, META_TYPE, null, storageManager, KEY_INDEXES, KEY_INDICATORS_LIST, i); - SecondaryIndexInfo secondaryIndexInfo = - nc.createSecondaryIndex(primaryIndexInfo, secondaryIndex, storageManager, i); - IndexDataflowHelperFactory iHelperFactory = - new IndexDataflowHelperFactory(nc.getStorageManager(), primaryIndexInfo.getFileSplitProvider()); - primaryIndexDataflowHelpers[i] = - iHelperFactory.create(taskCtxs[i].getJobletContext().getServiceContext(), i); + SecondaryIndexInfo secondaryIndexInfo = nc.createSecondaryIndex(primaryIndexInfo, secondaryIndex, + storageManager, i); + IndexDataflowHelperFactory iHelperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), + primaryIndexInfo.getFileSplitProvider()); + primaryIndexDataflowHelpers[i] = iHelperFactory.create(taskCtxs[i].getJobletContext().getServiceContext(), + i); primaryIndexDataflowHelpers[i].open(); primaryLsmBtrees[i] = (TestLsmBtree) primaryIndexDataflowHelpers[i].getIndexInstance(); - iHelperFactory = - new IndexDataflowHelperFactory(nc.getStorageManager(), secondaryIndexInfo.getFileSplitProvider()); - secondaryIndexDataflowHelpers[i] = - iHelperFactory.create(taskCtxs[i].getJobletContext().getServiceContext(), i); + iHelperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), + secondaryIndexInfo.getFileSplitProvider()); + secondaryIndexDataflowHelpers[i] = iHelperFactory.create(taskCtxs[i].getJobletContext().getServiceContext(), + i); secondaryIndexDataflowHelpers[i].open(); secondaryLsmBtrees[i] = (TestLsmBtree) secondaryIndexDataflowHelpers[i].getIndexInstance(); secondaryIndexDataflowHelpers[i].close();
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java index 7818d13..facf03d1 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java @@ -59,13 +59,13 @@ public class DmlTest { } outdir.mkdirs(); - integrationUtil.init(true); + integrationUtil.init(true, AsterixHyracksIntegrationUtil.DEFAULT_CONF_FILE); Reader loadReader = new BufferedReader( new InputStreamReader(new FileInputStream(LOAD_FOR_ENLIST_FILE), "UTF-8")); - AsterixJavaClient asterixLoad = - new AsterixJavaClient((ICcApplicationContext) integrationUtil.cc.getApplicationContext(), - integrationUtil.getHyracksClientConnection(), loadReader, - ERR, new AqlCompilationProvider(), new DefaultStatementExecutorFactory(), new StorageComponentProvider()); + AsterixJavaClient asterixLoad = new AsterixJavaClient( + (ICcApplicationContext) integrationUtil.cc.getApplicationContext(), + integrationUtil.getHyracksClientConnection(), loadReader, ERR, new AqlCompilationProvider(), + new DefaultStatementExecutorFactory(), new StorageComponentProvider()); try { asterixLoad.compile(true, false, false, false, false, true, false); } catch (AsterixException e) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java index 77d0130..52532d6 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java @@ -1 +1 @@ -/* * 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.asterix.test.jsonplan; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.util.ArrayList; import java.util.Collection; import java.util.logging.Logger; import org.apache.asterix.api.common.AsterixHyracksIntegrationUtil; import org.apache.asterix.api.java.AsterixJavaClient; import org.apache.asterix.app.translator.DefaultStatementExecutorFactory; import org.apache.asterix.common.config.GlobalConfig; import org.apache.asterix.common.context.IStorageComponentProvider; import org.apache.asterix.common.dataflow.ICcApplicationContext; import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.compiler.provider.AqlCompilationProvider; import org.apache.asterix.compiler.provider.ILangCompilationProvider; import org.apache.asterix.compiler.provider.SqlppCompilationProvider; import org.apache.asterix.external.util.ExternalDataConstants; import org.apache.asterix.external.util.IdentitiyResolverFactory; import org.apache.asterix.file.StorageComponentProvider; import org.apache.asterix.test.base.Asterix TestHelper; import org.apache.asterix.test.common.TestHelper; import org.apache.asterix.test.runtime.HDFSCluster; import org.apache.asterix.translator.IStatementExecutorFactory; import org.apache.asterix.translator.SessionConfig.PlanFormat; import org.apache.hyracks.api.client.IHyracksClientConnection; import org.junit.AfterClass; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; import org.junit.internal.AssumptionViolatedException; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(Parameterized.class) public class JsonLogicalPlanTest { private static final Logger LOGGER = Logger.getLogger(org.apache.asterix.test.jsonplan.JsonLogicalPlanTest.class.getName()); protected static final String SEPARATOR = File.separator; private static final String EXTEN SION_AQL = "aql"; private static final String EXTENSION_SQLPP = "sqlpp"; private static final String EXTENSION_RESULT = "plan"; private static final String FILENAME_IGNORE = "ignore.txt"; private static final String FILENAME_ONLY = "only.txt"; private static final String PATH_BASE = "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + "optimizerts" + SEPARATOR; private static final String PATH_QUERIES = PATH_BASE + "queries" + SEPARATOR; protected static String PATH_ACTUAL = "target" + File.separator + "jplantest" + SEPARATOR; protected static boolean optimized = false; private static final ArrayList<String> ignore = AsterixTestHelper.readTestListFile(FILENAME_IGNORE, PATH_BASE); private static final ArrayList<String> only = AsterixTestHelper.readTestListFile(FILENAME_ONLY, PATH_BASE); protected static String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; private static final ILangCompilationProvi der aqlCompilationProvider = new AqlCompilationProvider(); private static final ILangCompilationProvider sqlppCompilationProvider = new SqlppCompilationProvider(); protected static ILangCompilationProvider extensionLangCompilationProvider = null; protected static IStatementExecutorFactory statementExecutorFactory = new DefaultStatementExecutorFactory(); protected static IStorageComponentProvider storageComponentProvider = new StorageComponentProvider(); protected static AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); @BeforeClass public static void setUp() throws Exception { System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, TEST_CONFIG_FILE_NAME); final File outdir = new File(PATH_ACTUAL); outdir.mkdirs(); HDFSCluster.getInstance().setup(); integrationUtil.init(true); // Set the node resolver to be the identity resolver that expects node names // to be nod e controller ids; a valid assumption in test environment. System.setProperty(ExternalDataConstants.NODE_RESOLVER_FACTORY_PROPERTY, IdentitiyResolverFactory.class.getName()); } @AfterClass public static void tearDown() throws Exception { File outdir = new File(PATH_ACTUAL); File[] files = outdir.listFiles(); if (files == null || files.length == 0) { outdir.delete(); } HDFSCluster.getInstance().cleanup(); integrationUtil.deinit(true); } private static void suiteBuildPerFile(File file, Collection<Object[]> testArgs, String path) { if (file.isDirectory() && !file.getName().startsWith(".")) { for (File innerfile : file.listFiles()) { String subdir = innerfile.isDirectory() ? path + innerfile.getName() + SEPARATOR : path; suiteBuildPerFile(innerfile, testArgs, subdir); } } if (file.isFile() && (file.getN ame().endsWith(EXTENSION_AQL) || file.getName().endsWith(EXTENSION_SQLPP))) { String resultFileName = AsterixTestHelper.extToResExt(file.getName(), EXTENSION_RESULT); File actualFile = new File(PATH_ACTUAL + SEPARATOR + path + resultFileName); testArgs.add(new Object[] { file, actualFile }); } } @Parameters(name = "JsonLogicalPlanTest {index}: {0}") public static Collection<Object[]> tests() { Collection<Object[]> testArgs = new ArrayList<>(); if (only.isEmpty()) { suiteBuildPerFile(new File(PATH_QUERIES), testArgs, ""); } else { for (String path : only) { suiteBuildPerFile(new File(PATH_QUERIES + path), testArgs, path.lastIndexOf(SEPARATOR) < 0 ? "" : path.substring(0, path.lastIndexOf(SEPARATOR) + 1)); } } return testArgs; } private final File actualFile; private final File queryFile; public J sonLogicalPlanTest(final File queryFile, final File actualFile) { this.queryFile = queryFile; this.actualFile = actualFile; } @Test public void test() throws Exception { try { String queryFileShort = queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0), '/'); if (!only.isEmpty()) { boolean toRun = TestHelper.isInPrefixList(only, queryFileShort); if (!toRun) { LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" \"only.txt\" not empty and not in \"only.txt\"."); } Assume.assumeTrue(toRun); } boolean skipped = TestHelper.isInPrefixList(ignore, queryFileShort); if (skipped) { LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" in \"ignore.txt\"."); } Assume.assumeTrue(!skipped); LOGGER.info("RUN TEST: \"" + queryFile.getPath() + "\""); Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8")); // Forces the creation of actualFile. actualFile.getParentFile().mkdirs(); PrintWriter plan = new PrintWriter(actualFile); ILangCompilationProvider provider = queryFile.getName().endsWith("aql") ? aqlCompilationProvider : sqlppCompilationProvider; if (extensionLangCompilationProvider != null) { provider = extensionLangCompilationProvider; } IHyracksClientConnection hcc = integrationUtil.getHyracksClientConnection(); AsterixJavaClient asterix = new AsterixJavaClient((ICcApplicationContext) integrationUtil.cc.getApplicationContext(), hcc, query, plan, provider, statementExecutorFactory, storageComponentProvider); try { asterix.compile(true, false, !optimized, optimized, false, false, false, PlanFormat.JSON); } catch (AsterixException e) { plan.close(); query.close(); throw new Exception("Compile ERROR for " + queryFile + ": " + e.getMessage(), e); } plan.close(); query.close(); BufferedReader readerActual = new BufferedReader(new InputStreamReader(new FileInputStream(actualFile), "UTF-8")); String lineActual, objectActual = ""; boolean firstPlan = false; while ((lineActual = readerActual.readLine()) != null) { if (lineActual.contains("--")) { if (firstPlan) { break; } firstPlan = true; } else { objectActual = objectActual + lineActual; } } try { final JsonParser parser = new ObjectMapper().getJsonFactory().createJsonParser(objectActual); while (parser.nextToken() != null) { } } finally { readerActual.close(); } } catch (Exception e) { if (!(e instanceof AssumptionViolatedException)) { LOGGER.severe("Test \"" + queryFile.getPath() + "\" FAILED!"); throw new Exception("Test \"" + queryFile.getPath() + "\" FAILED!", e); } else { throw e; } } } } \ No newline at end of file +/* * 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.asterix.test.jsonplan; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.util.ArrayList; import java.util.Collection; import java.util.logging.Logger; import org.apache.asterix.api.common.AsterixHyracksIntegrationUtil; import org.apache.asterix.api.java.AsterixJavaClient; import org.apache.asterix.app.translator.DefaultStatementExecutorFactory; import org.apache.asterix.common.config.GlobalConfig; import org.apache.asterix.common.context.IStorageComponentProvider; import org.apache.asterix.common.dataflow.ICcApplicationContext; import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.compiler.provider.AqlCompilationProvider; import org.apache.asterix.compiler.provider.ILangCompilationProvider; import org.apache.asterix.compiler.provider.SqlppCompilationProvider; import org.apache.asterix.external.util.ExternalDataConstants; import org.apache.asterix.external.util.IdentitiyResolverFactory; import org.apache.asterix.file.StorageComponentProvider; import org.apache.asterix.test.base.Asterix TestHelper; import org.apache.asterix.test.common.TestHelper; import org.apache.asterix.test.runtime.HDFSCluster; import org.apache.asterix.translator.IStatementExecutorFactory; import org.apache.asterix.translator.SessionConfig.PlanFormat; import org.apache.hyracks.api.client.IHyracksClientConnection; import org.junit.AfterClass; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; import org.junit.internal.AssumptionViolatedException; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(Parameterized.class) public class JsonLogicalPlanTest { private static final Logger LOGGER = Logger .getLogger(org.apache.asterix.test.jsonplan.JsonLogicalPlanTest.class.getName()); protected static final String SEPARATOR = File.separator; private static final String EXTE NSION_AQL = "aql"; private static final String EXTENSION_SQLPP = "sqlpp"; private static final String EXTENSION_RESULT = "plan"; private static final String FILENAME_IGNORE = "ignore.txt"; private static final String FILENAME_ONLY = "only.txt"; private static final String PATH_BASE = "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + "optimizerts" + SEPARATOR; private static final String PATH_QUERIES = PATH_BASE + "queries" + SEPARATOR; protected static String PATH_ACTUAL = "target" + File.separator + "jplantest" + SEPARATOR; protected static boolean optimized = false; private static final ArrayList<String> ignore = AsterixTestHelper.readTestListFile(FILENAME_IGNORE, PATH_BASE); private static final ArrayList<String> only = AsterixTestHelper.readTestListFile(FILENAME_ONLY, PATH_BASE); protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; private static final ILangCompilationPro vider aqlCompilationProvider = new AqlCompilationProvider(); private static final ILangCompilationProvider sqlppCompilationProvider = new SqlppCompilationProvider(); protected static ILangCompilationProvider extensionLangCompilationProvider = null; protected static IStatementExecutorFactory statementExecutorFactory = new DefaultStatementExecutorFactory(); protected static IStorageComponentProvider storageComponentProvider = new StorageComponentProvider(); protected static AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); @BeforeClass public static void setUp() throws Exception { System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, TEST_CONFIG_FILE_NAME); final File outdir = new File(PATH_ACTUAL); outdir.mkdirs(); HDFSCluster.getInstance().setup(); integrationUtil.init(true, TEST_CONFIG_FILE_NAME); // Set the node resolver to be the identity resolver that expects node n ames // to be node controller ids; a valid assumption in test environment. System.setProperty(ExternalDataConstants.NODE_RESOLVER_FACTORY_PROPERTY, IdentitiyResolverFactory.class.getName()); } @AfterClass public static void tearDown() throws Exception { File outdir = new File(PATH_ACTUAL); File[] files = outdir.listFiles(); if (files == null || files.length == 0) { outdir.delete(); } HDFSCluster.getInstance().cleanup(); integrationUtil.deinit(true); } private static void suiteBuildPerFile(File file, Collection<Object[]> testArgs, String path) { if (file.isDirectory() && !file.getName().startsWith(".")) { for (File innerfile : file.listFiles()) { String subdir = innerfile.isDirectory() ? path + innerfile.getName() + SEPARATOR : path; suiteBuildPerFile(innerfile, testArgs, subdir); } } if (fi le.isFile() && (file.getName().endsWith(EXTENSION_AQL) || file.getName().endsWith(EXTENSION_SQLPP))) { String resultFileName = AsterixTestHelper.extToResExt(file.getName(), EXTENSION_RESULT); File actualFile = new File(PATH_ACTUAL + SEPARATOR + path + resultFileName); testArgs.add(new Object[] { file, actualFile }); } } @Parameters(name = "JsonLogicalPlanTest {index}: {0}") public static Collection<Object[]> tests() { Collection<Object[]> testArgs = new ArrayList<>(); if (only.isEmpty()) { suiteBuildPerFile(new File(PATH_QUERIES), testArgs, ""); } else { for (String path : only) { suiteBuildPerFile(new File(PATH_QUERIES + path), testArgs, path.lastIndexOf(SEPARATOR) < 0 ? "" : path.substring(0, path.lastIndexOf(SEPARATOR) + 1)); } } return testArgs; } private final File actualFile; private final File queryFile; public JsonLogicalPlanTest(final File queryFile, final File actualFile) { this.queryFile = queryFile; this.actualFile = actualFile; } @Test public void test() throws Exception { try { String queryFileShort = queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0), '/'); if (!only.isEmpty()) { boolean toRun = TestHelper.isInPrefixList(only, queryFileShort); if (!toRun) { LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" \"only.txt\" not empty and not in \"only.txt\"."); } Assume.assumeTrue(toRun); } boolean skipped = TestHelper.isInPrefixList(ignore, queryFileShort); if (skipped) { LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" in \"ignore.txt\"."); } Assume.assum eTrue(!skipped); LOGGER.info("RUN TEST: \"" + queryFile.getPath() + "\""); Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8")); // Forces the creation of actualFile. actualFile.getParentFile().mkdirs(); PrintWriter plan = new PrintWriter(actualFile); ILangCompilationProvider provider = queryFile.getName().endsWith("aql") ? aqlCompilationProvider : sqlppCompilationProvider; if (extensionLangCompilationProvider != null) { provider = extensionLangCompilationProvider; } IHyracksClientConnection hcc = integrationUtil.getHyracksClientConnection(); AsterixJavaClient asterix = new AsterixJavaClient( (ICcApplicationContext) integrationUtil.cc.getApplicationContext(), hcc, query, plan, provider, statementExecutorFactory, storageComponentProvider); try { asterix.compile(true, false, !optimized, optimized, false, false, false, PlanFormat.JSON); } catch (AsterixException e) { plan.close(); query.close(); throw new Exception("Compile ERROR for " + queryFile + ": " + e.getMessage(), e); } plan.close(); query.close(); BufferedReader readerActual = new BufferedReader( new InputStreamReader(new FileInputStream(actualFile), "UTF-8")); String lineActual, objectActual = ""; boolean firstPlan = false; while ((lineActual = readerActual.readLine()) != null) { if (lineActual.contains("--")) { if (firstPlan) { break; } firstPlan = true; } else { objectActual = objectActual + lineActual; } } try { final JsonParser parser = new ObjectMapper().getJsonFactory().createJsonParser(objectActual); while (parser.nextToken() != null) { } } finally { readerActual.close(); } } catch (Exception e) { if (!(e instanceof AssumptionViolatedException)) { LOGGER.severe("Test \"" + queryFile.getPath() + "\" FAILED!"); throw new Exception("Test \"" + queryFile.getPath() + "\" FAILED!", e); } else { throw e; } } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java index 7543bf6..f635d6f 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java @@ -30,8 +30,6 @@ import org.apache.asterix.app.data.gen.TupleGenerator; import org.apache.asterix.app.data.gen.TupleGenerator.GenerationFunction; import org.apache.asterix.common.config.DatasetConfig.DatasetType; import org.apache.asterix.common.config.TransactionProperties; -import org.apache.asterix.common.configuration.AsterixConfiguration; -import org.apache.asterix.common.configuration.Property; import org.apache.asterix.common.dataflow.LSMInsertDeleteOperatorNodePushable; import org.apache.asterix.common.transactions.Checkpoint; import org.apache.asterix.common.transactions.ICheckpointManager; @@ -52,7 +50,9 @@ import org.apache.asterix.om.types.IAType; import org.apache.asterix.test.common.TestHelper; import org.apache.asterix.transaction.management.service.logging.LogManager; import org.apache.asterix.transaction.management.service.recovery.AbstractCheckpointManager; +import org.apache.commons.lang3.tuple.Pair; import org.apache.hyracks.api.comm.VSizeFrame; +import org.apache.hyracks.api.config.IOption; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.job.JobId; import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender; @@ -67,16 +67,15 @@ import org.junit.Test; public class CheckpointingTest { - private static final String DEFAULT_TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; - private static final String TEST_CONFIG_FILE_NAME = "asterix-test-configuration.xml"; - private static final String TEST_CONFIG_PATH = - System.getProperty("user.dir") + File.separator + "target" + File.separator + "config"; + private static final String TEST_CONFIG_FILE_NAME = "cc.conf"; + private static final String TEST_CONFIG_PATH = System.getProperty("user.dir") + File.separator + "src" + + File.separator + "main" + File.separator + "resources"; private static final String TEST_CONFIG_FILE_PATH = TEST_CONFIG_PATH + File.separator + TEST_CONFIG_FILE_NAME; private static final IAType[] KEY_TYPES = { BuiltinType.AINT32 }; private static final ARecordType RECORD_TYPE = new ARecordType("TestRecordType", new String[] { "key", "value" }, new IAType[] { BuiltinType.AINT32, BuiltinType.AINT64 }, false); - private static final GenerationFunction[] RECORD_GEN_FUNCTION = - { GenerationFunction.DETERMINISTIC, GenerationFunction.DETERMINISTIC }; + private static final GenerationFunction[] RECORD_GEN_FUNCTION = { GenerationFunction.DETERMINISTIC, + GenerationFunction.DETERMINISTIC }; private static final boolean[] UNIQUE_RECORD_FIELDS = { true, false }; private static final ARecordType META_TYPE = null; private static final GenerationFunction[] META_GEN_FUNCTION = null; @@ -94,17 +93,6 @@ public class CheckpointingTest { @Before public void setUp() throws Exception { System.out.println("SetUp: "); - TestHelper.deleteExistingInstanceFiles(); - // Read default test configurations - AsterixConfiguration ac = TestHelper.getConfigurations(DEFAULT_TEST_CONFIG_FILE_NAME); - // Set log file size to 2MB - ac.getProperty().add(new Property(TransactionProperties.TXN_LOG_PARTITIONSIZE_KEY, - String.valueOf(TXN_LOG_PARTITION_SIZE), "")); - // Disable checkpointing by making checkpoint thread wait max wait time - ac.getProperty().add(new Property(TransactionProperties.TXN_LOG_CHECKPOINT_POLLFREQUENCY_KEY, - String.valueOf(Integer.MAX_VALUE), "")); - // Write test config file - TestHelper.writeConfigurations(ac, TEST_CONFIG_FILE_PATH); } @After @@ -113,10 +101,18 @@ public class CheckpointingTest { TestHelper.deleteExistingInstanceFiles(); } + private List<Pair<IOption, Object>> setOpts() { + List<Pair<IOption, Object>> opts = new ArrayList<>(); + opts.add(Pair.of(TransactionProperties.Option.TXN_LOG_PARTITIONSIZE, TXN_LOG_PARTITION_SIZE)); + opts.add(Pair.of(TransactionProperties.Option.TXN_LOG_CHECKPOINT_POLLFREQUENCY, Integer.MAX_VALUE)); + return opts; + } + @Test public void testDeleteOldLogFiles() { try { TestNodeController nc = new TestNodeController(new File(TEST_CONFIG_FILE_PATH).getAbsolutePath(), false); + nc.setOpts(setOpts()); StorageComponentProvider storageManager = new StorageComponentProvider(); nc.init(); List<List<String>> partitioningKeys = new ArrayList<>(); @@ -221,8 +217,8 @@ public class CheckpointingTest { nc.init(); try { final ITransactionSubsystem txnSubsystem = nc.getTransactionSubsystem(); - final AbstractCheckpointManager checkpointManager = - (AbstractCheckpointManager) txnSubsystem.getCheckpointManager(); + final AbstractCheckpointManager checkpointManager = (AbstractCheckpointManager) txnSubsystem + .getCheckpointManager(); // Make a checkpoint with the current minFirstLSN final long minFirstLSN = txnSubsystem.getRecoveryManager().getMinFirstLSN(); checkpointManager.tryCheckpoint(minFirstLSN); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java index f75942d..0cd9473 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java @@ -45,17 +45,16 @@ public class MetadataTest { private static final String PATH_ACTUAL = "target" + File.separator + "mdtest" + File.separator; private static final String PATH_BASE = StringUtils .join(new String[] { "src", "test", "resources", "metadata" + File.separator }, File.separator); - private static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; private static final TestExecutor testExecutor = new TestExecutor(); private static AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); @BeforeClass public static void setUp() throws Exception { - System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, TEST_CONFIG_FILE_NAME); File outdir = new File(PATH_ACTUAL); outdir.mkdirs(); - integrationUtil.init(true); + integrationUtil.init(true, TEST_CONFIG_FILE_NAME); } @AfterClass http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java index 3e906b4..1d31bc0 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java @@ -53,14 +53,14 @@ import org.junit.Test; public class MetadataTxnTest { - private static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; private static final TestExecutor testExecutor = new TestExecutor(); private static final AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); @Before public void setUp() throws Exception { System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, TEST_CONFIG_FILE_NAME); - integrationUtil.init(true); + integrationUtil.init(true, TEST_CONFIG_FILE_NAME); } @After @@ -70,8 +70,8 @@ public class MetadataTxnTest { @Test public void abortMetadataTxn() throws Exception { - ICcApplicationContext appCtx = - (ICcApplicationContext) integrationUtil.getClusterControllerService().getApplicationContext(); + ICcApplicationContext appCtx = (ICcApplicationContext) integrationUtil.getClusterControllerService() + .getApplicationContext(); final MetadataProvider metadataProvider = new MetadataProvider(appCtx, null); final MetadataTransactionContext mdTxn = MetadataManager.INSTANCE.beginTransaction(); metadataProvider.setMetadataTxnContext(mdTxn); @@ -98,8 +98,8 @@ public class MetadataTxnTest { @Test public void rebalanceFailureMetadataTxn() throws Exception { - ICcApplicationContext appCtx = - (ICcApplicationContext) integrationUtil.getClusterControllerService().getApplicationContext(); + ICcApplicationContext appCtx = (ICcApplicationContext) integrationUtil.getClusterControllerService() + .getApplicationContext(); String nodeGroup = "ng"; String datasetName = "dataset1"; final TestCaseContext.OutputFormat format = TestCaseContext.OutputFormat.CLEAN_JSON; @@ -158,8 +158,8 @@ public class MetadataTxnTest { testExecutor.executeSqlppUpdateOrDdl("CREATE DATASET " + datasetName + "(KeyType) PRIMARY KEY id;", format); // get created dataset - ICcApplicationContext appCtx = - (ICcApplicationContext) integrationUtil.getClusterControllerService().getApplicationContext(); + ICcApplicationContext appCtx = (ICcApplicationContext) integrationUtil.getClusterControllerService() + .getApplicationContext(); MetadataProvider metadataProvider = new MetadataProvider(appCtx, null); final MetadataTransactionContext mdTxnCtx = MetadataManager.INSTANCE.beginTransaction(); metadataProvider.setMetadataTxnContext(mdTxnCtx); @@ -202,8 +202,8 @@ public class MetadataTxnTest { Assert.assertEquals(0, failCount.get()); // make sure all metadata indexes have no pending operations after all txns committed/aborted - final IDatasetLifecycleManager datasetLifecycleManager = - ((INcApplicationContext) integrationUtil.ncs[0].getApplicationContext()).getDatasetLifecycleManager(); + final IDatasetLifecycleManager datasetLifecycleManager = ((INcApplicationContext) integrationUtil.ncs[0] + .getApplicationContext()).getDatasetLifecycleManager(); int maxMetadatasetId = 14; for (int i = 1; i <= maxMetadatasetId; i++) { if (datasetLifecycleManager.getIndex(i, i) != null) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java index c0a4d80..9b8afd3 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java @@ -67,15 +67,15 @@ public class OptimizerTest { private static final String EXTENSION_RESULT = "plan"; private static final String FILENAME_IGNORE = "ignore.txt"; private static final String FILENAME_ONLY = "only.txt"; - private static final String PATH_BASE = - "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + "optimizerts" + SEPARATOR; + private static final String PATH_BASE = "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + + "optimizerts" + SEPARATOR; private static final String PATH_QUERIES = PATH_BASE + "queries" + SEPARATOR; private static final String PATH_EXPECTED = PATH_BASE + "results" + SEPARATOR; protected static final String PATH_ACTUAL = "target" + File.separator + "opttest" + SEPARATOR; private static final ArrayList<String> ignore = AsterixTestHelper.readTestListFile(FILENAME_IGNORE, PATH_BASE); private static final ArrayList<String> only = AsterixTestHelper.readTestListFile(FILENAME_ONLY, PATH_BASE); - protected static String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; private static final ILangCompilationProvider aqlCompilationProvider = new AqlCompilationProvider(); private static final ILangCompilationProvider sqlppCompilationProvider = new SqlppCompilationProvider(); protected static ILangCompilationProvider extensionLangCompilationProvider = null; @@ -86,13 +86,12 @@ public class OptimizerTest { @BeforeClass public static void setUp() throws Exception { - System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, TEST_CONFIG_FILE_NAME); final File outdir = new File(PATH_ACTUAL); outdir.mkdirs(); HDFSCluster.getInstance().setup(); - integrationUtil.init(true); + integrationUtil.init(true, TEST_CONFIG_FILE_NAME); // Set the node resolver to be the identity resolver that expects node names // to be node controller ids; a valid assumption in test environment. System.setProperty(ExternalDataConstants.NODE_RESOLVER_FACTORY_PROPERTY, @@ -154,10 +153,10 @@ public class OptimizerTest { @Test public void test() throws Exception { try { - String queryFileShort = - queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0), '/'); + String queryFileShort = queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0), + '/'); if (!only.isEmpty()) { - boolean toRun = TestHelper.isInPrefixList(only, queryFileShort); + boolean toRun = TestHelper.isInPrefixList(only, queryFileShort); if (!toRun) { LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" \"only.txt\" not empty and not in \"only.txt\"."); @@ -179,15 +178,15 @@ public class OptimizerTest { actualFile.getParentFile().mkdirs(); PrintWriter plan = new PrintWriter(actualFile); - ILangCompilationProvider provider = - queryFile.getName().endsWith("aql") ? aqlCompilationProvider : sqlppCompilationProvider; + ILangCompilationProvider provider = queryFile.getName().endsWith("aql") ? aqlCompilationProvider + : sqlppCompilationProvider; if (extensionLangCompilationProvider != null) { provider = extensionLangCompilationProvider; } IHyracksClientConnection hcc = integrationUtil.getHyracksClientConnection(); - AsterixJavaClient asterix = - new AsterixJavaClient((ICcApplicationContext) integrationUtil.cc.getApplicationContext(), hcc, - query, plan, provider, statementExecutorFactory, storageComponentProvider); + AsterixJavaClient asterix = new AsterixJavaClient( + (ICcApplicationContext) integrationUtil.cc.getApplicationContext(), hcc, query, plan, provider, + statementExecutorFactory, storageComponentProvider); try { asterix.compile(true, false, false, true, true, false, false); } catch (AlgebricksException e) { @@ -198,10 +197,10 @@ public class OptimizerTest { plan.close(); query.close(); - BufferedReader readerExpected = - new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile), "UTF-8")); - BufferedReader readerActual = - new BufferedReader(new InputStreamReader(new FileInputStream(actualFile), "UTF-8")); + BufferedReader readerExpected = new BufferedReader( + new InputStreamReader(new FileInputStream(expectedFile), "UTF-8")); + BufferedReader readerActual = new BufferedReader( + new InputStreamReader(new FileInputStream(actualFile), "UTF-8")); String lineExpected, lineActual; int num = 1; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/APIExecutionTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/APIExecutionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/APIExecutionTest.java index dd87455..cf62e42 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/APIExecutionTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/APIExecutionTest.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class APIExecutionTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionFullParallelismIT.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionFullParallelismIT.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionFullParallelismIT.java index 4ab44e0..09758f6 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionFullParallelismIT.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionFullParallelismIT.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class AqlExecutionFullParallelismIT { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration2.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc2.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionLessParallelismIT.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionLessParallelismIT.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionLessParallelismIT.java index c72013e..62ed790 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionLessParallelismIT.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionLessParallelismIT.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class AqlExecutionLessParallelismIT { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration3.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc3.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTest.java index abc9f2f..6430219 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTest.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class AqlExecutionTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTestIT.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTestIT.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTestIT.java index 441f27d..290638e 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTestIT.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/AqlExecutionTestIT.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class AqlExecutionTestIT { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateDefaultParameterTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateDefaultParameterTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateDefaultParameterTest.java index 17e88a6..f029669 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateDefaultParameterTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateDefaultParameterTest.java @@ -40,7 +40,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class ClusterStateDefaultParameterTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration4.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc4.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionFullParallelismTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionFullParallelismTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionFullParallelismTest.java index e428c93..f79a7ea 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionFullParallelismTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionFullParallelismTest.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class ClusterStateExecutionFullParallelismTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration2.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc2.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionLessParallelismTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionLessParallelismTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionLessParallelismTest.java index 346ae2f..ccd54d7 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionLessParallelismTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ClusterStateExecutionLessParallelismTest.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class ClusterStateExecutionLessParallelismTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration3.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc3.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java index 5c2d263..b7ffcf2 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java @@ -34,6 +34,8 @@ import org.apache.asterix.external.util.ExternalDataConstants; import org.apache.asterix.external.util.IdentitiyResolverFactory; import org.apache.asterix.testframework.xml.TestGroup; import org.apache.asterix.testframework.xml.TestSuite; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.hyracks.api.config.IOption; import org.apache.hyracks.control.nc.NodeControllerService; public class ExecutionTestUtil { @@ -42,33 +44,36 @@ public class ExecutionTestUtil { protected static final String PATH_ACTUAL = "rttest" + File.separator; - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; - public static TestGroup FailedGroup; public static AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); public static List<ILibraryManager> setUp(boolean cleanup) throws Exception { - return setUp(cleanup, TEST_CONFIG_FILE_NAME, integrationUtil, true); + return setUp(cleanup, AsterixHyracksIntegrationUtil.DEFAULT_CONF_FILE, integrationUtil, true, null); } public static List<ILibraryManager> setUp(boolean cleanup, String configFile) throws Exception { - return setUp(cleanup, configFile, integrationUtil, true); + return setUp(cleanup, configFile, integrationUtil, true, null); } public static List<ILibraryManager> setUp(boolean cleanup, String configFile, - AsterixHyracksIntegrationUtil alternateIntegrationUtil, boolean startHdfs) throws Exception { + AsterixHyracksIntegrationUtil alternateIntegrationUtil, boolean startHdfs, List<Pair<IOption, Object>> opts) + throws Exception { System.out.println("Starting setup"); if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("Starting setup"); } - System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, configFile); if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("initializing pseudo cluster"); } integrationUtil = alternateIntegrationUtil; - integrationUtil.init(cleanup); + if (opts != null) { + for (Pair<IOption, Object> p : opts) { + integrationUtil.addOption(p.getLeft(), p.getRight()); + } + } + integrationUtil.init(cleanup, configFile); if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("initializing HDFS"); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java index 09761a0..8deb827 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.apache.asterix.common.config.NodeProperties; import org.apache.asterix.app.external.ExternalUDFLibrarian; import org.apache.asterix.common.library.ILibraryManager; import org.apache.asterix.common.utils.StorageConstants; @@ -48,8 +49,8 @@ import org.apache.hyracks.util.ThreadDumpUtil; public class LangExecutionUtil { private static final String PATH_ACTUAL = "target" + File.separator + "rttest" + File.separator; - private static final String PATH_BASE = - StringUtils.join(new String[] { "src", "test", "resources", "runtimets" }, File.separator); + private static final String PATH_BASE = StringUtils.join(new String[] { "src", "test", "resources", "runtimets" }, + File.separator); private static final boolean cleanupOnStart = true; private static final boolean cleanupOnStop = true; @@ -213,8 +214,8 @@ public class LangExecutionUtil { String processId = processName.split("@")[0]; // Checks whether there are leaked run files from operators. - Process process = - Runtime.getRuntime().exec(new String[] { "bash", "-c", "lsof -p " + processId + "|grep waf|wc -l" }); + Process process = Runtime.getRuntime() + .exec(new String[] { "bash", "-c", "lsof -p " + processId + "|grep waf|wc -l" }); try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { int runFileCount = Integer.parseInt(reader.readLine().trim()); if (runFileCount != 0) { @@ -230,8 +231,8 @@ public class LangExecutionUtil { } private static void outputLeakedOpenFiles(String processId) throws IOException { - Process process = - Runtime.getRuntime().exec(new String[] { "bash", "-c", "lsof -p " + processId + "|grep waf" }); + Process process = Runtime.getRuntime() + .exec(new String[] { "bash", "-c", "lsof -p " + processId + "|grep waf" }); try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { String line; while ((line = reader.readLine()) != null) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/MetricsExecutionTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/MetricsExecutionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/MetricsExecutionTest.java index c7fae46..a973c63 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/MetricsExecutionTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/MetricsExecutionTest.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class MetricsExecutionTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceTest.java index 7eb1110..afde4b2 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceTest.java @@ -34,7 +34,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class RebalanceTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceWithCancellationIT.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceWithCancellationIT.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceWithCancellationIT.java index 1d7bdc3..58502fb 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceWithCancellationIT.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/RebalanceWithCancellationIT.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class RebalanceWithCancellationIT { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; private static RebalanceCancellationTestExecutor executor = new RebalanceCancellationTestExecutor(); @BeforeClass http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java index 32b756b..d54d448 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java @@ -25,9 +25,9 @@ import java.util.HashMap; import java.util.Map; import org.apache.asterix.common.api.INcApplicationContext; -import org.apache.asterix.common.config.ClusterProperties; import org.apache.asterix.test.common.TestExecutor; import org.apache.asterix.testframework.context.TestCaseContext; +import org.apache.hyracks.control.common.controllers.NCConfig; import org.apache.hyracks.control.nc.NodeControllerService; import org.junit.After; import org.junit.Before; @@ -39,13 +39,12 @@ import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class ReplicationExecutionTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc-rep.conf"; private static final TestExecutor testExecutor = new TestExecutor(); private static boolean configured = false; @BeforeClass public static void setUp() { - ClusterProperties.INSTANCE.getCluster().getHighAvailability().setEnabled(String.valueOf(true)); LangExecutionUtil.setCheckStorageDistribution(false); } @@ -61,7 +60,7 @@ public class ReplicationExecutionTest { final String nodeId = nc.getId(); final INcApplicationContext appCtx = (INcApplicationContext) nc.getApplicationContext(); int apiPort = appCtx.getExternalProperties().getNcApiPort(); - int replicationPort = appCtx.getReplicationProperties().getDataReplicationPort(nodeId); + int replicationPort = (int) appCtx.getServiceContext().getAppConfig().get(NCConfig.Option.REPLICATION_LISTEN_PORT); ncEndPoints.put(nodeId, InetSocketAddress.createUnresolved(ip, apiPort)); replicationAddress.put(nodeId, InetSocketAddress.createUnresolved(ip, replicationPort)); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionFullParallelismIT.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionFullParallelismIT.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionFullParallelismIT.java index 3d93c36..df7976b 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionFullParallelismIT.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionFullParallelismIT.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class SqlppExecutionFullParallelismIT { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration2.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc2.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionIT.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionIT.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionIT.java index 99907a2..334d6df 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionIT.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionIT.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class SqlppExecutionIT { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionLessParallelismIT.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionLessParallelismIT.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionLessParallelismIT.java index 53b068e..d99590d 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionLessParallelismIT.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionLessParallelismIT.java @@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class SqlppExecutionLessParallelismIT { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration3.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc3.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java index 8ec1fe7..f9f57a3 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java @@ -34,7 +34,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class SqlppExecutionTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; @BeforeClass public static void setUp() throws Exception { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionWithCancellationTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionWithCancellationTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionWithCancellationTest.java index fff0775..c5ca66a 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionWithCancellationTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionWithCancellationTest.java @@ -36,7 +36,7 @@ import org.junit.runners.Parameterized.Parameters; */ @RunWith(Parameterized.class) public class SqlppExecutionWithCancellationTest { - protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; public static int numCancelledQueries = 0; @BeforeClass http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java index 8897169..c813c43 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java @@ -63,8 +63,8 @@ public class DiskIsFullTest { private static final IAType[] KEY_TYPES = { BuiltinType.AINT32 }; private static final ARecordType RECORD_TYPE = new ARecordType("TestRecordType", new String[] { "key", "value" }, new IAType[] { BuiltinType.AINT32, BuiltinType.AINT64 }, false); - private static final GenerationFunction[] RECORD_GEN_FUNCTION = - { GenerationFunction.DETERMINISTIC, GenerationFunction.DETERMINISTIC }; + private static final GenerationFunction[] RECORD_GEN_FUNCTION = { GenerationFunction.DETERMINISTIC, + GenerationFunction.DETERMINISTIC }; private static final boolean[] UNIQUE_RECORD_FIELDS = { true, false }; private static final ARecordType META_TYPE = null; private static final GenerationFunction[] META_GEN_FUNCTION = null; @@ -111,8 +111,8 @@ public class DiskIsFullTest { if (!shouldRun) { return; } - HyracksDataException expectedException = - HyracksDataException.create(ErrorCode.CANNOT_MODIFY_INDEX_DISK_IS_FULL); + HyracksDataException expectedException = HyracksDataException + .create(ErrorCode.CANNOT_MODIFY_INDEX_DISK_IS_FULL); try { TestNodeController nc = new TestNodeController(null, false); nc.init(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java index 402da6c..31cc77a 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java @@ -111,8 +111,8 @@ public class IndexDropOperatorNodePushableTest { // create dataset TestNodeController.PrimaryIndexInfo indexInfo = nc.createPrimaryIndex(dataset, KEY_TYPES, RECORD_TYPE, META_TYPE, null, storageManager, KEY_INDEXES, KEY_INDICATORS_LIST, 0); - IndexDataflowHelperFactory helperFactory = - new IndexDataflowHelperFactory(nc.getStorageManager(), indexInfo.getFileSplitProvider()); + IndexDataflowHelperFactory helperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), + indexInfo.getFileSplitProvider()); JobId jobId = nc.newJobId(); IHyracksTaskContext ctx = nc.createTestContext(jobId, 0, true); IIndexDataflowHelper dataflowHelper = helperFactory.create(ctx.getJobletContext().getServiceContext(), 0); @@ -153,10 +153,10 @@ public class IndexDropOperatorNodePushableTest { MetadataManager.INSTANCE.commitTransaction(mdTxn); FileSplit[] splits = SplitsAndConstraintsUtil.getIndexSplits(appCtx.getClusterStateManager(), dataset, indexName, Arrays.asList("asterix_nc1")); - final ConstantFileSplitProvider constantFileSplitProvider = - new ConstantFileSplitProvider(Arrays.copyOfRange(splits, 0, 1)); - IndexDataflowHelperFactory helperFactory = - new IndexDataflowHelperFactory(nc.getStorageManager(), constantFileSplitProvider); + final ConstantFileSplitProvider constantFileSplitProvider = new ConstantFileSplitProvider( + Arrays.copyOfRange(splits, 0, 1)); + IndexDataflowHelperFactory helperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), + constantFileSplitProvider); JobId jobId = nc.newJobId(); IHyracksTaskContext ctx = nc.createTestContext(jobId, 0, true); IIndexDataflowHelper dataflowHelper = helperFactory.create(ctx.getJobletContext().getServiceContext(), 0); @@ -172,8 +172,8 @@ public class IndexDropOperatorNodePushableTest { // open the index to make it in-use dataflowHelper.open(); // try to drop in-use index (should fail) - IndexDropOperatorNodePushable dropInUseOp = - new IndexDropOperatorNodePushable(helperFactory, EnumSet.noneOf(DropOption.class), ctx, 0); + IndexDropOperatorNodePushable dropInUseOp = new IndexDropOperatorNodePushable(helperFactory, + EnumSet.noneOf(DropOption.class), ctx, 0); try { dropInUseOp.initialize(); } catch (HyracksDataException e) { @@ -212,8 +212,8 @@ public class IndexDropOperatorNodePushableTest { private void dropNonExisting(IHyracksTaskContext ctx, IndexDataflowHelperFactory helperFactory) throws Exception { dropFailed.set(false); // Dropping non-existing index - IndexDropOperatorNodePushable dropNonExistingOp = - new IndexDropOperatorNodePushable(helperFactory, EnumSet.noneOf(DropOption.class), ctx, 0); + IndexDropOperatorNodePushable dropNonExistingOp = new IndexDropOperatorNodePushable(helperFactory, + EnumSet.noneOf(DropOption.class), ctx, 0); try { dropNonExistingOp.initialize(); } catch (HyracksDataException e) { @@ -228,8 +228,8 @@ public class IndexDropOperatorNodePushableTest { throws Exception { // Dropping non-existing index with if exists option should be successful dropFailed.set(false); - IndexDropOperatorNodePushable dropNonExistingWithIfExistsOp = - new IndexDropOperatorNodePushable(helperFactory, EnumSet.of(DropOption.IF_EXISTS), ctx, 0); + IndexDropOperatorNodePushable dropNonExistingWithIfExistsOp = new IndexDropOperatorNodePushable(helperFactory, + EnumSet.of(DropOption.IF_EXISTS), ctx, 0); try { dropNonExistingWithIfExistsOp.initialize(); } catch (HyracksDataException e) { @@ -238,4 +238,4 @@ public class IndexDropOperatorNodePushableTest { } Assert.assertFalse(dropFailed.get()); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/MigrateStorageResourcesTaskTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/MigrateStorageResourcesTaskTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/MigrateStorageResourcesTaskTest.java index 47a561a..a98730a 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/MigrateStorageResourcesTaskTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/MigrateStorageResourcesTaskTest.java @@ -42,12 +42,11 @@ import org.junit.Test; public class MigrateStorageResourcesTaskTest { - private static final String DEFAULT_TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; + private static final String DEFAULT_TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; private static final AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); @Before public void setUp() throws Exception { - System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, DEFAULT_TEST_CONFIG_FILE_NAME); } @After @@ -57,12 +56,12 @@ public class MigrateStorageResourcesTaskTest { @Test public void storageStructureMigration() throws Exception { - Function<IndexPathElements, String> legacyIndexPathProvider = (pathElements) -> - (pathElements.getRebalanceCount().equals("0") ? "" : pathElements.getRebalanceCount() + File.separator) - + pathElements.getDatasetName() + StorageConstants.LEGACY_DATASET_INDEX_NAME_SEPARATOR - + pathElements.getIndexName(); + Function<IndexPathElements, String> legacyIndexPathProvider = ( + pathElements) -> (pathElements.getRebalanceCount().equals("0") ? "" + : pathElements.getRebalanceCount() + File.separator) + pathElements.getDatasetName() + + StorageConstants.LEGACY_DATASET_INDEX_NAME_SEPARATOR + pathElements.getIndexName(); StoragePathUtil.setIndexPathProvider(legacyIndexPathProvider); - integrationUtil.init(true); + integrationUtil.init(true, DEFAULT_TEST_CONFIG_FILE_NAME); // create dataset and insert data using legacy structure String datasetName = "ds"; TestDataUtil.createIdOnlyDataset(datasetName); @@ -72,18 +71,18 @@ public class MigrateStorageResourcesTaskTest { integrationUtil.deinit(false); // forge a checkpoint with old version to force migration to new storage structure on all ncs final INcApplicationContext nc1AppCtx = (INcApplicationContext) integrationUtil.ncs[0].getApplicationContext(); - final AbstractCheckpointManager nc1CheckpointManager = - (AbstractCheckpointManager) nc1AppCtx.getTransactionSubsystem().getCheckpointManager(); + final AbstractCheckpointManager nc1CheckpointManager = (AbstractCheckpointManager) nc1AppCtx + .getTransactionSubsystem().getCheckpointManager(); forgeOldVersionCheckpoint(nc1CheckpointManager); final INcApplicationContext nc2AppCtx = (INcApplicationContext) integrationUtil.ncs[1].getApplicationContext(); - final AbstractCheckpointManager nc2CheckpointManager = - (AbstractCheckpointManager) nc2AppCtx.getTransactionSubsystem().getCheckpointManager(); + final AbstractCheckpointManager nc2CheckpointManager = (AbstractCheckpointManager) nc2AppCtx + .getTransactionSubsystem().getCheckpointManager(); forgeOldVersionCheckpoint(nc2CheckpointManager); // remove the legacy path provider to use the new default structure StoragePathUtil.setIndexPathProvider(null); // start the NCs to do the migration - integrationUtil.init(false); + integrationUtil.init(false, DEFAULT_TEST_CONFIG_FILE_NAME); final long countAfterMigration = TestDataUtil.getDatasetCount(datasetName); // ensure data migrated to new structure without issues Assert.assertEquals(countBeforeMigration, countAfterMigration); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/RecoveryManagerTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/RecoveryManagerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/RecoveryManagerTest.java index 29efa47..92e403c 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/RecoveryManagerTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/txn/RecoveryManagerTest.java @@ -23,11 +23,13 @@ import java.util.logging.ConsoleHandler; import java.util.logging.Level; import java.util.logging.Logger; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.asterix.api.common.AsterixHyracksIntegrationUtil; import org.apache.asterix.common.TestDataUtil; import org.apache.asterix.common.config.GlobalConfig; -import org.apache.asterix.common.configuration.AsterixConfiguration; -import org.apache.asterix.common.configuration.Property; +import org.apache.asterix.common.config.StorageProperties; +import org.apache.asterix.common.utils.Servlets; +import org.apache.asterix.test.common.TestExecutor; import org.apache.asterix.metadata.bootstrap.MetadataBuiltinEntities; import org.apache.asterix.test.common.TestHelper; import org.junit.After; @@ -37,25 +39,21 @@ import org.junit.Test; public class RecoveryManagerTest { - private static final String DEFAULT_TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml"; - private static final String TEST_CONFIG_FILE_NAME = "asterix-test-configuration.xml"; - private static final String TEST_CONFIG_PATH = - System.getProperty("user.dir") + File.separator + "target" + File.separator + "config"; + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + private static final String TEST_CONFIG_FILE_NAME = "cc.conf"; + private static final String TEST_CONFIG_PATH = System.getProperty("user.dir") + File.separator + "src" + + File.separator + "main" + File.separator + "resources"; private static final String TEST_CONFIG_FILE_PATH = TEST_CONFIG_PATH + File.separator + TEST_CONFIG_FILE_NAME; private static final AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); @Before public void setUp() throws Exception { // Read default test configurations - AsterixConfiguration ac = TestHelper.getConfigurations(DEFAULT_TEST_CONFIG_FILE_NAME); - // override memory config to enforce dataset eviction - ac.getProperty().add(new Property("storage.memorycomponent.globalbudget", "128MB", "")); - ac.getProperty().add(new Property("storage.memorycomponent.numpages", "32", "")); // Write test config file - TestHelper.writeConfigurations(ac, TEST_CONFIG_FILE_PATH); - System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, TEST_CONFIG_FILE_PATH); + integrationUtil.addOption(StorageProperties.Option.STORAGE_MEMORYCOMPONENT_GLOBALBUDGET, "128MB"); + integrationUtil.addOption(StorageProperties.Option.STORAGE_MEMORYCOMPONENT_NUMPAGES, 32); integrationUtil.setGracefulShutdown(false); - integrationUtil.init(true); + integrationUtil.init(true, TEST_CONFIG_FILE_PATH); } @After @@ -76,7 +74,7 @@ public class RecoveryManagerTest { final long countBeforeFirstRecovery = TestDataUtil.getDatasetCount(datasetName); // do ungraceful shutdown to enforce recovery integrationUtil.deinit(false); - integrationUtil.init(false); + integrationUtil.init(false, TEST_CONFIG_FILE_PATH); final long countAfterFirstRecovery = TestDataUtil.getDatasetCount(datasetName); Assert.assertEquals(countBeforeFirstRecovery, countAfterFirstRecovery); // create more datasets after recovery @@ -89,7 +87,7 @@ public class RecoveryManagerTest { final long countBeforeSecondRecovery = TestDataUtil.getDatasetCount(datasetName); // do ungraceful shutdown to enforce recovery again integrationUtil.deinit(false); - integrationUtil.init(false); + integrationUtil.init(false, TEST_CONFIG_FILE_PATH); final long countAfterSecondRecovery = TestDataUtil.getDatasetCount(datasetName); Assert.assertEquals(countBeforeSecondRecovery, countAfterSecondRecovery); } @@ -111,8 +109,8 @@ public class RecoveryManagerTest { final long countBeforeRecovery = TestDataUtil.getDatasetCount(datasetName); // do ungraceful shutdown to enforce recovery integrationUtil.deinit(false); - integrationUtil.init(false); + integrationUtil.init(false, TEST_CONFIG_FILE_PATH); final long countAfterRecovery = TestDataUtil.getDatasetCount(datasetName); Assert.assertEquals(countBeforeRecovery, countAfterRecovery); } -} \ No newline at end of file +}
