org.testcontainers.containers.Network.getId()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.testcontainers.containers.Network.getId()方法的一些代码示例,展示了Network.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Network.getId()方法的具体详情如下:
包路径:org.testcontainers.containers.Network
类名称:Network
方法名:getId

Network.getId介绍

暂无

代码示例

代码示例来源:origin: testcontainers/testcontainers-java

createCommand.withNetworkMode(network.getId());
  createCommand.withAliases(this.networkAliases);
} else if (networkMode != null) {

代码示例来源:origin: testcontainers/testcontainers-java

@Test
  public void testReusability() throws Exception {
    try (Network network = Network.newNetwork()) {
      String firstId = network.getId();
      assertNotNull(
          "Network exists",
          DockerClientFactory.instance().client().inspectNetworkCmd().withNetworkId(firstId).exec()
      );
      network.close();
      assertNotEquals(
          "New network created",
          firstId,
          DockerClientFactory.instance().client().inspectNetworkCmd().withNetworkId(network.getId()).exec().getId()
      );
    }
  }
}

代码示例来源:origin: testcontainers/testcontainers-java

@Test
public void testBuilder() throws Exception {
  try (
      Network network = Network.builder()
          .driver("macvlan")
          .build();
  ) {
    String id = network.getId();
    assertEquals(
        "Flag is set",
        "macvlan",
        DockerClientFactory.instance().client().inspectNetworkCmd().withNetworkId(id).exec().getDriver()
    );
  }
}

代码示例来源:origin: testcontainers/testcontainers-java

@Test
public void testModifiers() throws Exception {
  try (
      Network network = Network.builder()
          .createNetworkCmdModifier(cmd -> cmd.withDriver("macvlan"))
          .build();
  ) {
    String id = network.getId();
    assertEquals(
        "Flag is set",
        "macvlan",
        DockerClientFactory.instance().client().inspectNetworkCmd().withNetworkId(id).exec().getDriver()
    );
  }
}

代码示例来源:origin: Playtika/testcontainers-spring-boot

@Bean(destroyMethod = "close")
@ConditionalOnMissingBean(Network.class)
public Network kafkaNetwork() {
  Network network = Network.newNetwork();
  log.info("Created docker Network id={}", network.getId());
  return network;
}

代码示例来源:origin: Playtika/testcontainers-spring-boot

@Bean(destroyMethod = "close")
@ConditionalOnMissingBean(Network.class)
public Network couchbaseNetwork() {
  Network network = Network.newNetwork();
  log.info("Created docker Network id={}", network.getId());
  return network;
}

相关文章