use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource in project beneficiary-fhir-data by CMSgov.
the class FissClaimStreamCallerIT method basicCall.
@Test
public void basicCall() throws Exception {
RdaServer.InProcessConfig.builder().serverName(getClass().getSimpleName()).fissSourceFactory(sequenceNumber -> WrappedClaimSource.wrapFissClaims(new JsonMessageSource<>(CLAIM_1 + System.lineSeparator() + CLAIM_2, JsonMessageSource::parseFissClaim), clock, sequenceNumber)).build().runWithChannelParam(channel -> {
final FissClaimStreamCaller caller = new FissClaimStreamCaller();
assertEquals(RdaService.RDA_PROTO_VERSION, caller.callVersionService(channel, CallOptions.DEFAULT));
final GrpcResponseStream<FissClaimChange> results = caller.callService(channel, CallOptions.DEFAULT, 0L);
assertTrue(results.hasNext());
PreAdjFissClaim claim = transform(results.next());
assertEquals("63843470", claim.getDcn());
assertEquals(Long.valueOf(0), claim.getSequenceNumber());
assertTrue(results.hasNext());
claim = transform(results.next());
assertEquals("2643602", claim.getDcn());
assertEquals(Long.valueOf(1), claim.getSequenceNumber());
assertFalse(results.hasNext());
});
}
use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource in project beneficiary-fhir-data by CMSgov.
the class RdaLoadJobIT method mcsClaimsTest.
@Test
public void mcsClaimsTest() throws Exception {
RdaPipelineTestUtils.runTestWithTemporaryDb(RdaLoadJobIT.class, clock, (appState, entityManager) -> {
assertTablesAreEmpty(entityManager);
RdaServer.InProcessConfig.builder().serverName(RdaServerJob.Config.DEFAULT_SERVER_NAME).mcsSourceFactory(mcsJsonSource(mcsClaimJson)).build().runWithNoParam(() -> {
final RdaLoadOptions config = createRdaLoadOptions(-1);
final PipelineJob<?> job = config.createMcsClaimsLoadJob(appState);
job.call();
});
final ImmutableList<McsClaimChange> expectedClaims = JsonMessageSource.parseAll(mcsClaimJson, JsonMessageSource::parseMcsClaimChange);
List<PreAdjMcsClaim> claims = getPreAdjMcsClaims(entityManager);
assertEquals(expectedClaims.size(), claims.size());
for (PreAdjMcsClaim resultClaim : claims) {
McsClaim expected = findMatchingMcsClaim(expectedClaims, resultClaim);
assertNotNull(expected);
assertEquals(expected.getIdrHic(), Strings.nullToEmpty(resultClaim.getIdrHic()));
assertEquals(expected.getIdrClaimMbi(), Strings.nullToEmpty(resultClaim.getIdrClaimMbi()));
assertEquals(expected.getMcsDetailsCount(), resultClaim.getDetails().size());
assertEquals(expected.getMcsDiagnosisCodesCount(), resultClaim.getDiagCodes().size());
}
});
}
use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource in project beneficiary-fhir-data by CMSgov.
the class RdaLoadJobIT method mcsClaimsAreValid.
/**
* All of our test claims should be valid for our IT tests to succeed. This test ensures this is
* the case and catches any incompatibility issues when a new RDA API version contains breaking
* changes.
*/
@Test
public void mcsClaimsAreValid() throws Exception {
final ImmutableList<McsClaimChange> expectedClaims = JsonMessageSource.parseAll(mcsClaimJson, JsonMessageSource::parseMcsClaimChange);
final McsClaimTransformer transformer = new McsClaimTransformer(clock, MbiCache.computedCache(new IdHasher.Config(1, "testing")));
for (McsClaimChange claim : expectedClaims) {
try {
transformer.transformClaim(claim);
} catch (DataTransformer.TransformationException ex) {
fail(String.format("bad sample claim: seq=%d error=%s", claim.getSeq(), ex.getErrors()));
}
}
}
use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource in project beneficiary-fhir-data by CMSgov.
the class RdaLoadJobIT method fissClaimsTest.
@Test
public void fissClaimsTest() throws Exception {
RdaPipelineTestUtils.runTestWithTemporaryDb(RdaLoadJobIT.class, clock, (appState, entityManager) -> {
assertTablesAreEmpty(entityManager);
RdaServer.LocalConfig.builder().fissSourceFactory(fissJsonSource(fissClaimJson)).build().runWithPortParam(port -> {
final RdaLoadOptions config = createRdaLoadOptions(port);
final PipelineJob<?> job = config.createFissClaimsLoadJob(appState);
job.call();
});
final ImmutableList<FissClaimChange> expectedClaims = JsonMessageSource.parseAll(fissClaimJson, JsonMessageSource::parseFissClaimChange);
List<PreAdjFissClaim> claims = getPreAdjFissClaims(entityManager);
assertEquals(expectedClaims.size(), claims.size());
for (PreAdjFissClaim resultClaim : claims) {
FissClaim expected = findMatchingFissClaim(expectedClaims, resultClaim);
assertNotNull(expected);
assertEquals(expected.getHicNo(), resultClaim.getHicNo());
assertEquals(expected.getPracLocCity(), Strings.nullToEmpty(resultClaim.getPracLocCity()));
assertEquals(expected.getFissProcCodesCount(), resultClaim.getProcCodes().size());
assertEquals(expected.getFissDiagCodesCount(), resultClaim.getDiagCodes().size());
}
});
}
use of gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource in project beneficiary-fhir-data by CMSgov.
the class RdaLoadJobIT method fissClaimsAreValid.
/**
* All of our test claims should be valid for our IT tests to succeed. This test ensures this is
* the case and catches any incompatibility issues when a new RDA API version contains breaking
* changes.
*/
@Test
public void fissClaimsAreValid() throws Exception {
final ImmutableList<FissClaimChange> expectedClaims = JsonMessageSource.parseAll(fissClaimJson, JsonMessageSource::parseFissClaimChange);
final FissClaimTransformer transformer = new FissClaimTransformer(clock, MbiCache.computedCache(new IdHasher.Config(1, "testing")));
for (FissClaimChange claim : expectedClaims) {
try {
transformer.transformClaim(claim);
} catch (DataTransformer.TransformationException ex) {
fail(String.format("bad sample claim: seq=%d error=%s", claim.getSeq(), ex.getErrors()));
}
}
}
Aggregations