예제 #1
0
  @Before
  public void setUp() throws Exception {
    idGenerator = new TestIdGenerator();
    Intent.bindIdGenerator(idGenerator);

    applicationService = createMock(ApplicationService.class);

    coreService = createMock(CoreService.class);
    expect(coreService.registerApplication(APP_NAME)).andReturn(APPID);
    replay(coreService);

    hostsAvailable = Sets.newHashSet();
    hostService = new TestHostService(hostsAvailable);

    intentService = new TestIntentService();

    TestIntentSynchronizer intentSynchronizer = new TestIntentSynchronizer(intentService);

    interfaceService = createMock(InterfaceService.class);
    interfaceService.addListener(anyObject(InterfaceListener.class));
    expectLastCall().anyTimes();
    addIntfConfig();

    vpls = new Vpls();
    vpls.applicationService = applicationService;
    vpls.coreService = coreService;
    vpls.hostService = hostService;
    vpls.intentService = intentService;
    vpls.interfaceService = interfaceService;
    vpls.intentSynchronizer = intentSynchronizer;
  }
예제 #2
0
  @Before
  public void setUp() {
    service = new MockIntentService();
    store = new SimpleIntentStore();
    cleanup = new IntentCleanup();
    idGenerator = new MockIdGenerator();

    cleanup.cfgService = new ComponentConfigAdapter();
    cleanup.service = service;
    cleanup.store = store;
    cleanup.period = 10;
    cleanup.retryThreshold = 3;
    cleanup.activate();

    assertTrue("store should be empty", Sets.newHashSet(cleanup.store.getIntents()).isEmpty());

    Intent.bindIdGenerator(idGenerator);
  }