5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-15 08:20:47 +08:00

SQOOP-2692: Sqoop2: Use link name in shell

(Colin Ma via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2015-12-15 15:10:55 +01:00
parent d89f64adc8
commit 3f87658372
17 changed files with 86 additions and 91 deletions

View File

@ -45,18 +45,18 @@ public class CloneLinkFunction extends SqoopFunction {
@SuppressWarnings("static-access")
public CloneLinkFunction() {
this.addOption(OptionBuilder
.withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
.withLongOpt(Constants.OPT_LID)
.withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
.withLongOpt(Constants.OPT_NAME)
.hasArg()
.isRequired()
.create(Constants.OPT_LID_CHAR)
.create(Constants.OPT_NAME_CHAR)
);
}
@Override
@SuppressWarnings("unchecked")
public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException {
return cloneLink(line.getOptionValue(Constants.OPT_LID), line.getArgList(), isInteractive);
return cloneLink(line.getOptionValue(Constants.OPT_NAME), line.getArgList(), isInteractive);
}
private Status cloneLink(String linkArg, List<String> args, boolean isInteractive) throws IOException {

View File

@ -47,14 +47,14 @@ public class CreateJobFunction extends SqoopFunction {
@SuppressWarnings("static-access")
public CreateJobFunction() {
this.addOption(OptionBuilder
.withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
.withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
.withLongOpt(Constants.OPT_FROM)
.isRequired()
.hasArg()
.create(Constants.OPT_FROM_CHAR)
);
this.addOption(OptionBuilder
.withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
.withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
.withLongOpt(Constants.OPT_TO)
.isRequired()
.hasArg()

View File

@ -106,7 +106,7 @@ private Status createLink(CommandLine line, List<String> args, boolean isInterac
}
ConfigDisplayer.displayConfigWarning(link);
printlnResource(Constants.RES_CREATE_LINK_SUCCESSFUL, status.name(), link.getPersistenceId());
printlnResource(Constants.RES_CREATE_LINK_SUCCESSFUL, status.name(), link.getName());
return status;
}

View File

@ -34,16 +34,16 @@ public class DeleteLinkFunction extends SqoopFunction {
@SuppressWarnings("static-access")
public DeleteLinkFunction() {
this.addOption(OptionBuilder
.withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
.withLongOpt(Constants.OPT_LID)
.withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
.withLongOpt(Constants.OPT_NAME)
.isRequired()
.hasArg()
.create(Constants.OPT_LID_CHAR));
.create(Constants.OPT_NAME_CHAR));
}
@Override
public Object executeFunction(CommandLine line, boolean isInteractive) {
client.deleteLink(line.getOptionValue(Constants.OPT_LID));
client.deleteLink(line.getOptionValue(Constants.OPT_NAME));
return Status.OK;
}
}

View File

@ -34,16 +34,16 @@ public class DisableLinkFunction extends SqoopFunction {
@SuppressWarnings("static-access")
public DisableLinkFunction() {
this.addOption(OptionBuilder
.withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
.withLongOpt(Constants.OPT_LID)
.withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
.withLongOpt(Constants.OPT_NAME)
.isRequired()
.hasArg()
.create(Constants.OPT_LID_CHAR));
.create(Constants.OPT_NAME_CHAR));
}
@Override
public Object executeFunction(CommandLine line, boolean isInteractive) {
client.enableLink(line.getOptionValue(Constants.OPT_LID), false);
client.enableLink(line.getOptionValue(Constants.OPT_NAME), false);
return Status.OK;
}
}

View File

@ -34,16 +34,16 @@ public class EnableLinkFunction extends SqoopFunction {
@SuppressWarnings("static-access")
public EnableLinkFunction() {
this.addOption(OptionBuilder
.withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
.withLongOpt(Constants.OPT_LID)
.withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
.withLongOpt(Constants.OPT_NAME)
.isRequired()
.hasArg()
.create(Constants.OPT_LID_CHAR));
.create(Constants.OPT_NAME_CHAR));
}
@Override
public Object executeFunction(CommandLine line, boolean isInteractive) {
client.enableLink(line.getOptionValue(Constants.OPT_LID), true);
client.enableLink(line.getOptionValue(Constants.OPT_NAME), true);
return Status.OK;
}
}

View File

@ -136,11 +136,11 @@ private void displayJob(MJob job) {
displayConfig(job.getDriverConfig().getConfigs(),
client.getDriverConfigBundle());
printlnResource(Constants.RES_SHOW_PROMPT_JOB_FROM_LID_INFO,
printlnResource(Constants.RES_SHOW_PROMPT_JOB_FROM_LN_INFO,
job.getFromLinkName());
displayConfig(job.getFromJobConfig().getConfigs(),
client.getConnectorConfigBundle(job.getFromConnectorName()));
printlnResource(Constants.RES_SHOW_PROMPT_JOB_TO_LID_INFO,
printlnResource(Constants.RES_SHOW_PROMPT_JOB_TO_LN_INFO,
job.getToLinkName());
displayConfig(job.getToJobConfig().getConfigs(),
client.getConnectorConfigBundle(job.getToConnectorName()));

View File

@ -49,18 +49,18 @@ public ShowLinkFunction() {
.withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_ALL_LINKS))
.withLongOpt(Constants.OPT_ALL)
.create(Constants.OPT_ALL_CHAR));
this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_LID)
.withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_LINK_LID))
.withLongOpt(Constants.OPT_LID)
.create(Constants.OPT_LID_CHAR));
this.addOption(OptionBuilder.hasArg().withArgName(Constants.OPT_NAME)
.withDescription(resourceString(Constants.RES_SHOW_PROMPT_DISPLAY_LINK_LN))
.withLongOpt(Constants.OPT_NAME)
.create(Constants.OPT_NAME_CHAR));
}
@Override
public Object executeFunction(CommandLine line, boolean isInteractive) {
if (line.hasOption(Constants.OPT_ALL)) {
showLinks();
} else if (line.hasOption(Constants.OPT_LID)) {
showLink(line.getOptionValue(Constants.OPT_LID));
} else if (line.hasOption(Constants.OPT_NAME)) {
showLink(line.getOptionValue(Constants.OPT_NAME));
} else {
showSummary();
}
@ -72,24 +72,21 @@ private void showSummary() {
List<MLink> links = client.getLinks();
List<String> header = new LinkedList<String>();
header.add(resourceString(Constants.RES_TABLE_HEADER_ID));
header.add(resourceString(Constants.RES_TABLE_HEADER_NAME));
header.add(resourceString(Constants.RES_TABLE_HEADER_CONNECTOR_NAME));
header.add(resourceString(Constants.RES_TABLE_HEADER_ENABLED));
List<String> ids = new LinkedList<String>();
List<String> names = new LinkedList<String>();
List<String> connectorNames = new LinkedList<String>();
List<String> availabilities = new LinkedList<String>();
for (MLink link : links) {
ids.add(String.valueOf(link.getPersistenceId()));
names.add(link.getName());
connectorNames.add(link.getConnectorName());
availabilities.add(String.valueOf(link.getEnabled()));
}
TableDisplayer.display(header, ids, names, connectorNames, availabilities);
TableDisplayer.display(header, names, connectorNames, availabilities);
}
private void showLinks() {
@ -114,7 +111,6 @@ private void displayLink(MLink link) {
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
printlnResource(Constants.RES_SHOW_PROMPT_LINK_INFO,
link.getPersistenceId(),
link.getName(),
link.getEnabled(),
link.getCreationUser(),

View File

@ -45,17 +45,17 @@ public class UpdateLinkFunction extends SqoopFunction {
@SuppressWarnings("static-access")
public UpdateLinkFunction() {
this.addOption(OptionBuilder
.withDescription(resourceString(Constants.RES_PROMPT_LINK_ID))
.withLongOpt(Constants.OPT_LID)
.withDescription(resourceString(Constants.RES_PROMPT_LINK_NAME))
.withLongOpt(Constants.OPT_NAME)
.isRequired()
.hasArg()
.create(Constants.OPT_LID_CHAR));
.create(Constants.OPT_NAME_CHAR));
}
@Override
@SuppressWarnings("unchecked")
public Object executeFunction(CommandLine line, boolean isInteractive) throws IOException {
return updateLink(line.getOptionValue(Constants.OPT_LID), line.getArgList(), isInteractive);
return updateLink(line.getOptionValue(Constants.OPT_NAME), line.getArgList(), isInteractive);
}
private Status updateLink(String linkArg, List<String> args, boolean isInteractive) throws IOException {

View File

@ -34,7 +34,6 @@ public class Constants {
// Options
public static final String OPT_LID = "lid";
public static final String OPT_FROM = "from";
public static final String OPT_TO = "to";
public static final String OPT_ALL = "all";
@ -61,7 +60,6 @@ public class Constants {
public static final String OPT_WITH_GRANT = "with-grant";
public static final String OPT_WITH_JOB = "job";
public static final char OPT_LID_CHAR = 'l';
public static final char OPT_FROM_CHAR = 'f';
public static final char OPT_TO_CHAR = 't';
public static final char OPT_ALL_CHAR = 'a';
@ -162,8 +160,8 @@ public class Constants {
public static final String RES_ARGS_VALUE_MISSING =
"args.value_missing";
public static final String RES_PROMPT_LINK_ID =
"prompt.link_id";
public static final String RES_PROMPT_LINK_NAME =
"prompt.link_name";
public static final String RES_PROMPT_JOB_NAME =
"prompt.job_name";
public static final String RES_CONNECTOR_NAME =
@ -257,8 +255,8 @@ public class Constants {
public static final String RES_SHOW_PROMPT_DISPLAY_ALL_LINKS =
"show.prompt_display_all_links";
public static final String RES_SHOW_PROMPT_DISPLAY_LINK_LID =
"show.prompt_display_link_lid";
public static final String RES_SHOW_PROMPT_DISPLAY_LINK_LN =
"show.prompt_display_link_name";
public static final String RES_SHOW_PROMPT_LINKS_TO_SHOW =
"show.prompt_links_to_show";
public static final String RES_SHOW_PROMPT_LINK_INFO =
@ -294,10 +292,10 @@ public class Constants {
"show.prompt_jobs_to_show";
public static final String RES_SHOW_PROMPT_JOB_INFO =
"show.prompt_job_info";
public static final String RES_SHOW_PROMPT_JOB_FROM_LID_INFO =
"show.prompt_job_from_lid_info";
public static final String RES_SHOW_PROMPT_JOB_TO_LID_INFO =
"show.prompt_job_to_lid_info";
public static final String RES_SHOW_PROMPT_JOB_FROM_LN_INFO =
"show.prompt_job_from_ln_info";
public static final String RES_SHOW_PROMPT_JOB_TO_LN_INFO =
"show.prompt_job_to_ln_info";
public static final String RES_SHOW_PROMPT_DISPLAY_ALL_SUBMISSIONS =
"show.prompt_display_all_submissions";

View File

@ -41,7 +41,7 @@ args.name_missing = Required argument --name is missing.
args.value_missing = Required argument --value is missing.
## Generic description of various ids, types etc
prompt.link_id = Link Id
prompt.link_name = Link Name
prompt.connector_name = Connector Name
prompt.job_name = Job Name
prompt.job_type = Job type
@ -57,7 +57,7 @@ job object
# Update command
update.description = Update objects in Sqoop repository
update.link = Updating link with id {0}
update.link = Updating link with name {0}
update.job = Updating job with name {0}
update.link_successful = link was successfully updated with status {0}
update.job_successful = Job was successfully updated with status {0}
@ -74,12 +74,12 @@ clone.cloning_job = Cloning job with name {0}
# Create command
create.description = Create new object in Sqoop repository
create.link_successful = New link was successfully created with \
validation status {0} and persistent id {1}
validation status {0} and name {1}
create.job_successful = New job was successfully created with validation \
status {0} and name {1}
create.role_successful = New role was successfully created with name {0}
create.creating_link = Creating link for connector with name {0}
create.creating_job = Creating job for links with from id {0} and to id {1}
create.creating_job = Creating job for links with from name {0} and to name {1}
# Delete command
delete.description = Delete existing object in Sqoop repository
@ -129,10 +129,10 @@ set.server_ignored = --host, --port or --webapp option is ignored, because --url
# Show command
show.description = Display various objects and configuration options
show.prompt_display_all_links = Display all links
show.prompt_display_link_lid = Display the link with lid
show.prompt_display_link_name = Display the link with name
show.link_usage = Usage: show link
show.prompt_links_to_show = @|bold {0} link(s) to show: |@
show.prompt_link_info = link with id {0} and name {1} (Enabled: {2}, Created by {3} at {4}, Updated by {5} at {6})
show.prompt_link_info = link with name {0} (Enabled: {1}, Created by {2} at {3}, Updated by {4} at {5})
show.prompt_link_cn_info = Using Connector @|bold {0}|@ with name @|bold {1}|@
show.prompt_display_all_connectors = Display all connectors
@ -153,8 +153,8 @@ show.prompt_display_job_name = Display job with given name
show.job_usage = Usage: show job
show.prompt_jobs_to_show = @|bold {0} job(s) to show: |@
show.prompt_job_info = Job with name {0} (Enabled: {1}, Created by {2} at {3}, Updated by {4} at {5})
show.prompt_job_from_lid_info = From link: {0}
show.prompt_job_to_lid_info = To link: {0}
show.prompt_job_from_ln_info = From link: {0}
show.prompt_job_to_ln_info = To link: {0}
show.prompt_display_all_submissions = Display all submissions
show.prompt_display_all_submissions_jn = Display all submissions given job name

View File

@ -93,22 +93,22 @@ public void testCloneLink() {
when(client.saveLink(link)).thenReturn(Status.OK);
// clone link -lid link_test
Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
assertTrue(status != null && status == Status.OK);
// Missing argument for option lid
// Missing argument for option name
try {
cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
fail("Update link should fail as parameters aren't complete!");
} catch (SqoopException e) {
assertEquals(ShellError.SHELL_0003, e.getErrorCode());
assertTrue(e.getMessage().contains("Missing argument for option"));
}
// Missing option lid
// Missing option name
try {
cloneCmd.execute(Arrays.asList(Constants.FN_LINK));
fail("Update link should fail as option lid is missing");
fail("Update link should fail as option name is missing");
} catch (SqoopException e) {
assertEquals(ShellError.SHELL_0003, e.getErrorCode());
assertTrue(e.getMessage().contains("Missing required option"));
@ -125,7 +125,7 @@ public void testCloneLinkInteractive() {
when(client.saveLink(link)).thenReturn(Status.OK);
when(client.getConnector(any(Long.class))).thenReturn(new MConnector("", "", "", null, null, null));
// clone link -lid link_test
// clone link -name link_test
initData("linkname\r" + // link name
"abc\r" + // for input with name "String"
"12345\r" + // for input with name "Integer"
@ -135,7 +135,7 @@ public void testCloneLinkInteractive() {
"0\r" + // for input with name "Enum"
"l1\rl2\rl3\r\r" + // for input with name "List"
"12345678\r"); // for input with name "DateTime"
Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
Status status = (Status) cloneCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
assertTrue(status != null && status == Status.OK);
assertEquals(link.getName(), "linkname");
assertEquals(link.getConnectorLinkConfig("CONFIGFROMNAME").getStringInput("CONFIGFROMNAME.String").getValue(), "abc");

View File

@ -54,14 +54,14 @@ public void setup() {
public void testDeleteLink() {
doNothing().when(client).deleteLink("link_test");
// delete link -l link_test
Status status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-l", "link_test"));
// delete link -name link_test
Status status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
Assert.assertTrue(status != null && status == Status.OK);
// Missing argument for option lid
// Missing argument for option name
try {
status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
Assert.fail("Delete link should fail as link id/name is missing!");
status = (Status) deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
Assert.fail("Delete link should fail as link name is missing!");
} catch (SqoopException e) {
Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode());
Assert.assertTrue(e.getMessage().contains("Missing argument for option"));
@ -73,7 +73,7 @@ public void testDeleteLinkWithNonExistingLink() {
doThrow(new SqoopException(TestShellError.TEST_SHELL_0000, "link doesn't exist")).when(client).deleteLink(any(String.class));
try {
deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
deleteCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
Assert.fail("Delete link should fail as requested link doesn't exist!");
} catch (SqoopException e) {
Assert.assertEquals(TestShellError.TEST_SHELL_0000, e.getErrorCode());

View File

@ -53,14 +53,14 @@ public void setup() {
public void testDisableLink() {
doNothing().when(client).enableLink("link_test", false);
// disable link -l link_test
Status status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-l", "link_test"));
// disable link -name link_test
Status status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
Assert.assertTrue(status != null && status == Status.OK);
// Missing argument for option lid
// Missing argument for option name
try {
status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
Assert.fail("Disable link should fail as link id/name is missing!");
status = (Status) disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
Assert.fail("Disable link should fail as link name is missing!");
} catch (SqoopException e) {
Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode());
Assert.assertTrue(e.getMessage().contains("Missing argument for option"));
@ -72,7 +72,7 @@ public void testDisableLinkWithNonExistingLink() {
doThrow(new SqoopException(TestShellError.TEST_SHELL_0000, "link doesn't exist")).when(client).enableLink(any(String.class), any(Boolean.class));
try {
disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
disableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
Assert.fail("Disable link should fail as requested link doesn't exist!");
} catch (SqoopException e) {
Assert.assertEquals(TestShellError.TEST_SHELL_0000, e.getErrorCode());

View File

@ -53,14 +53,14 @@ public void setup() {
public void testEnableLink() {
doNothing().when(client).enableLink("link_test", true);
// enable link -l link_test
Status status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-l", "link_test"));
// enable link -name link_test
Status status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
Assert.assertTrue(status != null && status == Status.OK);
// Missing argument for option lid
// Missing argument for option name
try {
status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
Assert.fail("Enable link should fail as link id/name is missing!");
status = (Status) enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
Assert.fail("Enable link should fail as link name is missing!");
} catch (SqoopException e) {
Assert.assertEquals(ShellError.SHELL_0003, e.getErrorCode());
Assert.assertTrue(e.getMessage().contains("Missing argument for option"));
@ -72,7 +72,7 @@ public void testEnableLinkWithNonExistingLink() {
doThrow(new SqoopException(TestShellError.TEST_SHELL_0000, "link doesn't exist")).when(client).enableLink(any(String.class), any(Boolean.class));
try {
enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
enableCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
Assert.fail("Enable link should fail as requested link doesn't exist!");
} catch (SqoopException e) {
Assert.assertEquals(TestShellError.TEST_SHELL_0000, e.getErrorCode());

View File

@ -201,15 +201,16 @@ public void testShowDriver() {
@Test
public void testShowLink() {
MLink fakeLink = new MLink("connector_test", new MLinkConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>()));
fakeLink.setName("linkName");
when(client.getLinks()).thenReturn(new ArrayList<MLink>());
when(client.getLink(any(String.class))).thenReturn(new MLink("connector_test", new MLinkConfig(new ArrayList<MConfig>(), new ArrayList<MValidator>())));
when(client.getLink(any(String.class))).thenReturn(fakeLink);
// show link summary
out.reset();
Status status = (Status) showCmd.execute(Arrays.asList(Constants.FN_LINK));
Assert.assertTrue(status != null && status == Status.OK);
String str = new String(out.toByteArray());
Assert.assertTrue(str.contains("Id"));
Assert.assertTrue(str.contains("Name"));
Assert.assertTrue(str.contains("Connector Name"));
Assert.assertTrue(str.contains("Enabled"));
@ -221,12 +222,12 @@ public void testShowLink() {
str = new String(out.toByteArray());
Assert.assertTrue(str.contains("link(s) to show:"));
// show link -lid 1
// show link -name linkName
out.reset();
status = (Status) showCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "1"));
status = (Status) showCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "linkName"));
Assert.assertTrue(status != null && status == Status.OK);
str = new String(out.toByteArray());
Assert.assertTrue(str.contains("link with id"));
Assert.assertTrue(str.contains("link with name"));
}
@Test

View File

@ -110,20 +110,20 @@ public void testUpdateLink() throws InterruptedException {
when(client.getConnectorConfigBundle("connector_test")).thenReturn(new MapResourceBundle(new HashMap()));
when(client.updateLink(any(MLink.class))).thenReturn(Status.OK);
// update link -lid link_test
Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
// update link -name link_test
Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
assertTrue(status != null && status == Status.OK);
// Missing argument for option lid
// Missing argument for option name
try {
updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid"));
updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-name"));
fail("Update link should fail as parameters aren't complete!");
} catch (SqoopException e) {
assertEquals(ShellError.SHELL_0003, e.getErrorCode());
assertTrue(e.getMessage().contains("Missing argument for option"));
}
// Missing option lid
// Missing option name
try {
updateCmd.execute(Arrays.asList(Constants.FN_LINK));
fail("Update link should fail as option lid is missing");
@ -143,7 +143,7 @@ public void testUpdateLinkInteractive() throws Exception {
when(client.updateLink(any(MLink.class))).thenReturn(Status.OK);
when(client.getConnectorConfigBundle(any(String.class))).thenReturn(resourceBundle);
// update link -lid link_test
// update link -name link_test
initData("linkname\r" + // link name
"abc\r" + // for input with name "String"
"12345\r" + // for input with name "Integer"
@ -153,7 +153,7 @@ public void testUpdateLinkInteractive() throws Exception {
"0\r" + // for input with name "Enum"
"l1\rl2\rl3\r\r" + // for input with name "List"
"12345678\r"); // for input with name "DateTime"
Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-lid", "link_test"));
Status status = (Status) updateCmd.execute(Arrays.asList(Constants.FN_LINK, "-name", "link_test"));
assertTrue(status != null && status == Status.OK);
assertEquals(link.getName(), "linkname");
assertEquals(link.getConnectorLinkConfig("CONFIGFROMNAME").getStringInput("CONFIGFROMNAME.String").getValue(), "abc");