Skip to content

Commit 5a24e09

Browse files
committed
- Reset settings after test
- Fixed citation retrieval through mock service - Fixed confirm messages
1 parent 49925e0 commit 5a24e09

3 files changed

Lines changed: 30 additions & 18 deletions

File tree

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicController.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10457,7 +10457,7 @@ public abstract static class UpdateDatasetStatusAction extends ConfirmAction<Sho
1045710457
protected abstract void updateDatasetStatus(DatasetStatus datasetStatus);
1045810458
protected abstract void postNotification();
1045910459
protected abstract String getConfirmViewTitle();
10460-
protected abstract HtmlString getConfirmViewMessage();
10460+
protected abstract Renderable getConfirmViewMessage();
1046110461

1046210462
@Override
1046310463
public ModelAndView getConfirmView(ShortUrlForm shortUrlForm, BindException errors) throws Exception
@@ -10534,9 +10534,9 @@ protected String getConfirmViewTitle()
1053410534
}
1053510535

1053610536
@Override
10537-
protected HtmlString getConfirmViewMessage()
10537+
protected Renderable getConfirmViewMessage()
1053810538
{
10539-
return HtmlString.of("You are requesting an extension for the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL());
10539+
return DIV("You are requesting an extension for the private data on Panorama Public at ", _exptAnnotations.getShortUrl().renderShortURL());
1054010540
}
1054110541

1054210542
@Override
@@ -10598,9 +10598,9 @@ protected String getConfirmViewTitle()
1059810598
}
1059910599

1060010600
@Override
10601-
protected HtmlString getConfirmViewMessage()
10601+
protected Renderable getConfirmViewMessage()
1060210602
{
10603-
return HtmlString.of("You are requesting deletion of the private data on Panorama Public at " + _exptAnnotations.getShortUrl().renderShortURL());
10603+
return DIV("You are requesting deletion of the private data on Panorama Public at ", _exptAnnotations.getShortUrl().renderShortURL());
1060410604
}
1060510605

1060610606
@Override
@@ -10656,15 +10656,17 @@ protected String getConfirmViewTitle()
1065610656
}
1065710657

1065810658
@Override
10659-
protected HtmlString getConfirmViewMessage()
10659+
protected Renderable getConfirmViewMessage()
1066010660
{
1066110661
String publicationRef = _publicationMatch.getCitation() != null
1066210662
? _publicationMatch.getCitation()
1066310663
: _publicationMatch.getPublicationIdLabel();
10664-
return HtmlString.of("You are dismissing the publication suggestion for your data on Panorama Public at "
10665-
+ _exptAnnotations.getShortUrl().renderShortURL() +
10666-
". We will no longer suggest the following publication for this dataset - " +
10667-
HtmlString.BR + publicationRef);
10664+
return DIV("You are dismissing the publication suggestion for your data on Panorama Public at "
10665+
, _exptAnnotations.getShortUrl().renderShortURL()
10666+
, BR()
10667+
, "We will no longer suggest the following publication for this dataset - "
10668+
, BR(),
10669+
publicationRef);
1066810670
}
1066910671

1067010672
@Override
@@ -10712,7 +10714,6 @@ public ModelAndView getSuccessView(ShortUrlForm shortUrlForm)
1071210714
{
1071310715
setTitle("Publication Suggestion Dismissed");
1071410716
return new HtmlView(DIV("The publication suggestion has been dismissed for the data at " + _exptAnnotations.getShortUrl().renderShortURL(),
10715-
DIV("We will no longer suggest this publication for your dataset."),
1071610717
BR(),
1071710718
DIV(
1071810719
LinkBuilder.labkeyLink("Data Folder", PageFlowUtil.urlProvider(ProjectUrls.class).getBeginURL(_exptAnnotations.getContainer()))

panoramapublic/src/org/labkey/panoramapublic/ncbi/MockNcbiPublicationSearchService.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,16 @@ public void register(String database, String id, String searchKey,
9898
_pubmedMetadata.put(id, metadata);
9999
}
100100

101-
// Store citation keyed by PMID
102-
if (citation != null && pmid != null)
101+
// Store citation keyed by PMID.
102+
// For PMC articles, the PMID is in the pmid parameter.
103+
// For PubMed articles, the id parameter is already the PMID.
104+
if (citation != null)
103105
{
104-
_citations.put(pmid, citation);
106+
String citationKey = isPmc ? pmid : id;
107+
if (citationKey != null)
108+
{
109+
_citations.put(citationKey, citation);
110+
}
105111
}
106112
}
107113

panoramapublic/test/src/org/labkey/test/tests/panoramapublic/PublicationSearchTest.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.labkey.test.tests.panoramapublic;
22

3+
import org.junit.After;
34
import org.junit.Test;
45
import org.junit.experimental.categories.Category;
56
import org.labkey.remoteapi.CommandException;
@@ -238,7 +239,7 @@ private void setupMockNcbiService()
238239
boolean useMockNcbiService = TestProperties.isTestRunningOnTeamCity();
239240
if (useMockNcbiService)
240241
{
241-
installMockNcbiService();
242+
initMockNcbiService();
242243
}
243244
else
244245
{
@@ -247,7 +248,7 @@ private void setupMockNcbiService()
247248
}
248249
}
249250

250-
private void installMockNcbiService()
251+
private void initMockNcbiService()
251252
{
252253
try
253254
{
@@ -367,8 +368,8 @@ private void restoreNcbiService()
367368
}
368369
}
369370

370-
@Override
371-
protected void doCleanup(boolean afterTest) throws TestTimeoutException
371+
@After
372+
public void resetAfterTest()
372373
{
373374
if (_useMockNcbi)
374375
{
@@ -383,7 +384,11 @@ protected void doCleanup(boolean afterTest) throws TestTimeoutException
383384
_originalReminderSettings.get("reminderFrequency"),
384385
Boolean.parseBoolean(_originalReminderSettings.get("enablePublicationSearch")));
385386
}
387+
}
386388

389+
@Override
390+
protected void doCleanup(boolean afterTest) throws TestTimeoutException
391+
{
387392
_userHelper.deleteUsers(false, SUBMITTER_1, SUBMITTER_2, ADMIN_USER);
388393
super.doCleanup(afterTest);
389394
}

0 commit comments

Comments
 (0)