Package nginx.clojure.wave

Examples of nginx.clojure.wave.MethodDatabase


        msgs.add("Method "+className+"#t_join2(Ljava/lang/Thread;)V contains potentially blocking call to java/lang/Thread#join(J)V");
        msgs.add("Method "+className+"#t_join3(Ljava/lang/Thread;)V contains potentially blocking call to java/lang/Thread#join(JI)V");
        msgs.add("Method "+className+"#t_lock1(Ljava/util/concurrent/locks/Lock;)V contains potentially blocking call to java/util/concurrent/locks/Lock#lock()V");
        msgs.add("Method "+className+"#t_lock2(Ljava/util/concurrent/locks/Lock;)V contains potentially blocking call to java/util/concurrent/locks/Lock#lockInterruptibly()V");
       
        MethodDatabase db = new MethodDatabase(BlockingTest.class.getClassLoader());
        MethodDatabaseUtil.load(db, "nginx/clojure/wave/coroutine-method-db.txt");
        db.setAllowBlocking(true);
        db.setLog(new TinyLogService() {
          @Override
          public void warn(String message, Object ...args) {
            message = String.format(Locale.ENGLISH, message, args);
                assertTrue("Unexpected message: " + message, msgs.remove(message));
          }
View Full Code Here


public class MethodDatabaseUtilTest {


  @Test
  public void testLoad() throws IOException {
    MethodDatabase db = new MethodDatabase(Thread.currentThread().getContextClassLoader());
    MethodDatabaseUtil.load(db, "nginx/clojure/wave/test-coroutine-method-db.txt");
    ClassEntry ce = db.getClasses().get("java/lang/Thread");
    assertEquals(MethodDatabase.SUSPEND_BLOCKING, ce.check("sleep", "(J)V"));
    assertEquals(MethodDatabase.SUSPEND_BLOCKING, ce.check("sleep", "(JI)V"));
    assertEquals(MethodDatabase.SUSPEND_BLOCKING, ce.check("join", "()V"));
   
   
    ce = db.getClasses().get("java/lang/Object");
    assertEquals(MethodDatabase.SUSPEND_BLOCKING, ce.check("wait", "(J)V"));
    assertEquals(MethodDatabase.SUSPEND_BLOCKING, ce.check("wait", "()V"));
    assertEquals(MethodDatabase.SUSPEND_BLOCKING, ce.check("wait", "(JI)V"));
    assertNull(ce.check("test-unknown-method", "()V"));
   
    ce = db.getClasses().get("clojure/lang/IFn");
    assertEquals(MethodDatabase.SUSPEND_FAMILY, ce.check("invoke", "()Ljava/lang/Object;"));
   
    ClassEntry mce = MethodDatabaseUtil.buildClassEntryFamily(db, Type.getInternalName(MyAF.class));
    assertEquals(MethodDatabase.SUSPEND_FAMILY, db.checkMethodSuspendType(Type.getInternalName(MyAF.class), "invoke()Ljava/lang/Object;", true));
   
  }
View Full Code Here

   
  }
 
 
  public void testLazyAndFuzzyClass() throws IOException {
    MethodDatabase db = new MethodDatabase(Thread.currentThread().getContextClassLoader());
    MethodDatabaseUtil.load(db, "nginx/clojure/wave/test-coroutine-and-compojure-db.txt");
    ClassEntry sce = MethodDatabaseUtil.buildClassEntryFamily(db, "nginx/clojure/net/SimpleHandler4TestNginxClojureSocket");
    assertEquals(MethodDatabase.SUSPEND_NORMAL, sce.check("invoke(Ljava/lang/Object;)Ljava/lang/Object;"));
  }
View Full Code Here

    }
  }
 
  @Test
  public void testBuildClassEntryFamily() throws IOException {
    MethodDatabase db = new MethodDatabase(Thread.currentThread().getContextClassLoader());
    MethodDatabaseUtil.load(db, "nginx/clojure/wave/coroutine-method-db.txt");
    ClassEntry ce = MethodDatabaseUtil.buildClassEntryFamily(db, "nginx/clojure/CatchTest");
    assertEquals(MethodDatabase.SUSPEND_NONE, ce.check("testCatch", "()V"));
    assertEquals(MethodDatabase.SUSPEND_NORMAL, ce.check("run", "()V"));
   
   
   
    ClassEntry ifnce = MethodDatabaseUtil.buildClassEntryFamily(db, Type.getInternalName(MyAF.class));
    assertEquals(MethodDatabase.SUSPEND_FAMILY, db.checkMethodSuspendType(Type.getInternalName(MyAF.class),"invoke()Ljava/lang/Object;", true));
  }
View Full Code Here

TOP

Related Classes of nginx.clojure.wave.MethodDatabase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.