Package org.locationtech.udig.issues

Examples of org.locationtech.udig.issues.IIssuesList


    }
   
    @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);
View Full Code Here


      for (IIssue issue : list) {
      issue.setResolution(Resolution.RESOLVED);
    }
      view.setFocus();
      view.forTestingShowResolvedssues(true);
        IIssuesList list=view.forTestingGetResolvedIssues();
      IIssue issue = list.get(0);
    viewer.setSelection(new StructuredSelection(issue));
    view.forTestingGetDeleteAction().runWithEvent(new Event());
    assertEquals("only 1 item should have been deleted", 4,list.size()); //$NON-NLS-1$
    IIssue[] issues=new IIssue[3];
    issues[0]=list.get(0);
    issues[1]=list.get(1);
    issues[2]=list.get(2);
    StructuredSelection selection = new StructuredSelection(issues);
    viewer.setSelection(selection);
    view.forTestingGetDeleteAction().runWithEvent(new Event());
    assertEquals("All items should have been deleted except 1", 1,list.size()); //$NON-NLS-1$
  }
View Full Code Here

      for (IIssue issue : list) {
      issue.setResolution(Resolution.RESOLVED);
    }
      view.setFocus();
      view.forTestingShowResolvedssues(true);
        IIssuesList list=view.forTestingGetResolvedIssues();
      IIssue issue = list.get(0);
    viewer.setSelection(new StructuredSelection(issue));
    Event event = new Event();
    event.display=Display.getCurrent();
    view.forTestingGetDeleteGroupAction().runWithEvent(event);
    assertEquals("all items should have been deleted", 0,list.size()); //$NON-NLS-1$
   
  }
View Full Code Here

      assertTrue(view.forTestingGetFixAction().isEnabled());
    }
   
    @Test
    public void testRefreshSaveButtonEnablement() throws Exception {
        IIssuesList old = IIssuesManager.defaultInstance.getIssuesList();
        try{
            assertFalse(view.forTestingGetRefreshButton().isEnabled());
            assertFalse(view.forTestingGetSaveButton().isEnabled());
   
            IIssuesManager.defaultInstance.setIssuesList(IssuesListTestHelper.createInMemoryDatastoreIssuesList(null, null));
            IIssuesManager.defaultInstance.getIssuesList().addAll(list);
            IIssuesList list=IIssuesManager.defaultInstance.getIssuesList();
           
            assertTrue(view.forTestingGetRefreshButton().isEnabled());
            assertFalse(view.forTestingGetSaveButton().isEnabled());
           
            list.get(0).setDescription("New Description"); //$NON-NLS-1$

            assertTrue(view.forTestingGetRefreshButton().isEnabled());
            assertTrue(view.forTestingGetSaveButton().isEnabled());
           
            IIssuesManager.defaultInstance.save(new NullProgressMonitor());
View Full Code Here

        }
    }
   
    @Test
    public void testRefreshAction() throws Exception {
        IIssuesList old = IIssuesManager.defaultInstance.getIssuesList();
        try{
            IIssuesManager.defaultInstance.setIssuesList(IssuesListTestHelper.createInMemoryDatastoreIssuesList(null, null));
            IRemoteIssuesList list=(IRemoteIssuesList) IIssuesManager.defaultInstance.getIssuesList();
           
            final IssuesListEvent[] change=new IssuesListEvent[1];
View Full Code Here

        }
    }
   
    @Test
    public void testSaveAction() throws Exception {
        IIssuesList old = IIssuesManager.defaultInstance.getIssuesList();
        try{
            IIssuesManager.defaultInstance.setIssuesList(IssuesListTestHelper.createInMemoryDatastoreIssuesList(null, null));
            IRemoteIssuesList list=(IRemoteIssuesList) IIssuesManager.defaultInstance.getIssuesList();
            list.add(IssuesListTestHelper.createFeatureIssue("id")); //$NON-NLS-1$
           
View Full Code Here

     * Test method for 'org.locationtech.udig.project.ui.internal.IssuesManager.removeIssues(String)'
     */
    @Test
    public void testRemoveIssues() {
        IssuesManager m = new IssuesManager();
        IIssuesList issueslist = m.getIssuesList();
        for( int i = 0; i < 10; i++ ) {
            issueslist.add(new DummyIssue(i, i < 6 ? "toRemove" : "g" + i)); //$NON-NLS-1$ //$NON-NLS-2$
        }
        DummyListener l = new DummyListener();
        m.addIssuesListListener(l);

        assertEquals(10, issueslist.size());
        m.removeIssues("toRemove"); //$NON-NLS-1$
        assertEquals("All the issues with groupId \"toRemove\"" + //$NON-NLS-1$
                " should be gone leaving 4 items", 4, issueslist.size()); //$NON-NLS-1$
        for( IIssue issue : issueslist ) {
            assertFalse("Item has groupId \"toRemove\"", issue.getGroupId().equals("toRemove")); //$NON-NLS-1$ //$NON-NLS-2$
        }
        assertEquals(6, l.changes);
        assertEquals(1, l.timesCalled);
        l.changes = 0;
        l.timesCalled = 0;
        m.removeIssues("hello"); //$NON-NLS-1$
        assertEquals(0, l.changes);
        assertEquals(0, l.timesCalled);
        assertEquals(4, issueslist.size());
    }
View Full Code Here

    }

    @Test
    public void testSetIssuesList() throws Exception {
        IssuesManager m = new IssuesManager();
        IIssuesList issuesList = new IssuesList();
        m.setIssuesList(issuesList);

        final AtomicBoolean addedListener = new AtomicBoolean(false);
        final AtomicBoolean removedListener = new AtomicBoolean(false);
        DummyIssue dummyIssue = new DummyIssue(3){
            @Override
            public void addIssueListener( IIssueListener listener ) {
                addedListener.set(true);
            }

            @Override
            public void removeIssueListener( IIssueListener listener ) {
                removedListener.set(true);
            }
        };
        issuesList.add(dummyIssue);
        assertTrue(addedListener.get());
        assertFalse(removedListener.get());

        addedListener.set(false);
View Full Code Here

    }

    @Test
    public void testSaveIssuesList() throws Exception {
        IssuesManager m = new IssuesManager();
        IIssuesList issuesList = new IssuesList();
        m.setIssuesList(issuesList);
        issuesList.add(IssuesListTestHelper.createFeatureIssue("1")); //$NON-NLS-1$

        // no exception happens, and nothing else.
        assertFalse(m.save(new NullProgressMonitor()));

        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

    }

    @Ignore("fails in tycho")
    @Test
    public void testLoadedIssueThrowsException() throws Exception {
        final IIssuesList list = IIssuesManager.defaultInstance.getIssuesList();
        list.clear();
        list.add(new AbstractIssue(){

            public void fixIssue( IViewPart part, IEditorPart editor ) {
            }

            public String getExtensionID() {
                return null;
            }

            public String getProblemObject() {
                throw new RuntimeException();
            }

            public void init( IMemento memento, IMemento viewMemento, String issueId, String groupId, ReferencedEnvelope bounds ) {
            }

            public void save( IMemento memento ) {
            }
           
        });
       
        UDIGTestUtil.inDisplayThreadWait(5000, new WaitCondition(){

            public boolean isTrue()  {
                return list.isEmpty();
            }
           
        }, true);

        assertTrue(list.isEmpty());
       
    }
View Full Code Here

TOP

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

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.