[507] | 1 | /*
|
---|
| 2 | * To change this template, choose Tools | Templates
|
---|
| 3 | * and open the template in the editor.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | package gov.hhs.fha.nhinc.saml.extraction;
|
---|
| 7 |
|
---|
| 8 | import gov.hhs.fha.nhinc.connectmgr.ConnectionManagerCache;
|
---|
| 9 | import org.junit.After;
|
---|
| 10 | import org.junit.AfterClass;
|
---|
| 11 | import org.junit.Before;
|
---|
| 12 | import org.junit.BeforeClass;
|
---|
| 13 | import org.junit.Test;
|
---|
| 14 | import static org.junit.Assert.*;
|
---|
| 15 | import org.apache.commons.logging.Log;
|
---|
| 16 | import org.apache.commons.logging.LogFactory;
|
---|
| 17 |
|
---|
| 18 | /**
|
---|
| 19 | *
|
---|
| 20 | * @author jhoppesc
|
---|
| 21 | */
|
---|
| 22 | public class SamlTokenExtractorHelperTest {
|
---|
| 23 | private static Log log = LogFactory.getLog(SamlTokenExtractorHelperTest.class);
|
---|
| 24 |
|
---|
| 25 | public SamlTokenExtractorHelperTest() {
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | @BeforeClass
|
---|
| 29 | public static void setUpClass() throws Exception {
|
---|
| 30 | ConnectionManagerCache.overrideFileLocations("uddiConnectionInfo.xml", "internalConnectionInfo.xml");
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | @AfterClass
|
---|
| 34 | public static void tearDownClass() throws Exception {
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | @Before
|
---|
| 38 | public void setUp() {
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | @After
|
---|
| 42 | public void tearDown() {
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | /**
|
---|
| 46 | * Test of GetEndpointURL method, of class SamlTokenExtractorHelper.
|
---|
| 47 | */
|
---|
| 48 | @Test
|
---|
| 49 | public void testGetSDEndpointURL() {
|
---|
| 50 | log.debug("testGetSDEndpointURL");
|
---|
| 51 |
|
---|
| 52 | String homeCommunityId = "2.16.840.1.113883.3.200";
|
---|
| 53 | String service = SamlTokenExtractorHelper.INTERNAL_SUBJECT_DISCOVERY;
|
---|
| 54 | String expResult = "http://localhost:9080/NhinConnect/NhincSubjectDiscovery";
|
---|
| 55 | String result = SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, service);
|
---|
| 56 | assertEquals(expResult, result);
|
---|
| 57 |
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | /**
|
---|
| 61 | * Test of GetEndpointURL method, of class SamlTokenExtractorHelper.
|
---|
| 62 | */
|
---|
| 63 | @Test
|
---|
| 64 | public void testGetDQEndpointURL() {
|
---|
| 65 | log.debug("testGetDQEndpointURL");
|
---|
| 66 |
|
---|
| 67 | String homeCommunityId = "2.16.840.1.113883.3.200";
|
---|
| 68 | String service = SamlTokenExtractorHelper.INTERNAL_DOC_QUERY;
|
---|
| 69 | String expResult = "http://localhost:9080/NhinConnect/NhincDocumentQuery";
|
---|
| 70 | String result = SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, service);
|
---|
| 71 | assertEquals(expResult, result);
|
---|
| 72 |
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | /**
|
---|
| 76 | * Test of GetEndpointURL method, of class SamlTokenExtractorHelper.
|
---|
| 77 | */
|
---|
| 78 | @Test
|
---|
| 79 | public void testGetDREndpointURL() {
|
---|
| 80 | log.debug("testGetDREndpointURL");
|
---|
| 81 |
|
---|
| 82 | String homeCommunityId = "2.16.840.1.113883.3.200";
|
---|
| 83 | String service = SamlTokenExtractorHelper.INTERNAL_DOC_RETRIEVE;
|
---|
| 84 | String expResult = "http://localhost:9080/NhinConnect/NhincDocumentRetrieve";
|
---|
| 85 | String result = SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, service);
|
---|
| 86 | assertEquals(expResult, result);
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | /**
|
---|
| 90 | * Test of GetEndpointURL method, of class SamlTokenExtractorHelper.
|
---|
| 91 | */
|
---|
| 92 | @Test
|
---|
| 93 | public void testGetAQEndpointURL() {
|
---|
| 94 | log.debug("testGetAQEndpointURL");
|
---|
| 95 |
|
---|
| 96 | String homeCommunityId = "2.16.840.1.113883.3.200";
|
---|
| 97 | String service = SamlTokenExtractorHelper.INTERNAL_AUDIT_QUERY;
|
---|
| 98 | String expResult = "http://localhost:9080/NhinConnect/NhincAuditQuery";
|
---|
| 99 | String result = SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, service);
|
---|
| 100 | assertEquals(expResult, result);
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | /**
|
---|
| 104 | * Test of GetEndpointURL method, of class SamlTokenExtractorHelper.
|
---|
| 105 | */
|
---|
| 106 | @Test
|
---|
| 107 | public void testGetHIEMSubscriptionEndpointURL() {
|
---|
| 108 | log.debug("testGetHIEMSubscriptionEndpointURL");
|
---|
| 109 |
|
---|
| 110 | String homeCommunityId = "2.16.840.1.113883.3.200";
|
---|
| 111 | String service = SamlTokenExtractorHelper.INTERNAL_HIEM_SUBSCRIBE;
|
---|
| 112 | String expResult = "http://localhost:9080/NhinConnect/NhincSubscription";
|
---|
| 113 | String result = SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, service);
|
---|
| 114 | assertEquals(expResult, result);
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | /**
|
---|
| 118 | * Test of GetEndpointURL method, of class SamlTokenExtractorHelper.
|
---|
| 119 | */
|
---|
| 120 | @Test
|
---|
| 121 | public void testGetHIEMUnsubscribeEndpointURL() {
|
---|
| 122 | log.debug("testGetHIEMUnsubscribeEndpointURL");
|
---|
| 123 |
|
---|
| 124 | String homeCommunityId = "2.16.840.1.113883.3.200";
|
---|
| 125 | String service = SamlTokenExtractorHelper.INTERNAL_HIEM_UNSUBSCRIBE;
|
---|
| 126 | String expResult = "http://localhost:9080/NhinConnect/NhincUnsubscription";
|
---|
| 127 | String result = SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, service);
|
---|
| 128 | assertEquals(expResult, result);
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | /**
|
---|
| 132 | * Test of GetEndpointURL method, of class SamlTokenExtractorHelper.
|
---|
| 133 | */
|
---|
| 134 | @Test
|
---|
| 135 | public void testGetHIEMNotifyEndpointURL() {
|
---|
| 136 | log.debug("testGetHIEMNotifyEndpointURL");
|
---|
| 137 |
|
---|
| 138 | String homeCommunityId = "2.16.840.1.113883.3.200";
|
---|
| 139 | String service = SamlTokenExtractorHelper.INTERNAL_HIEM_NOTIFY;
|
---|
| 140 | String expResult = "http://localhost:9080/NhinConnect/NhincNotify";
|
---|
| 141 | String result = SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, service);
|
---|
| 142 | assertEquals(expResult, result);
|
---|
| 143 | }
|
---|
| 144 |
|
---|
| 145 | /**
|
---|
| 146 | * Test of GetEndpointURL method, of class SamlTokenExtractorHelper.
|
---|
| 147 | */
|
---|
| 148 | @Test
|
---|
| 149 | public void testGetEndpointURLInvalidService() {
|
---|
| 150 | log.debug("testGetEndpointURLInvalidService");
|
---|
| 151 |
|
---|
| 152 | String homeCommunityId = "2.16.840.1.113883.3.200";
|
---|
| 153 | String service = "Invalid";
|
---|
| 154 | String result = SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, service);
|
---|
| 155 | assertNull(result);
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 | /**
|
---|
| 159 | * Test of GetEndpointURL method, of class SamlTokenExtractorHelper.
|
---|
| 160 | */
|
---|
| 161 | @Test
|
---|
| 162 | public void testGetEndpointURLInvalidHcid() {
|
---|
| 163 | log.debug("testGetEndpointURLInvalidHcid");
|
---|
| 164 |
|
---|
| 165 | String homeCommunityId = "2.16.840.1.113883.3.198";
|
---|
| 166 | String service = SamlTokenExtractorHelper.INTERNAL_HIEM_NOTIFY;
|
---|
| 167 | String result = SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, service);
|
---|
| 168 | assertNull(result);
|
---|
| 169 | }
|
---|
| 170 | }
|
---|