You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by am...@apache.org on 2016/02/05 09:43:39 UTC

[2/3] lens git commit: LENS-791 : Fix CLI output to print yaml representation of entity

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPlan.xml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPlan.xml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPlan.xml
new file mode 100644
index 0000000..c4128b8
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPlan.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<queryPlan>
+  <tablesQueried>
+    <tablesQueried>table1</tablesQueried>
+    <tablesQueried>table2</tablesQueried>
+  </tablesQueried>
+  <hasSubQuery>false</hasSubQuery>
+  <execMode>MapReduce</execMode>
+  <scanMode>scanning mode 1</scanMode>
+  <planString>plan is to
+    run this
+    big query one
+    by one
+  </planString>
+  <queryCost>
+    <estimatedExecTimeMillis>1000</estimatedExecTimeMillis>
+    <estimatedResourceUsage>10000.0</estimatedResourceUsage>
+    <costType>HIGH</costType>
+  </queryCost>
+  <prepareHandle>
+    <prepareHandleId>81799e48-574c-4305-bd51-1c277c15713d</prepareHandleId>
+  </prepareHandle>
+</queryPlan>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPlan.yaml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPlan.yaml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPlan.yaml
new file mode 100644
index 0000000..879227a
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPlan.yaml
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+Tables Queried: table1, table2
+Is Has Sub Query: false
+Exec Mode: MapReduce
+Scan Mode: scanning mode 1
+Prepare Handle: 81799e48-574c-4305-bd51-1c277c15713d
+Plan String: plan is to
+    run this
+    big query one
+    by one
+
+Query Cost:
+  Estimated Exec Time Millis: 1000
+  Estimated Resource Usage: 10000.0
+  Cost Type: HIGH

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPrepareHandle.xml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPrepareHandle.xml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPrepareHandle.xml
new file mode 100644
index 0000000..21c5294
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPrepareHandle.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<queryPrepareHandle>
+  <prepareHandleId>81799e48-574c-4305-bd51-1c277c15713d</prepareHandleId>
+</queryPrepareHandle>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPrepareHandle.yaml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPrepareHandle.yaml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPrepareHandle.yaml
new file mode 100644
index 0000000..8bce762
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryPrepareHandle.yaml
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+81799e48-574c-4305-bd51-1c277c15713d
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryResultSetMetadata.xml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryResultSetMetadata.xml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryResultSetMetadata.xml
new file mode 100644
index 0000000..f24e934
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryResultSetMetadata.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<queryResultSetMetadata>
+  <columns>
+    <columns>
+      <name>col1</name>
+      <type>STRING</type>
+    </columns>
+    <columns>
+      <name>col2</name>
+      <type>BOOLEAN</type>
+    </columns>
+  </columns>
+</queryResultSetMetadata>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryResultSetMetadata.yaml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryResultSetMetadata.yaml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryResultSetMetadata.yaml
new file mode 100644
index 0000000..f8a3263
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryResultSetMetadata.yaml
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+col1: STRING
+col2: BOOLEAN

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryStatus.xml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryStatus.xml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryStatus.xml
new file mode 100644
index 0000000..70f9c93
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryStatus.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<queryStatus>
+  <progress>10.0</progress>
+  <status>RUNNING</status>
+  <statusMessage>query running</statusMessage>
+  <isResultSetAvailable>false</isResultSetAvailable>
+  <lensErrorTO>
+    <code>9999</code>
+    <message>error message</message>
+    <stackTrace>random stack trace</stackTrace>
+  </lensErrorTO>
+  <errorMessage>error message</errorMessage>
+  <progressMessage>progress message</progressMessage>
+  <queueNumber>11</queueNumber>
+</queryStatus>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryStatus.yaml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryStatus.yaml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryStatus.yaml
new file mode 100644
index 0000000..749cc87
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.QueryStatus.yaml
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+Progress: 10.0
+Queue Number: 11
+Status: RUNNING
+Status Message: query running
+Is Result Set Available: false
+Progress Message: progress message
+Error Message: error message

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.ResultRow.xml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.ResultRow.xml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.ResultRow.xml
new file mode 100644
index 0000000..6a9145f
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.ResultRow.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<resultRow>
+  <values>
+    <values xsi:type="xs:int" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">1</values>
+    <values xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">name</values>
+    <values xsi:type="xs:double" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">3.5</values>
+    <values xsi:type="xs:boolean" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</values>
+  </values>
+</resultRow>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.ResultRow.yaml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.ResultRow.yaml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.ResultRow.yaml
new file mode 100644
index 0000000..4167aa7
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.ResultRow.yaml
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+[1, name, 3.5, true]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.SchedulerJobHandle.xml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.SchedulerJobHandle.xml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.SchedulerJobHandle.xml
new file mode 100644
index 0000000..ef7d0c7
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.SchedulerJobHandle.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<schedulerJobHandle>
+  <handleId>e554a2a4-b19a-4df9-9015-323d0f145d7f</handleId>
+</schedulerJobHandle>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.query.SchedulerJobHandle.yaml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.query.SchedulerJobHandle.yaml b/lens-api/src/test/resources/toString/org.apache.lens.api.query.SchedulerJobHandle.yaml
new file mode 100644
index 0000000..567d8cf
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.query.SchedulerJobHandle.yaml
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+e554a2a4-b19a-4df9-9015-323d0f145d7f
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.result.QueryCostTO.xml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.result.QueryCostTO.xml b/lens-api/src/test/resources/toString/org.apache.lens.api.result.QueryCostTO.xml
new file mode 100644
index 0000000..de59c19
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.result.QueryCostTO.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<queryCostTO>
+  <estimatedExecTimeMillis>1000</estimatedExecTimeMillis>
+  <estimatedResourceUsage>10000.0</estimatedResourceUsage>
+  <costType>HIGH</costType>
+</queryCostTO>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-api/src/test/resources/toString/org.apache.lens.api.result.QueryCostTO.yaml
----------------------------------------------------------------------
diff --git a/lens-api/src/test/resources/toString/org.apache.lens.api.result.QueryCostTO.yaml b/lens-api/src/test/resources/toString/org.apache.lens.api.result.QueryCostTO.yaml
new file mode 100644
index 0000000..1de6e5c
--- /dev/null
+++ b/lens-api/src/test/resources/toString/org.apache.lens.api.result.QueryCostTO.yaml
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+Estimated Exec Time Millis: 1000
+Estimated Resource Usage: 10000.0
+Cost Type: HIGH
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/main/java/org/apache/lens/cli/commands/BaseLensCommand.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/main/java/org/apache/lens/cli/commands/BaseLensCommand.java b/lens-cli/src/main/java/org/apache/lens/cli/commands/BaseLensCommand.java
index 66a6c4d..0c10198 100644
--- a/lens-cli/src/main/java/org/apache/lens/cli/commands/BaseLensCommand.java
+++ b/lens-cli/src/main/java/org/apache/lens/cli/commands/BaseLensCommand.java
@@ -24,21 +24,22 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.apache.lens.api.ToXMLString;
 import org.apache.lens.api.util.PathValidator;
 import org.apache.lens.client.LensClient;
 import org.apache.lens.client.LensClientSingletonWrapper;
 
