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

add fake PID provider for devs #5327 #5399

Merged
merged 1 commit into from
Dec 18, 2018
Merged

Conversation

pdurbin
Copy link
Member

@pdurbin pdurbin commented Dec 13, 2018

connects to #5327

connects to #5409

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.003%) to 17.678% when pulling 3d35608 on 5327-fake-pid-provider into 881694b on develop.

Copy link
Contributor

@pameyer pameyer left a comment

Choose a reason for hiding this comment

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

Code itself looks fine by reading. Wasn't able to test (functionality, display of FAKE PIDs) due to gremlins apparently unrelated to this PR.

Open question about if it makes sense to update phoenix configs, docker-aio, vagrant (potentially other docker stuff too) to use this config. Will retry to see if the gremlins go away before worrying about that.

Copy link
Contributor

@poikilotherm poikilotherm left a comment

Choose a reason for hiding this comment

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

I really like the ideas behind this, as it allows for more testing like integration testing with a real instance. IMHO some things should be enhanced before merging.

I had no chance to test this yet.

@@ -154,6 +155,16 @@ protected void registerExternalIdentifier(Dataset theDataset, CommandContext ctx
if (!theDataset.isIdentifierRegistered()) {
GlobalIdServiceBean globalIdServiceBean = GlobalIdServiceBean.getBean(theDataset.getProtocol(), ctxt);
if ( globalIdServiceBean != null ) {
if (globalIdServiceBean instanceof FakePidProviderServiceBean) {
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO doubling the code from below for the sake of the fake provider is a suboptimal approach.

Why does alreadyExists() always return true? If it would return false, the existing code from below could be used instead.


@Override
public boolean alreadyExists(DvObject dvo) throws Exception {
return true;
Copy link
Contributor

@poikilotherm poikilotherm Dec 14, 2018

Choose a reason for hiding this comment

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

See my comment above.

This could be extended, too: when the fake provider would add a number to a simple database field, that could be used for constantly growing index number usable as a "real" faked PID. Other things like UUIDs or similar could be used, which are garantied to be doublication free. A third alternative would be to lookup the highest number in the database, increment and use. That is slow, but for demo / dev purposes this could be alright.


@Override
public boolean registerWhenPublished() {
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should be a setting instead? It might be usefull during demos of the code.

public List<String> getProviderInformation() {
ArrayList<String> providerInfo = new ArrayList<>();
String providerName = "FAKE";
String providerLink = "http://dataverse.org";
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be replaced with the dataverse FQDN/URL? That way we could generate fake, but working PID URLs pointing to the instance, couldn't we?


@Override
public String createIdentifier(DvObject dvo) throws Throwable {
return "fakeIdentifier";
Copy link
Contributor

Choose a reason for hiding this comment

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

See above about providing fake but usable PIDs.


@Override
public Map<String, String> lookupMetadataFromIdentifier(String protocol, String authority, String identifier) {
Map<String, String> map = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't this at least return some stuff from the DvObject if the identifier is fake but usable?

@sekmiller sekmiller self-requested a review December 14, 2018 15:37
Copy link
Contributor

@pameyer pameyer left a comment

Choose a reason for hiding this comment

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

Gremlins vanished, able to proceed with evaluation.

Functionality works; docs look good. But there's no user-visible indication that these are FAKE DOIs (API output, citation block, citation metadata all look like real ones).

@pdurbin
Copy link
Member Author

pdurbin commented Dec 18, 2018

At standup just now I told @landreev and others that I'd leave a comment here to note that @poikilotherm and I have talked about his comments in IRC and he and I are on the same page with this pull request being an incremental improvement. In the future, if this fake PID provider proves useful to developers, we can hack on the code some more and make it better.

@sekmiller pointed out that the fake PID providers doesn't support file DOIs which is a good catch but I don't believe it needs to. The REST Assured test suite passes without it. If we ever need to add support for file DOIs, Steve said we need to write some code in the publicizeIdentifier method.

@matthew-a-dunlap said he'd do some code review (thanks!) and I'd like to point out that I added a "connect to" the new issue I just created about phoenix tests failing: #5409.

Copy link
Contributor

@matthew-a-dunlap matthew-a-dunlap left a comment

Choose a reason for hiding this comment

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

This looks good. The alreadyExists method is a bit limited but practically we don't rely on that check for too much.

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.

6 participants