@Test public void testSubmit() { IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24"); Intent intent = intentBuilder(prefix, "00:00:00:00:00:01", SW1_ETH1); intentService.submit(intent); expect(intentService.getIntents()).andReturn(Collections.emptyList()) .anyTimes(); replay(intentService); intentSynchronizer.modifyPrimary(true); intentSynchronizer.submit(intent); verify(intentService); reset(intentService); replay(intentService); intentSynchronizer.modifyPrimary(false); intentSynchronizer.submit(intent); verify(intentService); }
@Override public void submit(Intent intent) { synchronized (this) { intents.put(intent.key(), intent); if (isElectedLeader && isActivatedLeader) { log.trace("Submitting intent: {}", intent); intentService.submit(intent); } } }
IntentSynchronizer implements IntentSynchronizationService,
        IntentSynchronizationAdminService { @Override public void submit(Intent intent) { synchronized (this) { intents.put(intent.key(), intent); if (isElectedLeader && isActivatedLeader) { log.trace("Submitting intent: {}", intent); intentService.submit(intent); } } } }
IntentSynchronizer implements IntentSynchronizationService,
        IntentSynchronizationAdminService { @Override public void submit(Intent intent) { synchronized (this) { intents.put(intent.key(), intent); if (isElectedLeader && isActivatedLeader) { log.trace("Submitting intent: {}", intent); intentService.submit(intent); } } }  }
IntentSynchronizer implements IntentSynchronizationService,
        IntentSynchronizationAdminService { @Override public void submit(Intent intent) { synchronized (this) { intents.put(intent.key(), intent); if (isElectedLeader && isActivatedLeader) { log.trace("Submitting intent: {}", intent); intentService.submit(intent); } } }  @Activate void activate(); @Deactivate void deactivate(); @Override void removeIntents(); @Override void removeIntentsByAppId(ApplicationId appId); @Override void submit(Intent intent); @Override void withdraw(Intent intent); @Override void modifyPrimary(boolean isPrimary); }
IntentSynchronizer implements IntentSynchronizationService,
        IntentSynchronizationAdminService { @Override public void submit(Intent intent) { synchronized (this) { intents.put(intent.key(), intent); if (isElectedLeader && isActivatedLeader) { log.trace("Submitting intent: {}", intent); intentService.submit(intent); } } }  @Activate void activate(); @Deactivate void deactivate(); @Override void removeIntents(); @Override void removeIntentsByAppId(ApplicationId appId); @Override void submit(Intent intent); @Override void withdraw(Intent intent); @Override void modifyPrimary(boolean isPrimary);  }