}
public void testUpdateConnection() throws Exception {
loadConnections();
MConnection connection = handler.findConnection(1, getDerbyConnection());
List<MForm> forms;
forms = connection.getConnectorPart().getForms();
((MStringInput)forms.get(0).getInputs().get(0)).setValue("Updated");
((MMapInput)forms.get(0).getInputs().get(1)).setValue(null);
((MStringInput)forms.get(1).getInputs().get(0)).setValue("Updated");
((MMapInput)forms.get(1).getInputs().get(1)).setValue(null);
forms = connection.getFrameworkPart().getForms();
((MStringInput)forms.get(0).getInputs().get(0)).setValue("Updated");
((MMapInput)forms.get(0).getInputs().get(1)).setValue(new HashMap<String, String>()); // inject new map value
((MStringInput)forms.get(1).getInputs().get(0)).setValue("Updated");
((MMapInput)forms.get(1).getInputs().get(1)).setValue(new HashMap<String, String>()); // inject new map value
connection.setName("name");
handler.updateConnection(connection, getDerbyConnection());
assertEquals(1, connection.getPersistenceId());
assertCountForTable("SQOOP.SQ_CONNECTION", 2);
assertCountForTable("SQOOP.SQ_CONNECTION_INPUT", 10);
MConnection retrieved = handler.findConnection(1, getDerbyConnection());
assertEquals("name", connection.getName());
forms = retrieved.getConnectorPart().getForms();
assertEquals("Updated", forms.get(0).getInputs().get(0).getValue());
assertNull(forms.get(0).getInputs().get(1).getValue());
assertEquals("Updated", forms.get(1).getInputs().get(0).getValue());
assertNull(forms.get(1).getInputs().get(1).getValue());
forms = retrieved.getFrameworkPart().getForms();
assertEquals("Updated", forms.get(0).getInputs().get(0).getValue());
assertNotNull(forms.get(0).getInputs().get(1).getValue());
assertEquals(((Map)forms.get(0).getInputs().get(1).getValue()).size(), 0);
assertEquals("Updated", forms.get(1).getInputs().get(0).getValue());
assertNotNull(forms.get(1).getInputs().get(1).getValue());