@Test public void testAddMany() throws Exception { List<IIssue> newIssues = new ArrayList<IIssue>(); newIssues.add(IssuesListTestHelper.createFeatureIssue("new1")); // $NON-NLS-1$ newIssues.add(IssuesListTestHelper.createFeatureIssue("new2")); // $NON-NLS-1$ list.addAll(newIssues); list.refresh(); assertEquals(6, list.size()); }
@Test public void testModifyIssue() throws Exception { String newDescription = "new modified description"; // $NON-NLS-1$ list.clear(); list.add(IssuesListTestHelper.createFeatureIssue("test")); // $NON-NLS-1$ list.refresh(); assertEquals(1, list.size()); IIssue issue = list.get(0); issue.setDescription(newDescription); ((IRemoteIssuesList) list).save(issue); FilterFactory factory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()); Expression expr2 = factory.literal(issue.getId()); Expression expr1 = factory.property(IssuesListTestHelper.ISSUE_ID_ATTR); Filter filter = factory.equals(expr1, expr2); SimpleFeature next = store .getFeatureSource(featureType.getName().getLocalPart()) .getFeatures(filter) .features() .next(); assertEquals(newDescription, next.getAttribute(IssuesListTestHelper.DESCRIPTION_ATTR)); }
@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()); assertEquals("new", list.get(4).getId()); // $NON-NLS-1$ assertEquals("groupID", list.get(4).getGroupId()); // $NON-NLS-1$ assertEquals("test description", list.get(4).getDescription()); // $NON-NLS-1$ assertEquals( 5, store.getFeatureSource(featureType.getName().getLocalPart()).getCount(Query.ALL)); }
@Test public void testNullID() throws Exception { list.clear(); list.add(IssuesListTestHelper.createFeatureIssue(null)); assertNotNull(list.get(0).getId()); SimpleFeature next = this.store .getFeatureSource(this.featureType.getName().getLocalPart()) .getFeatures() .features() .next(); Object id = next.getAttribute("id"); // $NON-NLS-1$ assertNotNull(id); }
@Test public void testAddIssueWithBounds() throws Exception { list.add(IssuesListTestHelper.createFeatureIssue("id")); // $NON-NLS-1$ // no exception? good. }