forked from neo4j/neo4j-java-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Feature:API:Driver.IsEncrypted Testkit feature (neo4j…
…#1152) (neo4j#1170)
- Loading branch information
1 parent
5abc24b
commit 3edf0e2
Showing
4 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
...end/src/main/java/neo4j/org/testkit/backend/messages/requests/CheckDriverIsEncrypted.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,70 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* 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 neo4j.org.testkit.backend.messages.requests; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import neo4j.org.testkit.backend.TestkitState; | ||
import neo4j.org.testkit.backend.holder.DriverHolder; | ||
import neo4j.org.testkit.backend.messages.responses.DriverIsEncrypted; | ||
import neo4j.org.testkit.backend.messages.responses.TestkitResponse; | ||
import reactor.core.publisher.Mono; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.CompletionStage; | ||
|
||
@Setter | ||
@Getter | ||
public class CheckDriverIsEncrypted implements TestkitRequest | ||
{ | ||
private CheckDriverIsEncryptedBody data; | ||
|
||
@Override | ||
public TestkitResponse process( TestkitState testkitState ) | ||
{ | ||
return createResponse( testkitState ); | ||
} | ||
|
||
@Override | ||
public CompletionStage<TestkitResponse> processAsync( TestkitState testkitState ) | ||
{ | ||
return CompletableFuture.completedFuture( createResponse( testkitState ) ); | ||
} | ||
|
||
@Override | ||
public Mono<TestkitResponse> processRx( TestkitState testkitState ) | ||
{ | ||
return Mono.just( createResponse( testkitState ) ); | ||
} | ||
|
||
private DriverIsEncrypted createResponse( TestkitState testkitState ) | ||
{ | ||
DriverHolder driverHolder = testkitState.getDriverHolder( data.getDriverId() ); | ||
return DriverIsEncrypted.builder() | ||
.data( DriverIsEncrypted.DriverIsEncryptedBody.builder().encrypted( driverHolder.getDriver().isEncrypted() ).build() ) | ||
.build(); | ||
} | ||
|
||
@Setter | ||
@Getter | ||
public static class CheckDriverIsEncryptedBody | ||
{ | ||
private String driverId; | ||
} | ||
} |
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
42 changes: 42 additions & 0 deletions
42
...backend/src/main/java/neo4j/org/testkit/backend/messages/responses/DriverIsEncrypted.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,42 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* 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 neo4j.org.testkit.backend.messages.responses; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class DriverIsEncrypted implements TestkitResponse | ||
{ | ||
private final DriverIsEncryptedBody data; | ||
|
||
@Override | ||
public String testkitName() | ||
{ | ||
return "DriverIsEncrypted"; | ||
} | ||
|
||
@Getter | ||
@Builder | ||
public static class DriverIsEncryptedBody | ||
{ | ||
private final boolean encrypted; | ||
} | ||
} |