List of usage examples for org.apache.commons.collections ListUtils isEqualList
public static boolean isEqualList(final Collection list1, final Collection list2)
From source file:org.codice.ddf.catalog.plugin.metacard.backup.common.ResponseSplitterTest.java
@Test public void testSplitDelete() { DeleteResponse mockResponse = mock(DeleteResponse.class); when(mockResponse.getDeletedMetacards()).thenReturn(metacards); ResponseMetacardActionSplitter splitter = new ResponseMetacardActionSplitter(); List<Metacard> splitCards = splitter.split(mockResponse); assertThat(ListUtils.isEqualList(splitCards, metacards), is(true)); }
From source file:org.fracturedatlas.athena.apa.impl.jpa.PropField.java
public boolean equals(Object obj) { if (obj == null) { return false; }/*from w w w. ja v a 2 s. c o m*/ if (getClass() != obj.getClass()) { return false; } final PropField other = (PropField) obj; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { return false; } if (this.strict != other.strict && (this.strict == null || !this.strict.equals(other.strict))) { return false; } if (!ListUtils.isEqualList(this.propValues, other.getPropValues())) { return false; } return IdAdapter.isEqual(this.getId(), other.getId()); }
From source file:org.kuali.kra.common.specialreview.rule.event.SaveSpecialReviewEvent.java
/** * {@inheritDoc}/* w w w . ja v a 2 s . c o m*/ * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SaveSpecialReviewEvent<?> other = (SaveSpecialReviewEvent<?>) obj; if (specialReviews == null) { if (other.specialReviews != null) { return false; } } else if (!ListUtils.isEqualList(specialReviews, other.specialReviews)) { return false; } return true; }
From source file:org.nuxeo.ecm.automation.server.jaxrs.batch.BatchManagerFixture.java
@Test public void testAddFileStream() throws IOException { // Add 2 file streams BatchManager bm = Framework.getService(BatchManager.class); String batchId = bm.initBatch(); InputStream is = new ByteArrayInputStream("Contenu accentu".getBytes("UTF-8")); bm.addStream(batchId, "0", is, "Mon doc 1.txt", "text/plain"); is = new ByteArrayInputStream("Autre contenu accentu".getBytes("UTF-8")); bm.addStream(batchId, "1", is, "Mon doc 2.txt", "text/plain"); // Check batch blobs Blob blob1 = bm.getBlob(batchId, "0"); assertEquals("Mon doc 1.txt", blob1.getFilename()); assertEquals("text/plain", blob1.getMimeType()); assertEquals("Contenu accentu", blob1.getString()); Blob blob2 = bm.getBlob(batchId, "1"); assertEquals("Mon doc 2.txt", blob2.getFilename()); assertEquals("text/plain", blob2.getMimeType()); assertEquals("Autre contenu accentu", blob2.getString()); List<Blob> blobs = bm.getBlobs(batchId); assertEquals(2, blobs.size());//from w ww .j a v a 2 s . com assertEquals(blob1, blobs.get(0)); assertEquals(blob2, blobs.get(1)); // Check transient store // Batch entry Batch batch = ((BatchManagerComponent) bm).getBatch(batchId); assertNotNull(batch); assertEquals(batchId, batch.getKey()); assertEquals(blob1, batch.getBlob("0")); assertEquals(blob2, batch.getBlob("1")); assertTrue(ListUtils.isEqualList(blobs, batch.getBlobs())); // Batch file entries List<BatchFileEntry> batchFileEntries = batch.getFileEntries(); assertEquals(2, batchFileEntries.size()); BatchFileEntry fileEntry1 = batchFileEntries.get(0); assertEquals(batchId + "_0", fileEntry1.getKey()); assertFalse(fileEntry1.isChunked()); assertEquals("Mon doc 1.txt", fileEntry1.getFileName()); assertEquals("text/plain", fileEntry1.getMimeType()); assertEquals(17, fileEntry1.getFileSize()); assertEquals(blob1, fileEntry1.getBlob()); BatchFileEntry fileEntry2 = batchFileEntries.get(1); assertEquals(batchId + "_1", fileEntry2.getKey()); assertFalse(fileEntry2.isChunked()); assertEquals("Mon doc 2.txt", fileEntry2.getFileName()); assertEquals("text/plain", fileEntry2.getMimeType()); assertEquals(23, fileEntry2.getFileSize()); assertEquals(blob2, fileEntry2.getBlob()); // Check TransientStore storage size assertEquals(40, ((AbstractTransientStore) bm.getTransientStore()).getStorageSize()); }
From source file:org.onehippo.forge.content.pojo.model.ContentNode.java
@Override public boolean equals(Object o) { if (!(o instanceof ContentNode)) { return false; }/* w ww . j av a2 s . c o m*/ ContentNode that = (ContentNode) o; if (!StringUtils.equals(getName(), that.getName())) { return false; } if (!StringUtils.equals(primaryType, that.primaryType)) { return false; } if (!SetUtils.isEqualSet(mixinTypes, that.mixinTypes)) { return false; } if (properties == null) { if (that.properties != null) { return false; } } else { if (!ListUtils.isEqualList(properties, that.properties)) { return false; } } if (!ListUtils.isEqualList(nodes, that.nodes)) { return false; } return true; }
From source file:org.onehippo.forge.content.pojo.model.ContentProperty.java
@Override public boolean equals(Object o) { if (!(o instanceof ContentProperty)) { return false; }/*from ww w. j a v a 2s.c om*/ ContentProperty that = (ContentProperty) o; if (!StringUtils.equals(getName(), that.getName())) { return false; } if (!type.equals(that.type)) { return false; } if (multiple != that.multiple) { return false; } return ListUtils.isEqualList(values, that.values); }
From source file:org.projectforge.common.BeanHelper.java
/** * Copies all properties from src object to dest object. * @param src/*w ww .j a v a 2s . c o m*/ * @param dest * @param whitespaceEqualsNull If true than a String modification from null to "" and vice versa will be ignored. * @param properties * @return true if any property is different between src and dest object. */ @SuppressWarnings("unchecked") public static boolean copyProperties(final Object src, final Object dest, final boolean whitespaceEqualsNull, final String... properties) { boolean modified = false; for (final String property : properties) { final Object srcValue = BeanHelper.getProperty(src, property); final Object destValue = BeanHelper.getProperty(dest, property); if (srcValue != null && srcValue instanceof Collection) { final Collection<Object> srcColl = (Collection<Object>) srcValue; final Collection<Object> destColl = (Collection<Object>) destValue; if (ListUtils.isEqualList(srcColl, destColl) == false) { modified = true; BeanHelper.setProperty(dest, property, srcValue); } } else if (srcValue != null && srcValue.getClass().isArray() == true) { final Object[] srcArr = (Object[]) srcValue; final Object[] destArr = (Object[]) destValue; if (Arrays.equals(srcArr, destArr) == false) { modified = true; BeanHelper.setProperty(dest, property, srcValue); } } else { if (ObjectUtils.equals(srcValue, destValue) == false) { if (whitespaceEqualsNull == true && (srcValue instanceof String || destValue instanceof String)) { if (StringUtils.isEmpty((String) srcValue) == false || StringUtils.isEmpty((String) destValue) == false) { // Do not copy this property if srcValue and destValue are empty ("" or null): BeanHelper.setProperty(dest, property, srcValue); modified = true; } } else { BeanHelper.setProperty(dest, property, srcValue); modified = true; } } } } return modified; }
From source file:org.wrml.werminal.action.ListValueDialogConfirmationAction.java
@Override protected boolean doIt() { final List<?> dialogValue = _ListValueDialog.getList(); final List<?> currentValue = _ValueTextBox.getValue(); if (!ListUtils.isEqualList(dialogValue, currentValue)) { _ValueTextBox.setValue(dialogValue, false); }/* www .j av a2 s . co m*/ return true; }