Package org.nutz.ioc.loader.json

Examples of org.nutz.ioc.loader.json.JsonLoader


    if (null == nut) {
      synchronized (Nutzs.class) {
        nut = nuts.get(key);
        try {
          if (null == nut) {
            nut = new NutIoc(new JsonLoader(key));
            nuts.put(key, nut);
          }
        }
        catch (Exception e) {
          throw Lang.wrapThrow(e);
View Full Code Here


    assertEquals(0, f.getDeposeTime());
  }

  @Test
  public void test_event_from_parent() {
    Ioc ioc = new NutIoc(new JsonLoader("org/nutz/ioc/json/events.js"));
    Animal f = ioc.get(Animal.class, "fox");
    assertEquals(1, f.getCreateTime());
    assertEquals(1, f.getFetchTime());
    assertEquals(0, f.getDeposeTime());
View Full Code Here

public class AopJsonIocTest {

  @Test
  public void test_simple() {
    IocLoader il = new JsonLoader("org/nutz/ioc/json/aop.js");
    Ioc ioc = new NutIoc(il);
    StringBuilder sb = ioc.get(StringBuilder.class, "sb");
    Mammal fox = ioc.get(Mammal.class, "fox");

    assertEquals("Fox", fox.getName());
View Full Code Here

    assertTrue(f == f.getAnother());
  }

  @Test
  public void test_null_json_file() {
    IocLoader loader = new JsonLoader("org/nutz/ioc/json/empty.js");
    Ioc ioc = new NutIoc(loader);
    assertEquals(0, ioc.getNames().length);
  }
View Full Code Here

    ioc.get(Animal.class, "f3");
  }

  @Test
  public void test_load_from_dir() throws ObjectLoadException {
    IocLoader loader = new JsonLoader("org/nutz/ioc/json/");
    assertTrue(loader.getName().length > 0);
  }
View Full Code Here

    assertTrue(loader.getName().length > 0);
  }

  @Test
  public void test_load_from_reader() throws ObjectLoadException {
    IocLoader loader = new JsonLoader(Streams.fileInr("org/nutz/ioc/json/main.js"));
    assertTrue(loader.getName().length > 0);
  }
View Full Code Here

import org.nutz.mvc.NutConfig;

public class JsonIocProvider implements IocProvider {

  public Ioc create(NutConfig config, String[] args) {
    return new NutIoc(new JsonLoader(args), new ScopeContext("app"), "app");
  }
View Full Code Here

public class JsonAopConfigrationTest {

  @Test
  public void test_jsonAop(){
    Ioc ioc = new NutIoc(new JsonLoader("org/nutz/ioc/aop/config/impl/jsonfile-aop.js"));
    Assert.assertTrue(ioc.getNames().length > 0);
    for (String name : ioc.getNames()) {
      ioc.get(null, name);
    }
    MyMI mi = ioc.get(MyMI.class, "myMI");
View Full Code Here

public class AopJsonIocTest {

    @Test
    public void test_simple() {
        IocLoader il = new JsonLoader("org/nutz/ioc/json/aop.js");
        Ioc ioc = new NutIoc(il);
        StringBuilder sb = ioc.get(StringBuilder.class, "sb");
        Mammal fox = ioc.get(Mammal.class, "fox");

        assertEquals("Fox", fox.getName());
View Full Code Here

import org.nutz.lang.Lang;

public class PojoTest {

  public static void main(String[] args) {
    IocLoader loader = new JsonLoader("ioc.js");
    Ioc ioc = new NutIoc(loader);
    Pet pet = ioc.get(Pet.class, "pet");
    System.out.println(pet.getName());
  }
View Full Code Here

TOP

Related Classes of org.nutz.ioc.loader.json.JsonLoader

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.