package com.agilex.healthcare.schedulingmanager.linkbuilder;

import com.agilex.healthcare.mobilehealthplatform.domain.ResourceDirectory;
import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import java.net.URI;
import java.net.URISyntaxException;

/**
 * Created by
 * User: ralph
 * Date: 11/5/13
 * Time: 5:28 PM
 */
@Ignore
public class LocationServiceResourceDirectoryBuilderTest extends TestCase {

    public static final String      TEST_URI = "http://localhost:8080/MobileHealthcare";
    public static final String      TEST_FACILITY = "777";

    public static final String      RESULT_URL_1 = TEST_URI + "/location-service/site/" + TEST_FACILITY + "/resource-directory";
    public static final String      RESULT_URL_2 = TEST_URI + "/location-service/site/" + TEST_FACILITY + "/wards";
    public static final String      RESULT_URL_3 = TEST_URI + "/location-service/site/" + TEST_FACILITY + "/clinics";
    public static final String      RESULT_URL_4 = TEST_URI + "/location-service/site/" + TEST_FACILITY + "/specialties";
    public static final String      RESULT_URL_5 = TEST_URI + "/location-service/site/" + TEST_FACILITY + "/specialties/system/CDW";
    public static final String      RESULT_URL_6 = TEST_URI + "/location-service/site/" + TEST_FACILITY + "/specialty";

    @Before
    public void setup() {

    }

    @After
    public void teardown() {

    }

    @Test
    public void  testGetResourceDirectory()
            throws URISyntaxException {
        LocationServiceResourceDirectoryBuilder       linkBuilder = new LocationServiceResourceDirectoryBuilder();
        ResourceDirectory                             directory;

        directory = linkBuilder.getResourceDirectory(new URI(TEST_URI), TEST_FACILITY);

        assertEquals("The URL was not built correctly", RESULT_URL_1, directory.getLink().get(0).getHref().toString());
        assertEquals("The URL was not built correctly", RESULT_URL_2, directory.getLink().get(1).getHref().toString());
        assertEquals("The URL was not built correctly", RESULT_URL_3, directory.getLink().get(2).getHref().toString());
        assertEquals("The URL was not built correctly", RESULT_URL_4, directory.getLink().get(3).getHref().toString());
        assertEquals("The URL was not built correctly", RESULT_URL_5, directory.getLink().get(4).getHref().toString());
        assertEquals("The URL was not built correctly", RESULT_URL_6, directory.getLink().get(5).getHref().toString());
    }
}
