Search in sources :

Example 1 with CFBuildpack

use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack in project sts4 by spring-projects.

the class ManifestYamlActualCfClientTest method testGetBuildpacks.

@Ignore
@Test
public void testGetBuildpacks() throws Exception {
    List<CFTarget> targets = cfTargetCache.getOrCreate();
    assertTrue(targets.size() == 1);
    CFTarget target = targets.get(0);
    List<CFBuildpack> buildpacks = target.getBuildpacks();
    assertTrue(!buildpacks.isEmpty());
}
Also used : CFTarget(org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget) CFBuildpack(org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with CFBuildpack

use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack in project sts4 by spring-projects.

the class ManifestYamlEditorTest method buildbackContentAssistNoTargets.

@Test
public void buildbackContentAssistNoTargets() throws Exception {
    ClientRequests cfClient = cloudfoundry.client;
    CFBuildpack buildPack = Mockito.mock(CFBuildpack.class);
    when(buildPack.getName()).thenReturn("java_buildpack");
    when(cfClient.getBuildpacks()).thenReturn(ImmutableList.of(buildPack));
    String title = "No targets";
    String description = "Use CLI to login";
    when(cloudfoundry.defaultParamsProvider.getParams()).thenThrow(new NoTargetsException(title + ": " + description));
    CompletionItem completion = assertCompletions("buildpack: <*>", "buildpack: <*>").get(0);
    assertEquals(title, completion.getLabel());
    assertEquals(description, completion.getDocumentation());
}
Also used : NoTargetsException(org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.NoTargetsException) CompletionItem(org.eclipse.lsp4j.CompletionItem) CFBuildpack(org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack) ClientRequests(org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests) Test(org.junit.Test)

Example 3 with CFBuildpack

use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack in project sts4 by spring-projects.

the class ManifestYamlEditorTest method buildpackContentAssist.

@Test
public void buildpackContentAssist() throws Exception {
    ClientRequests cfClient = cloudfoundry.client;
    CFBuildpack buildPack = Mockito.mock(CFBuildpack.class);
    when(buildPack.getName()).thenReturn("java_buildpack");
    when(cfClient.getBuildpacks()).thenReturn(ImmutableList.of(buildPack));
    CompletionItem completion = assertCompletions("buildpack: <*>", "buildpack: java_buildpack<*>").get(0);
    assertEquals("java_buildpack", completion.getLabel());
    assertEquals("an-org : a-space [test.io]", completion.getDocumentation());
}
Also used : CompletionItem(org.eclipse.lsp4j.CompletionItem) CFBuildpack(org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack) ClientRequests(org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 CFBuildpack (org.springframework.ide.vscode.commons.cloudfoundry.client.CFBuildpack)3 CompletionItem (org.eclipse.lsp4j.CompletionItem)2 ClientRequests (org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests)2 Ignore (org.junit.Ignore)1 CFTarget (org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget)1 NoTargetsException (org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.NoTargetsException)1