Examples of DataLoader


Examples of org.cassandraunit.DataLoader

  private static final StringSerializer ss = StringSerializer.get();

  @Before
  public void before() throws Exception {
    EmbeddedCassandraServerHelper.startEmbeddedCassandra();
    DataLoader dataLoader = new DataLoader("TestCluster", "localhost:9171");
    dataLoader.load(new ClassPathYamlDataSet("integration/emptyDataSetWithReversedComparatorOnCompositeTypes.yaml"));
  }
View Full Code Here

Examples of org.cassandraunit.DataLoader

        if (commandLine.hasOption("s")) {

            loadingOption.setStrategy(StrategyModel.fromValue(commandLine.getOptionValue("s")));
        }

        DataLoader dataLoader = new DataLoader("clusterToLoad", host + ":" + port);
        dataLoader.load(new FileDataSet(file), loadingOption);
    }
View Full Code Here

Examples of org.cassandraunit.DataLoader

            if (!isInitialized) {
                EmbeddedCassandraServerHelper.startEmbeddedCassandra();
                // create structure and load data
                String clusterName = "Tatami cluster";
                String host = "localhost:9171";
                DataLoader dataLoader = new DataLoader(clusterName, host);
                dataLoader.load(new ClassPathJsonDataSet("dataset/dataset.json"));

                final ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder();
                builder.put("cluster.name", clusterName);

                final Node node = NodeBuilder.nodeBuilder().settings(builder.build()).local(true).node();
View Full Code Here

Examples of org.dbpedia.spotlight.io.DataLoader

      // Lucene Manager - Controls indexing and searching
      LuceneManager luceneManager = new LuceneManager(FSDirectory.open(new File(luceneIndexFileName)));

        try {
            new CustomScoresDisambiguator(new LuceneCandidateSearcher(luceneManager, false), new DataLoader(new DataLoader.TSVParser(), new File("data/Distinct-surfaceForm-By-uri.grouped")));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

Examples of org.easetech.easytest.annotation.DataLoader

        if (testClass == null && method == null) {
            Assert
                .fail("The framework should provide either the testClass parameter or the method parameter in order to load the test data.");
        }
        // We give priority to Class Loading and then to method loading
        DataLoader testData = null;
        if (testClass != null) {
            testData = testClass.getAnnotation(DataLoader.class);
        } else {
            testData = method.getAnnotation(DataLoader.class);
        }
View Full Code Here

Examples of org.easetech.easytest.annotation.DataLoader

            List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterClass.class);
            // THere would always be atleast on method associated with the Runner, else validation would fail.
            FrameworkMethod method = frameworkMethods.get(0);
            // Only if the return type of the Method is not VOID, we try to determine the right loader and data files.
            if (method.getMethod().getReturnType() != Void.TYPE) {
                DataLoader loaderAnnotation = method.getAnnotation(DataLoader.class);
                if (loaderAnnotation != null) {
                    determineLoader(loaderAnnotation);

                } else {
                    loaderAnnotation = getTestClass().getJavaClass().getAnnotation(DataLoader.class);
                    if (loaderAnnotation != null) {
                        determineLoader(loaderAnnotation);
                    }
                }
                if (dataLoader == null) {
                    Assert.fail("The framework currently does not support the specified Loader type. "
                        + "You can provide the custom Loader by choosing LoaderType.CUSTOM in TestData "
                        + "annotation and providing your custom loader using DataLoader annotation.");
                }
                dataFiles = loaderAnnotation.filePaths();
            } else {
                dataLoader = null;
            }

            return new RunAftersWithOutputData(statement, afters, null, dataLoader, dataFiles, writableData);
View Full Code Here

Examples of org.easetech.easytest.annotation.DataLoader

        if (testClass == null && method == null) {
            Assert
                .fail("The framework should provide either the testClass parameter or the method parameter in order to load the test data.");
        }
        // We give priority to Class Loading and then to method loading
        DataLoader testData = null;
        if (testClass != null) {
            testData = testClass.getAnnotation(DataLoader.class);
        } else {
            testData = method.getAnnotation(DataLoader.class);
        }
View Full Code Here

Examples of org.easetech.easytest.annotation.DataLoader

            List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterClass.class);
            // THere would always be atleast on method associated with the Runner, else validation would fail.
            FrameworkMethod method = frameworkMethods.get(0);
            // Only if the return type of the Method is not VOID, we try to determine the right loader and data files.
            if (method.getMethod().getReturnType() != Void.TYPE) {
                DataLoader loaderAnnotation = method.getAnnotation(DataLoader.class);
                if (loaderAnnotation != null) {
                    determineLoader(loaderAnnotation);

                } else {
                    loaderAnnotation = getTestClass().getJavaClass().getAnnotation(DataLoader.class);
                    if (loaderAnnotation != null) {
                        determineLoader(loaderAnnotation);
                    }
                }
                if (dataLoader == null) {
                    Assert.fail("The framework currently does not support the specified Loader type. "
                        + "You can provide the custom Loader by choosing LoaderType.CUSTOM in TestData "
                        + "annotation and providing your custom loader using DataLoader annotation.");
                }
                dataFiles = loaderAnnotation.filePaths();
            } else {
                dataLoader = null;
            }

            return new RunAftersWithOutputData(statement, afters, null, dataLoader, dataFiles, writableData);