-import org.codehaus.jackson.JsonGenerationException;
 import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonNode;
 import org.codehaus.jackson.impl.Indenter;
 import org.codehaus.jackson.map.ObjectMapper;
 import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
 import org.codehaus.jackson.util.DefaultPrettyPrinter;
+import org.jvnet.jaxb2_commons.lang.ToString;
 import org.springframework.shell.core.ExecutionProcessor;
 import org.springframework.shell.event.ParseResult;
 
 import com.google.common.collect.Sets;
-
 import lombok.extern.slf4j.Slf4j;
 
 /**
@@ -46,6 +47,8 @@ import lombok.extern.slf4j.Slf4j;
  */
 @Slf4j
 public class BaseLensCommand implements ExecutionProcessor {
+  public static final String LENS_CLI_PREFIX = "lens.cli.";
+  public static final String JSON_PRETTY_SUFFIX = "json.pretty";
 
   /** The mapper. */
   protected ObjectMapper mapper;
@@ -100,11 +103,10 @@ public class BaseLensCommand implements ExecutionProcessor {
     pp = new DefaultPrettyPrinter();
     pp.indentObjectsWith(new Indenter() {
       @Override
-      public void writeIndentation(JsonGenerator jg, int level) throws IOException, JsonGenerationException {
-        if (level > 2) {
-          jg.writeRaw("  ");
-        } else {
-          jg.writeRaw("\n");
+      public void writeIndentation(JsonGenerator jg, int level) throws IOException {
+        jg.writeRaw("\n");
+        for (int i = 0; i < level; i++) {
+          jg.writeRaw(" ");
         }
       }
 
@@ -134,12 +136,25 @@ public class BaseLensCommand implements ExecutionProcessor {
   /**
    * Pretty printing JSON object into CLI String.
    *
-   * @param json to be formatted
+   * @param data to be formatted
    * @return cli formatted string
    */
-  public String formatJson(String json) {
-    return json.replaceAll("\\[ \\{", "\n\n ").replaceAll("\\{", "").replaceAll("}", "").replaceAll("\\[", "")
-      .replaceAll("]", "\n").replaceAll(",", "").replaceAll("\"", "").replaceAll("\n\n", "\n");
+  public String formatJson(Object data) {
+    try {
+      if (data instanceof ToString || data instanceof ToXMLString) {
+        return data.toString();
+      }
+      String json = mapper.writer(pp).writeValueAsString(data);
+      JsonNode tree = mapper.valueToTree(data);
+      System.out.println(tree);
+      if (getClient().getConf().getBoolean(LENS_CLI_PREFIX + JSON_PRETTY_SUFFIX, false)) {
+        return json;
+      }
+      return json.replaceAll("\\[ \\{", "\n\n ").replaceAll("\\{", "").replaceAll("}", "").replaceAll("\\[", "")
+        .replaceAll("]", "\n").replaceAll(",", "").replaceAll("\"", "").replaceAll("\n\n", "\n");
+    } catch (IOException e) {
+      throw new IllegalArgumentException(e);
+    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/main/java/org/apache/lens/cli/commands/LensCRUDCommand.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensCRUDCommand.java b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensCRUDCommand.java
index a0c05b4..6ce8209 100644
--- a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensCRUDCommand.java
+++ b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensCRUDCommand.java
@@ -19,7 +19,6 @@
 package org.apache.lens.cli.commands;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.List;
 
 import org.apache.lens.api.APIResult;
@@ -44,11 +43,7 @@ public abstract class LensCRUDCommand<T> extends BaseLensCommand {
   }
 
   public String describe(String name) {
-    try {
-      return formatJson(mapper.writer(pp).writeValueAsString(doRead(name)));
-    } catch (IOException e) {
-      throw new IllegalArgumentException(e);
-    }
+    return formatJson(doRead(name));
   }
 
   public String update(String entity, File path) {

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/main/java/org/apache/lens/cli/commands/LensConnectionCommands.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensConnectionCommands.java b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensConnectionCommands.java
index 0aa51a8..b760dad 100644
--- a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensConnectionCommands.java
+++ b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensConnectionCommands.java
@@ -27,6 +27,7 @@ import org.apache.lens.api.APIResult;
 import org.apache.lens.api.LensSessionHandle;
 import org.apache.lens.cli.commands.annotations.UserDocumentation;
 import org.apache.lens.client.LensClient;
+import org.apache.lens.client.LensClientConfig;
 
 import org.slf4j.LoggerFactory;
 import org.springframework.shell.core.ExitShellRequest;
@@ -34,12 +35,15 @@ import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 import org.springframework.stereotype.Component;
 
-import ch.qos.logback.classic.*;
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.PatternLayout;
 import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.*;
-
+import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.ConsoleAppender;
+import ch.qos.logback.core.Context;
 import com.google.common.base.Joiner;
-
 import lombok.NonNull;
 import lombok.extern.slf4j.Slf4j;
 
@@ -66,10 +70,16 @@ public class LensConnectionCommands extends BaseLensCommand {
     if (pair.length != 2) {
       return "Error: Pass parameter as <key>=<value>";
     }
-    APIResult result = getClient().setConnectionParam(pair[0], pair[1]);
-    return result.getMessage();
+    if (pair[0].startsWith(LENS_CLI_PREFIX) || pair[0].startsWith(LensClientConfig.CLIENT_PFX)) {
+      getClient().getConf().set(pair[0], pair[1]);
+      return "Client side Set " + pair[0] + "=" + pair[1];
+    } else {
+      APIResult result = getClient().setConnectionParam(pair[0], pair[1]);
+      return result.getMessage();
+    }
   }
 
+
   /**
    * Gets the param.
    *
@@ -182,7 +192,7 @@ public class LensConnectionCommands extends BaseLensCommand {
     help = "prints all class level logs and verbose logs on cli for debugging purpose."
       + " 'debug false' to turn off all class level logging and verbose level logging ")
   public void debug(@CliOption(key = {"", "enable"},
-      mandatory = false, unspecifiedDefaultValue = "true") boolean enable) {
+    mandatory = false, unspecifiedDefaultValue = "true") boolean enable) {
     Logger logger = LoggerUtil.getRootLogger();
     Logger cliLogger = LoggerUtil.getCliLogger();
     if (enable) {
@@ -201,7 +211,7 @@ public class LensConnectionCommands extends BaseLensCommand {
   @CliCommand(value = {"verbose"},
     help = "Show cliLogger logs on cli. 'verbose false'  turns off the cliLogger logs on console")
   public void verbose(@CliOption(key = {"", "enable"},
-      mandatory = false, unspecifiedDefaultValue = "true") boolean enable) {
+    mandatory = false, unspecifiedDefaultValue = "true") boolean enable) {
     Logger cliLogger = LoggerUtil.getCliLogger();
     if (enable) {
       LoggerUtil.addConsoleAppenderIfNotPresent(cliLogger);

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/main/java/org/apache/lens/cli/commands/LensDimensionCommands.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensDimensionCommands.java b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensDimensionCommands.java
index dc8349e..952577f 100644
--- a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensDimensionCommands.java
+++ b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensDimensionCommands.java
@@ -19,7 +19,6 @@
 package org.apache.lens.cli.commands;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.List;
 
 import org.apache.lens.api.APIResult;
@@ -73,11 +72,7 @@ public class LensDimensionCommands extends ConceptualTableCrudCommand<XDimension
   @CliCommand(value = "describe dimension", help = "describe dimension <dimension_name>")
   public String describeDimension(
     @CliOption(key = {"", "name"}, mandatory = true, help = "<dimension_name>") String name) {
-    try {
-      return formatJson(mapper.writer(pp).writeValueAsString(getClient().getDimension(name)));
-    } catch (IOException e) {
-      throw new IllegalArgumentException(e);
-    }
+    return formatJson(getClient().getDimension(name));
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java
index e2ac3af..007bf34 100644
--- a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java
+++ b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensQueryCommands.java
@@ -194,11 +194,7 @@ public class LensQueryCommands extends BaseLensCommand {
     if (query == null) {
       return "Unable to find query for " + qh;
     }
-    try {
-      return formatJson(mapper.writer(pp).writeValueAsString(query));
-    } catch (IOException e) {
-      throw new IllegalArgumentException(e);
-    }
+    return formatJson(query);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/main/java/org/apache/lens/cli/commands/LogicalTableCrudCommand.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/main/java/org/apache/lens/cli/commands/LogicalTableCrudCommand.java b/lens-cli/src/main/java/org/apache/lens/cli/commands/LogicalTableCrudCommand.java
index a04d5c8..e0b60c2 100644
--- a/lens-cli/src/main/java/org/apache/lens/cli/commands/LogicalTableCrudCommand.java
+++ b/lens-cli/src/main/java/org/apache/lens/cli/commands/LogicalTableCrudCommand.java
@@ -19,7 +19,6 @@
 package org.apache.lens.cli.commands;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.List;
 
 import org.apache.lens.api.APIResult;
@@ -58,11 +57,7 @@ public abstract class LogicalTableCrudCommand<T> extends LensCRUDCommand<T> {
   }
 
   public String getStorage(String tableName, String storage) {
-    try {
-      return formatJson(mapper.writer(pp).writeValueAsString(readStorage(tableName, storage)));
-    } catch (IOException e) {
-      throw new IllegalArgumentException(e);
-    }
+    return formatJson(readStorage(tableName, storage));
   }
 
   public String dropStorage(String tableName, String storageName) {
@@ -74,11 +69,7 @@ public abstract class LogicalTableCrudCommand<T> extends LensCRUDCommand<T> {
   }
 
   public String getAllPartitions(String tableName, String storageName, String filter) {
-    try {
-      return formatJson(mapper.writer(pp).writeValueAsString(readAllPartitions(tableName, storageName, filter)));
-    } catch (IOException e) {
-      throw new IllegalArgumentException(e);
-    }
+    return formatJson(readAllPartitions(tableName, storageName, filter));
   }
 
   public String addPartition(String tableName, String storageName, File path) {

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/test/java/org/apache/lens/cli/LensCliApplicationTest.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/java/org/apache/lens/cli/LensCliApplicationTest.java b/lens-cli/src/test/java/org/apache/lens/cli/LensCliApplicationTest.java
index 8312335..c536ed6 100644
--- a/lens-cli/src/test/java/org/apache/lens/cli/LensCliApplicationTest.java
+++ b/lens-cli/src/test/java/org/apache/lens/cli/LensCliApplicationTest.java
@@ -31,8 +31,7 @@ import org.testng.annotations.BeforeTest;
  * The Class LensCliApplicationTest.
  */
 public class LensCliApplicationTest extends LensAllApplicationJerseyTest {
-  public static final String SUCCESS_MESSAGE = "<?xml version=\"1.0\" encoding=\"utf-8\" "
-    + "standalone=\"yes\"?><apiresult><status>succeeded</status><message></message></apiresult>";
+  public static final String SUCCESS_MESSAGE = "status: succeeded\n";
 
   @Override
   protected int getTestPort() {

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/test/java/org/apache/lens/cli/TestLensCubeCommands.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/java/org/apache/lens/cli/TestLensCubeCommands.java b/lens-cli/src/test/java/org/apache/lens/cli/TestLensCubeCommands.java
index 43d0722..97ca2c8 100644
--- a/lens-cli/src/test/java/org/apache/lens/cli/TestLensCubeCommands.java
+++ b/lens-cli/src/test/java/org/apache/lens/cli/TestLensCubeCommands.java
@@ -173,9 +173,8 @@ public class TestLensCubeCommands extends LensCliApplicationTest {
       String desc = command.describeCube("sample_cube");
       LensClient client = command.getClient();
       LOG.debug(desc);
-      String propString = "name : sample_cube.prop  value : sample";
-      String propString1 = "name : sample_cube.prop1  value : sample1";
-
+      String propString = "sample_cube.prop: sample";
+      String propString1 = "sample_cube.prop1: sample1";
       assertTrue(desc.contains(propString));
 
       command.updateCube("sample_cube", new File("target/sample_cube1.xml"));

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionCommands.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionCommands.java b/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionCommands.java
index 160699b..45555f4 100644
--- a/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionCommands.java
+++ b/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionCommands.java
@@ -157,8 +157,8 @@ public class TestLensDimensionCommands extends LensCliApplicationTest {
 
       String desc = command.describeDimension("test_dim");
       log.debug(desc);
-      String propString = "name : test_dim.prop  value : test";
-      String propString1 = "name : test_dim.prop1  value : test1";
+      String propString = "test_dim.prop: test";
+      String propString1 = "test_dim.prop1: test1";
       Assert.assertTrue(desc.contains(propString));
 
       command.updateDimension("test_dim", new File("target/test_dim1.xml"));

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionTableCommands.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionTableCommands.java b/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionTableCommands.java
index bf92044..bea128b 100644
--- a/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionTableCommands.java
+++ b/lens-cli/src/test/java/org/apache/lens/cli/TestLensDimensionTableCommands.java
@@ -166,9 +166,9 @@ public class TestLensDimensionTableCommands extends LensCliApplicationTest {
 
       String desc = command.describeDimensionTable("dim_table2");
       log.debug(desc);
-      String propString = "name : dim2.prop  value : d2";
-      String propString1 = "name : dim2.prop  value : d1";
-      String propString2 = "name : dim2.prop1  value : d2";
+      String propString = "dim2.prop: d2";
+      String propString1 = "dim2.prop: d1";
+      String propString2 = "dim2.prop1: d2";
       assertTrue(desc.contains(propString));
 
       command.updateDimensionTable("dim_table2", new File("target/local-dim1.xml"));

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/test/java/org/apache/lens/cli/TestLensFactCommands.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/java/org/apache/lens/cli/TestLensFactCommands.java b/lens-cli/src/test/java/org/apache/lens/cli/TestLensFactCommands.java
index 448d0f6..1454e5f 100644
--- a/lens-cli/src/test/java/org/apache/lens/cli/TestLensFactCommands.java
+++ b/lens-cli/src/test/java/org/apache/lens/cli/TestLensFactCommands.java
@@ -158,8 +158,8 @@ public class TestLensFactCommands extends LensCliApplicationTest {
 
       String desc = command.describeFactTable("fact1");
       log.debug(desc);
-      String propString = "name : fact1.prop  value : f1";
-      String propString1 = "name : fact1.prop1  value : f2";
+      String propString = "fact1.prop: f1";
+      String propString1 = "fact1.prop1: f2";
 
       assertTrue(desc.contains(propString));
 

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-cli/src/test/java/org/apache/lens/cli/TestLensStorageCommands.java
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/java/org/apache/lens/cli/TestLensStorageCommands.java b/lens-cli/src/test/java/org/apache/lens/cli/TestLensStorageCommands.java
index 8bccac2..a178296 100644
--- a/lens-cli/src/test/java/org/apache/lens/cli/TestLensStorageCommands.java
+++ b/lens-cli/src/test/java/org/apache/lens/cli/TestLensStorageCommands.java
@@ -149,14 +149,14 @@ public class TestLensStorageCommands extends LensCliApplicationTest {
       String desc = command.describeStorage(storageName);
       LOG.debug(desc);
       System.out.println(desc);
-      String propString = "name : storage.url  value : file:///";
+      String propString = "storage.url: file:///";
       Assert.assertTrue(desc.contains(propString));
 
       String updateResult = command.updateStorage(storageName, new File(updateFilePath));
       Assert.assertTrue(updateResult.contains("succeeded"));
       desc = command.describeStorage(storageName);
       LOG.debug(desc);
-      String propString2 = "name : storage.prop1  value : v1";
+      String propString2 = "storage.prop1: v1";
       Assert.assertTrue(desc.contains(propString));
       Assert.assertTrue(desc.contains(propString2));
     } finally {

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-client/src/main/java/org/apache/lens/client/LensClient.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensClient.java b/lens-client/src/main/java/org/apache/lens/client/LensClient.java
index f7f99c7..ea0cd76 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensClient.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensClient.java
@@ -49,6 +49,7 @@ import lombok.extern.slf4j.Slf4j;
 public class LensClient {
   public static final String CLILOGGER =  "cliLogger";
   private static final String DEFAULT_PASSWORD = "";
+  @Getter
   private final LensClientConfig conf;
   @Getter
   private final LensMetadataClient mc;

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java b/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
index 07ce41e..d0f2b57 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
@@ -18,9 +18,7 @@
  */
 package org.apache.lens.client;
 
-import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.Date;
 import java.util.List;
 
@@ -46,19 +44,6 @@ public class LensMetadataClient {
   private final LensConnectionParams params;
   private final ObjectFactory objFact;
 
-  public static final Unmarshaller JAXB_UNMARSHALLER;
-
-  static {
-    try {
-      JAXBContext jaxbContext = new LensJAXBContext(ObjectFactory.class);
-      JAXB_UNMARSHALLER = jaxbContext.createUnmarshaller();
-    } catch (JAXBException e) {
-      log.error("Could not initialize JAXBContext. ", e);
-      throw new RuntimeException("Could not initialize JAXBContext. ", e);
-    }
-  }
-
-
   public LensMetadataClient(LensConnection connection) {
     this.connection = connection;
     this.params = connection.getLensConnectionParams();
@@ -166,16 +151,7 @@ public class LensMetadataClient {
   }
 
   private <T> T readFromXML(String filename) throws JAXBException, IOException {
-    if (filename.startsWith("/")) {
-      return ((JAXBElement<T>) JAXB_UNMARSHALLER.unmarshal(new File(filename))).getValue();
-    } else {
-      // load from classpath
-      InputStream file = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
-      if (file == null) {
-        throw new IOException("File not found:" + filename);
-      }
-      return ((JAXBElement<T>) JAXB_UNMARSHALLER.unmarshal(file)).getValue();
-    }
+    return LensJAXBContext.unmarshallFromFile(filename);
   }
 
   public APIResult createCube(String cubeSpec) {

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-client/src/main/java/org/apache/lens/client/LensStatement.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensStatement.java b/lens-client/src/main/java/org/apache/lens/client/LensStatement.java
index 0009182..33c26e1 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensStatement.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensStatement.java
@@ -218,7 +218,7 @@ public class LensStatement {
         query.getDriverOpHandle());
     }
     while (!query.getStatus().finished()
-      && !(query.getStatus().toString().equals(Status.CLOSED.toString()))) {
+      && !(query.getStatus().getStatus().equals(Status.CLOSED))) {
       query = getQuery(handle);
       LensClient.getCliLooger().info("Query Status:{} ", query.getStatus());
       try {

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-client/src/main/resources/lens-client-default.xml
----------------------------------------------------------------------
diff --git a/lens-client/src/main/resources/lens-client-default.xml b/lens-client/src/main/resources/lens-client-default.xml
index 1b7c978..e8dbd2c 100644
--- a/lens-client/src/main/resources/lens-client-default.xml
+++ b/lens-client/src/main/resources/lens-client-default.xml
@@ -51,4 +51,9 @@
     <value>10</value>
     <description>Interval at which query progress will be polled. Interval has to be given in milliseconds</description>
   </property>
+  <property>
+    <name>lens.cli.json.pretty</name>
+    <value>false</value>
+    <description>Should CLI try to prettify the JSON of an object before priting.</description>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/pom.xml
----------------------------------------------------------------------
diff --git a/lens-examples/pom.xml b/lens-examples/pom.xml
index c97392e..a13ee33 100644
--- a/lens-examples/pom.xml
+++ b/lens-examples/pom.xml
@@ -19,7 +19,8 @@
   under the License.
 
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <name>Lens Examples</name>
   <parent>
@@ -41,6 +42,14 @@
 
     <dependency>
       <groupId>org.apache.lens</groupId>
+      <artifactId>lens-api</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.lens</groupId>
       <artifactId>lens-client</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -55,5 +64,10 @@
       <artifactId>hsqldb</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+    </dependency>
+
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java
----------------------------------------------------------------------
diff --git a/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java b/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java
index b6385d4..0c2301b 100644
--- a/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java
+++ b/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java
@@ -21,7 +21,10 @@ package org.apache.lens.examples;
 import java.io.IOException;
 import java.io.InputStream;
 
-import javax.xml.bind.*;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
 
 import org.apache.lens.api.APIResult;
 import org.apache.lens.api.jaxb.LensJAXBContext;

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/main/resources/example-job.xml
----------------------------------------------------------------------
diff --git a/lens-examples/src/main/resources/example-job.xml b/lens-examples/src/main/resources/example-job.xml
index 93f36d4..3fb9be8 100644
--- a/lens-examples/src/main/resources/example-job.xml
+++ b/lens-examples/src/main/resources/example-job.xml
@@ -19,16 +19,17 @@
   under the License.
 
 -->
-<job xmlns="uri:lens:job:0.1">
+<job xmlns="uri:lens:job:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="uri:lens:job:0.1 scheduler-job-0.1.xsd ">
     <name>Sample Scheduler job</name>
     <execution>
-        <resource_path>/path/to/a/resource/</resource_path>
         <session>
             <db>myDb</db>
             <conf>
                 <key>userName</key>
                 <value>ajayyadava</value>
             </conf>
+            <resource_path>/path/to/a/resource/</resource_path>
         </session>
         <query>
             <query>cube select measure2 from sample_cube where time_range_in(dt, '2014-06-24-23', '2014-06-25-00')</query>

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/java/org/apache/lens/examples/ExampleSchemaToStringTest.java
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/java/org/apache/lens/examples/ExampleSchemaToStringTest.java b/lens-examples/src/test/java/org/apache/lens/examples/ExampleSchemaToStringTest.java
new file mode 100644
index 0000000..b884368
--- /dev/null
+++ b/lens-examples/src/test/java/org/apache/lens/examples/ExampleSchemaToStringTest.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.lens.examples;
+
+
+import static org.apache.lens.api.jaxb.LensJAXBContext.unmarshallFromFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.lens.api.jaxb.YAMLToStringStrategyTest;
+
+import com.beust.jcommander.internal.Lists;
+
+public class ExampleSchemaToStringTest extends YAMLToStringStrategyTest {
+
+  public List<ToStringTestData> provideData() throws URISyntaxException, JAXBException, IOException {
+    List<ToStringTestData> ret = Lists.newArrayList();
+    for (String yamlName : new File(getClass().getResource("/yaml").toURI()).list()) {
+      ret.add(new ToStringTestData(yamlName, unmarshallFromFile("/" + yamlName.replaceAll("yaml$", "xml")),
+        readYAML("/yaml/" + yamlName)));
+    }
+    return ret;
+  }
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/city-local-part.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/city-local-part.yaml b/lens-examples/src/test/resources/yaml/city-local-part.yaml
new file mode 100644
index 0000000..9c076d6
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/city-local-part.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-03-27T12:00:00
+factOrDimensionTableName: city_table
+location: examples/data/city_local
+updatePeriod: HOURLY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/city.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/city.yaml b/lens-examples/src/test/resources/yaml/city.yaml
new file mode 100644
index 0000000..a5c8a32
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/city.yaml
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+attributes:
+  id: type: INT
+  name: type: STRING
+  POI [Point of interests]: type: ARRAY<STRING>
+  population: type: BIGINT
+properties:
+  dimension.city.timed.dimension: dt
+name: city

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/city_subset.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/city_subset.yaml b/lens-examples/src/test/resources/yaml/city_subset.yaml
new file mode 100644
index 0000000..cd5c8ad
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/city_subset.yaml
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+columns:
+  id: type: INT, comment: ID
+  name: type: STRING, comment: name
+storageTables:
+  mydb:
+    tableDesc:
+      tableParameters:
+        lens.metastore.native.db.name: default
+      external: true
+      tableLocation: /tmp/db-storage.db
+      fieldDelimiter: ,
+      storageHandlerName: org.apache.lens.storage.db.DBStorageHandler
+dimensionName: city
+tableName: city_subset
+weight: 100.0

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/city_table.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/city_table.yaml b/lens-examples/src/test/resources/yaml/city_table.yaml
new file mode 100644
index 0000000..4f3b986
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/city_table.yaml
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+columns:
+  id: type: INT, comment: ID
+  name: type: STRING, comment: name
+  POI: type: ARRAY<STRING>, comment: Point of interests
+  population: type: BIGINT, comment: city population
+properties:
+  city.prop: d1
+storageTables:
+  local:
+    updatePeriods: HOURLY
+    tableDesc:
+      partCols:
+        dt: type: STRING, comment: Time column
+      timePartCols: dt
+      external: true
+      tableLocation: /tmp/examples/city
+      fieldDelimiter: ,
+      collectionDelimiter: :
+dimensionName: city
+tableName: city_table
+weight: 10.0

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/customer-local-part.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/customer-local-part.yaml b/lens-examples/src/test/resources/yaml/customer-local-part.yaml
new file mode 100644
index 0000000..638a9cc
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/customer-local-part.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-03-27T12:00:00
+factOrDimensionTableName: customer_table
+location: examples/data/customer_local
+updatePeriod: HOURLY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/customer.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/customer.yaml b/lens-examples/src/test/resources/yaml/customer.yaml
new file mode 100644
index 0000000..1a6368d
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/customer.yaml
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+attributes:
+  id: type: INT
+  name: type: STRING
+  gender: values: M, F, type: STRING
+  age: type: INT
+  city_id: type: INT
+  Customer City(customer_city_name) [City name to which the customer belongs]:
+    chainRefColumn:
+      -
+        chainName: customer_city
+        refCol: name
+    type: string
+  customer_credit_status:
+    type: STRING
+    startTime: 2015-03-01T00:00:00
+joinChains:
+  customer_city:
+    paths:
+      -
+        customer.city_id=city.id
+properties:
+  dimension.customer.timed.dimension: dt
+name: customer

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/customer_table.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/customer_table.yaml b/lens-examples/src/test/resources/yaml/customer_table.yaml
new file mode 100644
index 0000000..2de5cd9
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/customer_table.yaml
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+columns:
+  id: type: INT, comment: ID
+  name: type: STRING, comment: name
+  gender: type: STRING
+  age: type: INT
+  city_id: type: INT
+  customer_credit_status: type: STRING
+properties:
+  dim4.prop: d1
+storageTables:
+  local:
+    updatePeriods: HOURLY
+    tableDesc:
+      partCols:
+        dt: type: STRING, comment: Time column
+      timePartCols: dt
+      external: true
+      tableLocation: /tmp/examples/customer
+      fieldDelimiter: ,
+  mydb:
+    tableDesc:
+      tableParameters:
+        lens.metastore.native.db.name: default
+      external: true
+      tableLocation: /tmp/db-storage.db
+      fieldDelimiter: ,
+      storageHandlerName: org.apache.lens.storage.db.DBStorageHandler
+dimensionName: customer
+tableName: customer_table
+weight: 100.0

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/db-storage.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/db-storage.yaml b/lens-examples/src/test/resources/yaml/db-storage.yaml
new file mode 100644
index 0000000..6e3c6bc
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/db-storage.yaml
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+properties:
+  lens.storage.db.url: file:///tmp/db-storage.db
+name: mydb
+classname: org.apache.lens.storage.db.DBStorage

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/dim1-local-part.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/dim1-local-part.yaml b/lens-examples/src/test/resources/yaml/dim1-local-part.yaml
new file mode 100644
index 0000000..db42585
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/dim1-local-part.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-03-27T12:00:00
+factOrDimensionTableName: dim_table
+location: examples/data/dim1_local
+updatePeriod: HOURLY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/dim2-local-part.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/dim2-local-part.yaml b/lens-examples/src/test/resources/yaml/dim2-local-part.yaml
new file mode 100644
index 0000000..e98e24d
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/dim2-local-part.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-03-27T12:00:00
+factOrDimensionTableName: dim_table2
+location: examples/data/dim2_local
+updatePeriod: HOURLY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/dim4-local-part.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/dim4-local-part.yaml b/lens-examples/src/test/resources/yaml/dim4-local-part.yaml
new file mode 100644
index 0000000..be79a70
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/dim4-local-part.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-03-27T12:00:00
+factOrDimensionTableName: dim_table4
+location: examples/data/dim4_local
+updatePeriod: HOURLY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/dim_table.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/dim_table.yaml b/lens-examples/src/test/resources/yaml/dim_table.yaml
new file mode 100644
index 0000000..8191456
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/dim_table.yaml
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+columns:
+  id: type: INT, comment: ID
+  name: type: STRING, comment: name
+  detail: type: STRING, comment: more details
+  d2id: type: INT, comment: d2 ID
+properties:
+  dim1.prop: d1
+storageTables:
+  local:
+    updatePeriods: HOURLY
+    tableDesc:
+      partCols:
+        dt: type: STRING, comment: Time column
+      timePartCols: dt
+      external: true
+      tableLocation: /tmp/examples/dim1
+      fieldDelimiter: ,
+dimensionName: sample_dim
+tableName: dim_table
+weight: 100.0

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/dim_table2.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/dim_table2.yaml b/lens-examples/src/test/resources/yaml/dim_table2.yaml
new file mode 100644
index 0000000..0df4682
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/dim_table2.yaml
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+columns:
+  id: type: INT, comment: ID
+  name: type: STRING, comment: name
+  detail2: type: STRING, comment: more details for dim2
+properties:
+  dim2.prop: d2
+storageTables:
+  local:
+    updatePeriods: HOURLY
+    tableDesc:
+      partCols:
+        dt: type: STRING, comment: Time column
+      timePartCols: dt
+      external: true
+      tableLocation: /tmp/examples/dim2
+      fieldDelimiter: ,
+dimensionName: sample_dim2
+tableName: dim_table2
+weight: 100.0

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/dim_table3.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/dim_table3.yaml b/lens-examples/src/test/resources/yaml/dim_table3.yaml
new file mode 100644
index 0000000..74cd367
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/dim_table3.yaml
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+columns:
+  id: type: INT, comment: ID
+  name: type: STRING, comment: name
+  detail: type: STRING, comment: more details
+  d2id: type: INT, comment: d2 ID
+properties:
+  dim3.prop: d1
+storageTables:
+  mydb:
+    tableDesc:
+      tableParameters:
+        lens.metastore.native.db.name: default
+      external: true
+      tableLocation: /tmp/db-storage.db
+      fieldDelimiter: ,
+      storageHandlerName: org.apache.lens.storage.db.DBStorageHandler
+dimensionName: sample_db_dim
+tableName: dim_table3
+weight: 100.0

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/dim_table4.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/dim_table4.yaml b/lens-examples/src/test/resources/yaml/dim_table4.yaml
new file mode 100644
index 0000000..f26c2cd
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/dim_table4.yaml
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+columns:
+  id: type: INT, comment: ID
+  name: type: STRING, comment: name
+  detail: type: STRING, comment: more details
+  d2id: type: INT, comment: d2 ID
+properties:
+  dim4.prop: d1
+storageTables:
+  local:
+    updatePeriods: HOURLY
+    tableDesc:
+      partCols:
+        dt: type: STRING, comment: Time column
+      timePartCols: dt
+      external: true
+      tableLocation: /tmp/examples/dim4
+      fieldDelimiter: ,
+  mydb:
+    tableDesc:
+      tableParameters:
+        lens.metastore.native.db.name: default
+      external: true
+      tableLocation: /tmp/db-storage.db
+      fieldDelimiter: ,
+      storageHandlerName: org.apache.lens.storage.db.DBStorageHandler
+dimensionName: sample_dim
+tableName: dim_table4
+weight: 100.0

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/example-job.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/example-job.yaml b/lens-examples/src/test/resources/yaml/example-job.yaml
new file mode 100644
index 0000000..62788bb
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/example-job.yaml
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+name: Sample Scheduler job
+execution:
+  session:
+    db: myDb
+    conf:
+      -
+        key: userName
+        value: ajayyadava
+    resourcePath: /path/to/a/resource/
+  query:
+    query: cube select measure2 from sample_cube where time_range_in(dt, '2014-06-24-23', '2014-06-25-00')
+    conf:
+      -
+        key: queryKey1
+        value: queryValue1
+trigger:
+  cronExpression: 0 15 10 * * ? 2014
+  timezone: UTC
+jobConf:
+  -
+    key: key1
+    value: value1
+startTime: 2013-11-30T00:00:00
+endTime: 2015-12-30T00:00:00

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/fact1-local-part1.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/fact1-local-part1.yaml b/lens-examples/src/test/resources/yaml/fact1-local-part1.yaml
new file mode 100644
index 0000000..03c3f67
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/fact1-local-part1.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-06-24T23:00:00
+factOrDimensionTableName: fact1
+location: examples/data/fact1_local1
+updatePeriod: HOURLY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/fact1-local-part2.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/fact1-local-part2.yaml b/lens-examples/src/test/resources/yaml/fact1-local-part2.yaml
new file mode 100644
index 0000000..8de4540
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/fact1-local-part2.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-06-25T00:00:00
+factOrDimensionTableName: fact1
+location: examples/data/fact1_local2
+updatePeriod: DAILY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/fact1-local-part3.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/fact1-local-part3.yaml b/lens-examples/src/test/resources/yaml/fact1-local-part3.yaml
new file mode 100644
index 0000000..ff07faa
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/fact1-local-part3.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-06-26T00:00:00
+factOrDimensionTableName: fact1
+location: examples/data/fact1_local3
+updatePeriod: HOURLY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/fact1.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/fact1.yaml b/lens-examples/src/test/resources/yaml/fact1.yaml
new file mode 100644
index 0000000..4252e33
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/fact1.yaml
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+columns:
+  dim1: type: INT
+  measure2: type: BIGINT
+  measure3: type: INT
+  measure4: type: FLOAT
+properties:
+  cube.fact.is.aggregated: true
+storageTables:
+  local:
+    updatePeriods: HOURLY, DAILY
+    tableDesc:
+      partCols:
+        dt: type: STRING, comment: Time column
+      timePartCols: dt
+      external: true
+      tableLocation: /tmp/examples/fact1_local
+      fieldDelimiter: ,
+name: fact1
+cubeName: sample_cube
+weight: 100.0

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/fact2-local-part1.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/fact2-local-part1.yaml b/lens-examples/src/test/resources/yaml/fact2-local-part1.yaml
new file mode 100644
index 0000000..b19a1c8
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/fact2-local-part1.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-06-24T23:00:00
+factOrDimensionTableName: fact2
+location: examples/data/fact2_local1
+updatePeriod: HOURLY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/fact2-local-part2.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/fact2-local-part2.yaml b/lens-examples/src/test/resources/yaml/fact2-local-part2.yaml
new file mode 100644
index 0000000..26f7b06
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/fact2-local-part2.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-06-25T00:00:00
+factOrDimensionTableName: fact2
+location: examples/data/fact2_local2
+updatePeriod: DAILY

http://git-wip-us.apache.org/repos/asf/lens/blob/b805ee98/lens-examples/src/test/resources/yaml/fact2-local-part3.yaml
----------------------------------------------------------------------
diff --git a/lens-examples/src/test/resources/yaml/fact2-local-part3.yaml b/lens-examples/src/test/resources/yaml/fact2-local-part3.yaml
new file mode 100644
index 0000000..7a802cd
--- /dev/null
+++ b/lens-examples/src/test/resources/yaml/fact2-local-part3.yaml
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+timePartitionSpec:
+  dt: 2014-06-26T00:00:00
+factOrDimensionTableName: fact2
+location: examples/data/fact2_local3
+updatePeriod: HOURLY