Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
puneetkhanduri committed Nov 2, 2022
1 parent 6a58c9c commit afda4af
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/features/overrides/editor/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function CodeEditor() {
color="inherit"
aria-label="save"
onClick={
()=>selectedEdge && updateOverride({injectionPoint: selectedEdge, transformationJs: currentTxJs})
()=>selectedEdge && updateOverride({injectionPoint: selectedEdge, transformationJs: currentTxJs || '(request)=>(request)'})
.then(() => {
dispatch(setTransformationJs(undefined));
dispatch(openAlert(`Save success. Transformation will be applied to ${selectedEdge}.`));
Expand Down
15 changes: 15 additions & 0 deletions src/test/scala/ai/diffy/functional/algebra/BijectionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ai.diffy.functional.algebra;

public class BijectionTest {
public static void main(String[] args) {
Bijection<String, String> identity = Bijection.of(String::toUpperCase, String::toLowerCase);
try {
identity.apply("s");
identity.unapply("s");
String x = identity.wrap(str -> str+str).apply("lower");
System.out.println(x);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
}
19 changes: 19 additions & 0 deletions src/test/scala/ai/diffy/interpreter/SimpleTransformerTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package ai.diffy.interpreter;

public class SimpleTransformerTest {
public static class Name{
public String first;
public String last;
}
public static void main(String[] args) {
try {
Name name = new Name();
name.first = "Puneet";
name.last = "Khanduri";
Transformer<Name> transformer = new Transformer<>(Name.class, "(name)=>{console.log(JSON.stringify(name,null,4)); return name;}");
transformer.apply(name);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.HashMap;
import java.util.Map;

public class TxTest {
public class TransformerTest {
public static void main(String [] args) {
try {
Source tx = Source.newBuilder("js", new File("src/test/scala/ai/diffy/interpreter/transform.js")).build();
Expand All @@ -22,7 +22,7 @@ public static void main(String [] args) {
System.out.println("All done!");
System.out.println("\n\nHere's the original:\n"+request);
System.out.println("\n\nHere's the transformed:\n"+transformed);
} catch (Exception e) {
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
Expand Down
14 changes: 14 additions & 0 deletions src/test/scala/ai/diffy/proxy/ReactorHttpDifferenceProxyTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package ai.diffy.proxy;

import reactor.core.publisher.Mono;

import java.util.concurrent.CompletableFuture;

public class ReactorHttpDifferenceProxyTest {
public static void main(String[] args) {
Mono.fromFuture(CompletableFuture.failedFuture(new RuntimeException()))
.doOnError(t -> System.out.println("error"))
.block()
;
}
}

0 comments on commit afda4af

Please sign in to comment.