mirror of
https://github.com/apache/sqoop.git
synced 2025-05-07 02:11:52 +08:00
Revert "SQOOP-2740: Sqoop2: Use name instead of id for ValidationResultBean"
This reverts commit 060be9049c
.
I've mistakenly committed wrong version of the patch, so I'm reverting it and I'll commit the right version.
This commit is contained in:
parent
2fe4ff5369
commit
9ac461cc41
@ -806,9 +806,9 @@ private Status applyLinkValidations(ValidationResultBean bean, MLink link) {
|
|||||||
ConfigValidationResult linkConfig = bean.getValidationResults()[0];
|
ConfigValidationResult linkConfig = bean.getValidationResults()[0];
|
||||||
// Apply validation results
|
// Apply validation results
|
||||||
ConfigUtils.applyValidation(link.getConnectorLinkConfig(), linkConfig);
|
ConfigUtils.applyValidation(link.getConnectorLinkConfig(), linkConfig);
|
||||||
String linkName = bean.getName();
|
Long id = bean.getId();
|
||||||
if (linkName != null) {
|
if (id != null) {
|
||||||
link.setName(linkName);
|
link.setPersistenceId(id);
|
||||||
}
|
}
|
||||||
return Status.getWorstStatus(linkConfig.getStatus());
|
return Status.getWorstStatus(linkConfig.getStatus());
|
||||||
}
|
}
|
||||||
@ -830,9 +830,9 @@ private Status applyJobValidations(ValidationResultBean bean, MJob job) {
|
|||||||
driver
|
driver
|
||||||
);
|
);
|
||||||
|
|
||||||
String jobName = bean.getName();
|
Long id = bean.getId();
|
||||||
if(jobName != null) {
|
if(id != null) {
|
||||||
job.setName(jobName);
|
job.setPersistenceId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status.getWorstStatus(fromConfig.getStatus(), toConfig.getStatus(), driver.getStatus());
|
return Status.getWorstStatus(fromConfig.getStatus(), toConfig.getStatus(), driver.getStatus());
|
||||||
|
@ -38,11 +38,12 @@
|
|||||||
public class ValidationResultBean implements JsonBean {
|
public class ValidationResultBean implements JsonBean {
|
||||||
|
|
||||||
private static final String VALIDATION_RESULT = "validation-result";
|
private static final String VALIDATION_RESULT = "validation-result";
|
||||||
|
private static final String ID = "id";
|
||||||
private static final String STATUS = "status";
|
private static final String STATUS = "status";
|
||||||
private static final String MESSAGE = "message";
|
private static final String MESSAGE = "message";
|
||||||
|
|
||||||
private ConfigValidationResult[] results;
|
private ConfigValidationResult[] results;
|
||||||
private String name;
|
private Long id;
|
||||||
|
|
||||||
public ValidationResultBean() {
|
public ValidationResultBean() {
|
||||||
// Empty, for restore
|
// Empty, for restore
|
||||||
@ -59,12 +60,12 @@ public ConfigValidationResult[] getValidationResults() {
|
|||||||
return results.clone();
|
return results.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public void setId(Long id) {
|
||||||
return name;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public Long getId() {
|
||||||
this.name = name;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -79,8 +80,8 @@ public JSONObject extract(boolean skipSensitive) {
|
|||||||
|
|
||||||
JSONObject object = new JSONObject();
|
JSONObject object = new JSONObject();
|
||||||
object.put(VALIDATION_RESULT, array);
|
object.put(VALIDATION_RESULT, array);
|
||||||
if(name != null) {
|
if(id != null) {
|
||||||
object.put(NAME, name);
|
object.put(ID, id);
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
@ -123,8 +124,8 @@ public void restore(JSONObject jsonObject) {
|
|||||||
for(Object item : array) {
|
for(Object item : array) {
|
||||||
results[i++] = restoreValidationResult((JSONObject) item);
|
results[i++] = restoreValidationResult((JSONObject) item);
|
||||||
}
|
}
|
||||||
if(jsonObject.containsKey(NAME)) {
|
if(jsonObject.containsKey(ID)) {
|
||||||
name = JSONUtils.getString(jsonObject, NAME);
|
id = JSONUtils.getLong(jsonObject, ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,11 +71,11 @@ public void testTwoMessages() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testId() {
|
public void testId() {
|
||||||
String name = transfer("testName");
|
long id = transfer(10L);
|
||||||
assertEquals("testName", name);
|
assertEquals(10L, id);
|
||||||
|
|
||||||
String nameNull = transfer((String)null);
|
Long idNull = transfer((Long)null);
|
||||||
assertNull(nameNull);
|
assertNull(idNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyResultA(ConfigValidationResult result) {
|
public void verifyResultA(ConfigValidationResult result) {
|
||||||
@ -107,9 +107,9 @@ public ConfigValidationResult getResultA() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String transfer(String name) {
|
private Long transfer(Long id) {
|
||||||
ValidationResultBean bean = new ValidationResultBean(new ConfigValidationResult[0]);
|
ValidationResultBean bean = new ValidationResultBean(new ConfigValidationResult[0]);
|
||||||
bean.setName(name);
|
bean.setId(id);
|
||||||
JSONObject json = bean.extract(false);
|
JSONObject json = bean.extract(false);
|
||||||
|
|
||||||
String string = json.toString();
|
String string = json.toString();
|
||||||
@ -118,7 +118,7 @@ private String transfer(String name) {
|
|||||||
ValidationResultBean retrievedBean = new ValidationResultBean();
|
ValidationResultBean retrievedBean = new ValidationResultBean();
|
||||||
retrievedBean.restore(retrievedJson);
|
retrievedBean.restore(retrievedJson);
|
||||||
|
|
||||||
return retrievedBean.getName();
|
return retrievedBean.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConfigValidationResult[] transfer(ConfigValidationResult [] results) {
|
private ConfigValidationResult[] transfer(ConfigValidationResult [] results) {
|
||||||
|
@ -250,7 +250,7 @@ private JsonBean createUpdateJob(RequestContext ctx, boolean create) {
|
|||||||
postedJob.setCreationUser(username);
|
postedJob.setCreationUser(username);
|
||||||
postedJob.setLastUpdateUser(username);
|
postedJob.setLastUpdateUser(username);
|
||||||
repository.createJob(postedJob);
|
repository.createJob(postedJob);
|
||||||
validationResultBean.setName(postedJob.getName());
|
validationResultBean.setId(postedJob.getPersistenceId());
|
||||||
} else {
|
} else {
|
||||||
AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
|
AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
|
||||||
ctx.getRequest().getRemoteAddr(), "update", "job",
|
ctx.getRequest().getRemoteAddr(), "update", "job",
|
||||||
|
@ -174,7 +174,7 @@ private JsonBean createUpdateLink(RequestContext ctx, boolean create) {
|
|||||||
postedLink.setCreationUser(username);
|
postedLink.setCreationUser(username);
|
||||||
postedLink.setLastUpdateUser(username);
|
postedLink.setLastUpdateUser(username);
|
||||||
repository.createLink(postedLink);
|
repository.createLink(postedLink);
|
||||||
linkValidationBean.setName(postedLink.getName());
|
linkValidationBean.setId(postedLink.getPersistenceId());
|
||||||
} else {
|
} else {
|
||||||
AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
|
AuditLoggerManager.getInstance().logAuditEvent(ctx.getUserName(),
|
||||||
ctx.getRequest().getRemoteAddr(), "update", "link",
|
ctx.getRequest().getRemoteAddr(), "update", "link",
|
||||||
|
Loading…
Reference in New Issue
Block a user