io.vertx.servicediscovery.Record.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(66)

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

Record.<init>介绍

[英]Creates a new Record.
[中]创造一个新记录。

代码示例

代码示例来源:origin: vert-x3/vertx-examples

Record record1 = new Record()
 .setType("eventbus-service-proxy")
 .setLocation(new JsonObject().put("endpoint", "the-service-address"))

代码示例来源:origin: engagingspaces/vertx-graphql-service-discovery

/**
 * Creates a new {@link SchemaReferenceData} by copying
 * the values from another {@link SchemaReferenceData}.
 *
 * @param other the reference state to copy
 */
public SchemaReferenceData(SchemaReferenceData other) {
  this.id = other.id;
  this.status = other.status;
  this.record = new Record(other.record);
}

代码示例来源:origin: engagingspaces/vertx-graphql-service-discovery

/**
 * Creates a new {@link SchemaReferenceData} from
 * its json representation.
 *
 * @param json the json object
 */
public SchemaReferenceData(JsonObject json) {
  this.id = json.getString("id");
  this.record = new Record(json.getJsonObject("record"));
  this.status = "bind".equals(json.getValue("type")) ? Status.BOUND : Status.RELEASED;
}

代码示例来源:origin: io.vertx/vertx-lang-groovy

public static void publish(io.vertx.servicediscovery.spi.ServicePublisher j_receiver, java.util.Map<String, Object> record, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
 j_receiver.publish(record != null ? new io.vertx.servicediscovery.Record(io.vertx.core.impl.ConversionHelper.toJsonObject(record)) : null,
  resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record>>() {
  public void handle(io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record> ar) {
   resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
  }
 } : null);
}
public static void update(io.vertx.servicediscovery.spi.ServicePublisher j_receiver, java.util.Map<String, Object> record, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {

代码示例来源:origin: io.vertx/vertx-lang-groovy

public static void publish(io.vertx.servicediscovery.ServiceDiscovery j_receiver, java.util.Map<String, Object> record, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
 j_receiver.publish(record != null ? new io.vertx.servicediscovery.Record(io.vertx.core.impl.ConversionHelper.toJsonObject(record)) : null,
  resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record>>() {
  public void handle(io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record> ar) {
   resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
  }
 } : null);
}
public static void getRecord(io.vertx.servicediscovery.ServiceDiscovery j_receiver, java.util.Map<String, Object> filter, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {

代码示例来源:origin: io.vertx/vertx-lang-groovy

public static void update(io.vertx.servicediscovery.spi.ServicePublisher j_receiver, java.util.Map<String, Object> record, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
  j_receiver.update(record != null ? new io.vertx.servicediscovery.Record(io.vertx.core.impl.ConversionHelper.toJsonObject(record)) : null,
   resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record>>() {
   public void handle(io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record> ar) {
    resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
   }
  } : null);
 }
}

代码示例来源:origin: io.vertx/vertx-lang-groovy

public static void update(io.vertx.servicediscovery.ServiceDiscovery j_receiver, java.util.Map<String, Object> record, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.util.Map<String, Object>>> resultHandler) {
 j_receiver.update(record != null ? new io.vertx.servicediscovery.Record(io.vertx.core.impl.ConversionHelper.toJsonObject(record)) : null,
  resultHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record>>() {
  public void handle(io.vertx.core.AsyncResult<io.vertx.servicediscovery.Record> ar) {
   resultHandler.handle(ar.map(event -> event != null ? io.vertx.core.impl.ConversionHelper.fromJsonObject(event.toJson()) : null));
  }
 } : null);
}
public static java.util.Map<String, Object> options(io.vertx.servicediscovery.ServiceDiscovery j_receiver) {

代码示例来源:origin: io.vertx/vertx-service-discovery

static Record createRecord(String name, JsonObject location, JsonObject metadata) {
 Objects.requireNonNull(name);
 Objects.requireNonNull(location);
 Record record = new Record().setName(name)
   .setType(TYPE)
   .setLocation(location);
 if (metadata != null) {
  record.setMetadata(metadata);
 }
 return record;
}

代码示例来源:origin: vert-x3/vertx-service-discovery

static Record createRecord(String name, JsonObject location, JsonObject metadata) {
 Objects.requireNonNull(name);
 Objects.requireNonNull(location);
 Record record = new Record().setName(name)
   .setType(TYPE)
   .setLocation(location);
 if (metadata != null) {
  record.setMetadata(metadata);
 }
 return record;
}

代码示例来源:origin: io.vertx/vertx-service-discovery

@Override
public void onUpdate(Record record) {
 state.put(record.getRegistration(), new Record(record));
}

代码示例来源:origin: io.vertx/vertx-lang-groovy

public static io.vertx.servicediscovery.ServiceReference getReferenceWithConfiguration(io.vertx.servicediscovery.ServiceDiscovery j_receiver, java.util.Map<String, Object> record, java.util.Map<String, Object> configuration) {
 return io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.getReferenceWithConfiguration(record != null ? new io.vertx.servicediscovery.Record(io.vertx.core.impl.ConversionHelper.toJsonObject(record)) : null,
  configuration != null ? io.vertx.core.impl.ConversionHelper.toJsonObject(configuration) : null));
}
public static io.vertx.servicediscovery.ServiceDiscovery registerServiceImporter(io.vertx.servicediscovery.ServiceDiscovery j_receiver, io.vertx.servicediscovery.spi.ServiceImporter importer, java.util.Map<String, Object> configuration) {

代码示例来源:origin: io.vertx/vertx-service-discovery

@Test
public void TestTypeMatch() {
 Record record = new Record().setName("Name").setType(HttpEndpoint.TYPE);
 assertThat(record.match(new JsonObject().put("name", "Name").put("type", "any"))).isFalse();
 assertThat(record.match(new JsonObject().put("name", "Name").put("type", HttpEndpoint.TYPE))).isTrue();
 assertThat(record.match(new JsonObject().put("type", HttpEndpoint.TYPE))).isTrue();
 assertThat(record.match(new JsonObject().put("name", "Name").put("type", "*"))).isTrue();
}

代码示例来源:origin: vert-x3/vertx-service-discovery

@Test
public void TestTypeMatch() {
 Record record = new Record().setName("Name").setType(HttpEndpoint.TYPE);
 assertThat(record.match(new JsonObject().put("name", "Name").put("type", "any"))).isFalse();
 assertThat(record.match(new JsonObject().put("name", "Name").put("type", HttpEndpoint.TYPE))).isTrue();
 assertThat(record.match(new JsonObject().put("type", HttpEndpoint.TYPE))).isTrue();
 assertThat(record.match(new JsonObject().put("name", "Name").put("type", "*"))).isTrue();
}

代码示例来源:origin: vert-x3/vertx-service-discovery

@Test(expected = IllegalArgumentException.class)
public void unknown() {
 Record record = new Record();
 record.setType(ServiceType.UNKNOWN);
 ServiceTypes.get(record);
}

代码示例来源:origin: io.vertx/vertx-service-discovery

@Test(expected = IllegalArgumentException.class)
public void notAKnownType() {
 Record record = new Record();
 record.setType("bob");
 ServiceTypes.get(record);
}

代码示例来源:origin: io.vertx/vertx-service-discovery

@Test(expected = IllegalArgumentException.class)
public void unknown() {
 Record record = new Record();
 record.setType(ServiceType.UNKNOWN);
 ServiceTypes.get(record);
}

代码示例来源:origin: vert-x3/vertx-service-discovery

@Test(expected = IllegalArgumentException.class)
public void notAKnownType() {
 Record record = new Record();
 record.setType("bob");
 ServiceTypes.get(record);
}

代码示例来源:origin: engagingspaces/vertx-graphql-service-discovery

@Test
public void should_Fail_Service_Proxy_With_Record_Status_Not_UP(TestContext context) {
  GraphQLClient.getSchemaProxy(discovery, new Record()
      .setName("DroidQueries").setType(Queryable.SERVICE_TYPE),
          context.asyncAssertFailure(ex ->
            assertEquals("Record status indicates service 'DroidQueries' is: UNKNOWN. Expected: UP",
                ex.getMessage())
          ));
}

代码示例来源:origin: vert-x3/vertx-service-discovery

@Test
public void testFailedPublication() {
 HelloService svc = new HelloServiceImpl("stuff");
 ProxyHelper.registerService(HelloService.class, vertx, svc, "address");
 Record record = new Record()
  .setName("Hello")
  .setRegistration("this-is-not-allowed")
  .setLocation(new JsonObject().put(Record.ENDPOINT, "address"));
 Restafari.Response response = given().request().body(record.toJson().toString()).post("/discovery");
 assertThat(response.getStatusCode()).isEqualTo(500);
}

代码示例来源:origin: io.vertx/vertx-service-discovery

@Test
public void testFailedPublication() {
 HelloService svc = new HelloServiceImpl("stuff");
 ProxyHelper.registerService(HelloService.class, vertx, svc, "address");
 Record record = new Record()
  .setName("Hello")
  .setRegistration("this-is-not-allowed")
  .setLocation(new JsonObject().put(Record.ENDPOINT, "address"));
 Restafari.Response response = given().request().body(record.toJson().toString()).post("/discovery");
 assertThat(response.getStatusCode()).isEqualTo(500);
}

相关文章