Search in sources :

Example 1 with DesignDocumentNotFoundException

use of com.couchbase.client.core.error.DesignDocumentNotFoundException in project couchbase-jvm-clients by couchbase.

the class ViewManagerIntegrationTest method dropAbsentDesignDoc.

@Test
void dropAbsentDesignDoc() {
    DesignDocumentNotFoundException e = assertThrows(DesignDocumentNotFoundException.class, () -> views.dropDesignDocument("doesnotexist", DEVELOPMENT));
    assertEquals("doesnotexist", e.name());
}
Also used : DesignDocumentNotFoundException(com.couchbase.client.core.error.DesignDocumentNotFoundException) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 2 with DesignDocumentNotFoundException

use of com.couchbase.client.core.error.DesignDocumentNotFoundException in project couchbase-jvm-clients by couchbase.

the class ViewManagerIntegrationTest method getAbsentDesignDoc.

@Test
void getAbsentDesignDoc() {
    DesignDocumentNotFoundException e = assertThrows(DesignDocumentNotFoundException.class, () -> views.getDesignDocument("doesnotexist", DEVELOPMENT));
    assertEquals("doesnotexist", e.name());
}
Also used : DesignDocumentNotFoundException(com.couchbase.client.core.error.DesignDocumentNotFoundException) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 3 with DesignDocumentNotFoundException

use of com.couchbase.client.core.error.DesignDocumentNotFoundException in project couchbase-jvm-clients by couchbase.

the class ViewManagerIntegrationTest method publishAbsentDesignDoc.

@Test
void publishAbsentDesignDoc() {
    DesignDocumentNotFoundException e = assertThrows(DesignDocumentNotFoundException.class, () -> views.publishDesignDocument("doesnotexist"));
    assertEquals("doesnotexist", e.name());
}
Also used : DesignDocumentNotFoundException(com.couchbase.client.core.error.DesignDocumentNotFoundException) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 4 with DesignDocumentNotFoundException

use of com.couchbase.client.core.error.DesignDocumentNotFoundException in project couchbase-jvm-clients by couchbase.

the class CoreViewIndexManager method publishDesignDocument.

/**
 * Convenience method that gets a the document from the development namespace
 * and upserts it to the production namespace.
 *
 * @param name name of the development design document
 * @throws DesignDocumentNotFoundException if the development namespace does not contain a document with the given name
 */
public CompletableFuture<Void> publishDesignDocument(String name, CoreCommonOptions options) {
    notNullOrEmpty(name, "Name", () -> new ReducedViewErrorContext(null, null, bucket));
    RequestSpan span = buildSpan(TracingIdentifiers.SPAN_REQUEST_MV_PUBLISH_DD, options.parentSpan());
    CoreCommonOptions childOptions = options.withParentSpan(span);
    return getDesignDocument(name, false, childOptions).thenCompose(doc -> upsertDesignDocument(name, doc, true, childOptions)).whenComplete((r, t) -> span.end());
}
Also used : DesignDocumentNotFoundException(com.couchbase.client.core.error.DesignDocumentNotFoundException) HttpStatusCodeException(com.couchbase.client.core.error.HttpStatusCodeException) Validators.notNull(com.couchbase.client.core.util.Validators.notNull) CouchbaseException(com.couchbase.client.core.error.CouchbaseException) RequestTarget(com.couchbase.client.core.msg.RequestTarget) CompletableFuture(java.util.concurrent.CompletableFuture) CoreHttpPath(com.couchbase.client.core.endpoint.http.CoreHttpPath) CoreCommonOptions(com.couchbase.client.core.endpoint.http.CoreCommonOptions) JsonNode(com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode) LinkedHashMap(java.util.LinkedHashMap) CbCollections.mapOf(com.couchbase.client.core.util.CbCollections.mapOf) TracingIdentifiers(com.couchbase.client.core.cnc.TracingIdentifiers) Map(java.util.Map) CoreHttpPath.path(com.couchbase.client.core.endpoint.http.CoreHttpPath.path) Objects.requireNonNull(java.util.Objects.requireNonNull) Stability(com.couchbase.client.core.annotation.Stability) RequestSpan(com.couchbase.client.core.cnc.RequestSpan) ObjectNode(com.couchbase.client.core.deps.com.fasterxml.jackson.databind.node.ObjectNode) CbStrings.removeStart(com.couchbase.client.core.util.CbStrings.removeStart) CbTracing(com.couchbase.client.core.cnc.CbTracing) ReducedViewErrorContext(com.couchbase.client.core.error.context.ReducedViewErrorContext) Mapper(com.couchbase.client.core.json.Mapper) CoreHttpClient(com.couchbase.client.core.endpoint.http.CoreHttpClient) UrlQueryStringBuilder.urlEncode(com.couchbase.client.core.util.UrlQueryStringBuilder.urlEncode) InvalidArgumentException(com.couchbase.client.core.error.InvalidArgumentException) Validators.notNullOrEmpty(com.couchbase.client.core.util.Validators.notNullOrEmpty) ResponseStatus(com.couchbase.client.core.msg.ResponseStatus) RedactableArgument.redactMeta(com.couchbase.client.core.logging.RedactableArgument.redactMeta) CoreHttpResponse(com.couchbase.client.core.endpoint.http.CoreHttpResponse) Optional(java.util.Optional) Core(com.couchbase.client.core.Core) CoreCommonOptions(com.couchbase.client.core.endpoint.http.CoreCommonOptions) ReducedViewErrorContext(com.couchbase.client.core.error.context.ReducedViewErrorContext) RequestSpan(com.couchbase.client.core.cnc.RequestSpan)

Aggregations

DesignDocumentNotFoundException (com.couchbase.client.core.error.DesignDocumentNotFoundException)4 JavaIntegrationTest (com.couchbase.client.java.util.JavaIntegrationTest)3 Test (org.junit.jupiter.api.Test)3 Core (com.couchbase.client.core.Core)1 Stability (com.couchbase.client.core.annotation.Stability)1 CbTracing (com.couchbase.client.core.cnc.CbTracing)1 RequestSpan (com.couchbase.client.core.cnc.RequestSpan)1 TracingIdentifiers (com.couchbase.client.core.cnc.TracingIdentifiers)1 JsonNode (com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode)1 ObjectNode (com.couchbase.client.core.deps.com.fasterxml.jackson.databind.node.ObjectNode)1 CoreCommonOptions (com.couchbase.client.core.endpoint.http.CoreCommonOptions)1 CoreHttpClient (com.couchbase.client.core.endpoint.http.CoreHttpClient)1 CoreHttpPath (com.couchbase.client.core.endpoint.http.CoreHttpPath)1 CoreHttpPath.path (com.couchbase.client.core.endpoint.http.CoreHttpPath.path)1 CoreHttpResponse (com.couchbase.client.core.endpoint.http.CoreHttpResponse)1 CouchbaseException (com.couchbase.client.core.error.CouchbaseException)1 HttpStatusCodeException (com.couchbase.client.core.error.HttpStatusCodeException)1 InvalidArgumentException (com.couchbase.client.core.error.InvalidArgumentException)1 ReducedViewErrorContext (com.couchbase.client.core.error.context.ReducedViewErrorContext)1 Mapper (com.couchbase.client.core.json.Mapper)1