Search in sources :

Example 11 with Files

use of com.google.common.io.Files in project sonar-java by SonarSource.

the class XmlFileSensorTest method test_issues_creation.

@Test
public void test_issues_creation() throws Exception {
    SensorContextTester context = SensorContextTester.create(new File("src/test/files/maven/").getAbsoluteFile());
    DefaultFileSystem fs = context.fileSystem();
    final File file = new File("src/test/files/maven/pom.xml");
    DefaultInputFile inputFile = new TestInputFileBuilder("", "pom.xml").setModuleBaseDir(fs.baseDirPath()).setPublish(false).build();
    fs.add(inputFile);
    SonarComponents sonarComponents = createSonarComponentsMock(fs, file);
    XmlFileSensor sensor = new XmlFileSensor(sonarComponents, fs);
    assertThat(inputFile.isPublished()).isFalse();
    sensor.execute(context);
    assertThat(inputFile.isPublished()).isTrue();
    verify(sonarComponents, times(1)).reportIssue(Mockito.argThat(argument -> file.getAbsolutePath().equals(argument.getFile().getAbsolutePath())));
}
Also used : TestInputFileBuilder(org.sonar.api.batch.fs.internal.TestInputFileBuilder) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) DefaultFileSystem(org.sonar.api.batch.fs.internal.DefaultFileSystem) DefaultInputFile(org.sonar.api.batch.fs.internal.DefaultInputFile) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SensorContextTester(org.sonar.api.batch.sensor.internal.SensorContextTester) Lists(com.google.common.collect.Lists) Files(com.google.common.io.Files) JavaCheck(org.sonar.plugins.java.api.JavaCheck) SonarComponents(org.sonar.java.SonarComponents) Checks(org.sonar.api.batch.rule.Checks) Nullable(javax.annotation.Nullable) Before(org.junit.Before) IOException(java.io.IOException) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) RuleAnnotationUtils(org.sonar.api.rules.RuleAnnotationUtils) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) TestInputFileBuilder(org.sonar.api.batch.fs.internal.TestInputFileBuilder) SensorDescriptor(org.sonar.api.batch.sensor.SensorDescriptor) Mockito.verify(org.mockito.Mockito.verify) Mockito(org.mockito.Mockito) Mockito.never(org.mockito.Mockito.never) PomElementOrderCheck(org.sonar.java.checks.xml.maven.PomElementOrderCheck) RuleKey(org.sonar.api.rule.RuleKey) Mockito.mock(org.mockito.Mockito.mock) SonarComponents(org.sonar.java.SonarComponents) SensorContextTester(org.sonar.api.batch.sensor.internal.SensorContextTester) DefaultInputFile(org.sonar.api.batch.fs.internal.DefaultInputFile) DefaultInputFile(org.sonar.api.batch.fs.internal.DefaultInputFile) File(java.io.File) DefaultFileSystem(org.sonar.api.batch.fs.internal.DefaultFileSystem) Test(org.junit.Test)

Example 12 with Files

use of com.google.common.io.Files in project j2objc by google.

the class Options method getPathArgument.

