Skip to content

Commit

Permalink
minor rename of operation
Browse files Browse the repository at this point in the history
relates to elastic#69
  • Loading branch information
costin committed Oct 31, 2013
1 parent 4fcdfae commit e8cee57
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Expand Up @@ -71,12 +71,12 @@ public interface ConfigurationOptions {
String ES_INDEX_READ_MISSING_AS_EMPTY_DEFAULT = "false";

/** Operation types */
String ES_OPERATION = "es.operation";
String ES_WRITE_OPERATION = "es.write.operation";
String ES_OPERATION_INDEX = "index";
String ES_OPERATION_CREATE = "create";
String ES_OPERATION_UPDATE = "update";
String ES_OPERATION_DELETE = "delete";
String ES_OPERATION_DEFAULT = ES_OPERATION_INDEX;
String ES_WRITE_OPERATION_DEFAULT = ES_OPERATION_INDEX;

String ES_MAPPING_ID = "es.mapping.id";
String ES_MAPPING_ID_EXTRACTOR_CLASS = "es.mapping.id.extractor.class";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/elasticsearch/hadoop/cfg/Settings.java
Expand Up @@ -82,7 +82,7 @@ public boolean getIndexReadMissingAsEmpty() {
}

public String getOperation() {
return getProperty(ES_OPERATION, ES_OPERATION_DEFAULT).toLowerCase();
return getProperty(ES_WRITE_OPERATION, ES_WRITE_OPERATION_DEFAULT).toLowerCase();
}

public String getMappingId() {
Expand Down
Expand Up @@ -76,7 +76,7 @@ public void testSaveWithId() throws Exception {
@Test
public void testCreateWithId() throws Exception {
Configuration conf = createConf();
conf.set(ConfigurationOptions.ES_OPERATION, "create");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "create");
conf.set(ConfigurationOptions.ES_MAPPING_ID, "number");
conf.set(ConfigurationOptions.ES_RESOURCE, "mrnewapi/createwithid");

Expand All @@ -87,7 +87,7 @@ public void testCreateWithId() throws Exception {
public void testCreateWithIdShouldFailOnDuplicate() throws Exception {
Configuration conf = createConf();
conf.setBoolean("mapred.used.genericoptionsparser", true);
conf.set(ConfigurationOptions.ES_OPERATION, "create");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "create");
conf.set(ConfigurationOptions.ES_MAPPING_ID, "number");
conf.set(ConfigurationOptions.ES_RESOURCE, "mrnewapi/createwithid");

Expand All @@ -97,7 +97,7 @@ public void testCreateWithIdShouldFailOnDuplicate() throws Exception {
@Test(expected = IllegalArgumentException.class)
public void testUpdateWithoutId() throws Exception {
Configuration conf = createConf();
conf.set(ConfigurationOptions.ES_OPERATION, "update");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "update");
conf.set(ConfigurationOptions.ES_RESOURCE, "mroldapi/update");

new Job(conf).waitForCompletion(true);
Expand All @@ -106,7 +106,7 @@ public void testUpdateWithoutId() throws Exception {
@Test
public void testUpdateWithId() throws Exception {
Configuration conf = createConf();
conf.set(ConfigurationOptions.ES_OPERATION, "update");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "update");
conf.set(ConfigurationOptions.ES_MAPPING_ID, "number");
conf.set(ConfigurationOptions.ES_RESOURCE, "mroldapi/update");

Expand All @@ -116,7 +116,7 @@ public void testUpdateWithId() throws Exception {
@Test
public void testUpdateWithoutUpsert() throws Exception {
Configuration conf = createConf();
conf.set(ConfigurationOptions.ES_OPERATION, "update");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "update");
conf.set(ConfigurationOptions.ES_MAPPING_ID, "number");
conf.set(ConfigurationOptions.ES_RESOURCE, "mroldapi/updatewoupsert");
conf.set(ConfigurationOptions.ES_UPSERT_DOC, "false");
Expand Down
Expand Up @@ -80,7 +80,7 @@ public void testBasicIndexWithId() throws Exception {
@Test
public void testCreateWithId() throws Exception {
JobConf conf = createJobConf();
conf.set(ConfigurationOptions.ES_OPERATION, "create");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "create");
conf.set(ConfigurationOptions.ES_MAPPING_ID, "number");
conf.set(ConfigurationOptions.ES_RESOURCE, "mroldapi/createwithid");

Expand All @@ -90,7 +90,7 @@ public void testCreateWithId() throws Exception {
@Test(expected = IOException.class)
public void testCreateWithIdShouldFailOnDuplicate() throws Exception {
JobConf conf = createJobConf();
conf.set(ConfigurationOptions.ES_OPERATION, "create");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "create");
conf.set(ConfigurationOptions.ES_MAPPING_ID, "number");
conf.set(ConfigurationOptions.ES_RESOURCE, "mroldapi/createwithid");

Expand All @@ -100,7 +100,7 @@ public void testCreateWithIdShouldFailOnDuplicate() throws Exception {
@Test(expected = IllegalArgumentException.class)
public void testUpdateWithoutId() throws Exception {
JobConf conf = createJobConf();
conf.set(ConfigurationOptions.ES_OPERATION, "update");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "update");
conf.set(ConfigurationOptions.ES_RESOURCE, "mroldapi/update");

JobClient.runJob(conf);
Expand All @@ -109,7 +109,7 @@ public void testUpdateWithoutId() throws Exception {
@Test
public void testUpdateWithId() throws Exception {
JobConf conf = createJobConf();
conf.set(ConfigurationOptions.ES_OPERATION, "update");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "update");
conf.set(ConfigurationOptions.ES_MAPPING_ID, "number");
conf.set(ConfigurationOptions.ES_RESOURCE, "mroldapi/update");

Expand All @@ -119,7 +119,7 @@ public void testUpdateWithId() throws Exception {
@Test(expected = IOException.class)
public void testUpdateWithoutUpsert() throws Exception {
JobConf conf = createJobConf();
conf.set(ConfigurationOptions.ES_OPERATION, "update");
conf.set(ConfigurationOptions.ES_WRITE_OPERATION, "update");
conf.set(ConfigurationOptions.ES_MAPPING_ID, "number");
conf.set(ConfigurationOptions.ES_RESOURCE, "mroldapi/updatewoupsert");
conf.set(ConfigurationOptions.ES_UPSERT_DOC, "false");
Expand Down

0 comments on commit e8cee57

Please sign in to comment.