io.fabric8.openshift.api.model.BuildBuilder Java Examples

The following examples show how to use io.fabric8.openshift.api.model.BuildBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BuildConfigTest.java    From kubernetes-client with Apache License 2.0 6 votes vote down vote up
public void testBinaryBuildWithTimeout() {
 server.expect().post().delay(200).withPath("/apis/build.openshift.io/v1/namespaces/ns1/buildconfigs/bc2/instantiatebinary?commit=")
    .andReturn(201, new BuildBuilder()
    .withNewMetadata().withName("bc2").endMetadata().build()).once();

  OpenShiftClient client = server.getOpenshiftClient();
  InputStream dummy = new ByteArrayInputStream("".getBytes() );

  try {
    client.buildConfigs().inNamespace("ns1").withName("bc2").instantiateBinary()
      .withTimeout(100, TimeUnit.MILLISECONDS)
      .fromInputStream(dummy);
  } catch (KubernetesClientException e) {
    assertEquals(SocketTimeoutException.class, e.getCause().getClass());
    return;
  }
  fail("Expected exception");
}
 
Example #2
Source File: MetadataVisitor.java    From jkube with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected ObjectMeta getOrCreateMetadata(BuildBuilder item) {
    return addEmptyLabelsAndAnnotations(item::hasMetadata, item::withNewMetadata, item::editMetadata, item::buildMetadata)
            .endMetadata().buildMetadata();
}