@Override
    public List<Intent> compile(HostToHostIntent intent, List<Intent> installable) {
        // If source and destination are the same, there are never any installables.
        if (Objects.equals(intent.one(), intent.two())) {
            return ImmutableList.of();
        }

        boolean isAsymmetric = intent.constraints().contains(new AsymmetricPathConstraint());
        Path pathOne = getPathOrException(intent, intent.one(), intent.two());
        Path pathTwo = isAsymmetric ?
                getPathOrException(intent, intent.two(), intent.one()) : invertPath(pathOne);

        Host one = hostService.getHost(intent.one());
        Host two = hostService.getHost(intent.two());

        return Arrays.asList(createLinkCollectionIntent(pathOne, one, two, intent),
                             createLinkCollectionIntent(pathTwo, two, one, intent));
    }
@Test
    public void testSingleLongPathCompilation() {

        HostToHostIntent intent = makeIntent(HOST_ONE,
                                             HOST_TWO);
        assertThat(intent, is(notNullValue()));

        String[] hops = {HOST_ONE, S1, S2, S3, S4, S5, S6, S7, S8, HOST_TWO};
        HostToHostIntentCompiler compiler = makeCompiler(hops);
        assertThat(compiler, is(notNullValue()));

        List<Intent> result = compiler.compile(intent, null);
        assertThat(result, is(Matchers.notNullValue()));
        assertThat(result, hasSize(2));
        Intent forwardIntent = result.get(0);
        assertThat(forwardIntent instanceof LinkCollectionIntent, is(true));
        Intent reverseIntent = result.get(1);
        assertThat(reverseIntent instanceof LinkCollectionIntent, is(true));

        LinkCollectionIntent forwardLCIntent = (LinkCollectionIntent) forwardIntent;
        Set<Link> links = forwardLCIntent.links();
        assertThat(links, hasSize(7));
        Set<FilteredConnectPoint> ingressPoints = ImmutableSet.of(
                new FilteredConnectPoint(new ConnectPoint(DID_S1, PORT_1))
        );
        assertThat(forwardLCIntent.filteredIngressPoints(), is(ingressPoints));
        assertThat(links, linksHasPath(S1, S2));
        assertThat(links, linksHasPath(S2, S3));
        assertThat(links, linksHasPath(S3, S4));
        assertThat(links, linksHasPath(S4, S5));
        assertThat(links, linksHasPath(S5, S6));
        assertThat(links, linksHasPath(S6, S7));
        assertThat(links, linksHasPath(S7, S8));
        Set<FilteredConnectPoint> egressPoints = ImmutableSet.of(
                new FilteredConnectPoint(new ConnectPoint(DID_S8, PORT_2))
        );
        assertThat(forwardLCIntent.filteredEgressPoints(), is(egressPoints));

        LinkCollectionIntent reverseLCIntent = (LinkCollectionIntent) reverseIntent;
        links = reverseLCIntent.links();
        assertThat(reverseLCIntent.links(), hasSize(7));
        ingressPoints = ImmutableSet.of(new FilteredConnectPoint(new ConnectPoint(DID_S8, PORT_2)));
        assertThat(reverseLCIntent.filteredIngressPoints(), is(ingressPoints));
        assertThat(links, linksHasPath(S2, S1));
        assertThat(links, linksHasPath(S3, S2));
        assertThat(links, linksHasPath(S4, S3));
        assertThat(links, linksHasPath(S5, S4));
        assertThat(links, linksHasPath(S6, S5));
        assertThat(links, linksHasPath(S7, S6));
        assertThat(links, linksHasPath(S8, S7));
        egressPoints = ImmutableSet.of(new FilteredConnectPoint(new ConnectPoint(DID_S1, PORT_1)));
        assertThat(reverseLCIntent.filteredEgressPoints(), is(egressPoints));


        assertThat("key is inherited",
                   result.stream().map(Intent::key).collect(Collectors.toList()),
                   everyItem(is(intent.key())));
    }