private List<String> getPathArgument(String argument, boolean expandAarFiles, boolean expandWildcard) {
    List<String> entries = new ArrayList<>();
    for (String entry : Splitter.on(File.pathSeparatorChar).split(argument)) {
        if (entry.startsWith("~/")) {
            // Expand bash/csh tildes, which don't get expanded by the shell
            // first if in the middle of a path string.
            entry = System.getProperty("user.home") + entry.substring(1);
        }
        File f = new File(entry);
        if (f.getName().equals("*") && expandWildcard) {
            File parent = f.getParentFile() == null ? new File(".") : f.getParentFile();
            FileFilter jarFilter = file -> file.getName().endsWith(".jar");
            File[] files = parent.listFiles(jarFilter);
            if (files != null) {
                for (File jar : files) {
                    entries.add(jar.toString());
                }
            }
            continue;
        }
        if (entry.endsWith(".aar") && expandAarFiles) {
            // Extract classes.jar from Android library AAR file.
            f = fileUtil().extractClassesJarFromAarFile(f);
        }
        if (f.exists()) {
            entries.add(f.toString());
        }
    }
    return entries;
}
Also used : ExternalAnnotations(com.google.devtools.j2objc.util.ExternalAnnotations) Arrays(java.util.Arrays) URL(java.net.URL) GenerationUnit(com.google.devtools.j2objc.gen.GenerationUnit) Mappings(com.google.devtools.j2objc.util.Mappings) PackageInfoLookup(com.google.devtools.j2objc.util.PackageInfoLookup) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) Files(com.google.common.io.Files) NameTable(com.google.devtools.j2objc.util.NameTable) PackagePrefixes(com.google.devtools.j2objc.util.PackagePrefixes) Version(com.google.devtools.j2objc.util.Version) Splitter(com.google.common.base.Splitter) EnumSet(java.util.EnumSet) SourceVersion(com.google.devtools.j2objc.util.SourceVersion) ImmutableSet(com.google.common.collect.ImmutableSet) Properties(java.util.Properties) Iterator(java.util.Iterator) Resources(com.google.common.io.Resources) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Set(java.util.Set) IOException(java.io.IOException) Logger(java.util.logging.Logger) Sets(com.google.common.collect.Sets) File(java.io.File) List(java.util.List) FileFilter(java.io.FileFilter) HeaderMap(com.google.devtools.j2objc.util.HeaderMap) Preconditions(com.google.common.base.Preconditions) APPEND(com.google.common.io.FileWriteMode.APPEND) VisibleForTesting(com.google.common.annotations.VisibleForTesting) UnsupportedCharsetException(java.nio.charset.UnsupportedCharsetException) Pattern(java.util.regex.Pattern) Handler(java.util.logging.Handler) ErrorUtil(com.google.devtools.j2objc.util.ErrorUtil) Collections(java.util.Collections) FileUtil(com.google.devtools.j2objc.util.FileUtil) ArrayList(java.util.ArrayList) FileFilter(java.io.FileFilter) File(java.io.File)

Example 13 with Files

use of com.google.common.io.Files in project knime-core by knime.

the class NodeViewManagerTest method testGetNodeViewPageUrl.

/**
 * Tests {@link NodeViewManager#getNodeViewPageUrl(NativeNodeContainer)}.
 *
 * @throws URISyntaxException
 * @throws IOException
 */
