-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combined Nessie server+client for testing #7527
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Nessie Client directly accessing a Nessie backend | ||
|
||
... without REST or any other intermediate protocol. | ||
|
||
**NOT FOR PRODUCTION USE** | ||
|
||
* No access checks | ||
* (possibly) not fully tested and (possibly) does not provide the same behavior | ||
* Meant for testing use cases that do not want to or cannot use (another) Jersey/Weld instance | ||
* (Currently?) only implemented for (and useful with?) an in-memory backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (C) 2023 Dremio | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
plugins { | ||
id("nessie-conventions-server") | ||
id("nessie-jacoco") | ||
} | ||
|
||
extra["maven.name"] = "Nessie - Combined Client and Server" | ||
|
||
dependencies { | ||
api(project(":nessie-client")) | ||
api(project(":nessie-model")) | ||
implementation(project(":nessie-rest-services")) | ||
implementation(project(":nessie-services")) | ||
implementation(project(":nessie-server-store")) | ||
implementation(project(":nessie-versioned-spi")) | ||
implementation(project(":nessie-versioned-persist-store")) | ||
implementation(project(":nessie-versioned-storage-common")) | ||
implementation(project(":nessie-versioned-storage-inmemory")) | ||
implementation(project(":nessie-versioned-storage-store")) | ||
implementation(libs.slf4j.api) | ||
|
||
// javax/jakarta | ||
compileOnly(libs.jakarta.ws.rs.api) | ||
compileOnly(libs.javax.ws.rs21) | ||
compileOnly(libs.jakarta.enterprise.cdi.api) | ||
compileOnly(libs.javax.enterprise.cdi.api) | ||
compileOnly(libs.jakarta.annotation.api) | ||
compileOnly(libs.findbugs.jsr305) | ||
compileOnly(libs.jakarta.validation.api) | ||
compileOnly(libs.javax.validation.api) | ||
|
||
compileOnly(libs.microprofile.openapi) | ||
|
||
compileOnly(libs.hibernate.validator.cdi) | ||
|
||
implementation(platform(libs.jackson.bom)) | ||
implementation("com.fasterxml.jackson.core:jackson-databind") | ||
compileOnly("com.fasterxml.jackson.core:jackson-annotations") | ||
|
||
compileOnly(libs.bundles.junit.testing) | ||
compileOnly(project(":nessie-client-testextension")) | ||
compileOnly("org.junit.jupiter:junit-jupiter-engine") | ||
|
||
testImplementation(project(":nessie-jaxrs-tests")) | ||
|
||
testRuntimeOnly(libs.h2) | ||
testRuntimeOnly(libs.logback.classic) | ||
|
||
// javax/jakarta | ||
testCompileOnly(libs.jakarta.annotation.api) | ||
testCompileOnly(libs.findbugs.jsr305) | ||
|
||
testCompileOnly(libs.microprofile.openapi) | ||
|
||
testImplementation(libs.bundles.junit.testing) | ||
testImplementation(project(":nessie-client-testextension")) | ||
testCompileOnly("org.junit.jupiter:junit-jupiter-engine") | ||
} |
49 changes: 49 additions & 0 deletions
49
...bined-cs/src/main/java/org/projectnessie/nessie/combined/BaseCombinedAssignReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (C) 2022 Dremio | ||
* | ||
* Licensed 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.projectnessie.nessie.combined; | ||
|
||
import org.projectnessie.api.v2.TreeApi; | ||
import org.projectnessie.client.builder.BaseAssignReferenceBuilder; | ||
import org.projectnessie.error.NessieConflictException; | ||
import org.projectnessie.error.NessieNotFoundException; | ||
import org.projectnessie.model.Reference; | ||
|
||
abstract class BaseCombinedAssignReference<T extends Reference, B> | ||
extends BaseAssignReferenceBuilder<B> { | ||
|
||
private final TreeApi treeApi; | ||
|
||
BaseCombinedAssignReference(TreeApi treeApi) { | ||
this.treeApi = treeApi; | ||
} | ||
|
||
public void assign() throws NessieNotFoundException, NessieConflictException { | ||
assignAndGet(); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public T assignAndGet() throws NessieNotFoundException, NessieConflictException { | ||
try { | ||
String type = super.type != null ? super.type.name() : null; | ||
return (T) | ||
treeApi | ||
.assignReference(type, Reference.toPathString(refName, expectedHash), assignTo) | ||
.getReference(); | ||
} catch (RuntimeException e) { | ||
throw CombinedClientImpl.maybeWrapException(e); | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...bined-cs/src/main/java/org/projectnessie/nessie/combined/BaseCombinedDeleteReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (C) 2022 Dremio | ||
* | ||
* Licensed 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.projectnessie.nessie.combined; | ||
|
||
import org.projectnessie.api.v2.TreeApi; | ||
import org.projectnessie.client.builder.BaseChangeReferenceBuilder; | ||
import org.projectnessie.error.NessieConflictException; | ||
import org.projectnessie.error.NessieNotFoundException; | ||
import org.projectnessie.model.Reference; | ||
|
||
abstract class BaseCombinedDeleteReference<T extends Reference, B> | ||
extends BaseChangeReferenceBuilder<B> { | ||
|
||
private final TreeApi treeApi; | ||
|
||
BaseCombinedDeleteReference(TreeApi treeApi) { | ||
this.treeApi = treeApi; | ||
} | ||
|
||
public void delete() throws NessieConflictException, NessieNotFoundException { | ||
getAndDelete(); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public T getAndDelete() throws NessieNotFoundException, NessieConflictException { | ||
String type = super.type != null ? super.type.name() : null; | ||
try { | ||
return (T) | ||
treeApi | ||
.deleteReference(type, Reference.toPathString(refName, expectedHash)) | ||
.getReference(); | ||
} catch (RuntimeException e) { | ||
throw CombinedClientImpl.maybeWrapException(e); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ing/combined-cs/src/main/java/org/projectnessie/nessie/combined/CombinedAssignBranch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2022 Dremio | ||
* | ||
* Licensed 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.projectnessie.nessie.combined; | ||
|
||
import org.projectnessie.api.v2.TreeApi; | ||
import org.projectnessie.client.api.AssignBranchBuilder; | ||
import org.projectnessie.model.Branch; | ||
import org.projectnessie.model.Reference.ReferenceType; | ||
|
||
final class CombinedAssignBranch extends BaseCombinedAssignReference<Branch, AssignBranchBuilder> | ||
implements AssignBranchBuilder { | ||
|
||
CombinedAssignBranch(TreeApi treeApi) { | ||
super(treeApi); | ||
refType(ReferenceType.BRANCH); | ||
} | ||
|
||
@Override | ||
public AssignBranchBuilder branchName(String branchName) { | ||
return refName(branchName); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
.../combined-cs/src/main/java/org/projectnessie/nessie/combined/CombinedAssignReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (C) 2022 Dremio | ||
* | ||
* Licensed 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.projectnessie.nessie.combined; | ||
|
||
import org.projectnessie.api.v2.TreeApi; | ||
import org.projectnessie.client.api.AssignReferenceBuilder; | ||
import org.projectnessie.model.Reference; | ||
|
||
final class CombinedAssignReference | ||
extends BaseCombinedAssignReference<Reference, AssignReferenceBuilder<Reference>> | ||
implements AssignReferenceBuilder<Reference> { | ||
|
||
CombinedAssignReference(TreeApi treeApi) { | ||
super(treeApi); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
testing/combined-cs/src/main/java/org/projectnessie/nessie/combined/CombinedAssignTag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2022 Dremio | ||
* | ||
* Licensed 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.projectnessie.nessie.combined; | ||
|
||
import org.projectnessie.api.v2.TreeApi; | ||
import org.projectnessie.client.api.AssignTagBuilder; | ||
import org.projectnessie.model.Reference.ReferenceType; | ||
import org.projectnessie.model.Tag; | ||
|
||
final class CombinedAssignTag extends BaseCombinedAssignReference<Tag, AssignTagBuilder> | ||
implements AssignTagBuilder { | ||
|
||
CombinedAssignTag(TreeApi treeApi) { | ||
super(treeApi); | ||
refType(ReferenceType.TAG); | ||
} | ||
|
||
@Override | ||
public AssignTagBuilder tagName(String tagName) { | ||
return refName(tagName); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test exercises the "exception mapping" in the added client impl