Skip to content

Commit 4ee7cf8

Browse files
author
Greg Meyer
authored
Merge pull request #13 from DirectProjectJavaRI/develop
Releasing 7.0.1
2 parents e94c42a + 97edaa1 commit 4ee7cf8

File tree

3 files changed

+83
-1
lines changed

3 files changed

+83
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.nhind</groupId>
55
<artifactId>config-service-jar</artifactId>
6-
<version>7.0</version>
6+
<version>7.0.1</version>
77
<packaging>jar</packaging>
88
<name>NHIN Direct Java RI config service jar</name>
99
<description>NHIN Direct Java RI config service jar.</description>

src/main/java/org/nhindirect/config/resources/TrustBundleResource.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
6262
import org.springframework.web.bind.annotation.RestController;
6363
import org.springframework.web.util.UriTemplate;
6464

65+
import edu.emory.mathcs.backport.java.util.Arrays;
6566
import reactor.core.publisher.Flux;
6667
import reactor.core.publisher.Mono;
6768

@@ -555,6 +556,19 @@ public ResponseEntity<Mono<Void>> updateBundleAttributes(@PathVariable("bundle")
555556
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).cacheControl(noCache).build();
556557
}
557558

559+
// check to see if the bundle info is the same... if so, then exit
560+
if (entityBundle.getBundleName().equals(bundleData.getBundleName()) &&
561+
entityBundle.getBundleURL().equals(bundleData.getBundleURL()) &&
562+
entityBundle.getRefreshInterval() == bundleData.getRefreshInterval())
563+
{
564+
if (bundleData.getSigningCertificateData() == null && entityBundle.getSigningCertificateData() == null)
565+
return ResponseEntity.status(HttpStatus.NO_CONTENT).cacheControl(noCache).build();
566+
567+
else if (bundleData.getSigningCertificateData() != null && entityBundle.getSigningCertificateData() != null
568+
&& Arrays.equals(bundleData.getSigningCertificateData(), entityBundle.getSigningCertificateData()))
569+
return ResponseEntity.status(HttpStatus.NO_CONTENT).cacheControl(noCache).build();
570+
}
571+
558572
final String oldBundleURL = entityBundle.getBundleURL();
559573

560574
// if there is a signing certificate in the request, make sure it's valid

src/test/java/org/nhindirect/config/resources/TrustBundleResource_updateBundleAttributesTest.java

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,74 @@ protected void doAssertions(TrustBundle bundle) throws Exception
155155
}.perform();
156156
}
157157

158+
@Test
159+
public void testUpdateBundleAttributes_noChange_assertNameChanged() throws Exception
160+
{
161+
new TestPlan()
162+
{
163+
protected Collection<TrustBundle> bundles;
164+
165+
@Override
166+
protected Collection<TrustBundle> getBundlesToAdd()
167+
{
168+
try
169+
{
170+
bundles = new ArrayList<TrustBundle>();
171+
172+
TrustBundle bundle = new TrustBundle();
173+
bundle.setBundleName("testBundle1");
174+
File fl = new File("src/test/resources/bundles/providerTestBundle.p7b");
175+
bundle.setBundleURL(filePrefix + fl.getAbsolutePath());
176+
bundle.setRefreshInterval(24);
177+
bundle.setSigningCertificateData(null);
178+
bundles.add(bundle);
179+
180+
return bundles;
181+
}
182+
catch (Exception e)
183+
{
184+
throw new RuntimeException (e);
185+
}
186+
}
187+
188+
@Override
189+
protected TrustBundle getBundleDataToUpdate() throws Exception
190+
{
191+
final TrustBundle bundleData = new TrustBundle();
192+
bundleData.setBundleName("testBundle1");
193+
File fl = new File("src/test/resources/bundles/providerTestBundle.p7b");
194+
bundleData.setBundleURL(filePrefix + fl.getAbsolutePath());
195+
bundleData.setRefreshInterval(24);
196+
bundleData.setSigningCertificateData(null);
197+
198+
return bundleData;
199+
200+
}
201+
202+
@Override
203+
protected String getBundleToUpdate()
204+
{
205+
return "testBundle1";
206+
}
207+
208+
@Override
209+
protected String getBundleUpdatedName()
210+
{
211+
return "testBundle1";
212+
}
213+
214+
protected void doAssertions(TrustBundle bundle) throws Exception
215+
{
216+
final TrustBundle addedBundle = this.bundles.iterator().next();
217+
218+
assertEquals(getBundleUpdatedName(), bundle.getBundleName());
219+
assertNull(bundle.getSigningCertificateAsX509Certificate());
220+
assertEquals(addedBundle.getBundleURL(), bundle.getBundleURL());
221+
assertEquals(24, bundle.getRefreshInterval());
222+
}
223+
}.perform();
224+
}
225+
158226
@Test
159227
public void testUpdateBundleAttributes_newSigningCert_assertSigningCertChanged() throws Exception
160228
{

0 commit comments

Comments
 (0)