@Test
  public void testMapper() throws IOException, URISyntaxException {

    MapDriver<LongWritable, Text, Text, Text> mapDriver;
    JpylyzerMapper mapper = new JpylyzerMapper();
    String name = "B400022028241-RT1/balloon.jp2";
    mapDriver = MapDriver.newMapDriver(mapper);
    File testFolder =
        new File(Thread.currentThread().getContextClassLoader().getResource(name).toURI())
            .getParentFile()
            .getParentFile()
            .getParentFile()
            .getParentFile();
    File jpylyzerPath = new File(testFolder, "src/test/extras/jpylyzer-1.10.1/jpylyzer.py");
    mapDriver
        .getConfiguration()
        .set(
            dk.statsbiblioteket.medieplatform.autonomous.ConfigConstants.JPYLYZER_PATH,
            jpylyzerPath.getAbsolutePath());

    String testFile = getAbsolutePath(name);
    mapDriver.withInput(new LongWritable(1), new Text(testFile));
    mapDriver.withOutput(
        new Text(testFile),
        Utils.asText(JpylyzerMapper.jpylize(testFile, jpylyzerPath.getAbsolutePath())));
    mapDriver.runTest();
  }
コード例 #2
0
  private void serializations() {
    final String[] strings = reduceDriver.getConfiguration().getStrings("io.serializations");
    final String[] newStrings = new String[strings.length + 1];
    System.arraycopy(strings, 0, newStrings, 0, strings.length);
    newStrings[newStrings.length - 1] = SimpleFeatureImplSerialization.class.getName();
    reduceDriver.getConfiguration().setStrings("io.serializations", newStrings);

    mapDriver.getConfiguration().setStrings("io.serializations", newStrings);
  }
コード例 #3
0
  @Before
  public void setUp() throws IOException {

    mapDriver = MapDriver.newMapDriver(nnMapper);
    reduceDriver = ReduceDriver.newReduceDriver(nnReducer);

    mapDriver
        .getConfiguration()
        .set(
            GeoWaveConfiguratorBase.enumToConfKey(
                NNMapReduce.class, PartitionParameters.Partition.DISTANCE_THRESHOLDS),
            "10,10");

    reduceDriver
        .getConfiguration()
        .setDouble(
            GeoWaveConfiguratorBase.enumToConfKey(
                NNMapReduce.class, PartitionParameters.Partition.MAX_DISTANCE),
            10);

    ftype =
        AnalyticFeature.createGeometryFeatureAdapter(
                "centroid",
                new String[] {"extra1"},
                BasicFeatureTypes.DEFAULT_NAMESPACE,
                ClusteringUtils.CLUSTERING_CRS)
            .getType();

    reduceDriver
        .getConfiguration()
        .setClass(
            GeoWaveConfiguratorBase.enumToConfKey(
                DBScanMapReduce.class, HullParameters.Hull.PROJECTION_CLASS),
            SimpleFeatureProjection.class,
            Projection.class);

    JobContextAdapterStore.addDataAdapter(
        mapDriver.getConfiguration(), new FeatureDataAdapter(ftype));

    JobContextAdapterStore.addDataAdapter(
        reduceDriver.getConfiguration(), new FeatureDataAdapter(ftype));

    serializations();
  }
  @Test
  public void testSimplest() throws IOException {
    MapDriver<LongWritable, Text, Text, Text> mapDriver;
    JpylyzerMapper mapper = new JpylyzerMapper();
    mapDriver = MapDriver.newMapDriver(mapper);
    mapDriver
        .getConfiguration()
        .set(dk.statsbiblioteket.medieplatform.autonomous.ConfigConstants.JPYLYZER_PATH, "echo");

    mapDriver.withInput(new LongWritable(1), new Text("ein"));
    mapDriver.withOutput(new Text("ein"), new Text("ein"));
    mapDriver.runTest();
  }