Example usage for javax.imageio.metadata IIOMetadataNode setNodeValue

List of usage examples for javax.imageio.metadata IIOMetadataNode setNodeValue

Introduction

In this page you can find the example usage for javax.imageio.metadata IIOMetadataNode setNodeValue.

Prototype

public void setNodeValue(String value) 

Source Link

Usage

From source file:org.pentaho.big.data.kettle.plugins.hbase.input.HBaseInputMetaTest.java

@Test
public void testLoadXmlDoesntBubleUpException() throws Exception {
    KettleLogStore.init();/*  ww  w  .ja va 2s .  c  o  m*/
    ClusterInitializationException exception = new ClusterInitializationException(new Exception());
    hBaseInputMeta.setNamedCluster(namedCluster);
    when(namedClusterServiceLocator.getService(namedCluster, HBaseService.class)).thenThrow(exception);
    when(namedClusterService.getClusterTemplate()).thenReturn(namedCluster);

    IIOMetadataNode node = new IIOMetadataNode();
    IIOMetadataNode child = new IIOMetadataNode("disable_wal");
    IIOMetadataNode grandChild = new IIOMetadataNode();
    grandChild.setNodeValue("N");
    child.appendChild(grandChild);
    node.appendChild(child);

    hBaseInputMeta.loadXML(node, new ArrayList<>(), metaStore);

    ServiceStatus serviceStatus = hBaseInputMeta.getServiceStatus();
    assertNotNull(serviceStatus);
    assertFalse(serviceStatus.isOk());
    assertEquals(exception, serviceStatus.getException());
}

From source file:org.pentaho.big.data.kettle.plugins.hbase.input.HBaseInputMetaTest.java

@Test
public void testLoadXmlServiceStatusOk() throws Exception {
    KettleLogStore.init();/*from  w  w w.ja v  a 2s  . c o  m*/
    hBaseInputMeta.setNamedCluster(namedCluster);
    when(namedClusterServiceLocator.getService(namedCluster, HBaseService.class)).thenReturn(hBaseService);
    when(namedClusterService.getClusterTemplate()).thenReturn(namedCluster);
    when(hBaseService.getHBaseValueMetaInterfaceFactory())
            .thenReturn(mock(HBaseValueMetaInterfaceFactory.class));
    MappingFactory mappingFactory = mock(MappingFactory.class);
    when(hBaseService.getMappingFactory()).thenReturn(mappingFactory);
    when(mappingFactory.createMapping()).thenReturn(mock(Mapping.class));

    IIOMetadataNode node = new IIOMetadataNode();
    IIOMetadataNode child = new IIOMetadataNode("disable_wal");
    IIOMetadataNode grandChild = new IIOMetadataNode();
    grandChild.setNodeValue("N");
    child.appendChild(grandChild);
    node.appendChild(child);

    hBaseInputMeta.loadXML(node, new ArrayList<>(), metaStore);

    ServiceStatus serviceStatus = hBaseInputMeta.getServiceStatus();
    assertNotNull(serviceStatus);
    assertTrue(serviceStatus.isOk());
}