Search in sources :

Example 1 with VectorTool

use of com.sldeditor.tool.vector.VectorTool in project sldeditor by robward-scisys.

the class VectorToolTest method testGetToolName.

/**
 * Test method for {@link com.sldeditor.tool.vector.VectorTool#getToolName()}.
 */
@Test
public void testGetToolName() {
    VectorTool vectorTool = new VectorTool(null);
    assertNotNull(vectorTool.getToolName());
}
Also used : VectorTool(com.sldeditor.tool.vector.VectorTool) Test(org.junit.jupiter.api.Test)

Example 2 with VectorTool

use of com.sldeditor.tool.vector.VectorTool in project sldeditor by robward-scisys.

the class VectorToolTest method testSupports.

/**
 * Test method for {@link com.sldeditor.tool.vector.VectorTool#supports(java.util.List,
 * java.util.List, java.util.List)}.
 */
@Test
public void testSupports() {
    try {
        FileTreeNode vectorTreeNode = new FileTreeNode(new File("/test"), "sld_cookbook_polygon.shp");
        vectorTreeNode.setFileCategory(FileTreeNodeTypeEnum.VECTOR);
        FileTreeNode rasterTreeNode = new FileTreeNode(new File("/test"), "sld_cookbook_polygon.tif");
        rasterTreeNode.setFileCategory(FileTreeNodeTypeEnum.RASTER);
        List<Class<?>> uniqueNodeTypeList = new ArrayList<Class<?>>();
        List<NodeInterface> nodeTypeList = new ArrayList<NodeInterface>();
        List<SLDDataInterface> sldDataList = new ArrayList<SLDDataInterface>();
        // Try vector file
        nodeTypeList.add(vectorTreeNode);
        VectorTool vectorTool = new VectorTool(null);
        assertTrue(vectorTool.supports(uniqueNodeTypeList, nodeTypeList, sldDataList));
        // Try raster file
        nodeTypeList.clear();
        nodeTypeList.add(rasterTreeNode);
        assertFalse(vectorTool.supports(uniqueNodeTypeList, nodeTypeList, sldDataList));
        // Try database feature class
        nodeTypeList.clear();
        DatabaseFeatureClassNode databaseFeatureClassNode = new DatabaseFeatureClassNode(null, null, "db fc");
        nodeTypeList.add(databaseFeatureClassNode);
        assertTrue(vectorTool.supports(uniqueNodeTypeList, nodeTypeList, sldDataList));
        // Try invalid node class
        nodeTypeList.clear();
        nodeTypeList.add(new GeoServerStyleHeadingNode(null, null, "test"));
        assertFalse(vectorTool.supports(uniqueNodeTypeList, nodeTypeList, sldDataList));
        // Try with no nodes
        nodeTypeList.clear();
        assertFalse(vectorTool.supports(uniqueNodeTypeList, nodeTypeList, sldDataList));
        // Try with null
        assertFalse(vectorTool.supports(uniqueNodeTypeList, null, sldDataList));
    } catch (SecurityException e) {
        fail(e.getStackTrace().toString());
    } catch (FileNotFoundException e) {
        fail(e.getStackTrace().toString());
    }
}
Also used : ArrayList(java.util.ArrayList) FileNotFoundException(java.io.FileNotFoundException) FileTreeNode(com.sldeditor.datasource.extension.filesystem.node.file.FileTreeNode) VectorTool(com.sldeditor.tool.vector.VectorTool) DatabaseFeatureClassNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseFeatureClassNode) SLDDataInterface(com.sldeditor.common.SLDDataInterface) GeoServerStyleHeadingNode(com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerStyleHeadingNode) SLDEditorFile(com.sldeditor.datasource.SLDEditorFile) File(java.io.File) NodeInterface(com.sldeditor.common.NodeInterface) Test(org.junit.jupiter.api.Test)

Example 3 with VectorTool

use of com.sldeditor.tool.vector.VectorTool in project sldeditor by robward-scisys.

the class VectorToolTest method testGetPanel.

/**
 * Test method for {@link com.sldeditor.tool.vector.VectorTool#getPanel()}.
 */
@Test
public void testGetPanel() {
    VectorTool vectorTool = new VectorTool(null);
    assertNotNull(vectorTool.getPanel());
}
Also used : VectorTool(com.sldeditor.tool.vector.VectorTool) Test(org.junit.jupiter.api.Test)

Aggregations

VectorTool (com.sldeditor.tool.vector.VectorTool)3 Test (org.junit.jupiter.api.Test)3 NodeInterface (com.sldeditor.common.NodeInterface)1 SLDDataInterface (com.sldeditor.common.SLDDataInterface)1 SLDEditorFile (com.sldeditor.datasource.SLDEditorFile)1 DatabaseFeatureClassNode (com.sldeditor.datasource.extension.filesystem.node.database.DatabaseFeatureClassNode)1 FileTreeNode (com.sldeditor.datasource.extension.filesystem.node.file.FileTreeNode)1 GeoServerStyleHeadingNode (com.sldeditor.datasource.extension.filesystem.node.geoserver.GeoServerStyleHeadingNode)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1