You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by im...@apache.org on 2017/01/06 11:43:24 UTC
[5/6] asterixdb git commit: ASTERIXDB-1714: Eliminate dependency on
org.json
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
index 15b1baa..746b75d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
@@ -1,129 +1,162 @@
{
- "cc": {
- "configUri": "http://127.0.0.1:19002/admin/cluster/cc/config",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/cc/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+ "cc" : {
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/cc/config",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/cc/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+ },
+ "config" : {
+ "api.port" : 19002,
+ "cluster.partitions" : {
+ "0" : {
+ "partitionId" : 0,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 0
+ },
+ "1" : {
+ "partitionId" : 1,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 1
+ },
+ "2" : {
+ "partitionId" : 2,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 0
+ },
+ "3" : {
+ "partitionId" : 3,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 1
+ }
},
- "config": {
- "api.port": 19002,
- "cluster.partitions": {
- "0": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
- "1": "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1",
- "2": "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
- "3": "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
- },
- "compiler.framesize": 32768,
- "compiler.groupmemory": 163840,
- "compiler.joinmemory": 262144,
- "compiler.parallelism": 0,
- "compiler.pregelix.home": "~/pregelix",
- "compiler.sortmemory": 327680,
- "core.dump.paths": {},
- "feed.central.manager.port": 4500,
- "feed.max.threshold.period": 5,
- "feed.memory.available.wait.timeout": 10,
- "feed.memory.global.budget": 67108864,
- "feed.pending.work.threshold": 50,
- "feed.port": 19003,
- "instance.name": null,
- "log.level": "INFO",
- "max.wait.active.cluster": 60,
- "metadata.callback.port": 0,
- "metadata.node": "asterix_nc1",
- "metadata.partition": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
- "metadata.port": 0,
- "metadata.registration.timeout.secs": 60,
- "node.partitions": {
- "asterix_nc1": [
- "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
- "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1"
- ],
- "asterix_nc2": [
- "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
- "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
- ]
- },
- "node.stores": {
- "asterix_nc1": [
- "iodevice0",
- "iodevice1"
- ],
- "asterix_nc2": [
- "iodevice0",
- "iodevice1"
- ]
- },
- "plot.activate": false,
- "storage.buffercache.maxopenfiles": 2147483647,
- "storage.buffercache.pagesize": 32768,
- "storage.buffercache.size": 50331648,
- "storage.lsm.bloomfilter.falsepositiverate": 0.01,
- "storage.memorycomponent.globalbudget": 536870912,
- "storage.memorycomponent.numcomponents": 2,
- "storage.memorycomponent.numpages": 8,
- "storage.memorycomponent.pagesize": 131072,
- "storage.metadata.memorycomponent.numpages": 256,
- "transaction.log.dirs": {
- "asterix_nc1": "target/txnLogDir/asterix_nc1",
- "asterix_nc2": "target/txnLogDir/asterix_nc2"
- },
- "txn.commitprofiler.reportinterval": 5,
- "txn.job.recovery.memorysize": 67108864,
- "txn.lock.escalationthreshold": 1000,
- "txn.lock.shrinktimer": 5000,
- "txn.lock.timeout.sweepthreshold": 10000,
- "txn.lock.timeout.waitthreshold": 60000,
- "txn.log.buffer.numpages": 8,
- "txn.log.buffer.pagesize": 131072,
- "txn.log.checkpoint.history": 0,
- "txn.log.checkpoint.lsnthreshold": 67108864,
- "txn.log.checkpoint.pollfrequency": 120,
- "txn.log.partitionsize": 268435456,
- "web.port": 19001,
- "web.queryinterface.port": 19006,
- "web.secondary.port": 19005
+ "compiler.framesize" : 32768,
+ "compiler.groupmemory" : 163840,
+ "compiler.joinmemory" : 262144,
+ "compiler.parallelism" : 0,
+ "compiler.pregelix.home" : "~/pregelix",
+ "compiler.sortmemory" : 327680,
+ "core.dump.paths" : { },
+ "feed.central.manager.port" : 4500,
+ "feed.max.threshold.period" : 5,
+ "feed.memory.available.wait.timeout" : 10,
+ "feed.memory.global.budget" : 67108864,
+ "feed.pending.work.threshold" : 50,
+ "feed.port" : 19003,
+ "instance.name" : null,
+ "log.level" : "INFO",
+ "max.wait.active.cluster" : 60,
+ "metadata.callback.port" : 0,
+ "metadata.node" : "asterix_nc1",
+ "metadata.partition" : {
+ "partitionId" : 0,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 0
},
- "diagnosticsUri": "http://127.0.0.1:19002/admin/diagnostics",
- "fullShutdownUri": "http://127.0.0.1:19002/admin/shutdown?all=true",
- "metadata_node": "asterix_nc1",
- "ncs": [
- {
- "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
- "node_id": "asterix_nc1",
- "partitions": [
- {
- "active": true,
- "partition_id": "partition_0"
- },
- {
- "active": true,
- "partition_id": "partition_1"
- }
- ],
- "state": "ACTIVE",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
- },
- {
- "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
- "node_id": "asterix_nc2",
- "partitions": [
- {
- "active": true,
- "partition_id": "partition_2"
- },
- {
- "active": true,
- "partition_id": "partition_3"
- }
- ],
- "state": "ACTIVE",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
- }
- ],
- "replicationUri": "http://127.0.0.1:19002/admin/cluster/replication",
- "shutdownUri": "http://127.0.0.1:19002/admin/shutdown",
- "state": "ACTIVE",
- "versionUri": "http://127.0.0.1:19002/admin/version"
+ "metadata.port" : 0,
+ "metadata.registration.timeout.secs" : 60,
+ "node.partitions" : {
+ "asterix_nc1" : [ {
+ "partitionId" : 0,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 0
+ }, {
+ "partitionId" : 1,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 1
+ } ],
+ "asterix_nc2" : [ {
+ "partitionId" : 2,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 0
+ }, {
+ "partitionId" : 3,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 1
+ } ]
+ },
+ "node.stores" : {
+ "asterix_nc1" : [ "iodevice0", "iodevice1" ],
+ "asterix_nc2" : [ "iodevice0", "iodevice1" ]
+ },
+ "plot.activate" : false,
+ "storage.buffercache.maxopenfiles" : 2147483647,
+ "storage.buffercache.pagesize" : 32768,
+ "storage.buffercache.size" : 50331648,
+ "storage.lsm.bloomfilter.falsepositiverate" : 0.01,
+ "storage.memorycomponent.globalbudget" : 536870912,
+ "storage.memorycomponent.numcomponents" : 2,
+ "storage.memorycomponent.numpages" : 8,
+ "storage.memorycomponent.pagesize" : 131072,
+ "storage.metadata.memorycomponent.numpages" : 256,
+ "transaction.log.dirs" : {
+ "asterix_nc1" : "target/txnLogDir/asterix_nc1",
+ "asterix_nc2" : "target/txnLogDir/asterix_nc2"
+ },
+ "txn.commitprofiler.reportinterval" : 5,
+ "txn.job.recovery.memorysize" : 67108864,
+ "txn.lock.escalationthreshold" : 1000,
+ "txn.lock.shrinktimer" : 5000,
+ "txn.lock.timeout.sweepthreshold" : 10000,
+ "txn.lock.timeout.waitthreshold" : 60000,
+ "txn.log.buffer.numpages" : 8,
+ "txn.log.buffer.pagesize" : 131072,
+ "txn.log.checkpoint.history" : 0,
+ "txn.log.checkpoint.lsnthreshold" : 67108864,
+ "txn.log.checkpoint.pollfrequency" : 120,
+ "txn.log.partitionsize" : 268435456,
+ "web.port" : 19001,
+ "web.queryinterface.port" : 19006,
+ "web.secondary.port" : 19005
+ },
+ "diagnosticsUri" : "http://127.0.0.1:19002/admin/diagnostics",
+ "fullShutdownUri" : "http://127.0.0.1:19002/admin/shutdown?all=true",
+ "metadata_node" : "asterix_nc1",
+ "ncs" : [ {
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+ "node_id" : "asterix_nc1",
+ "partitions" : [ {
+ "active" : true,
+ "partition_id" : "partition_0"
+ }, {
+ "active" : true,
+ "partition_id" : "partition_1"
+ } ],
+ "state" : "ACTIVE",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+ }, {
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
+ "node_id" : "asterix_nc2",
+ "partitions" : [ {
+ "active" : true,
+ "partition_id" : "partition_2"
+ }, {
+ "active" : true,
+ "partition_id" : "partition_3"
+ } ],
+ "state" : "ACTIVE",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
+ } ],
+ "replicationUri" : "http://127.0.0.1:19002/admin/cluster/replication",
+ "shutdownUri" : "http://127.0.0.1:19002/admin/shutdown",
+ "state" : "ACTIVE",
+ "versionUri" : "http://127.0.0.1:19002/admin/version"
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
index 11e964c..7818a58 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
@@ -1,129 +1,162 @@
{
- "cc": {
- "configUri": "http://127.0.0.1:19002/admin/cluster/cc/config",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/cc/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+ "cc" : {
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/cc/config",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/cc/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+ },
+ "config" : {
+ "api.port" : 19002,
+ "cluster.partitions" : {
+ "0" : {
+ "partitionId" : 0,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 0
+ },
+ "1" : {
+ "partitionId" : 1,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 1
+ },
+ "2" : {
+ "partitionId" : 2,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 0
+ },
+ "3" : {
+ "partitionId" : 3,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 1
+ }
},
- "config": {
- "api.port": 19002,
- "cluster.partitions": {
- "0": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
- "1": "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1",
- "2": "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
- "3": "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
- },
- "compiler.framesize": 32768,
- "compiler.groupmemory": 163840,
- "compiler.joinmemory": 262144,
- "compiler.parallelism": -1,
- "compiler.pregelix.home": "~/pregelix",
- "compiler.sortmemory": 327680,
- "core.dump.paths": {},
- "feed.central.manager.port": 4500,
- "feed.max.threshold.period": 5,
- "feed.memory.available.wait.timeout": 10,
- "feed.memory.global.budget": 67108864,
- "feed.pending.work.threshold": 50,
- "feed.port": 19003,
- "instance.name": null,
- "log.level": "INFO",
- "max.wait.active.cluster": 60,
- "metadata.callback.port": 0,
- "metadata.node": "asterix_nc1",
- "metadata.partition": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
- "metadata.port": 0,
- "metadata.registration.timeout.secs": 60,
- "node.partitions": {
- "asterix_nc1": [
- "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
- "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1"
- ],
- "asterix_nc2": [
- "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
- "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
- ]
- },
- "node.stores": {
- "asterix_nc1": [
- "iodevice0",
- "iodevice1"
- ],
- "asterix_nc2": [
- "iodevice0",
- "iodevice1"
- ]
- },
- "plot.activate": false,
- "storage.buffercache.maxopenfiles": 2147483647,
- "storage.buffercache.pagesize": 32768,
- "storage.buffercache.size": 50331648,
- "storage.lsm.bloomfilter.falsepositiverate": 0.01,
- "storage.memorycomponent.globalbudget": 536870912,
- "storage.memorycomponent.numcomponents": 2,
- "storage.memorycomponent.numpages": 8,
- "storage.memorycomponent.pagesize": 131072,
- "storage.metadata.memorycomponent.numpages": 256,
- "transaction.log.dirs": {
- "asterix_nc1": "target/txnLogDir/asterix_nc1",
- "asterix_nc2": "target/txnLogDir/asterix_nc2"
- },
- "txn.commitprofiler.reportinterval": 5,
- "txn.job.recovery.memorysize": 67108864,
- "txn.lock.escalationthreshold": 1000,
- "txn.lock.shrinktimer": 5000,
- "txn.lock.timeout.sweepthreshold": 10000,
- "txn.lock.timeout.waitthreshold": 60000,
- "txn.log.buffer.numpages": 8,
- "txn.log.buffer.pagesize": 131072,
- "txn.log.checkpoint.history": 0,
- "txn.log.checkpoint.lsnthreshold": 67108864,
- "txn.log.checkpoint.pollfrequency": 120,
- "txn.log.partitionsize": 268435456,
- "web.port": 19001,
- "web.queryinterface.port": 19006,
- "web.secondary.port": 19005
+ "compiler.framesize" : 32768,
+ "compiler.groupmemory" : 163840,
+ "compiler.joinmemory" : 262144,
+ "compiler.parallelism" : -1,
+ "compiler.pregelix.home" : "~/pregelix",
+ "compiler.sortmemory" : 327680,
+ "core.dump.paths" : { },
+ "feed.central.manager.port" : 4500,
+ "feed.max.threshold.period" : 5,
+ "feed.memory.available.wait.timeout" : 10,
+ "feed.memory.global.budget" : 67108864,
+ "feed.pending.work.threshold" : 50,
+ "feed.port" : 19003,
+ "instance.name" : null,
+ "log.level" : "INFO",
+ "max.wait.active.cluster" : 60,
+ "metadata.callback.port" : 0,
+ "metadata.node" : "asterix_nc1",
+ "metadata.partition" : {
+ "partitionId" : 0,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 0
},
- "diagnosticsUri": "http://127.0.0.1:19002/admin/diagnostics",
- "fullShutdownUri": "http://127.0.0.1:19002/admin/shutdown?all=true",
- "metadata_node": "asterix_nc1",
- "ncs": [
- {
- "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
- "node_id": "asterix_nc1",
- "partitions": [
- {
- "active": true,
- "partition_id": "partition_0"
- },
- {
- "active": true,
- "partition_id": "partition_1"
- }
- ],
- "state": "ACTIVE",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
- },
- {
- "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
- "node_id": "asterix_nc2",
- "partitions": [
- {
- "active": true,
- "partition_id": "partition_2"
- },
- {
- "active": true,
- "partition_id": "partition_3"
- }
- ],
- "state": "ACTIVE",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
- }
- ],
- "replicationUri": "http://127.0.0.1:19002/admin/cluster/replication",
- "shutdownUri": "http://127.0.0.1:19002/admin/shutdown",
- "state": "ACTIVE",
- "versionUri": "http://127.0.0.1:19002/admin/version"
+ "metadata.port" : 0,
+ "metadata.registration.timeout.secs" : 60,
+ "node.partitions" : {
+ "asterix_nc1" : [ {
+ "partitionId" : 0,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 0
+ }, {
+ "partitionId" : 1,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 1
+ } ],
+ "asterix_nc2" : [ {
+ "partitionId" : 2,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 0
+ }, {
+ "partitionId" : 3,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 1
+ } ]
+ },
+ "node.stores" : {
+ "asterix_nc1" : [ "iodevice0", "iodevice1" ],
+ "asterix_nc2" : [ "iodevice0", "iodevice1" ]
+ },
+ "plot.activate" : false,
+ "storage.buffercache.maxopenfiles" : 2147483647,
+ "storage.buffercache.pagesize" : 32768,
+ "storage.buffercache.size" : 50331648,
+ "storage.lsm.bloomfilter.falsepositiverate" : 0.01,
+ "storage.memorycomponent.globalbudget" : 536870912,
+ "storage.memorycomponent.numcomponents" : 2,
+ "storage.memorycomponent.numpages" : 8,
+ "storage.memorycomponent.pagesize" : 131072,
+ "storage.metadata.memorycomponent.numpages" : 256,
+ "transaction.log.dirs" : {
+ "asterix_nc1" : "target/txnLogDir/asterix_nc1",
+ "asterix_nc2" : "target/txnLogDir/asterix_nc2"
+ },
+ "txn.commitprofiler.reportinterval" : 5,
+ "txn.job.recovery.memorysize" : 67108864,
+ "txn.lock.escalationthreshold" : 1000,
+ "txn.lock.shrinktimer" : 5000,
+ "txn.lock.timeout.sweepthreshold" : 10000,
+ "txn.lock.timeout.waitthreshold" : 60000,
+ "txn.log.buffer.numpages" : 8,
+ "txn.log.buffer.pagesize" : 131072,
+ "txn.log.checkpoint.history" : 0,
+ "txn.log.checkpoint.lsnthreshold" : 67108864,
+ "txn.log.checkpoint.pollfrequency" : 120,
+ "txn.log.partitionsize" : 268435456,
+ "web.port" : 19001,
+ "web.queryinterface.port" : 19006,
+ "web.secondary.port" : 19005
+ },
+ "diagnosticsUri" : "http://127.0.0.1:19002/admin/diagnostics",
+ "fullShutdownUri" : "http://127.0.0.1:19002/admin/shutdown?all=true",
+ "metadata_node" : "asterix_nc1",
+ "ncs" : [ {
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+ "node_id" : "asterix_nc1",
+ "partitions" : [ {
+ "active" : true,
+ "partition_id" : "partition_0"
+ }, {
+ "active" : true,
+ "partition_id" : "partition_1"
+ } ],
+ "state" : "ACTIVE",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+ }, {
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
+ "node_id" : "asterix_nc2",
+ "partitions" : [ {
+ "active" : true,
+ "partition_id" : "partition_2"
+ }, {
+ "active" : true,
+ "partition_id" : "partition_3"
+ } ],
+ "state" : "ACTIVE",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
+ } ],
+ "replicationUri" : "http://127.0.0.1:19002/admin/cluster/replication",
+ "shutdownUri" : "http://127.0.0.1:19002/admin/shutdown",
+ "state" : "ACTIVE",
+ "versionUri" : "http://127.0.0.1:19002/admin/version"
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
index 83f18f1..71d6f8a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
@@ -1,129 +1,162 @@
{
- "cc": {
- "configUri": "http://127.0.0.1:19002/admin/cluster/cc/config",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/cc/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+ "cc" : {
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/cc/config",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/cc/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+ },
+ "config" : {
+ "api.port" : 19002,
+ "cluster.partitions" : {
+ "0" : {
+ "partitionId" : 0,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 0
+ },
+ "1" : {
+ "partitionId" : 1,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 1
+ },
+ "2" : {
+ "partitionId" : 2,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 0
+ },
+ "3" : {
+ "partitionId" : 3,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 1
+ }
},
- "config": {
- "api.port": 19002,
- "cluster.partitions": {
- "0": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
- "1": "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1",
- "2": "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
- "3": "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
- },
- "compiler.framesize": 32768,
- "compiler.groupmemory": 163840,
- "compiler.joinmemory": 262144,
- "compiler.parallelism": 3,
- "compiler.pregelix.home": "~/pregelix",
- "compiler.sortmemory": 327680,
- "core.dump.paths": {},
- "feed.central.manager.port": 4500,
- "feed.max.threshold.period": 5,
- "feed.memory.available.wait.timeout": 10,
- "feed.memory.global.budget": 67108864,
- "feed.pending.work.threshold": 50,
- "feed.port": 19003,
- "instance.name": null,
- "log.level": "INFO",
- "max.wait.active.cluster": 60,
- "metadata.callback.port": 0,
- "metadata.node": "asterix_nc1",
- "metadata.partition": "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
- "metadata.port": 0,
- "metadata.registration.timeout.secs": 60,
- "node.partitions": {
- "asterix_nc1": [
- "ID:0, Original Node: asterix_nc1, IODevice: 0, Active Node: asterix_nc1",
- "ID:1, Original Node: asterix_nc1, IODevice: 1, Active Node: asterix_nc1"
- ],
- "asterix_nc2": [
- "ID:2, Original Node: asterix_nc2, IODevice: 0, Active Node: asterix_nc2",
- "ID:3, Original Node: asterix_nc2, IODevice: 1, Active Node: asterix_nc2"
- ]
- },
- "node.stores": {
- "asterix_nc1": [
- "iodevice0",
- "iodevice1"
- ],
- "asterix_nc2": [
- "iodevice0",
- "iodevice1"
- ]
- },
- "plot.activate": false,
- "storage.buffercache.maxopenfiles": 2147483647,
- "storage.buffercache.pagesize": 32768,
- "storage.buffercache.size": 50331648,
- "storage.lsm.bloomfilter.falsepositiverate": 0.01,
- "storage.memorycomponent.globalbudget": 536870912,
- "storage.memorycomponent.numcomponents": 2,
- "storage.memorycomponent.numpages": 8,
- "storage.memorycomponent.pagesize": 131072,
- "storage.metadata.memorycomponent.numpages": 256,
- "transaction.log.dirs": {
- "asterix_nc1": "target/txnLogDir/asterix_nc1",
- "asterix_nc2": "target/txnLogDir/asterix_nc2"
- },
- "txn.commitprofiler.reportinterval": 5,
- "txn.job.recovery.memorysize": 67108864,
- "txn.lock.escalationthreshold": 1000,
- "txn.lock.shrinktimer": 5000,
- "txn.lock.timeout.sweepthreshold": 10000,
- "txn.lock.timeout.waitthreshold": 60000,
- "txn.log.buffer.numpages": 8,
- "txn.log.buffer.pagesize": 131072,
- "txn.log.checkpoint.history": 0,
- "txn.log.checkpoint.lsnthreshold": 67108864,
- "txn.log.checkpoint.pollfrequency": 120,
- "txn.log.partitionsize": 268435456,
- "web.port": 19001,
- "web.queryinterface.port": 19006,
- "web.secondary.port": 19005
+ "compiler.framesize" : 32768,
+ "compiler.groupmemory" : 163840,
+ "compiler.joinmemory" : 262144,
+ "compiler.parallelism" : 3,
+ "compiler.pregelix.home" : "~/pregelix",
+ "compiler.sortmemory" : 327680,
+ "core.dump.paths" : { },
+ "feed.central.manager.port" : 4500,
+ "feed.max.threshold.period" : 5,
+ "feed.memory.available.wait.timeout" : 10,
+ "feed.memory.global.budget" : 67108864,
+ "feed.pending.work.threshold" : 50,
+ "feed.port" : 19003,
+ "instance.name" : null,
+ "log.level" : "INFO",
+ "max.wait.active.cluster" : 60,
+ "metadata.callback.port" : 0,
+ "metadata.node" : "asterix_nc1",
+ "metadata.partition" : {
+ "partitionId" : 0,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 0
},
- "diagnosticsUri": "http://127.0.0.1:19002/admin/diagnostics",
- "fullShutdownUri": "http://127.0.0.1:19002/admin/shutdown?all=true",
- "metadata_node": "asterix_nc1",
- "ncs": [
- {
- "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
- "node_id": "asterix_nc1",
- "partitions": [
- {
- "active": true,
- "partition_id": "partition_0"
- },
- {
- "active": true,
- "partition_id": "partition_1"
- }
- ],
- "state": "ACTIVE",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
- },
- {
- "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
- "node_id": "asterix_nc2",
- "partitions": [
- {
- "active": true,
- "partition_id": "partition_2"
- },
- {
- "active": true,
- "partition_id": "partition_3"
- }
- ],
- "state": "ACTIVE",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
- }
- ],
- "replicationUri": "http://127.0.0.1:19002/admin/cluster/replication",
- "shutdownUri": "http://127.0.0.1:19002/admin/shutdown",
- "state": "ACTIVE",
- "versionUri": "http://127.0.0.1:19002/admin/version"
+ "metadata.port" : 0,
+ "metadata.registration.timeout.secs" : 60,
+ "node.partitions" : {
+ "asterix_nc1" : [ {
+ "partitionId" : 0,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 0
+ }, {
+ "partitionId" : 1,
+ "nodeId" : "asterix_nc1",
+ "activeNodeId" : "asterix_nc1",
+ "active" : true,
+ "iodeviceNum" : 1
+ } ],
+ "asterix_nc2" : [ {
+ "partitionId" : 2,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 0
+ }, {
+ "partitionId" : 3,
+ "nodeId" : "asterix_nc2",
+ "activeNodeId" : "asterix_nc2",
+ "active" : true,
+ "iodeviceNum" : 1
+ } ]
+ },
+ "node.stores" : {
+ "asterix_nc1" : [ "iodevice0", "iodevice1" ],
+ "asterix_nc2" : [ "iodevice0", "iodevice1" ]
+ },
+ "plot.activate" : false,
+ "storage.buffercache.maxopenfiles" : 2147483647,
+ "storage.buffercache.pagesize" : 32768,
+ "storage.buffercache.size" : 50331648,
+ "storage.lsm.bloomfilter.falsepositiverate" : 0.01,
+ "storage.memorycomponent.globalbudget" : 536870912,
+ "storage.memorycomponent.numcomponents" : 2,
+ "storage.memorycomponent.numpages" : 8,
+ "storage.memorycomponent.pagesize" : 131072,
+ "storage.metadata.memorycomponent.numpages" : 256,
+ "transaction.log.dirs" : {
+ "asterix_nc1" : "target/txnLogDir/asterix_nc1",
+ "asterix_nc2" : "target/txnLogDir/asterix_nc2"
+ },
+ "txn.commitprofiler.reportinterval" : 5,
+ "txn.job.recovery.memorysize" : 67108864,
+ "txn.lock.escalationthreshold" : 1000,
+ "txn.lock.shrinktimer" : 5000,
+ "txn.lock.timeout.sweepthreshold" : 10000,
+ "txn.lock.timeout.waitthreshold" : 60000,
+ "txn.log.buffer.numpages" : 8,
+ "txn.log.buffer.pagesize" : 131072,
+ "txn.log.checkpoint.history" : 0,
+ "txn.log.checkpoint.lsnthreshold" : 67108864,
+ "txn.log.checkpoint.pollfrequency" : 120,
+ "txn.log.partitionsize" : 268435456,
+ "web.port" : 19001,
+ "web.queryinterface.port" : 19006,
+ "web.secondary.port" : 19005
+ },
+ "diagnosticsUri" : "http://127.0.0.1:19002/admin/diagnostics",
+ "fullShutdownUri" : "http://127.0.0.1:19002/admin/shutdown?all=true",
+ "metadata_node" : "asterix_nc1",
+ "ncs" : [ {
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+ "node_id" : "asterix_nc1",
+ "partitions" : [ {
+ "active" : true,
+ "partition_id" : "partition_0"
+ }, {
+ "active" : true,
+ "partition_id" : "partition_1"
+ } ],
+ "state" : "ACTIVE",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+ }, {
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
+ "node_id" : "asterix_nc2",
+ "partitions" : [ {
+ "active" : true,
+ "partition_id" : "partition_2"
+ }, {
+ "active" : true,
+ "partition_id" : "partition_3"
+ } ],
+ "state" : "ACTIVE",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
+ } ],
+ "replicationUri" : "http://127.0.0.1:19002/admin/cluster/replication",
+ "shutdownUri" : "http://127.0.0.1:19002/admin/shutdown",
+ "state" : "ACTIVE",
+ "versionUri" : "http://127.0.0.1:19002/admin/version"
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_3/cluster_state_3.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_3/cluster_state_3.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_3/cluster_state_3.1.adm
index b0815ee..14a00d0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_3/cluster_state_3.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_3/cluster_state_3.1.adm
@@ -1,36 +1,29 @@
-{"ncs": [
- {
- "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
- "node_id": "asterix_nc1",
- "partitions": [
- {
- "active": true,
- "partition_id": "partition_0"
- },
- {
- "active": true,
- "partition_id": "partition_1"
- }
- ],
- "state": "ACTIVE",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
- },
- {
- "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
- "node_id": "asterix_nc2",
- "partitions": [
- {
- "active": true,
- "partition_id": "partition_2"
- },
- {
- "active": true,
- "partition_id": "partition_3"
- }
- ],
- "state": "ACTIVE",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
- }
-]}
+{
+ "ncs" : [ {
+ "node_id" : "asterix_nc1",
+ "state" : "ACTIVE",
+ "partitions" : [ {
+ "partition_id" : "partition_0",
+ "active" : true
+ }, {
+ "partition_id" : "partition_1",
+ "active" : true
+ } ],
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+ }, {
+ "node_id" : "asterix_nc2",
+ "state" : "ACTIVE",
+ "partitions" : [ {
+ "partition_id" : "partition_2",
+ "active" : true
+ }, {
+ "partition_id" : "partition_3",
+ "active" : true
+ } ],
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/config",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc2/threaddump"
+ } ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_4/cluster_state_4.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_4/cluster_state_4.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_4/cluster_state_4.1.adm
index 4635690..5e88f5c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_4/cluster_state_4.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_4/cluster_state_4.1.adm
@@ -1,17 +1,14 @@
{
- "configUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
- "node_id": "asterix_nc1",
- "partitions": [
- {
- "active": true,
- "partition_id": "partition_0"
- },
- {
- "active": true,
- "partition_id": "partition_1"
- }
- ],
- "state": "ACTIVE",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
-}
+ "node_id" : "asterix_nc1",
+ "state" : "ACTIVE",
+ "partitions" : [ {
+ "partition_id" : "partition_0",
+ "active" : true
+ }, {
+ "partition_id" : "partition_1",
+ "active" : true
+ } ],
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/config",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/node/asterix_nc1/threaddump"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_1/cluster_state_cc_1.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_1/cluster_state_cc_1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_1/cluster_state_cc_1.1.adm
index 5e1e154..879ecbc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_1/cluster_state_cc_1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_1/cluster_state_cc_1.1.adm
@@ -1,5 +1,5 @@
{
- "configUri": "http://127.0.0.1:19002/admin/cluster/cc/config",
- "statsUri": "http://127.0.0.1:19002/admin/cluster/cc/stats",
- "threadDumpUri": "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
-}
+ "configUri" : "http://127.0.0.1:19002/admin/cluster/cc/config",
+ "statsUri" : "http://127.0.0.1:19002/admin/cluster/cc/stats",
+ "threadDumpUri" : "http://127.0.0.1:19002/admin/cluster/cc/threaddump"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_stats_1/cluster_state_cc_stats_1.1.regexadm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_stats_1/cluster_state_cc_stats_1.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_stats_1/cluster_state_cc_stats_1.1.regexadm
index 196a12b..01ff72a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_stats_1/cluster_state_cc_stats_1.1.regexadm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_cc_stats_1/cluster_state_cc_stats_1.1.regexadm
@@ -1,27 +1,24 @@
\{
- "date": ".*",
- "gcs": \[
- \{
- "collection-count": .*,
- "collection-time": .*,
- "name": ".*"
- \},
- \{
- "collection-count": .*,
- "collection-time": .*,
- "name": ".*"
- \}
- \],
- "heap_committed_size": [0-9]*,
- "heap_init_size": [0-9]*,
- "heap_max_size": [0-9]*,
- "heap_used_size": [0-9]*,
- "nonheap_committed_size": [0-9]*,
- "nonheap_init_size": [0-9]*,
- "nonheap_max_size": -?[0-9]*,
- "nonheap_used_size": [0-9]*,
- "peak_thread_count": [0-9]*,
- "started_thread_count": [0-9]*,
- "system_load_average": [0-9\.]*,
- "thread_count": [0-9]*
-\}
\ No newline at end of file
+ "gcs" : \[ \{
+ "name" : ".*",
+ "collection-time" : .*,
+ "collection-count" : .*
+ \}, \{
+ "name" : ".*",
+ "collection-time" : .*,
+ "collection-count" : .*
+ \} \],
+ "date" : ".*",
+ "heap_init_size" : [0-9]*,
+ "heap_used_size" : [0-9]*,
+ "heap_committed_size" : [0-9]*,
+ "heap_max_size" : [0-9]*,
+ "nonheap_init_size" : [0-9]*,
+ "nonheap_used_size" : [0-9]*,
+ "nonheap_committed_size" : [0-9]*,
+ "nonheap_max_size" : -?[0-9]*,
+ "thread_count" : [0-9]*,
+ "peak_thread_count" : [0-9]*,
+ "started_thread_count" : [0-9]*,
+ "system_load_average" : [0-9\.]*
+\}*
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_nc_threaddump_1/cluster_state_cc_threaddump_1.1.regex
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_nc_threaddump_1/cluster_state_cc_threaddump_1.1.regex b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_nc_threaddump_1/cluster_state_cc_threaddump_1.1.regex
index 1e5c47b..3f1bfdc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_nc_threaddump_1/cluster_state_cc_threaddump_1.1.regex
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_nc_threaddump_1/cluster_state_cc_threaddump_1.1.regex
@@ -1,10 +1,10 @@
-/"date": ".*"/
-/"threads": \[/
-/"id": [0-9]+/
-/"lock_name": ".*"/
-/"name": ".*"/
-/"stack": \[/
+/"date" : ".*"/
+/"threads" : \[/
+/"id" : [0-9]+/
+/"lock_name" : ".*"/
+/"name" : ".*"/
+/"stack" : \[/
/"java.lang.Thread.run\(Thread.java:[0-9]+\)"/
-/"state": "TIMED_WAITING"/
-/"state": "RUNNABLE"/
-/"state": "WAITING"/
\ No newline at end of file
+/"state" : "TIMED_WAITING"/
+/"state" : "RUNNABLE"/
+/"state" : "WAITING"/
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/diagnostics_1/diagnostics_1.1.regexadm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/diagnostics_1/diagnostics_1.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/diagnostics_1/diagnostics_1.1.regexadm
index 29c03bf..b2dafd9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/diagnostics_1/diagnostics_1.1.regexadm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/diagnostics_1/diagnostics_1.1.regexadm
@@ -1,10 +1,7 @@
-.*"cc": \{
- "config": \{.*
- \},
- "stats": \{.*
- \},
- "threaddump": \{.*
- \}
-.*"ncs".*"node_id": "asterix_nc1",
-.*"threaddump".*"node_id": "asterix_nc2",
-.*"threaddump".*
\ No newline at end of file
+.*"cc" : \{.*
+ "stats" : \{.*
+ \},.*
+ "threaddump" : \{.*
+ \},.*
+ "config" : \{.*
+ \}.*"ncs".*"node_id" : "asterix_nc1".*"threaddump".*"node_id" : "asterix_nc2".*"threaddump".*
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-app/src/test/resources/runtimets/results/api/replication/replication.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/replication/replication.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/replication/replication.1.adm
index 8adc10c..74e019b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/replication/replication.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/replication/replication.1.adm
@@ -1,9 +1,11 @@
-{"config": {
- "enabled": false,
- "factor": 2,
- "log.batchsize": 4096,
- "log.buffer.numpages": 8,
- "log.buffer.pagesize": 131072,
- "max.remote.recovery.attempts": 5,
- "timeout": 30
-}}
+{
+ "config" : {
+ "enabled" : false,
+ "factor" : 2,
+ "log.batchsize" : 4096,
+ "log.buffer.numpages" : 8,
+ "log.buffer.pagesize" : 131072,
+ "max.remote.recovery.attempts" : 5,
+ "timeout" : 30
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-client-helper/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/pom.xml b/asterixdb/asterix-client-helper/pom.xml
index 3270fbb..04de18a 100644
--- a/asterixdb/asterix-client-helper/pom.xml
+++ b/asterixdb/asterix-client-helper/pom.xml
@@ -108,8 +108,12 @@
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
</dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
index 77ed78f..e0fcb06 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
@@ -24,10 +24,11 @@ import java.nio.charset.StandardCharsets;
import javax.servlet.http.HttpServletResponse;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.asterix.clienthelper.Args;
import org.apache.commons.io.IOUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
public class GetClusterStateCommand extends RemoteCommand {
@@ -49,8 +50,9 @@ public class GetClusterStateCommand extends RemoteCommand {
conn = openConnection(args.getClusterStatePath(), Method.GET);
if (conn.getResponseCode() == HttpServletResponse.SC_OK) {
String result = IOUtils.toString(conn.getInputStream(), StandardCharsets.UTF_8.name());
- JSONObject json = new JSONObject(result);
- final String state = json.getString("state");
+ ObjectMapper om = new ObjectMapper();
+ JsonNode json = om.readTree(result);
+ final String state = json.get("state").asText();
logState(state);
switch (state) {
case "ACTIVE":
@@ -66,9 +68,6 @@ public class GetClusterStateCommand extends RemoteCommand {
} catch (IOException e) { // NOSONAR - log or rethrow exception
logState("DOWN");
return 1;
- } catch (JSONException e) { // NOSONAR - log or rethrow exception
- logState("UNKNOWN (malformed response)");
- return 3;
}
}
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
index b0b4c6f..dad9f8c 100644
--- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
@@ -25,10 +25,11 @@ import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletResponse;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.asterix.clienthelper.Args;
import org.apache.commons.io.IOUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.databind.node.ObjectNode;
public class WaitForClusterCommand extends RemoteCommand {
@@ -66,14 +67,15 @@ public class WaitForClusterCommand extends RemoteCommand {
conn = openConnection(args.getClusterStatePath(), Method.GET);
if (conn.getResponseCode() == HttpServletResponse.SC_OK) {
String result = IOUtils.toString(conn.getInputStream(), StandardCharsets.UTF_8.name());
- JSONObject json = new JSONObject(result);
- lastState = json.getString("state");
+ ObjectMapper om = new ObjectMapper();
+ JsonNode json = om.readTree(result);
+ lastState = json.get("state").asText();
if ("ACTIVE".equals(lastState)) {
log("Cluster started and is ACTIVE.");
return 0;
}
}
- } catch (JSONException |IOException e) { //NOSONAR - log or rethrow exception
+ } catch (IOException e) { //NOSONAR - log or rethrow exception
// ignore exception, try again
}
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-common/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/pom.xml b/asterixdb/asterix-common/pom.xml
index d4a4517..722e1c5 100644
--- a/asterixdb/asterix-common/pom.xml
+++ b/asterixdb/asterix-common/pom.xml
@@ -270,10 +270,6 @@
<version>1.2.17</version>
</dependency>
<dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- </dependency>
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
@@ -307,6 +303,19 @@
<version>2.0.2-beta</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>18.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
index b6a960f..eccbff2 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AbstractProperties.java
@@ -49,9 +49,14 @@ public abstract class AbstractProperties {
Map<String, Object> properties = new HashMap<>();
for (Method m : getClass().getMethods()) {
PropertyKey key = m.getAnnotation(PropertyKey.class);
+ Stringify stringify = m.getAnnotation(Stringify.class);
if (key != null) {
try {
- properties.put(keyTransformer.apply(key.value()), m.invoke(this));
+ if (stringify != null) {
+ properties.put(keyTransformer.apply(key.value()), String.valueOf(m.invoke(this)));
+ } else {
+ properties.put(keyTransformer.apply(key.value()), m.invoke(this));
+ }
} catch (Exception e) {
LOGGER.log(Level.INFO, "Error accessing property: " + key.value(), e);
}
@@ -65,6 +70,10 @@ public abstract class AbstractProperties {
String value();
}
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Stringify {
+ }
+
public static List<AbstractProperties> getImplementations() {
return Collections.unmodifiableList(IMPLS);
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
index dac154c..eb6bda5 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
@@ -22,35 +22,35 @@ import java.util.logging.Level;
public class ExternalProperties extends AbstractProperties {
- private static final String EXTERNAL_WEBPORT_KEY = "web.port";
- private static final int EXTERNAL_WEBPORT_DEFAULT = 19001;
+ public static final String EXTERNAL_WEBPORT_KEY = "web.port";
+ public static final int EXTERNAL_WEBPORT_DEFAULT = 19001;
- private static final String EXTERNAL_SECONDARY_WEBPORT_KEY = "web.secondary.port";
- private static final int EXTERNAL_SECONDARY_WEBPORT_DEFAULT = 19005;
+ public static final String EXTERNAL_SECONDARY_WEBPORT_KEY = "web.secondary.port";
+ public static final int EXTERNAL_SECONDARY_WEBPORT_DEFAULT = 19005;
- private static final String QUERY_WEBPORT_KEY = "web.queryinterface.port";
- private static final int QUERY_WEBPORT_DEFAULT = 19006;
+ public static final String QUERY_WEBPORT_KEY = "web.queryinterface.port";
+ public static final int QUERY_WEBPORT_DEFAULT = 19006;
- private static final String EXTERNAL_LOGLEVEL_KEY = "log.level";
- private static final Level EXTERNAL_LOGLEVEL_DEFAULT = Level.WARNING;
+ public static final String EXTERNAL_LOGLEVEL_KEY = "log.level";
+ public static final Level EXTERNAL_LOGLEVEL_DEFAULT = Level.WARNING;
- private static final String EXTERNAL_APISERVER_KEY = "api.port";
- private static final int EXTERNAL_APISERVER_DEFAULT = 19002;
+ public static final String EXTERNAL_APISERVER_KEY = "api.port";
+ public static final int EXTERNAL_APISERVER_DEFAULT = 19002;
- private static final String EXTERNAL_FEEDSERVER_KEY = "feed.port";
- private static final int EXTERNAL_FEEDSERVER_DEFAULT = 19003;
+ public static final String EXTERNAL_FEEDSERVER_KEY = "feed.port";
+ public static final int EXTERNAL_FEEDSERVER_DEFAULT = 19003;
- private static final String EXTERNAL_CC_JAVA_OPTS_KEY = "cc.java.opts";
- private static final String EXTERNAL_CC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
+ public static final String EXTERNAL_CC_JAVA_OPTS_KEY = "cc.java.opts";
+ public static final String EXTERNAL_CC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
- private static final String EXTERNAL_NC_JAVA_OPTS_KEY = "nc.java.opts";
- private static final String EXTERNAL_NC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
+ public static final String EXTERNAL_NC_JAVA_OPTS_KEY = "nc.java.opts";
+ public static final String EXTERNAL_NC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
- private static final String EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER = "max.wait.active.cluster";
- private static final int EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER_DEFAULT = 60;
+ public static final String EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER = "max.wait.active.cluster";
+ public static final int EXTERNAL_MAX_WAIT_FOR_ACTIVE_CLUSTER_DEFAULT = 60;
- private static final String EXTERNAL_PLOT_ACTIVATE = "plot.activate";
- private static final boolean EXTERNAL_PLOT_ACTIVATE_DEFAULT = false;
+ public static final String EXTERNAL_PLOT_ACTIVATE = "plot.activate";
+ public static final boolean EXTERNAL_PLOT_ACTIVATE_DEFAULT = false;
public ExternalProperties(PropertiesAccessor accessor) {
super(accessor);
@@ -87,6 +87,7 @@ public class ExternalProperties extends AbstractProperties {
}
@PropertyKey(EXTERNAL_LOGLEVEL_KEY)
+ @Stringify
public Level getLogLevel() {
return accessor.getProperty(EXTERNAL_LOGLEVEL_KEY, EXTERNAL_LOGLEVEL_DEFAULT,
PropertyInterpreters.getLevelPropertyInterpreter());
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
index 0cbf1b9..80df260 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
@@ -18,49 +18,65 @@
*/
package org.apache.asterix.common.utils;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+import java.io.IOException;
import java.util.Iterator;
import java.util.logging.Logger;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
public class JSONUtil {
private static final Logger LOGGER = Logger.getLogger(JSONUtil.class.getName());
private static final String INDENT = "\t";
+ private static final ObjectMapper SORTED_MAPPER = new ObjectMapper();
+
private JSONUtil() {
}
+ static {
+ SORTED_MAPPER.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
+ }
+
+ public static String convertNode(final JsonNode node) throws JsonProcessingException {
+ final Object obj = SORTED_MAPPER.treeToValue(node, Object.class);
+ final String json = SORTED_MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(obj);
+ return json;
+ }
+
public static String indent(String str, int initialIndent) {
+ ObjectMapper om = new ObjectMapper();
try {
- return append(new StringBuilder(), new JSONObject(str), initialIndent).toString();
- } catch (JSONException e) {
+ return appendObj(new StringBuilder(), om.readTree(str), initialIndent).toString();
+ } catch (IOException e) {
+ LOGGER.finest(String.valueOf(e));
LOGGER.finest("Could not indent JSON string, returning the input string: " + str);
return str;
}
}
- private static StringBuilder append(StringBuilder sb, Object o, int indent) throws JSONException {
- if (o instanceof JSONObject) {
- return append(sb, (JSONObject) o, indent);
- } else if (o instanceof JSONArray) {
- return append(sb, (JSONArray) o, indent);
- } else if (o instanceof String) {
- return quoteAndEscape(sb, (String) o);
- } else if (JSONObject.NULL.equals(o) || o instanceof Number || o instanceof Boolean) {
+ private static StringBuilder appendOrd(StringBuilder sb, JsonNode o, int indent) {
+ if (o.isObject()) {
+ return appendObj(sb, o, indent);
+ } else if (o.isArray()) {
+ return appendAry(sb, o, indent);
+ } else if (o.isTextual()) {
+ return quoteAndEscape(sb, o.asText());
+ } else if (o.isNull() || o.isIntegralNumber() || o.isBoolean()) {
return sb.append(String.valueOf(o));
}
throw new UnsupportedOperationException(o.getClass().getSimpleName());
}
- private static StringBuilder append(StringBuilder builder, JSONObject jobj, int indent) throws JSONException {
+ private static StringBuilder appendObj(StringBuilder builder, JsonNode jobj, int indent) {
StringBuilder sb = builder.append("{\n");
boolean first = true;
- for (Iterator it = jobj.keys(); it.hasNext();) {
- final String key = (String) it.next();
+ for (Iterator<JsonNode> it = jobj.iterator(); it.hasNext();) {
+ final String key = it.next().asText();
if (first) {
first = false;
} else {
@@ -69,20 +85,32 @@ public class JSONUtil {
sb = indent(sb, indent + 1);
sb = quote(sb, key);
sb = sb.append(": ");
- sb = append(sb, jobj.get(key), indent + 1);
+ if (jobj.get(key).isArray()) {
+ sb = appendAry(sb, jobj.get(key), indent + 1);
+ } else if (jobj.get(key).isObject()) {
+ sb = appendObj(sb, jobj.get(key), indent + 1);
+ } else {
+ sb = appendOrd(sb, jobj.get(key), indent + 1);
+ }
}
sb = sb.append("\n");
return indent(sb, indent).append("}");
}
- private static StringBuilder append(StringBuilder builder, JSONArray jarr, int indent) throws JSONException {
+ private static StringBuilder appendAry(StringBuilder builder, JsonNode jarr, int indent) {
StringBuilder sb = builder.append("[\n");
- for (int i = 0; i < jarr.length(); ++i) {
+ for (int i = 0; i < jarr.size(); ++i) {
if (i > 0) {
sb = sb.append(",\n");
}
sb = indent(sb, indent + 1);
- sb = append(sb, jarr.get(i), indent + 1);
+ if (jarr.get(i).isArray()) {
+ sb = appendAry(sb, jarr.get(i), indent + 1);
+ } else if (jarr.get(i).isObject()) {
+ sb = appendObj(sb, jarr.get(i), indent + 1);
+ } else {
+ sb = appendOrd(sb, jarr.get(i), indent + 1);
+ }
}
sb = sb.append("\n");
return indent(sb, indent).append("]");
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/d49bc6eb/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/ResultExtractor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/ResultExtractor.java b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/ResultExtractor.java
index 662888e..8399f7a 100644
--- a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/ResultExtractor.java
+++ b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/ResultExtractor.java
@@ -19,18 +19,24 @@
package org.apache.asterix.test.aql;
import java.io.InputStream;
+import java.io.StringWriter;
import java.nio.charset.Charset;
+import java.util.Iterator;
import java.util.logging.Logger;
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.PrettyPrinter;
+import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Iterators;
+import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.commons.io.IOUtils;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONTokener;
/**
* extracts results from the response of the QueryServiceServlet.
- *
* As the response is not necessarily valid JSON, non-JSON content has to be extracted in some cases.
* The current implementation creates a toomany copies of the data to be usable for larger results.
*/
@@ -39,150 +45,84 @@ public class ResultExtractor {
private static final Logger LOGGER = Logger.getLogger(ResultExtractor.class.getName());
public static InputStream extract(InputStream resultStream) throws Exception {
- final Charset utf8 = Charset.forName("UTF-8");
- String result = IOUtils.toString(resultStream, utf8);
+ ObjectMapper om = new ObjectMapper();
+ StringWriter sw = new StringWriter();
+ String resultStr = IOUtils.toString(resultStream, Charset.defaultCharset());
+ PrettyPrinter singleLine = new SingleLinePrettyPrinter();
+ ObjectNode result = om.readValue(resultStr, ObjectNode.class);
LOGGER.fine("+++++++\n" + result + "\n+++++++\n");
- JSONTokener tokener = new JSONTokener(result);
- tokener.nextTo('{');
- tokener.next('{');
- String name;
- String type = null;
- String status = null;
+ String type = "";
+ String status = "";
String results = "";
- while ((name = getFieldName(tokener)) != null) {
- if ("requestID".equals(name) || "signature".equals(name)) {
- getStringField(tokener);
- } else if ("status".equals(name)) {
- status = getStringField(tokener);
- } else if ("type".equals(name)) {
- type = getStringField(tokener);
- } else if ("metrics".equals(name)) {
- JSONObject metrics = getObjectField(tokener);
- LOGGER.fine(name + ": " + metrics);
- } else if ("errors".equals(name)) {
- JSONArray errors = getArrayField(tokener);
- LOGGER.fine(name + ": " + errors);
- JSONObject err = errors.getJSONObject(0);
- throw new Exception(err.getString("msg"));
- } else if ("results".equals(name)) {
- results = getResults(tokener, type);
- } else {
- throw tokener.syntaxError(name + ": unanticipated field");
+ String field = "";
+ for (Iterator<String> sIter = result.fieldNames(); sIter.hasNext();) {
+ field = sIter.next();
+ switch (field) {
+ case "requestID":
+ break;
+ case "signature":
+ break;
+ case "status":
+ status = om.writeValueAsString(result.get(field));
+ break;
+ case "type":
+ type = om.writeValueAsString(result.get(field));
+ break;
+ case "metrics":
+ LOGGER.fine(om.writeValueAsString(result.get(field)));
+ break;
+ case "errors":
+ JsonNode errors = result.get(field).get(0).get("msg");
+ throw new AsterixException(errors.asText());
+ case "results":
+ if (result.get(field).size() <= 1) {
+ if (result.get(field).size() == 0) {
+ results = "";
+ } else if (result.get(field).isArray()) {
+ if (result.get(field).get(0).isTextual()) {
+ results = result.get(field).get(0).asText();
+ } else {
+ ObjectMapper omm = new ObjectMapper();
+ omm.setDefaultPrettyPrinter(singleLine);
+ omm.enable(SerializationFeature.INDENT_OUTPUT);
+ results = omm.writer(singleLine).writeValueAsString(result.get(field));
+ }
+ } else {
+ results = om.writeValueAsString(result.get(field));
+ }
+ } else {
+ StringBuilder sb = new StringBuilder();
+ JsonNode[] fields = Iterators.toArray(result.get(field).elements(), JsonNode.class);
+ if (fields.length > 1) {
+ for (JsonNode f : fields) {
+ if (f.isObject()) {
+ sb.append(om.writeValueAsString(f));
+ } else {
+ sb.append(f.asText());
+ }
+ }
+ }
+ results = sb.toString();
+ }
+ break;
+ default:
+ throw new AsterixException(field + "unanticipated field");
}
}
- while (tokener.more() && tokener.skipTo('}') != '}') {
- // skip along
- }
- tokener.next('}');
- if (! "success".equals(status)) {
- throw new Exception("Unexpected status: '" + status + "'");
- }
- return IOUtils.toInputStream(results, utf8);
+
+ return IOUtils.toInputStream(results);
}
public static String extractHandle(InputStream resultStream) throws Exception {
final Charset utf8 = Charset.forName("UTF-8");
+ ObjectMapper om = new ObjectMapper();
String result = IOUtils.toString(resultStream, utf8);
- JSONObject parsed = new JSONObject(result);
- JSONArray handle = parsed.getJSONArray("handle");
- JSONObject res = new JSONObject();
- res.put("handle", handle);
- return res.toString();
- }
-
- private static String getFieldName(JSONTokener tokener) throws JSONException {
- char c = tokener.skipTo('"');
- if (c != '"') {
- return null;
- }
- tokener.next('"');
- return tokener.nextString('"');
- }
-
- private static String getStringField(JSONTokener tokener) throws JSONException {
- tokener.skipTo('"');
- tokener.next('"');
- return tokener.nextString('"');
- }
-
- private static JSONArray getArrayField(JSONTokener tokener) throws JSONException {
- tokener.skipTo(':');
- tokener.next(':');
- Object obj = tokener.nextValue();
- if (obj instanceof JSONArray) {
- return (JSONArray) obj;
- } else {
- throw tokener.syntaxError(String.valueOf(obj) + ": unexpected value");
- }
- }
-
- private static JSONObject getObjectField(JSONTokener tokener) throws JSONException {
- tokener.skipTo(':');
- tokener.next(':');
- Object obj = tokener.nextValue();
- if (obj instanceof JSONObject) {
- return (JSONObject) obj;
- } else {
- throw tokener.syntaxError(String.valueOf(obj) + ": unexpected value");
- }
- }
-
- private static String getResults(JSONTokener tokener, String type) throws JSONException {
- tokener.skipTo(':');
- tokener.next(':');
- StringBuilder result = new StringBuilder();
- if (type != null) {
- // a type was provided in the response and so the result is encoded as an array of escaped strings that
- // need to be concatenated
- Object obj = tokener.nextValue();
- if (!(obj instanceof JSONArray)) {
- throw tokener.syntaxError("array expected");
- }
- JSONArray array = (JSONArray) obj;
- for (int i = 0; i < array.length(); ++i) {
- result.append(array.getString(i));
- }
- return result.toString();
- } else {
- int level = 0;
- boolean inQuote = false;
- while (tokener.more()) {
- char c = tokener.next();
- switch (c) {
- case '{':
- case '[':
- ++level;
- result.append(c);
- break;
- case '}':
- case ']':
- --level;
- result.append(c);
- break;
- case '"':
- if (inQuote) {
- --level;
- } else {
- ++level;
- }
- inQuote = !inQuote;
- result.append(c);
- break;
- case ',':
- if (level == 0) {
- return result.toString().trim();
- } else {
- result.append(c);
- }
- break;
- default:
- result.append(c);
- break;
- }
- }
- }
- return null;
+ ObjectNode resultJson = om.readValue(result, ObjectNode.class);
+ JsonNode handle = resultJson.get("handle");
+ ObjectNode res = om.createObjectNode();
+ res.set("handle", handle);
+ return om.writeValueAsString(res);
}
}