You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by "Alfonso Nishikawa (JIRA)" <ji...@apache.org> on 2017/06/05 22:13:04 UTC
[jira] [Comment Edited] (GORA-512) Fail at the time of error
logging if KeyClass in gora-hbase-mapping is not the same as the one in the
data bean
[ https://issues.apache.org/jira/browse/GORA-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16037688#comment-16037688 ]
Alfonso Nishikawa edited comment on GORA-512 at 6/5/17 10:12 PM:
-----------------------------------------------------------------
Hi, [~nishadi],
I think that what could be done is implementing a test which expects an exception ( @Test(expected=...) ) by creating a datastore in this way:
```
return DataStoreFactory.createDataStore(HBaseStore.class, String.class, WebPage.class, conf);
```
The last configuration parameter is read at initialization time in HBaseStore [1], and there is the key 'gora.hbase.mapping.file' that it is used at [2] that you can use to configure a "not-matching-keyclass-mapping.xml" that will fail just in that line (`readMapping()` is being called).
You can create a copy of gora-hbase-mapping.xml with the WebPage information deleted, into the folder `gora-hbase/src/test/conf`.
I think that should work. Just theoretically, as always :P
Better ideas are welcome.
Thank you!
[1] - https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L128
[2] - https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L130
was (Author: alfonso.nishikawa):
Hi, [~nishadi],
I think that what could be done is implementing a test which expects an exception ( @Test(expected=...) ) by creating a datastore in this way:
```
return DataStoreFactory.createDataStore(HBaseStore.class, String.class, WebPage.class, conf);
```
The last configuration parameter is read at initialization time in HBaseStore [1], and there is the key 'gora.hbase.mapping.file' that it is used at [2] that you can use to configure a "not-matching-keyclass-mapping.xml" that will fail just in that line (`readMapping()` is being called).
You can create a copy of gora-hbase-mapping.xml with the WebPage infomation deleted, into the folder `gora-hbase/src/test/conf`.
I think that should work. Just theoretically, as always :P
Better ideas are welcome.
Thank you!
[1] - https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L128
[2] - https://github.com/apache/gora/blob/apache-gora-0.7/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L130
> Fail at the time of error logging if KeyClass in gora-hbase-mapping is not the same as the one in the data bean
> ---------------------------------------------------------------------------------------------------------------
>
> Key: GORA-512
> URL: https://issues.apache.org/jira/browse/GORA-512
> Project: Apache Gora
> Issue Type: Improvement
> Components: gora-hbase
> Reporter: Nishadi Kirielle
> Assignee: Nishadi Kirielle
> Priority: Minor
>
> In the current implementation, when reading the HBase mapping file, if the HBase mapping file does not have a matching key class and name to the data bean, it only logs that information.[1] It does not fail at the time of detecting it. It fails only at the time of building the mapper [2] when it detects the table name is null. It will be better if it can fail at the time of detecting that mapping file is missing the corresponding class.
> [1]. https://github.com/apache/gora/blob/master/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L797
> [2]. https://github.com/apache/gora/blob/master/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java#L815
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)