use of com.sldeditor.extension.filesystem.FileSystemExtension in project sldeditor by robward-scisys.
the class FileSystemExtensionTest method testCreateMenus.
/**
* Test method for
* {@link com.sldeditor.extension.filesystem.FileSystemExtension#createMenus(javax.swing.JMenu)}.
*/
@Test
public void testCreateMenus() {
FileSystemExtension fsExt = new FileSystemExtension();
DummyExtension dummyExtension = new DummyExtension();
List<FileSystemInterface> overrideExtensionList = new ArrayList<FileSystemInterface>();
overrideExtensionList.add(dummyExtension);
FileSystemExtensionFactory.override(overrideExtensionList);
fsExt.initialise(null, null);
fsExt.createMenus(null);
}
use of com.sldeditor.extension.filesystem.FileSystemExtension in project sldeditor by robward-scisys.
the class FileSystemExtensionTest method testGetExtensionArgPrefix.
/**
* Test method for
* {@link com.sldeditor.extension.filesystem.FileSystemExtension#getExtensionArgPrefix()}.
*/
@Test
public void testGetExtensionArgPrefix() {
FileSystemExtension fsExt = new FileSystemExtension();
DummyExtension dummyExtension = new DummyExtension();
List<FileSystemInterface> overrideExtensionList = new ArrayList<FileSystemInterface>();
overrideExtensionList.add(dummyExtension);
FileSystemExtensionFactory.override(overrideExtensionList);
fsExt.initialise(null, null);
assertEquals("file", fsExt.getExtensionArgPrefix());
}
use of com.sldeditor.extension.filesystem.FileSystemExtension in project sldeditor by robward-scisys.
the class FileSystemExtensionTest method testGetName.
/**
* Test method for {@link com.sldeditor.extension.filesystem.FileSystemExtension#getName()}.
*/
@Test
public void testGetName() {
FileSystemExtension fsExt = new FileSystemExtension();
DummyExtension dummyExtension = new DummyExtension();
List<FileSystemInterface> overrideExtensionList = new ArrayList<FileSystemInterface>();
overrideExtensionList.add(dummyExtension);
FileSystemExtensionFactory.override(overrideExtensionList);
fsExt.initialise(null, null);
assertTrue(fsExt.getName() != null);
}
use of com.sldeditor.extension.filesystem.FileSystemExtension in project sldeditor by robward-scisys.
the class FileSystemExtensionTest method testGetTooltip.
/**
* Test method for {@link com.sldeditor.extension.filesystem.FileSystemExtension#getTooltip()}.
*/
@Test
public void testGetTooltip() {
FileSystemExtension fsExt = new FileSystemExtension();
DummyExtension dummyExtension = new DummyExtension();
List<FileSystemInterface> overrideExtensionList = new ArrayList<FileSystemInterface>();
overrideExtensionList.add(dummyExtension);
FileSystemExtensionFactory.override(overrideExtensionList);
fsExt.initialise(null, null);
assertTrue(fsExt.getTooltip() != null);
}
use of com.sldeditor.extension.filesystem.FileSystemExtension in project sldeditor by robward-scisys.
the class FileSystemExtensionTest method testSetArguments.
/**
* Test method for
* {@link com.sldeditor.extension.filesystem.FileSystemExtension#setArguments(java.util.List)}.
*/
@Test
public void testSetArguments() {
File configPropertiesFile = new File("./FileSystemExtensionTest.properties");
PropertyManagerFactory.getInstance().setPropertyFile(configPropertiesFile);
FileSystemExtension fsExt = new FileSystemExtension();
FileSystemExtensionFactory.override(null);
fsExt.initialise(null, new DummyToolMgr());
// Handle null argument
fsExt.setArguments(null);
List<String> extensionArgList = new ArrayList<String>();
extensionArgList.add("invalid1");
extensionArgList.add("in.val.id2");
extensionArgList.add("in.va.li.d3.");
extensionArgList.add("invalid4=abc");
String actual = fsExt.setArguments(extensionArgList);
assertNull(actual);
// File does not exist
extensionArgList.clear();
String expectedFile = "folder=X:\\asdef";
extensionArgList.add(expectedFile);
actual = fsExt.setArguments(extensionArgList);
assertNull(actual);
// Valid file
extensionArgList.clear();
File f = null;
try {
f = File.createTempFile(getClass().getSimpleName(), ".tmp");
} catch (IOException e) {
e.printStackTrace();
fail();
}
expectedFile = "folder=" + f.getParent();
extensionArgList.add(expectedFile);
actual = fsExt.setArguments(extensionArgList);
assertEquals(expectedFile, actual);
f.delete();
// Invalid GeoServer
extensionArgList.clear();
String expectedGeoServer = "geoserver=unknown";
extensionArgList.add(expectedGeoServer);
actual = fsExt.setArguments(extensionArgList);
assertNull(actual);
// Valid GeoServer
GeoServerConnection geoServerConnection = new GeoServerConnection();
geoServerConnection.setConnectionName("GeoServer connection");
try {
geoServerConnection.setUrl(new URL("http://localhost/geoserver"));
} catch (MalformedURLException e) {
e.printStackTrace();
fail();
}
geoServerConnection.setUserName("username");
geoServerConnection.setPassword("password");
GeoServerConnectionManager.getInstance().addNewConnection(null, geoServerConnection);
GeoServerConnectionManager.getInstance().updateList();
extensionArgList.clear();
expectedGeoServer = "geoserver=" + geoServerConnection.getConnectionName();
extensionArgList.add(expectedGeoServer);
actual = fsExt.setArguments(extensionArgList);
assertEquals(expectedGeoServer, actual);
configPropertiesFile.delete();
}
Aggregations