View Full Code Here

Examples of org.easetech.easytest.annotation.DataLoader

        for (FrameworkMethod method : testMethods) {
            TestInfo testInfo = null;

            // Only if the return type of the Method is not VOID, we try to determine the right loader and data
            // files.
            DataLoader loaderAnnotation = method.getAnnotation(DataLoader.class);
            if (loaderAnnotation != null) {
                testInfo = DataLoaderUtil.determineLoader(loaderAnnotation, getTestClass());

            } else {
                loaderAnnotation = getTestClass().getJavaClass().getAnnotation(DataLoader.class);
View Full Code Here

Examples of org.easetech.easytest.annotation.DataLoader

        if (testClass == null && method == null) {
            Assert
                .fail("The framework should provide either the testClass parameter or the method parameter in order to load the test data.");
        }
        // We give priority to Class Loading and then to method loading
        DataLoader testData = null;
        if (testClass != null) {
            testData = testClass.getAnnotation(DataLoader.class);
        } else {
            testData = method.getAnnotation(DataLoader.class);
        }
        if (testData != null) {
            TestInfo testInfo = DataLoaderUtil.determineLoader(testData, currentTestClass);
            Loader dataLoader = testInfo.getDataLoader();
            if (testInfo.getDataLoader() == null) {
                Assert.fail("The framework currently does not support the specified Loader type. "
                    + "You can provide the custom Loader by choosing LoaderType.CUSTOM in TestData "
                    + "annotation and providing your custom loader using DataLoader annotation.");
            } else {
                if (testInfo.getFilePaths() == null || testInfo.getFilePaths().length == 0) {
                    // implies that there exists a CUSTOM loader that loads the data using Java classes
                    Map<String, List<Map<String, Object>>> data = dataLoader.loadData(new EmptyResource());
                    // We also maintain the copy of the actual data for our write functionality.
                    fillWritableData(writableData , data , testData.appendData());
                    DataContext.setData(DataConverter.appendClassName(data, currentTestClass.getJavaClass()), testData.appendData());
                    DataContext.setConvertedData(DataConverter.convert(data, currentTestClass.getJavaClass()) , testData.appendData());
                } else {
                    ResourceLoader resourceLoader = new ResourceLoaderStrategy(currentTestClass.getJavaClass());
                    for (String filePath : testInfo.getFilePaths()) {
                        Resource resource = resourceLoader.getResource(filePath);
                        try {
                            if (resource.exists()) {
                                Map<String, List<Map<String, Object>>> data = dataLoader.loadData(resource);
                                // We also maintain the copy of the actual data for our write functionality.
                                fillWritableData(writableData , data , testData.appendData());
                                DataContext
                                    .setData(DataConverter.appendClassName(data, currentTestClass.getJavaClass()), testData.appendData());
                                DataContext.setConvertedData(DataConverter.convert(data,
                                    currentTestClass.getJavaClass()), testData.appendData());
                            } else {
                                LOG.warn(
                                    "Resource {} does not exists in the specified path. If it is a classpath resource, use 'classpath:' "
                                        + "before the path name, else check the path.", resource);
                            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.