Navigation Menu

Skip to content

Commit

Permalink
Also suppressing weak-reference _ref nodes from output
Browse files Browse the repository at this point in the history
  • Loading branch information
escowles committed Apr 30, 2014
1 parent ba01f43 commit 3107811
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -26,6 +26,7 @@
import static javax.jcr.PropertyType.BINARY;
import static org.modeshape.jcr.api.JcrConstants.JCR_DATA;
import static javax.jcr.PropertyType.REFERENCE;
import static javax.jcr.PropertyType.WEAKREFERENCE;
import static org.fcrepo.kernel.utils.NodePropertiesTools.REFERENCE_PROPERTY_SUFFIX;
import static org.slf4j.LoggerFactory.getLogger;

Expand Down Expand Up @@ -246,7 +247,8 @@ public boolean apply(final Property p) {
@Override
public boolean apply(final Property p) {
try {
return p.getType() == REFERENCE && p.getName().endsWith(REFERENCE_PROPERTY_SUFFIX);
return (p.getType() == REFERENCE || p.getType() == WEAKREFERENCE)
&& p.getName().endsWith(REFERENCE_PROPERTY_SUFFIX);
} catch (final RepositoryException e) {
throw propagate(e);
}
Expand Down
Expand Up @@ -186,6 +186,12 @@ public void testIsReferenceProperty() throws RepositoryException {
when(mockProperty.getName()).thenReturn("foo" + REFERENCE_PROPERTY_SUFFIX);
assertTrue(isReferenceProperty.apply(mockProperty));
}
@Test
public void testIsReferencePropertyWeak() throws RepositoryException {
when(mockProperty.getType()).thenReturn(PropertyType.WEAKREFERENCE);
when(mockProperty.getName()).thenReturn("foo" + REFERENCE_PROPERTY_SUFFIX);
assertTrue(isReferenceProperty.apply(mockProperty));
}

@Test
public void testIsInternalProperty() throws RepositoryException {
Expand Down

0 comments on commit 3107811

Please sign in to comment.