Package org.locationtech.udig.issues

Examples of org.locationtech.udig.issues.FeatureIssue


    @Test
    public void testCloseView() throws Exception {
        IIssuesList old = IIssuesManager.defaultInstance.getIssuesList();
        try{
        IIssuesManager.defaultInstance.setIssuesList(IssuesListTestHelper.createInMemoryDatastoreIssuesList(null, null));
        FeatureIssue createFeatureIssue = IssuesListTestHelper.createFeatureIssue("issue"); //$NON-NLS-1$
        IssuesManager.defaultInstance.getIssuesList().add(createFeatureIssue);
        createFeatureIssue.setPriority(Priority.TRIVIAL);
        final AtomicBoolean saved=new AtomicBoolean(false);
        IssuesManager.defaultInstance.getIssuesList().addListener(new IIssuesListListener(){

            public void notifyChange( IssuesListEvent event ) {
                if(event.getType()==IssuesListEventType.SAVE)
View Full Code Here


        assertEquals( 4, store.getFeatureSource(featureType.getName().getLocalPart()).getCount(Query.ALL));
    }
   
    @Test
    public void testAddIIssue() throws Exception {
        FeatureIssue issue = IssuesListTestHelper.createFeatureIssue("new"); //$NON-NLS-1$
        list.add(issue);
        assertEquals(5, list.size());
        assertEquals("new", list.get(4).getId()); //$NON-NLS-1$
        list.refresh();
        assertEquals(5, list.size());
View Full Code Here

    @Test
    public void testDirtyEvents() throws Exception {
            IssuesManager m = new IssuesManager();
            m.setIssuesList(IssuesListTestHelper.createInMemoryDatastoreIssuesList(null, null));

            FeatureIssue createFeatureIssue = IssuesListTestHelper.createFeatureIssue("newFeature"); //$NON-NLS-1$
            m.getIssuesList().add(createFeatureIssue);

            final IssuesManagerEvent[] managerEvent = new IssuesManagerEvent[1];

            m.addListener(new IIssuesManagerListener(){

                public void notifyChange( IssuesManagerEvent event ) {
                    managerEvent[0] = event;
                }

            });

            createFeatureIssue.setPriority(Priority.CRITICAL);

            assertEquals(IssuesManagerEventType.DIRTY_ISSUE, managerEvent[0].getType());
            assertEquals(Boolean.TRUE, managerEvent[0].getNewValue());
            managerEvent[0] = null;
View Full Code Here

        DataStore[] store = new DataStore[1];
        SimpleFeatureType[] featureType = new SimpleFeatureType[1];
        issuesList = IssuesListTestHelper.createInMemoryDatastoreIssuesList(store, featureType);
        m.setIssuesList(issuesList);

        FeatureIssue createIssue = IssuesListTestHelper.createFeatureIssue("2"); //$NON-NLS-1$
        issuesList.add(createIssue);
        issuesList.add(IssuesListTestHelper.createFeatureIssue("3")); //$NON-NLS-1$
        assertFalse(m.save(new NullProgressMonitor()));

        createIssue.setPriority(Priority.TRIVIAL);

        class Listener implements IIssuesListListener {

            private Collection< ? extends IIssue> saved;

            public void notifyChange( IssuesListEvent event ) {

                if (event.getType() == IssuesListEventType.SAVE)
                    saved = event.getChanged();
            }

        };

        Listener listener = new Listener();
        issuesList.addListener(listener);

        assertTrue(m.save(new NullProgressMonitor()));
        assertEquals(1, listener.saved.size());
        assertEquals(createIssue.getId(), listener.saved.iterator().next().getId());
    }
View Full Code Here

  public void testFixIssue() throws Exception {
    final Layer layer= map.getLayersInternal().get(0);
    layer.setCRS(DefaultGeographicCRS.WGS84);
    CoordinateReferenceSystem crs = CRS.decode("EPSG:3005");//$NON-NLS-1$
    map.getViewportModelInternal().setCRS(crs);
    FeatureIssue issue=new FeatureIssue(Priority.LOW, "Description",layer, features[0], "test" ); //$NON-NLS-1$ //$NON-NLS-2$
   
    if( issue.getViewPartId()!=null  ){
      IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
      IViewPart view = activePage.findView(issue.getViewPartId());
      activePage.hideView(view);
    }
   
    assertFalse(ApplicationGIS.getActiveMap()==map);
   
View Full Code Here

        assertTrue("Map must contain feature", map.getViewportModel().getBounds().contains((Envelope)env.transform(layer.getCRS(), true,5))); //$NON-NLS-1$
  }
   
    @Test
    public void testSetDescriptionEvents() throws Exception {
        FeatureIssue issue=IssuesListTestHelper.createFeatureIssue("Issue"); //$NON-NLS-1$
       
        Listener l=new Listener();
        issue.addIssueListener(l);
        Object oldValue=issue.getDescription();
        String newDescription="new Description";//$NON-NLS-1$
        issue.setDescription(newDescription);
        assertEquals(issue, l.source);
        assertEquals(newDescription, l.newValue);
        assertEquals(oldValue, l.oldValue);
        assertEquals(IssueChangeType.DESCRIPTION, l.change);
    }
View Full Code Here

        assertEquals(IssueChangeType.DESCRIPTION, l.change);
    }
   
    @Test
    public void testSetPriorityEvents() throws Exception {
        FeatureIssue issue=IssuesListTestHelper.createFeatureIssue("Issue"); //$NON-NLS-1$
       
        Listener l=new Listener();
        issue.addIssueListener(l);
        Object oldValue=issue.getPriority();
        Priority newPriority=Priority.TRIVIAL;
        issue.setPriority(newPriority);
        assertEquals(issue, l.source);
        assertEquals(newPriority, l.newValue);
        assertEquals(oldValue, l.oldValue);
        assertEquals(IssueChangeType.PRIORITY, l.change);
    }
View Full Code Here

        assertEquals(IssueChangeType.PRIORITY, l.change);
    }
   
    @Test
    public void testSetResolutionEvents() throws Exception {
        FeatureIssue issue=IssuesListTestHelper.createFeatureIssue("Issue"); //$NON-NLS-1$
       
        Listener l=new Listener();
        issue.addIssueListener(l);
        Object oldValue=issue.getResolution();
        Resolution newValue=Resolution.UNKNOWN;
        issue.setResolution(newValue);
        assertEquals(issue, l.source);
        assertEquals(newValue, l.newValue);
        assertEquals(oldValue, l.oldValue);
        assertEquals(IssueChangeType.RESOLUTION, l.change);
    }
View Full Code Here

        IMap map=MapTests.createDefaultMap("name", 1, true, new Dimension(10,10)); //$NON-NLS-1$
        ILayer layer=map.getMapLayers().get(0);
        FeatureCollection<SimpleFeatureType, SimpleFeature> collection = layer.getResource(FeatureSource.class, null).getFeatures();
        SimpleFeature feature=collection.features().next();
       
        IIssue original=new FeatureIssue(Priority.WARNING, "test description", layer, feature, "groupID"); //$NON-NLS-1$ //$NON-NLS-2$
        XMLMemento memento=XMLMemento.createWriteRoot("memento"); //$NON-NLS-1$
        XMLMemento viewMemento=XMLMemento.createWriteRoot("viewMemento"); //$NON-NLS-1$
        original.save(memento);
        original.getViewMemento(viewMemento);
        FeatureIssue restored=new FeatureIssue();
        restored.init(memento, viewMemento, original.getId(), original.getGroupId(), original.getBounds());
        restored.setDescription(original.getDescription());
        restored.setPriority(original.getPriority());
        restored.setResolution(original.getResolution());
       
        assertEquals(original.getBounds(), restored.getBounds());
        assertEquals(original.getDescription(), restored.getDescription());
        assertEquals(original.getEditorID(), restored.getEditorID());
        assertEquals(original.getEditorInput(), restored.getEditorInput());
        assertEquals(original.getExtensionID(), restored.getExtensionID());
        assertEquals(original.getGroupId(), restored.getGroupId());
        assertEquals(original.getId(), restored.getId());
        assertEquals(original.getPerspectiveID(), restored.getPerspectiveID());
        assertEquals(original.getPriority(), restored.getPriority());
        assertEquals(original.getProblemObject(), restored.getProblemObject());
        for( int i = 0; i < original.getPropertyNames().length; i++ ) {
            assertEquals(original.getPropertyNames()[i], restored.getPropertyNames()[i]);
        }
        assertEquals(original.getResolution(), restored.getResolution());
        assertEquals(original.getViewPartId(), restored.getViewPartId());
    }
View Full Code Here

    public static FeatureIssue createFeatureIssue(String id) throws Exception {
        IMap map=MapTests.createDefaultMap("testMap", 1, true, new java.awt.Dimension(10,10)); //$NON-NLS-1$
        ILayer layer=map.getMapLayers().get(0);
        FeatureCollection<SimpleFeatureType, SimpleFeature> collection = layer.getResource(FeatureSource.class, null).getFeatures();
        SimpleFeature feature=collection.features().next();
        FeatureIssue issue=new FeatureIssue(Priority.WARNING, "test description", layer, feature, "groupID"); //$NON-NLS-1$ //$NON-NLS-2$
        issue.setId(id);
        return issue;
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.issues.FeatureIssue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.