Migrate watcher hlrc response tests to use AbstractResponseTestCase (#43478)

Relates to #43472
This commit is contained in:
Martijn van Groningen 2019-06-28 21:14:59 +02:00
parent d8fe0f5c13
commit 9d5c66be41
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
6 changed files with 93 additions and 261 deletions

View File

@ -45,7 +45,7 @@ public abstract class AbstractResponseTestCase<S extends ToXContent, C> extends
final S serverTestInstance = createServerTestInstance();
final XContentType xContentType = randomFrom(XContentType.values());
final BytesReference bytes = toShuffledXContent(serverTestInstance, xContentType, ToXContent.EMPTY_PARAMS, randomBoolean());
final BytesReference bytes = toShuffledXContent(serverTestInstance, xContentType, getParams(), randomBoolean());
final XContent xContent = XContentFactory.xContent(xContentType);
final XContentParser parser = xContent.createParser(
@ -62,4 +62,8 @@ public abstract class AbstractResponseTestCase<S extends ToXContent, C> extends
protected abstract void assertInstances(S serverTestInstance, C clientInstance);
protected ToXContent.Params getParams() {
return ToXContent.EMPTY_PARAMS;
}
}

View File

@ -1,115 +0,0 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.client.watcher;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.ObjectPath;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.test.ESTestCase;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester;
import static org.hamcrest.Matchers.is;
public class ExecuteWatchResponseTests extends ESTestCase {
public static final String WATCH_ID_VALUE = "my_watch";
public static final String NODE_VALUE = "my_node";
public static final String TRIGGER_TYPE_VALUE = "manual";
public static final String STATE_VALUE = "executed";
public static final String STATE_KEY = "state";
public static final String TRIGGER_EVENT_KEY = "trigger_event";
public static final String TRIGGER_EVENT_TYPE_KEY = "type";
public static final String MESSAGES_KEY = "messages";
public static final String NODE_KEY = "node";
public static final String WATCH_ID_KEY = "watch_id";
public void testFromXContent() throws IOException {
xContentTester(this::createParser,
ExecuteWatchResponseTests::createTestInstance,
this::toXContent,
ExecuteWatchResponse::fromXContent)
.supportsUnknownFields(true)
.assertEqualsConsumer(this::assertEqualInstances)
.assertToXContentEquivalence(false)
.test();
}
private void assertEqualInstances(ExecuteWatchResponse expected, ExecuteWatchResponse actual) {
assertThat(expected.getRecordId(), is(actual.getRecordId()));
// This may have extra json, so lets just assume that if all of the original fields from the creation are there, then its equal
// This is the same code that is in createTestInstance in this class.
Map<String, Object> actualMap = actual.getRecordAsMap();
assertThat(ObjectPath.eval(WATCH_ID_KEY, actualMap), is(WATCH_ID_VALUE));
assertThat(ObjectPath.eval(NODE_KEY, actualMap), is(NODE_VALUE));
List<Object> messages = ObjectPath.eval(MESSAGES_KEY, actualMap);
assertThat(messages.size(), is(0));
assertThat(ObjectPath.eval(TRIGGER_EVENT_KEY + "." + TRIGGER_EVENT_TYPE_KEY, actualMap), is(TRIGGER_TYPE_VALUE));
assertThat(ObjectPath.eval(STATE_KEY, actualMap), is(STATE_VALUE));
}
private XContentBuilder toXContent(BytesReference bytes, XContentBuilder builder) throws IOException {
// EMPTY is safe here because we never use namedObject
try (InputStream stream = bytes.streamInput();
XContentParser parser = createParser(JsonXContent.jsonXContent, stream)) {
parser.nextToken();
builder.generator().copyCurrentStructure(parser);
return builder;
}
}
private XContentBuilder toXContent(ExecuteWatchResponse response, XContentBuilder builder) throws IOException {
builder.startObject();
builder.field("_id", response.getRecordId());
builder.field("watch_record");
toXContent(response.getRecord(), builder);
return builder.endObject();
}
private static ExecuteWatchResponse createTestInstance() {
String id = "my_watch_0-2015-06-02T23:17:55.124Z";
try {
XContentBuilder builder = XContentFactory.jsonBuilder();
builder.startObject();
builder.field(WATCH_ID_KEY, WATCH_ID_VALUE);
builder.field(NODE_KEY, NODE_VALUE);
builder.startArray(MESSAGES_KEY);
builder.endArray();
builder.startObject(TRIGGER_EVENT_KEY);
builder.field(TRIGGER_EVENT_TYPE_KEY, TRIGGER_TYPE_VALUE);
builder.endObject();
builder.field(STATE_KEY, STATE_VALUE);
builder.endObject();
BytesReference bytes = BytesReference.bytes(builder);
return new ExecuteWatchResponse(id, bytes);
}
catch (IOException e) {
throw new AssertionError(e);
}
}
}

View File

@ -19,16 +19,12 @@
package org.elasticsearch.client.watcher;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.DeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.client.AbstractHlrcStreamableXContentTestCase;
import org.elasticsearch.xpack.core.watcher.actions.ActionStatus;
import org.elasticsearch.xpack.core.watcher.execution.ExecutionState;
import org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource;
@ -36,7 +32,6 @@ import org.elasticsearch.xpack.core.watcher.transport.actions.get.GetWatchRespon
import org.elasticsearch.xpack.core.watcher.watch.WatchStatus;
import java.io.IOException;
import java.io.InputStream;
import java.time.Clock;
import java.time.Instant;
import java.time.ZoneOffset;
@ -44,65 +39,14 @@ import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Predicate;
public class GetWatchResponseTests extends
AbstractHlrcStreamableXContentTestCase<GetWatchResponse, org.elasticsearch.client.watcher.GetWatchResponse> {
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
private static final String[] SHUFFLE_FIELDS_EXCEPTION = new String[] { "watch" };
public class GetWatchResponseTests extends AbstractResponseTestCase<GetWatchResponse, org.elasticsearch.client.watcher.GetWatchResponse> {
@Override
protected String[] getShuffleFieldsExceptions() {
return SHUFFLE_FIELDS_EXCEPTION;
}
@Override
protected ToXContent.Params getToXContentParams() {
return new ToXContent.MapParams(Collections.singletonMap("hide_headers", "false"));
}
@Override
protected Predicate<String> getRandomFieldsExcludeFilter() {
return f -> f.contains("watch") || f.contains("actions") || f.contains("headers");
}
@Override
protected void assertEqualInstances(GetWatchResponse expectedInstance, GetWatchResponse newInstance) {
if (expectedInstance.isFound() &&
expectedInstance.getSource().getContentType() != newInstance.getSource().getContentType()) {
/**
* The {@link GetWatchResponse#getContentType()} depends on the content type that
* was used to serialize the main object so we use the same content type than the
* <code>expectedInstance</code> to translate the watch of the <code>newInstance</code>.
*/
XContent from = XContentFactory.xContent(newInstance.getSource().getContentType());
XContent to = XContentFactory.xContent(expectedInstance.getSource().getContentType());
final BytesReference newSource;
// It is safe to use EMPTY here because this never uses namedObject
try (InputStream stream = newInstance.getSource().getBytes().streamInput();
XContentParser parser = XContentFactory.xContent(from.type()).createParser(NamedXContentRegistry.EMPTY,
DeprecationHandler.THROW_UNSUPPORTED_OPERATION, stream)) {
parser.nextToken();
XContentBuilder builder = XContentFactory.contentBuilder(to.type());
builder.copyCurrentStructure(parser);
newSource = BytesReference.bytes(builder);
} catch (IOException e) {
throw new AssertionError(e);
}
newInstance = new GetWatchResponse(newInstance.getId(), newInstance.getVersion(),
newInstance.getSeqNo(), newInstance.getPrimaryTerm(),
newInstance.getStatus(), new XContentSource(newSource, expectedInstance.getSource().getContentType()));
}
super.assertEqualInstances(expectedInstance, newInstance);
}
@Override
protected GetWatchResponse createBlankInstance() {
return new GetWatchResponse();
}
@Override
protected GetWatchResponse createTestInstance() {
protected GetWatchResponse createServerTestInstance() {
String id = randomAlphaOfLength(10);
if (LuceneTestCase.rarely()) {
return new GetWatchResponse(id);
@ -115,6 +59,34 @@ public class GetWatchResponseTests extends
return new GetWatchResponse(id, version, seqNo, primaryTerm, status, new XContentSource(source, XContentType.JSON));
}
@Override
protected org.elasticsearch.client.watcher.GetWatchResponse doParseToClientInstance(XContentParser parser) throws IOException {
return org.elasticsearch.client.watcher.GetWatchResponse.fromXContent(parser);
}
@Override
protected void assertInstances(GetWatchResponse serverTestInstance, org.elasticsearch.client.watcher.GetWatchResponse clientInstance) {
assertThat(clientInstance.getId(), equalTo(serverTestInstance.getId()));
assertThat(clientInstance.getSeqNo(), equalTo(serverTestInstance.getSeqNo()));
assertThat(clientInstance.getPrimaryTerm(), equalTo(serverTestInstance.getPrimaryTerm()));
assertThat(clientInstance.getVersion(), equalTo(serverTestInstance.getVersion()));
if (serverTestInstance.getStatus() != null) {
assertThat(convertWatchStatus(clientInstance.getStatus()), equalTo(serverTestInstance.getStatus()));
} else {
assertThat(clientInstance.getStatus(), nullValue());
}
if (serverTestInstance.getSource() != null) {
assertThat(clientInstance.getSourceAsMap(), equalTo(serverTestInstance.getSource().getAsMap()));
} else {
assertThat(clientInstance.getSource(), nullValue());
}
}
@Override
protected ToXContent.Params getParams() {
return new ToXContent.MapParams(Collections.singletonMap("hide_headers", "false"));
}
private static BytesReference simpleWatch() {
try {
XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent());
@ -181,58 +153,45 @@ public class GetWatchResponseTests extends
}
}
@Override
public org.elasticsearch.client.watcher.GetWatchResponse doHlrcParseInstance(XContentParser parser) throws IOException {
return org.elasticsearch.client.watcher.GetWatchResponse.fromXContent(parser);
}
@Override
public GetWatchResponse convertHlrcToInternal(org.elasticsearch.client.watcher.GetWatchResponse instance) {
if (instance.isFound()) {
return new GetWatchResponse(instance.getId(), instance.getVersion(), instance.getSeqNo(), instance.getPrimaryTerm(),
convertHlrcToInternal(instance.getStatus()), new XContentSource(instance.getSource(), instance.getContentType()));
} else {
return new GetWatchResponse(instance.getId());
}
}
private static WatchStatus convertHlrcToInternal(org.elasticsearch.client.watcher.WatchStatus status) {
private static WatchStatus convertWatchStatus(org.elasticsearch.client.watcher.WatchStatus status) {
final Map<String, ActionStatus> actions = new HashMap<>();
for (Map.Entry<String, org.elasticsearch.client.watcher.ActionStatus> entry : status.getActions().entrySet()) {
actions.put(entry.getKey(), convertHlrcToInternal(entry.getValue()));
actions.put(entry.getKey(), convertActionStatus(entry.getValue()));
}
return new WatchStatus(status.version(),
convertHlrcToInternal(status.state()),
status.getExecutionState() == null ? null : convertHlrcToInternal(status.getExecutionState()),
convertWatchStatusState(status.state()),
status.getExecutionState() == null ? null : convertWatchStatus(status.getExecutionState()),
status.lastChecked(), status.lastMetCondition(), actions, status.getHeaders()
);
}
private static ActionStatus convertHlrcToInternal(org.elasticsearch.client.watcher.ActionStatus actionStatus) {
return new ActionStatus(convertHlrcToInternal(actionStatus.ackStatus()),
actionStatus.lastExecution() == null ? null : convertHlrcToInternal(actionStatus.lastExecution()),
actionStatus.lastSuccessfulExecution() == null ? null : convertHlrcToInternal(actionStatus.lastSuccessfulExecution()),
actionStatus.lastThrottle() == null ? null : convertHlrcToInternal(actionStatus.lastThrottle())
private static ActionStatus convertActionStatus(org.elasticsearch.client.watcher.ActionStatus actionStatus) {
return new ActionStatus(convertAckStatus(actionStatus.ackStatus()),
actionStatus.lastExecution() == null ? null : convertActionStatusExecution(actionStatus.lastExecution()),
actionStatus.lastSuccessfulExecution() == null ? null : convertActionStatusExecution(actionStatus.lastSuccessfulExecution()),
actionStatus.lastThrottle() == null ? null : convertActionStatusThrottle(actionStatus.lastThrottle())
);
}
private static ActionStatus.AckStatus convertHlrcToInternal(org.elasticsearch.client.watcher.ActionStatus.AckStatus ackStatus) {
return new ActionStatus.AckStatus(ackStatus.timestamp(), convertHlrcToInternal(ackStatus.state()));
private static ActionStatus.AckStatus convertAckStatus(org.elasticsearch.client.watcher.ActionStatus.AckStatus ackStatus) {
return new ActionStatus.AckStatus(ackStatus.timestamp(), convertAckStatusState(ackStatus.state()));
}
private static ActionStatus.AckStatus.State convertHlrcToInternal(org.elasticsearch.client.watcher.ActionStatus.AckStatus.State state) {
private static ActionStatus.AckStatus.State convertAckStatusState(
org.elasticsearch.client.watcher.ActionStatus.AckStatus.State state) {
return ActionStatus.AckStatus.State.valueOf(state.name());
}
private static WatchStatus.State convertHlrcToInternal(org.elasticsearch.client.watcher.WatchStatus.State state) {
private static WatchStatus.State convertWatchStatusState(org.elasticsearch.client.watcher.WatchStatus.State state) {
return new WatchStatus.State(state.isActive(), state.getTimestamp());
}
private static ExecutionState convertHlrcToInternal(org.elasticsearch.client.watcher.ExecutionState executionState) {
private static ExecutionState convertWatchStatus(org.elasticsearch.client.watcher.ExecutionState executionState) {
return ExecutionState.valueOf(executionState.name());
}
private static ActionStatus.Execution convertHlrcToInternal(org.elasticsearch.client.watcher.ActionStatus.Execution execution) {
private static ActionStatus.Execution convertActionStatusExecution(
org.elasticsearch.client.watcher.ActionStatus.Execution execution) {
if (execution.successful()) {
return ActionStatus.Execution.successful(execution.timestamp());
} else {
@ -240,7 +199,7 @@ public class GetWatchResponseTests extends
}
}
private static ActionStatus.Throttle convertHlrcToInternal(org.elasticsearch.client.watcher.ActionStatus.Throttle throttle) {
private static ActionStatus.Throttle convertActionStatusThrottle(org.elasticsearch.client.watcher.ActionStatus.Throttle throttle) {
return new ActionStatus.Throttle(throttle.timestamp(), throttle.reason());
}

View File

@ -18,17 +18,19 @@
*/
package org.elasticsearch.client.watcher.hlrc;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.client.watcher.DeleteWatchResponse;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.client.AbstractHlrcXContentTestCase;
import java.io.IOException;
public class DeleteWatchResponseTests extends AbstractHlrcXContentTestCase<
import static org.hamcrest.Matchers.equalTo;
public class DeleteWatchResponseTests extends AbstractResponseTestCase<
org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse, DeleteWatchResponse> {
@Override
protected org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse createTestInstance() {
protected org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse createServerTestInstance() {
String id = randomAlphaOfLength(10);
long version = randomLongBetween(1, 10);
boolean found = randomBoolean();
@ -36,23 +38,15 @@ public class DeleteWatchResponseTests extends AbstractHlrcXContentTestCase<
}
@Override
protected org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse doParseInstance(XContentParser parser) throws IOException {
return org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse.fromXContent(parser);
}
@Override
public DeleteWatchResponse doHlrcParseInstance(XContentParser parser) throws IOException {
protected DeleteWatchResponse doParseToClientInstance(XContentParser parser) throws IOException {
return DeleteWatchResponse.fromXContent(parser);
}
@Override
public org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse convertHlrcToInternal(DeleteWatchResponse instance) {
return new org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse(instance.getId(), instance.getVersion(),
instance.isFound());
}
@Override
protected boolean supportsUnknownFields() {
return false;
protected void assertInstances(org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse serverTestInstance,
DeleteWatchResponse clientInstance) {
assertThat(clientInstance.getId(), equalTo(serverTestInstance.getId()));
assertThat(clientInstance.getVersion(), equalTo(serverTestInstance.getVersion()));
assertThat(clientInstance.isFound(), equalTo(serverTestInstance.isFound()));
}
}

View File

@ -19,31 +19,23 @@
package org.elasticsearch.client.watcher.hlrc;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.client.AbstractHlrcXContentTestCase;
import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchResponse;
import java.io.IOException;
public class ExecuteWatchResponseTests
extends AbstractHlrcXContentTestCase<ExecuteWatchResponse, org.elasticsearch.client.watcher.ExecuteWatchResponse> {
import static org.hamcrest.Matchers.equalTo;
public class ExecuteWatchResponseTests extends AbstractResponseTestCase<
ExecuteWatchResponse, org.elasticsearch.client.watcher.ExecuteWatchResponse> {
@Override
public org.elasticsearch.client.watcher.ExecuteWatchResponse doHlrcParseInstance(XContentParser parser) throws IOException {
return org.elasticsearch.client.watcher.ExecuteWatchResponse.fromXContent(parser);
}
@Override
public ExecuteWatchResponse convertHlrcToInternal(org.elasticsearch.client.watcher.ExecuteWatchResponse instance) {
return new ExecuteWatchResponse(instance.getRecordId(), instance.getRecord(), XContentType.JSON);
}
@Override
protected ExecuteWatchResponse createTestInstance() {
protected ExecuteWatchResponse createServerTestInstance() {
String id = "my_watch_0-2015-06-02T23:17:55.124Z";
try {
XContentBuilder builder = XContentFactory.jsonBuilder();
@ -66,12 +58,14 @@ public class ExecuteWatchResponseTests
}
@Override
protected ExecuteWatchResponse doParseInstance(XContentParser parser) throws IOException {
return ExecuteWatchResponse.fromXContent(parser);
protected org.elasticsearch.client.watcher.ExecuteWatchResponse doParseToClientInstance(XContentParser parser) throws IOException {
return org.elasticsearch.client.watcher.ExecuteWatchResponse.fromXContent(parser);
}
@Override
protected boolean supportsUnknownFields() {
return false;
protected void assertInstances(ExecuteWatchResponse serverTestInstance,
org.elasticsearch.client.watcher.ExecuteWatchResponse clientInstance) {
assertThat(clientInstance.getRecordId(), equalTo(serverTestInstance.getRecordId()));
assertThat(clientInstance.getRecordAsMap(), equalTo(serverTestInstance.getRecordSource().getAsMap()));
}
}

View File

@ -18,17 +18,19 @@
*/
package org.elasticsearch.client.watcher.hlrc;
import org.elasticsearch.client.AbstractResponseTestCase;
import org.elasticsearch.client.watcher.PutWatchResponse;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.client.AbstractHlrcXContentTestCase;
import java.io.IOException;
public class PutWatchResponseTests extends AbstractHlrcXContentTestCase<
import static org.hamcrest.Matchers.equalTo;
public class PutWatchResponseTests extends AbstractResponseTestCase<
org.elasticsearch.protocol.xpack.watcher.PutWatchResponse, PutWatchResponse> {
@Override
protected org.elasticsearch.protocol.xpack.watcher.PutWatchResponse createTestInstance() {
protected org.elasticsearch.protocol.xpack.watcher.PutWatchResponse createServerTestInstance() {
String id = randomAlphaOfLength(10);
long seqNo = randomNonNegativeLong();
long primaryTerm = randomLongBetween(1, 20);
@ -38,23 +40,17 @@ public class PutWatchResponseTests extends AbstractHlrcXContentTestCase<
}
@Override
protected org.elasticsearch.protocol.xpack.watcher.PutWatchResponse doParseInstance(XContentParser parser) throws IOException {
return org.elasticsearch.protocol.xpack.watcher.PutWatchResponse.fromXContent(parser);
protected PutWatchResponse doParseToClientInstance(XContentParser parser) throws IOException {
return PutWatchResponse.fromXContent(parser);
}
@Override
public PutWatchResponse doHlrcParseInstance(XContentParser parser) throws IOException {
return org.elasticsearch.client.watcher.PutWatchResponse.fromXContent(parser);
}
@Override
public org.elasticsearch.protocol.xpack.watcher.PutWatchResponse convertHlrcToInternal(PutWatchResponse instance) {
return new org.elasticsearch.protocol.xpack.watcher.PutWatchResponse(instance.getId(), instance.getVersion(),
instance.getSeqNo(), instance.getPrimaryTerm(), instance.isCreated());
}
@Override
protected boolean supportsUnknownFields() {
return false;
protected void assertInstances(org.elasticsearch.protocol.xpack.watcher.PutWatchResponse serverTestInstance,
PutWatchResponse clientInstance) {
assertThat(clientInstance.getId(), equalTo(serverTestInstance.getId()));
assertThat(clientInstance.getSeqNo(), equalTo(serverTestInstance.getSeqNo()));
assertThat(clientInstance.getPrimaryTerm(), equalTo(serverTestInstance.getPrimaryTerm()));
assertThat(clientInstance.getVersion(), equalTo(serverTestInstance.getVersion()));
assertThat(clientInstance.isCreated(), equalTo(serverTestInstance.isCreated()));
}
}