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

Pre-validates paths for invalid namespaces #473

Closed
wants to merge 17 commits into from

Conversation

whikloj
Copy link
Collaborator

@whikloj whikloj commented Sep 15, 2014

  • Adds FedoraInvalidNamespaceException type
  • New FedoraInvalidNamespaceExceptionMapper
  • Modifies Service to add new validatePath method
  • Call validatePath from AbstractService.nodeExists function
  • Fixes Unit Test that require a mock NamespaceRegistry

This resolves https://www.pivotaltracker.com/story/show/61500426

Jared Whiklo and others added 2 commits September 15, 2014 15:11
- Adds FedoraInvalidNamespaceException type
- New FedoraInvalidNamespaceExceptionMapper
- Modifies Service to add new validatePath method
- Call validatePath from AbstractService.nodeExists function
- Fixes Unit Test that require a mock NamespaceRegistry

This resolves https://www.pivotaltracker.com/story/show/61500426
* @see org.fcrepo.kernel.services.Service#validatePath(javax.jcr.Session, java.lang.String)
*/
@Override
public void validatePath(final Session session, final String path) throws RepositoryException {
Copy link

Choose a reason for hiding this comment

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

Please add a unit test for this new method.

Copy link

Choose a reason for hiding this comment

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

This method does not appear to "Override" any methods from its parent class or interfaces.
Also, it can probably be "private".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

About the unit test. As this function normally returns nothing and throws an exception on error. I've seen that some people suggest catch-exception with mockito? Is there a best practice?

Copy link

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Use @test(expected=MyException.class).

See here.

Copy link

Choose a reason for hiding this comment

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

@awoods
Copy link

awoods commented Sep 16, 2014

Please rebase this commit on master... as master has changed.

Andrew Woods and others added 7 commits September 16, 2014 09:08
- Adds FedoraInvalidNamespaceException type
- New FedoraInvalidNamespaceExceptionMapper
- Modifies Service to add new validatePath method
- Call validatePath from AbstractService.nodeExists function
- Fixes Unit Test that require a mock NamespaceRegistry

This resolves https://www.pivotaltracker.com/story/show/61500426
- Remove integration tests where function replaced with comments
- Added new integration test for exists() function.
@whikloj
Copy link
Collaborator Author

whikloj commented Sep 16, 2014

I promise not to add any more commits to this behemoth.

* @throws RepositoryException
*/
public boolean exists(final Session session, final String path) throws RepositoryException;
public void validatePath(final Session session, final String path);
Copy link

Choose a reason for hiding this comment

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

This method should likely not be a part of the Service.java interface.

@awoods
Copy link

awoods commented Sep 17, 2014

Please rebase on master once again.

Jared Whiklo added 8 commits September 17, 2014 16:54
- Adds FedoraInvalidNamespaceException type
- New FedoraInvalidNamespaceExceptionMapper
- Modifies Service to add new validatePath method
- Call validatePath from AbstractService.nodeExists function
- Fixes Unit Test that require a mock NamespaceRegistry

This resolves https://www.pivotaltracker.com/story/show/61500426
- Adds FedoraInvalidNamespaceException type
- New FedoraInvalidNamespaceExceptionMapper
- Modifies Service to add new validatePath method
- Call validatePath from AbstractService.nodeExists function
- Fixes Unit Test that require a mock NamespaceRegistry

This resolves https://www.pivotaltracker.com/story/show/61500426
- Remove integration tests where function replaced with comments
- Added new integration test for exists() function.
…nto topic-61500426

Conflicts:
	fcrepo-kernel-impl/src/main/java/org/fcrepo/kernel/impl/services/AbstractService.java
@whikloj
Copy link
Collaborator Author

whikloj commented Sep 18, 2014

This has become a rebasing disaster.

See #480 for hopefully a better PR.

@whikloj whikloj closed this Sep 18, 2014
@whikloj whikloj deleted the topic-61500426 branch October 22, 2016 02:23
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

4 participants