@Test
public void testGetNodeViewPageUrl() throws URISyntaxException, IOException {
    var staticPage = Page.builder(BUNDLE_ID, "files", "page.html").addResourceFile("resource.html").build();
    var dynamicPage = Page.builder(() -> "page content", "page.html").addResourceFromString(() -> "resource content", "resource.html").build();
    NativeNodeContainer nnc = createNodeWithNodeView(m_wfm, m -> createNodeView(staticPage));
    NativeNodeContainer nnc2 = createNodeWithNodeView(m_wfm, m -> createNodeView(staticPage));
    NativeNodeContainer nnc3 = createNodeWithNodeView(m_wfm, m -> createNodeView(dynamicPage));
    var nodeViewManager = NodeViewManager.getInstance();
    String url = nodeViewManager.getNodeViewPageUrl(nnc).orElse("");
    String url2 = nodeViewManager.getNodeViewPageUrl(nnc2).orElse(null);
    String url3 = nodeViewManager.getNodeViewPageUrl(nnc3).orElse(null);
    String url4 = nodeViewManager.getNodeViewPageUrl(nnc3).orElse(null);
    assertThat("file url of static pages not expected to change", url, is(url2));
    assertThat("file url of dynamic pages expected to change between node instances", url, is(not(url3)));
    assertThat("file url of dynamic pages not expected for same node instance (without node state change)", url3, is(url4));
    assertThat("resource files are expected to be written, too", new File(new URI(url.replace("page.html", "resource.html"))).exists(), is(true));
    assertThat(new File(new URI(url)).exists(), is(true));
    assertThat(new File(new URI(url3)).exists(), is(true));
    String pageContent = Files.readLines(new File(new URI(url3)), StandardCharsets.UTF_8).get(0);
    assertThat(pageContent, is("page content"));
    // impose node state changes
    m_wfm.executeAllAndWaitUntilDone();
    var dynamicPage2 = Page.builder(() -> "new page content", "page.html").addResourceFromString(() -> "resource content", "resource.html").build();
    nnc = createNodeWithNodeView(m_wfm, m -> createNodeView(dynamicPage2));
    String url5 = nodeViewManager.getNodeViewPageUrl(nnc).orElse(null);
    pageContent = Files.readLines(new File(new URI(url5)), StandardCharsets.UTF_8).get(0);
    assertThat(pageContent, is("new page content"));
    runOnExecutor(() -> assertThat(nodeViewManager.getNodeViewPageUrl(nnc2).isEmpty(), is(true)));
}
Also used : NativeNodeContainer(org.knime.core.node.workflow.NativeNodeContainer) VirtualSubNodeInputNodeFactory(org.knime.core.node.workflow.virtual.subnode.VirtualSubNodeInputNodeFactory) NodeSettingsRO(org.knime.core.node.NodeSettingsRO) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) Assert.assertThrows(org.junit.Assert.assertThrows) URISyntaxException(java.net.URISyntaxException) Matchers.not(org.hamcrest.Matchers.not) WorkflowManagerUtil.createAndAddNode(org.knime.testing.util.WorkflowManagerUtil.createAndAddNode) NodeSettings(org.knime.core.node.NodeSettings) ApplyDataService(org.knime.core.webui.data.ApplyDataService) Page(org.knime.core.webui.page.Page) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) InitialDataService(org.knime.core.webui.data.InitialDataService) BUNDLE_ID(org.knime.core.webui.page.PageTest.BUNDLE_ID) NodeContainer(org.knime.core.node.workflow.NodeContainer) Files(com.google.common.io.Files) WorkflowManagerUtil(org.knime.testing.util.WorkflowManagerUtil) After(org.junit.After) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) NodeViewTest.createNodeView(org.knime.core.webui.node.view.NodeViewTest.createNodeView) URI(java.net.URI) TextReExecuteDataService(org.knime.core.webui.data.text.TextReExecuteDataService) Before(org.junit.Before) PortType(org.knime.core.node.port.PortType) NodeViewNodeFactory(org.knime.testing.node.view.NodeViewNodeFactory) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) TimeUnit(java.util.concurrent.TimeUnit) DataService(org.knime.core.webui.data.DataService) NodeViewNodeModel(org.knime.testing.node.view.NodeViewNodeModel) Optional(java.util.Optional) TextInitialDataService(org.knime.core.webui.data.text.TextInitialDataService) Matchers.is(org.hamcrest.Matchers.is) Matchers.containsString(org.hamcrest.Matchers.containsString) Awaitility(org.awaitility.Awaitility) TextDataService(org.knime.core.webui.data.text.TextDataService) Matchers.containsString(org.hamcrest.Matchers.containsString) File(java.io.File) URI(java.net.URI) NativeNodeContainer(org.knime.core.node.workflow.NativeNodeContainer) Test(org.junit.Test)

Example 14 with Files

use of com.google.common.io.Files in project ArachneCentralAPI by OHDSI.

the class BaseSubmissionController method getResultFiles.

@ApiOperation("Get result files of the submission.")
@GetMapping("/api/v1/analysis-management/submissions/{submissionId}/results")
public List<ResultFileDTO> getResultFiles(Principal principal, @PathVariable("submissionId") Long submissionId, @RequestParam(value = "path", required = false, defaultValue = "") String path, @RequestParam(value = "real-name", required = false) String realName) throws PermissionDeniedException, IOException {
    IUser user = userService.getByUsername(principal.getName());
    ResultFileSearch resultFileSearch = new ResultFileSearch();
    resultFileSearch.setPath(path);
    resultFileSearch.setRealName(realName);
    List<? extends ArachneFileMeta> resultFileList = submissionService.getResultFiles(user, submissionId, resultFileSearch);
    String resultFilesPath = contentStorageHelper.getResultFilesDir(Submission.class, submissionId, null);
    return resultFileList.stream().map(rf -> {
        ResultFileDTO rfDto = conversionService.convert(rf, ResultFileDTO.class);
        rfDto.setSubmissionId(submissionId);
        rfDto.setRelativePath(contentStorageHelper.getRelativePath(resultFilesPath, rfDto.getPath()));
        return rfDto;
    }).collect(Collectors.toList());
}
Also used : PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) AnalysisHelper(com.odysseusinc.arachne.portal.util.AnalysisHelper) ResultFile(com.odysseusinc.arachne.portal.model.ResultFile) LoggerFactory(org.slf4j.LoggerFactory) StringUtils(org.apache.commons.lang3.StringUtils) Valid(javax.validation.Valid) ApiOperation(io.swagger.annotations.ApiOperation) PutMapping(org.springframework.web.bind.annotation.PutMapping) Analysis(com.odysseusinc.arachne.portal.model.Analysis) ResultFileSearch(com.odysseusinc.arachne.portal.model.search.ResultFileSearch) SubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionFile) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) Path(java.nio.file.Path) SubmissionStatusHistoryElement(com.odysseusinc.arachne.portal.model.SubmissionStatusHistoryElement) ToPdfConverter(com.odysseusinc.arachne.portal.service.ToPdfConverter) BaseSubmissionService(com.odysseusinc.arachne.portal.service.submission.BaseSubmissionService) PostMapping(org.springframework.web.bind.annotation.PostMapping) BaseAnalysisService(com.odysseusinc.arachne.portal.service.analysis.BaseAnalysisService) ContentStorageService(com.odysseusinc.arachne.storage.service.ContentStorageService) ResultFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO) HttpUtils(com.odysseusinc.arachne.portal.util.HttpUtils) MediaType(org.springframework.http.MediaType) ArachneFileMeta(com.odysseusinc.arachne.storage.model.ArachneFileMeta) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) StandardCharsets(java.nio.charset.StandardCharsets) IUser(com.odysseusinc.arachne.portal.model.IUser) FileDTO(com.odysseusinc.arachne.portal.api.v1.dto.FileDTO) IOUtils(org.apache.commons.io.IOUtils) Principal(java.security.Principal) BaseSubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionDTO) SubmissionStatus(com.odysseusinc.arachne.portal.model.SubmissionStatus) FilenameUtils(org.apache.commons.io.FilenameUtils) java.util(java.util) FileDtoContentHandler(com.odysseusinc.arachne.portal.api.v1.dto.converters.FileDtoContentHandler) ZipInputStream(java.util.zip.ZipInputStream) StringUtils.getFilename(org.springframework.util.StringUtils.getFilename) ArrayUtils(org.apache.commons.lang3.ArrayUtils) Submission(com.odysseusinc.arachne.portal.model.Submission) ValidationException(com.odysseusinc.arachne.portal.exception.ValidationException) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) RequestBody(org.springframework.web.bind.annotation.RequestBody) NoExecutableFileException(com.odysseusinc.arachne.portal.exception.NoExecutableFileException) ApproveDTO(com.odysseusinc.arachne.portal.api.v1.dto.ApproveDTO) ZipUtil(com.odysseusinc.arachne.portal.util.ZipUtil) Files(com.google.common.io.Files) ObjectUtils(org.apache.commons.lang3.ObjectUtils) SubmissionStatusHistoryElementDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusHistoryElementDTO) NO_ERROR(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult.ErrorCode.NO_ERROR) GetMapping(org.springframework.web.bind.annotation.GetMapping) UploadFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.UploadFileDTO) BaseController(com.odysseusinc.arachne.portal.api.v1.controller.BaseController) Validated(org.springframework.validation.annotation.Validated) Logger(org.slf4j.Logger) HttpServletResponse(javax.servlet.http.HttpServletResponse) FileUtils(org.apache.commons.io.FileUtils) IOException(java.io.IOException) CommonAnalysisExecutionStatusDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisExecutionStatusDTO) CreateSubmissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateSubmissionsDTO) SubmissionFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO) File(java.io.File) PermissionDeniedException(com.odysseusinc.arachne.portal.exception.PermissionDeniedException) ContentStorageHelper(com.odysseusinc.arachne.portal.util.ContentStorageHelper) HttpStatus(org.springframework.http.HttpStatus) NotExistException(com.odysseusinc.arachne.portal.exception.NotExistException) MultipartFile(org.springframework.web.multipart.MultipartFile) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO) BaseSubmissionAndAnalysisTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseSubmissionAndAnalysisTypeDTO) SubmissionInsightService(com.odysseusinc.arachne.portal.service.submission.SubmissionInsightService) ResultFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) ResultFileSearch(com.odysseusinc.arachne.portal.model.search.ResultFileSearch) GetMapping(org.springframework.web.bind.annotation.GetMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 15 with Files

use of com.google.common.io.Files in project presto by prestodb.

the class TestHivePageSink method writeTestFile.

private static long writeTestFile(HiveClientConfig config, MetastoreClientConfig metastoreClientConfig, ExtendedHiveMetastore metastore, String outputPath) {
    HiveTransactionHandle transaction = new HiveTransactionHandle();
    HiveWriterStats stats = new HiveWriterStats();
    ConnectorPageSink pageSink = createPageSink(transaction, config, metastoreClientConfig, metastore, new Path("file:///" + outputPath), stats);
    List<LineItemColumn> columns = getTestColumns();
    List<Type> columnTypes = columns.stream().map(LineItemColumn::getType).map(TestHivePageSink::getHiveType).map(hiveType -> hiveType.getType(FUNCTION_AND_TYPE_MANAGER)).collect(toList());
    PageBuilder pageBuilder = new PageBuilder(columnTypes);
    int rows = 0;
    for (LineItem lineItem : new LineItemGenerator(0.01, 1, 1)) {
        rows++;
        if (rows >= NUM_ROWS) {
            break;
        }
        pageBuilder.declarePosition();
        for (int i = 0; i < columns.size(); i++) {
            LineItemColumn column = columns.get(i);
            BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(i);
            switch(column.getType().getBase()) {
                case IDENTIFIER:
                    BIGINT.writeLong(blockBuilder, column.getIdentifier(lineItem));
                    break;
                case INTEGER:
                    INTEGER.writeLong(blockBuilder, column.getInteger(lineItem));
                    break;
                case DATE:
                    DATE.writeLong(blockBuilder, column.getDate(lineItem));
                    break;
                case DOUBLE:
                    DOUBLE.writeDouble(blockBuilder, column.getDouble(lineItem));
                    break;
                case VARCHAR:
                    createUnboundedVarcharType().writeSlice(blockBuilder, Slices.utf8Slice(column.getString(lineItem)));
                    break;
                default:
                    throw new IllegalArgumentException("Unsupported type " + column.getType());
            }
        }
    }
    Page page = pageBuilder.build();
    pageSink.appendPage(page);
    getFutureValue(pageSink.finish());
    File outputDir = new File(outputPath);
    List<File> files = ImmutableList.copyOf(outputDir.listFiles((dir, name) -> !name.endsWith(".crc")));
    File outputFile = getOnlyElement(files);
    long length = outputFile.length();
    ConnectorPageSource pageSource = createPageSource(transaction, config, metastoreClientConfig, outputFile);
    List<Page> pages = new ArrayList<>();
    while (!pageSource.isFinished()) {
        Page nextPage = pageSource.getNextPage();
        if (nextPage != null) {
            pages.add(nextPage.getLoadedPage());
        }
    }
    MaterializedResult expectedResults = toMaterializedResult(getSession(config), columnTypes, ImmutableList.of(page));
    MaterializedResult results = toMaterializedResult(getSession(config), columnTypes, pages);
    assertEquals(results, expectedResults);
    assertEquals(stats.getInputPageSizeInBytes().getAllTime().getMax(), page.getRetainedSizeInBytes());
    return length;
}
Also used : Path(org.apache.hadoop.fs.Path) Page(com.facebook.presto.common.Page) MetadataManager(com.facebook.presto.metadata.MetadataManager) VarcharType.createUnboundedVarcharType(com.facebook.presto.common.type.VarcharType.createUnboundedVarcharType) HiveTestUtils.getDefaultHiveFileWriterFactories(com.facebook.presto.hive.HiveTestUtils.getDefaultHiveFileWriterFactories) NO_PREFERENCE(com.facebook.presto.spi.schedule.NodeSelectionStrategy.NO_PREFERENCE) MoreFiles.deleteRecursively(com.google.common.io.MoreFiles.deleteRecursively) Test(org.testng.annotations.Test) NO_CACHE_REQUIREMENT(com.facebook.presto.hive.CacheQuotaRequirement.NO_CACHE_REQUIREMENT) TpchColumnTypes(io.airlift.tpch.TpchColumnTypes) CacheConfig(com.facebook.presto.cache.CacheConfig) HiveTestUtils.getDefaultOrcFileWriterFactory(com.facebook.presto.hive.HiveTestUtils.getDefaultOrcFileWriterFactory) MoreFutures.getFutureValue(com.facebook.airlift.concurrent.MoreFutures.getFutureValue) DIRECT_TO_TARGET_NEW_DIRECTORY(com.facebook.presto.hive.LocationHandle.WriteMode.DIRECT_TO_TARGET_NEW_DIRECTORY) PageBuilder(com.facebook.presto.common.PageBuilder) SchemaTableName(com.facebook.presto.spi.SchemaTableName) ExtendedHiveMetastore(com.facebook.presto.hive.metastore.ExtendedHiveMetastore) Slices(io.airlift.slice.Slices) ConnectorPageSink(com.facebook.presto.spi.ConnectorPageSink) Path(org.apache.hadoop.fs.Path) HIVE_LONG(com.facebook.presto.hive.HiveType.HIVE_LONG) TpchColumnType(io.airlift.tpch.TpchColumnType) METASTORE_CONTEXT(com.facebook.presto.hive.HiveQueryRunner.METASTORE_CONTEXT) BlockBuilder(com.facebook.presto.common.block.BlockBuilder) ImmutableSet(com.google.common.collect.ImmutableSet) TestHiveUtil.createTestingFileHiveMetastore(com.facebook.presto.hive.TestHiveUtil.createTestingFileHiveMetastore) StorageFormat(com.facebook.presto.hive.metastore.StorageFormat) ImmutableMap(com.google.common.collect.ImmutableMap) DOUBLE(com.facebook.presto.common.type.DoubleType.DOUBLE) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) TestingNodeManager(com.facebook.presto.testing.TestingNodeManager) TRUE_CONSTANT(com.facebook.presto.expressions.LogicalRowExpressions.TRUE_CONSTANT) String.format(java.lang.String.format) ConnectorSession(com.facebook.presto.spi.ConnectorSession) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) LineItemGenerator(io.airlift.tpch.LineItemGenerator) PAGE_SORTER(com.facebook.presto.hive.HiveTestUtils.PAGE_SORTER) HIVE_STRING(com.facebook.presto.hive.HiveType.HIVE_STRING) List(java.util.List) Stream(java.util.stream.Stream) INTEGER(com.facebook.presto.common.type.IntegerType.INTEGER) Assertions.assertGreaterThan(com.facebook.airlift.testing.Assertions.assertGreaterThan) Optional(java.util.Optional) ConnectorId(com.facebook.presto.spi.ConnectorId) HiveTestUtils.getDefaultHiveBatchPageSourceFactories(com.facebook.presto.hive.HiveTestUtils.getDefaultHiveBatchPageSourceFactories) LineItem(io.airlift.tpch.LineItem) Assert.assertEquals(com.facebook.presto.testing.assertions.Assert.assertEquals) Column(com.facebook.presto.hive.metastore.Column) REGULAR(com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR) HivePageSinkMetadata(com.facebook.presto.hive.metastore.HivePageSinkMetadata) OptionalInt(java.util.OptionalInt) DATE(com.facebook.presto.common.type.DateType.DATE) ArrayList(java.util.ArrayList) HIVE_DATE(com.facebook.presto.hive.HiveType.HIVE_DATE) ROW_EXPRESSION_SERVICE(com.facebook.presto.hive.HiveTestUtils.ROW_EXPRESSION_SERVICE) HIVE_INT(com.facebook.presto.hive.HiveType.HIVE_INT) HiveTestUtils.createTestHdfsEnvironment(com.facebook.presto.hive.HiveTestUtils.createTestHdfsEnvironment) ALLOW_INSECURE(com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE) ImmutableList(com.google.common.collect.ImmutableList) HIVE_DOUBLE(com.facebook.presto.hive.HiveType.HIVE_DOUBLE) NON_CACHEABLE(com.facebook.presto.spi.SplitContext.NON_CACHEABLE) Files(com.google.common.io.Files) LineItemColumn(io.airlift.tpch.LineItemColumn) TableHandle(com.facebook.presto.spi.TableHandle) Type(com.facebook.presto.common.type.Type) BIGINT(com.facebook.presto.common.type.BigintType.BIGINT) Storage(com.facebook.presto.hive.metastore.Storage) HiveTestUtils.getDefaultHiveSelectivePageSourceFactories(com.facebook.presto.hive.HiveTestUtils.getDefaultHiveSelectivePageSourceFactories) HIVE_CATALOG(com.facebook.presto.hive.HiveQueryRunner.HIVE_CATALOG) TEST_HIVE_PAGE_SINK_CONTEXT(com.facebook.presto.hive.AbstractTestHiveClient.TEST_HIVE_PAGE_SINK_CONTEXT) NEW(com.facebook.presto.hive.LocationHandle.TableType.NEW) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) TestingConnectorSession(com.facebook.presto.testing.TestingConnectorSession) TupleDomain(com.facebook.presto.common.predicate.TupleDomain) File(java.io.File) FUNCTION_AND_TYPE_MANAGER(com.facebook.presto.hive.HiveTestUtils.FUNCTION_AND_TYPE_MANAGER) MaterializedResult(com.facebook.presto.testing.MaterializedResult) NONE(com.facebook.presto.hive.HiveCompressionCodec.NONE) Collectors.toList(java.util.stream.Collectors.toList) ConnectorPageSource(com.facebook.presto.spi.ConnectorPageSource) Assert.assertTrue(org.testng.Assert.assertTrue) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) SplitWeight(com.facebook.presto.spi.SplitWeight) JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) HiveTestUtils.getDefaultHiveRecordCursorProvider(com.facebook.presto.hive.HiveTestUtils.getDefaultHiveRecordCursorProvider) LineItemColumn(io.airlift.tpch.LineItemColumn) ArrayList(java.util.ArrayList) LineItem(io.airlift.tpch.LineItem) Page(com.facebook.presto.common.Page) PageBuilder(com.facebook.presto.common.PageBuilder) ConnectorPageSource(com.facebook.presto.spi.ConnectorPageSource) VarcharType.createUnboundedVarcharType(com.facebook.presto.common.type.VarcharType.createUnboundedVarcharType) TpchColumnType(io.airlift.tpch.TpchColumnType) Type(com.facebook.presto.common.type.Type) ConnectorPageSink(com.facebook.presto.spi.ConnectorPageSink) MaterializedResult(com.facebook.presto.testing.MaterializedResult) File(java.io.File) LineItemGenerator(io.airlift.tpch.LineItemGenerator) BlockBuilder(com.facebook.presto.common.block.BlockBuilder)

Aggregations

Files (com.google.common.io.Files)16 File (java.io.File)13 IOException (java.io.IOException)11 List (java.util.List)9 StandardCharsets (java.nio.charset.StandardCharsets)8 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 ImmutableList (com.google.common.collect.ImmutableList)5 ImmutableMap (com.google.common.collect.ImmutableMap)5 Stream (java.util.stream.Stream)5 Joiner (com.google.common.base.Joiner)3 ImmutableSet (com.google.common.collect.ImmutableSet)3 Optional (java.util.Optional)3 Before (org.junit.Before)3 Compiler (com.facebook.buck.cxx.Compiler)2 CxxPreprocessorInput (com.facebook.buck.cxx.CxxPreprocessorInput)2 BuildTarget (com.facebook.buck.model.BuildTarget)2 Flavor (com.facebook.buck.model.Flavor)2 InternalFlavor (com.facebook.buck.model.InternalFlavor)2 BuildRule (com.facebook.buck.rules.BuildRule)2