use of io.crate.metadata.Reference in project crate by crate.
the class SysNodesExpressionsTest method testHeap.
@Test
public void testHeap() throws Exception {
Reference refInfo = refInfo("sys.nodes.heap", DataTypes.STRING, RowGranularity.NODE);
io.crate.operation.reference.NestedObjectExpression heap = (io.crate.operation.reference.NestedObjectExpression) resolver.getChildImplementation(refInfo.ident().columnIdent().name());
Map<String, Object> v = heap.value();
assertEquals(123456L, v.get("max"));
assertEquals(123456L, v.get("used"));
assertEquals(0L, v.get("free"));
}
use of io.crate.metadata.Reference in project crate by crate.
the class SysNodesExpressionsTest method testOsInfo.
@Test
public void testOsInfo() throws Exception {
Reference refInfo = refInfo("sys.nodes.os_info", DataTypes.OBJECT, RowGranularity.NODE);
io.crate.operation.reference.NestedObjectExpression ref = (io.crate.operation.reference.NestedObjectExpression) resolver.getChildImplementation(refInfo.ident().columnIdent().name());
Map<String, Object> v = ref.value();
int cores = (int) v.get("available_processors");
assertEquals(4, cores);
}
use of io.crate.metadata.Reference in project crate by crate.
the class SysNodesExpressionsTest method testNestedBytesRefExpressionsString.
@Test
public void testNestedBytesRefExpressionsString() throws Exception {
Reference refInfo = refInfo("sys.nodes.version", DataTypes.OBJECT, RowGranularity.NODE);
ColumnIdent versionColIdent = refInfo.ident().columnIdent();
io.crate.operation.reference.NestedObjectExpression version = (io.crate.operation.reference.NestedObjectExpression) resolver.getChildImplementation(versionColIdent.name());
assertThat(version.value().get("number"), instanceOf(String.class));
}
use of io.crate.metadata.Reference in project crate by crate.
the class SysNodesExpressionsTest method testName.
@Test
public void testName() throws Exception {
Reference refInfo = refInfo("sys.nodes.name", DataTypes.STRING, RowGranularity.NODE);
@SuppressWarnings("unchecked") ReferenceImplementation<BytesRef> name = (ReferenceImplementation<BytesRef>) resolver.getChildImplementation(refInfo.ident().columnIdent().name());
assertEquals(new BytesRef("node 1"), name.value());
}
use of io.crate.metadata.Reference in project crate by crate.
the class SysNodesExpressionsOnHandlerTest method testHostname.
@Test
public void testHostname() throws Exception {
Reference refInfo = refInfo("sys.nodes.hostname", DataTypes.STRING, RowGranularity.NODE);
collectExpression = resolver.getImplementation(refInfo);
collectExpression.setNextRow(CONTEXT);
assertThat(BytesRefs.toBytesRef("crate1.example.com"), is(collectExpression.value()));
}
Aggregations