Skip to content

Commit

Permalink
Fix examples not loading client.json5
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarian2 committed Sep 6, 2024
1 parent 9513fe2 commit ba5ee92
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cfg/client.json5
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@

// Predefined delivery routes to use instead of MX and port.
routes: [
{
name: "local",
mx: [
"127.0.0.1"
],
port: 25
},

{
name: "com",
mx: [
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/cases/ExampleHttp.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
package cases;

import com.mimecast.robin.assertion.AssertException;
import com.mimecast.robin.main.Foundation;
import com.mimecast.robin.main.RequestClient;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import javax.naming.ConfigurationException;
import java.io.IOException;

public class ExampleHttp {

@BeforeAll
static void before() throws ConfigurationException {
Foundation.init("cfg/");
}

/**
* JSON example of a test with a DELETE request.
* <p>Navigate to https://requestcatcher.com to debug.
Expand Down
10 changes: 9 additions & 1 deletion src/test/java/cases/ExampleProgramatic.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
import com.mimecast.robin.config.assertion.AssertConfig;
import com.mimecast.robin.config.client.RouteConfig;
import com.mimecast.robin.main.Config;
import com.mimecast.robin.main.Foundation;
import com.mimecast.robin.mime.EmailBuilder;
import com.mimecast.robin.mime.parts.FileMimePart;
import com.mimecast.robin.mime.parts.TextMimePart;
import com.mimecast.robin.smtp.EmailDelivery;
import com.mimecast.robin.smtp.MessageEnvelope;
import com.mimecast.robin.smtp.session.Session;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import javax.naming.ConfigurationException;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileOutputStream;
Expand All @@ -23,6 +26,11 @@

public class ExampleProgramatic {

@BeforeAll
static void before() throws ConfigurationException {
Foundation.init("cfg/");
}

/**
* Programmatic example of a case.
*/
Expand Down Expand Up @@ -65,7 +73,7 @@ void programmaticUsage() throws AssertException, IOException {
.setDelay(5)
.setEhlo("dynamic.test");

RouteConfig route = Config.getClient().getRoute("dev");
RouteConfig route = Config.getClient().getRoute("local");
session.setMx(route.getMx())
.setPort(route.getPort())
.setAuth(route.isAuth())
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/cases/ExampleSend.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

import com.mimecast.robin.assertion.AssertException;
import com.mimecast.robin.main.Client;
import com.mimecast.robin.main.Foundation;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import javax.naming.ConfigurationException;
import java.io.IOException;

public class ExampleSend {

@BeforeAll
static void before() throws ConfigurationException {
Foundation.init("cfg/");
}

/**
* JSON example of a basic test that sends an eml file.
*/
Expand Down

0 comments on commit ba5ee92

Please sign in to comment.