-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix : Add
io.fabric8.zjsonpatch.Json*
classes for backward compatib…
…ility After migrating to upstream zjsonpatch dependency, KubernetesMutationHookHandlingTest started failing. Upon checking the failures I found that this module depends on Java Operator SDK that also uses zjsonpatch library to calculate JSON diff from KubernetesClient. Adding back the `io.fabric8.zjsonpatch.JsonDiff` and `io.fabric8.zjsonpatch.JsonPatch` classes. Signed-off-by: Rohan Kumar <[email protected]>
- Loading branch information
1 parent
23f3ea0
commit ee93287
Showing
5 changed files
with
76 additions
and
1 deletion.
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
27 changes: 27 additions & 0 deletions
27
zjsonpatch/src/main/java/io/fabric8/zjsonpatch/JsonDiff.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,27 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.zjsonpatch; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
public class JsonDiff { | ||
private JsonDiff() { | ||
} | ||
|
||
public static JsonNode asJson(final JsonNode source, final JsonNode target) { | ||
return com.flipkart.zjsonpatch.JsonDiff.asJson(source, target); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
zjsonpatch/src/main/java/io/fabric8/zjsonpatch/JsonPatch.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,45 @@ | ||
/* | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* 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 io.fabric8.zjsonpatch; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.flipkart.zjsonpatch.CompatibilityFlags; | ||
import com.flipkart.zjsonpatch.InvalidJsonPatchException; | ||
import com.flipkart.zjsonpatch.JsonPatchApplicationException; | ||
|
||
import java.util.EnumSet; | ||
|
||
public class JsonPatch { | ||
private JsonPatch() { | ||
} | ||
|
||
public static void validate(JsonNode patch, EnumSet<CompatibilityFlags> flags) throws InvalidJsonPatchException { | ||
com.flipkart.zjsonpatch.JsonPatch.validate(patch, flags); | ||
} | ||
|
||
public static void validate(JsonNode patch) throws InvalidJsonPatchException { | ||
com.flipkart.zjsonpatch.JsonPatch.validate(patch, CompatibilityFlags.defaults()); | ||
} | ||
|
||
public static JsonNode apply(JsonNode patch, JsonNode source, EnumSet<CompatibilityFlags> flags) | ||
throws JsonPatchApplicationException { | ||
return com.flipkart.zjsonpatch.JsonPatch.apply(patch, source, flags); | ||
} | ||
|
||
public static JsonNode apply(JsonNode patch, JsonNode source) throws JsonPatchApplicationException { | ||
return apply(patch, source, CompatibilityFlags.defaults()); | ||
} | ||
} |
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