Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fcrepo 1290 #741

Closed
wants to merge 12 commits into from
Closed

Fcrepo 1290 #741

wants to merge 12 commits into from

Conversation

yinlinchen
Copy link
Contributor

No description provided.

public void testFedoraBinaryProperties() throws RepositoryException {
final Model results = new PropertiesRdfContext(mockBinary, idTranslator).asModel();

assertTrue("Response contains both NonRdfSourceDescription and RdfSourceDescription", results
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test looks good. Please split this assertTrue into two assertions, instead of having results.contains(...) && results.contains(...)

node.setProperty("dc:title", "this-is-some-title");

final Graph graph =
container.getChildren().next().getTriples(subjects, PropertiesRdfContext.class).asModel().getGraph();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to rely on next() for this or do you want to retrieve the child by name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is to make sure if the child is a nonRdfSource with a dc:title, the request does include the child's title. I don't need to retrieve the child by name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know. You're assuming that the child will be the first child of the container, and it now is, but it may or may not always be-- you're assuming that we will never change the code to add other children in some other way in between your method calls and that the JCR iteration order won't ever change. I'm not saying your test doesn't work now, I'm saying it's a bit brittle unless you specify which child to retrieve.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not assuming that the child will be the first child. A parent can have multiple children and there maybe just one child with dc:title among them. I was not think of retrieve the child by name because the change I made in PropertiesRdfContext.java was Iterators...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are assuming that. You are only testing one child, the first one to be returned by next(). That's the "first child". If that happens not to be the binary-child you created then the test will fail even though the software may be operating correctly. It would be stronger to retrieve all the children and filter to the one that has the name you gave your binary-child, then check it for the title you think it should have. Let's leave it at that.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running this new test in FedoraResourceImplIT against the master branch successfully passes... therefore it does not demonstrate a fix to the issue of:
https://jira.duraspace.org/browse/FCREPO-1290

I suggest removing the updates to this class, and instead adding the integration test provided here:
https://github.com/yinlinchen/fcrepo4/pull/4

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting. It seems to imply that the problem is somewhere in whatever is producing triples from resource-children. I think that's ChildrenRdfContext?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test was assuming there is only one child and that's not stronger enough. I will update this test to retrieve all the children and filter to the one that has the name and check it. Thanks for the comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait-- did you not see @awoods' comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't see it, but see it now.

@awoods
Copy link

awoods commented Mar 13, 2015

Resolved with: b947785
and
bea17d0

@awoods awoods closed this Mar 13, 2015
@yinlinchen yinlinchen deleted the fcrepo-1290 branch March 16, 2015 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants