コード例 #1
0
  @Test
  public void testUsesOtherGraph() throws Exception {

    Map<String, Object> parameters = new HashMap<String, Object>(1);
    parameters.put("THR", 67.0);

    Product targetProduct = GPF.createProduct("UsesOtherGraph", parameters, Collections.EMPTY_MAP);
    assertNotNull(targetProduct);
    assertEquals("Op2Name", targetProduct.getName());
    OperatorProductReader operatorProductReader =
        (OperatorProductReader) targetProduct.getProductReader();
    Operator operator = operatorProductReader.getOperatorContext().getOperator();
    TestOps.Op2 op2 = (Op2) operator;
    assertEquals(67.0, op2.threshold, 0.00001);
  }
コード例 #2
0
  @Test
  public void testParameterValuesAreUsedFromHeader() throws Exception {

    Map<String, Product> sourceProducts = new HashMap<String, Product>(1);
    Product testProduct = new Product("p", "t", 1, 1);
    testProduct.addBand("Op1A", ProductData.TYPE_INT8);
    sourceProducts.put("toa", testProduct);

    Product targetProduct =
        GPF.createProduct("Op2Graph", new HashMap<String, Object>(), sourceProducts);
    assertNotNull(targetProduct);
    assertEquals("Op2Name", targetProduct.getName());
    OperatorProductReader operatorProductReader =
        (OperatorProductReader) targetProduct.getProductReader();
    Operator operator = operatorProductReader.getOperatorContext().getOperator();
    TestOps.Op2 op2 = (Op2) operator;
    assertEquals(24.0, op2.threshold, 0.00001);
  }