Search in sources :

Example 1 with Method

use of com.dexels.navajo.document.Method in project navajo by Dexels.

the class TestNavajo method testAddMethod.

@Test
public void testAddMethod() {
    Method m = NavajoFactory.getInstance().createMethod(testDoc, "mymethod", "Postman");
    testDoc.addMethod(m);
    Method result = testDoc.getMethod("mymethod");
    Assert.assertNotNull(result);
    Assert.assertEquals("mymethod", result.getName());
    Assert.assertEquals("Postman", result.getServer());
}
Also used : Method(com.dexels.navajo.document.Method) Test(org.junit.Test)

Example 2 with Method

use of com.dexels.navajo.document.Method in project navajo by Dexels.

the class TestOperation method testOperation.

@Test
public void testOperation() {
    NavajoFactory f = NavajoFactory.getInstance();
    Navajo n = f.createNavajo();
    Message msg = f.createMessage(n, "__Mongo__");
    Operation o = f.createOperation(n, "PUT", "vla/ProcessInsertPerson", null, "Person", null);
    n.addOperation(o);
    o.setExtraMessage(msg);
    Method m = f.createMethod(n, "vla/ProcessUpdatePerson", null);
    m.addRequired("Apenoot");
    n.addMethod(m);
    n.write(System.err);
}
Also used : NavajoFactory(com.dexels.navajo.document.NavajoFactory) Message(com.dexels.navajo.document.Message) Navajo(com.dexels.navajo.document.Navajo) Operation(com.dexels.navajo.document.Operation) Method(com.dexels.navajo.document.Method) Test(org.junit.Test)

Example 3 with Method

use of com.dexels.navajo.document.Method in project navajo by Dexels.

the class VersionedNavajoMap method main.

public static void main(String[] args) throws Exception {
    Navajo n = NavajoFactory.getInstance().createNavajo(new java.io.FileInputStream("/home/arjen/@@.tml"));
    n.write(System.err);
    List<Method> l = n.getAllMethods();
    logger.debug("l = " + l.size());
    System.exit(1);
}
Also used : Navajo(com.dexels.navajo.document.Navajo) Method(com.dexels.navajo.document.Method)

Example 4 with Method

use of com.dexels.navajo.document.Method in project navajo by Dexels.

the class BaseMethodsImpl method getAllMethods.

public List<Method> getAllMethods() {
    List<Method> al = new ArrayList<Method>();
    for (int i = 0; i < myMethods.size(); i++) {
        Method m = (Method) myMethods.get(i);
        al.add(m);
    }
    return al;
}
Also used : ArrayList(java.util.ArrayList) Method(com.dexels.navajo.document.Method)

Example 5 with Method

use of com.dexels.navajo.document.Method in project navajo by Dexels.

the class BaseNavajoImpl method copy.

@Override
public Navajo copy() {
    Navajo ni = NavajoFactory.getInstance().createNavajo();
    BaseNavajoImpl n = (BaseNavajoImpl) ni;
    List<Message> al = getAllMessages();
    for (int i = 0; i < al.size(); i++) {
        Message m = al.get(i);
        Message m2 = copyMessage(m, n);
        n.addMessage(m2);
    }
    List<Method> mm = myMethods.getAllMethods();
    for (int i = 0; i < mm.size(); i++) {
        Method m = mm.get(i);
        Method m2 = m.copy(n);
        n.addMethod(m2);
    }
    List<Operation> oo = myOperations.getAllOperations();
    for (Operation o : oo) {
        Operation o2 = o.copy(n);
        n.addOperation(o2);
    }
    if (getHeader() != null) {
        ni.addHeader(getHeader().copy(ni));
    }
    return n;
}
Also used : Message(com.dexels.navajo.document.Message) Navajo(com.dexels.navajo.document.Navajo) Method(com.dexels.navajo.document.Method) Operation(com.dexels.navajo.document.Operation)

Aggregations

Method (com.dexels.navajo.document.Method)6 Navajo (com.dexels.navajo.document.Navajo)4 Message (com.dexels.navajo.document.Message)3 Operation (com.dexels.navajo.document.Operation)2 Test (org.junit.Test)2 NavajoException (com.dexels.navajo.document.NavajoException)1 NavajoFactory (com.dexels.navajo.document.NavajoFactory)1 Property (com.dexels.navajo.document.Property)1 UserException (com.dexels.navajo.script.api.UserException)1 ArrayList (java.util.ArrayList)1