org.onosproject.core.CoreService Java Examples
The following examples show how to use
org.onosproject.core.CoreService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpticalOduIntentCompilerTest.java From onos with Apache License 2.0 | 6 votes |
@Before public void setUp() { AbstractProjectableModel.setDriverService(null, new MockDriverService()); sut = new OpticalOduIntentCompiler(); coreService = createMock(CoreService.class); expect(coreService.registerApplication("org.onosproject.net.intent")) .andReturn(appId); sut.coreService = coreService; sut.deviceService = new MockDeviceService(); sut.resourceService = new MockResourceService(); sut.topologyService = new MockTopologyService(); super.setUp(); intentExtensionService = createMock(IntentExtensionService.class); intentExtensionService.registerCompiler(OpticalOduIntent.class, sut); intentExtensionService.unregisterCompiler(OpticalOduIntent.class); sut.intentManager = intentExtensionService; replay(coreService, intentExtensionService); }
Example #2
Source File: IntentsResourceTest.java From onos with Apache License 2.0 | 6 votes |
/** * Initializes test mocks and environment. */ @Before public void setUpTest() { expect(mockIntentService.getIntents()).andReturn(intents).anyTimes(); expect(mockIntentService.getIntentState(anyObject())) .andReturn(IntentState.INSTALLED) .anyTimes(); // Register the services needed for the test final CodecManager codecService = new CodecManager(); codecService.activate(); ServiceDirectory testDirectory = new TestServiceDirectory() .add(IntentService.class, mockIntentService) .add(FlowRuleService.class, mockFlowService) .add(CodecService.class, codecService) .add(CoreService.class, mockCoreService); setServiceDirectory(testDirectory); MockIdGenerator.cleanBind(); }
Example #3
Source File: IntentsWebResource.java From onos with Apache License 2.0 | 6 votes |
/** * Gets intent installables by application ID and key. * @param appId application identifier * @param key intent key * * @return 200 OK with array of the intent installables * @onos.rsModel Intents */ @GET @Produces(MediaType.APPLICATION_JSON) @Path("installables/{appId}/{key}") public Response getIntentWithInstallable(@PathParam("appId") String appId, @PathParam("key") String key) { final IntentService intentService = get(IntentService.class); final ApplicationId app = get(CoreService.class).getAppId(appId); nullIsNotFound(app, APP_ID_NOT_FOUND); Intent intent = intentService.getIntent(Key.of(key, app)); if (intent == null) { long numericalKey = Long.decode(key); intent = intentService.getIntent(Key.of(numericalKey, app)); } nullIsNotFound(intent, INTENT_NOT_FOUND); final Iterable<Intent> installables = intentService.getInstallableIntents(intent.key()); final ObjectNode root = encodeArray(Intent.class, "installables", installables); return ok(root).build(); }
Example #4
Source File: PacketManager.java From onos with Apache License 2.0 | 6 votes |
@Activate public void activate() { eventHandlingExecutor = Executors.newSingleThreadExecutor( groupedThreads("onos/net/packet", "event-handler", log)); localNodeId = clusterService.getLocalNode().id(); appId = coreService.getAppId(CoreService.CORE_APP_NAME); store.setDelegate(delegate); deviceService.addListener(deviceListener); defaultProvider.init(deviceService); store.existingRequests().forEach(request -> { if (request.deviceId().isPresent()) { Device device = deviceService.getDevice(request.deviceId().get()); if (device != null) { pushRule(device, request); } else { log.info("Device is not ready yet; not processing packet request {}", request); } } else { pushToAllDevices(request); } }); log.info("Started"); }
Example #5
Source File: OplinkSwitchProtection.java From onos with Apache License 2.0 | 6 votes |
private void addFlow(PortNumber workingPort) { // set working port as flow's input port TrafficSelector selector = DefaultTrafficSelector.builder() .matchInPort(workingPort) .build(); // the flow's output port is always the clinet port TrafficTreatment treatment = DefaultTrafficTreatment.builder() .setOutput(PortNumber.portNumber(CLIENT_PORT)) .build(); FlowRule flowRule = DefaultFlowRule.builder() .forDevice(data().deviceId()) .fromApp(handler().get(CoreService.class).getAppId(APP_ID)) .withPriority(FLOWRULE_PRIORITY) .withSelector(selector) .withTreatment(treatment) .makePermanent() .build(); // install flow rule handler().get(FlowRuleService.class).applyFlowRules(flowRule); }
Example #6
Source File: FlowTableConfigTest.java From onos with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { directory.add(CoreService.class, new CoreServiceAdapter() { @Override public ApplicationId getAppId(Short id) { return APP_ID; } @Override public ApplicationId registerApplication(String name) { return APP_ID; } }); mapper = testFriendlyMapper(); JsonNode sample = loadJsonFromResource(SAMPLE, mapper); cfgnode = sample.path("devices") .path(DID.toString()) .path(FlowTableConfig.CONFIG_KEY); }
Example #7
Source File: OpticalIntentsWebResource.java From onos with Apache License 2.0 | 6 votes |
/** * Delete the specified optical intent. * * @param appId application identifier * @param keyString intent key * @return 204 NO CONTENT */ @DELETE @Consumes(MediaType.APPLICATION_JSON) @Path("{appId}/{key}") public Response deleteIntent(@PathParam("appId") String appId, @PathParam("key") String keyString) { final ApplicationId app = get(CoreService.class).getAppId(appId); nullIsNotFound(app, "Application Id not found"); IntentService intentService = get(IntentService.class); Intent intent = intentService.getIntent(Key.of(keyString, app)); if (intent == null) { intent = intentService.getIntent(Key.of(Long.decode(keyString), app)); } nullIsNotFound(intent, "Intent Id is not found"); if ((intent instanceof OpticalConnectivityIntent) || (intent instanceof OpticalCircuitIntent)) { intentService.withdraw(intent); } else { throw new IllegalArgumentException("Specified intent is not of type OpticalConnectivityIntent"); } return Response.noContent().build(); }
Example #8
Source File: LinkDiscoveryProviderTest.java From onos with Apache License 2.0 | 6 votes |
@Before public void setUp() { coreService = createMock(CoreService.class); expect(coreService.registerApplication(appId.name())) .andReturn(appId).anyTimes(); replay(coreService); provider.coreService = coreService; provider.providerRegistry = linkRegistry; provider.deviceService = deviceService; provider.mastershipService = mastershipService; provider.linkService = linkService; provider.cfgService = new ComponentConfigAdapter(); AbstractProjectableModel.setDriverService(null, new DriverServiceAdapter()); provider.activate(null); providerService = linkRegistry.registeredProvider(); }
Example #9
Source File: HostLocationProviderTest.java From onos with Apache License 2.0 | 6 votes |
@Before public void setUp() { coreService = createMock(CoreService.class); expect(coreService.registerApplication(appId.name())) .andReturn(appId).anyTimes(); replay(coreService); provider.cfgService = new ComponentConfigAdapter(); provider.coreService = coreService; provider.providerRegistry = hostRegistry; provider.topologyService = topoService; provider.packetService = packetService; provider.deviceService = deviceService; provider.hostService = hostService; provider.interfaceService = interfaceService; provider.registry = registryAdapter; provider.netcfgService = netcfgService; provider.activate(CTX_FOR_NO_REMOVE); provider.deviceEventHandler = MoreExecutors.newDirectExecutorService(); }
Example #10
Source File: PacketRequestCodec.java From onos with Apache License 2.0 | 6 votes |
@Override public PacketRequest decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } final JsonCodec<TrafficSelector> trafficSelectorCodec = context.codec(TrafficSelector.class); TrafficSelector trafficSelector = trafficSelectorCodec.decode( get(json, TRAFFIC_SELECTOR), context); NodeId nodeId = NodeId.nodeId(extractMember(NODE_ID, json)); PacketPriority priority = PacketPriority.valueOf(extractMember(PRIORITY, json)); CoreService coreService = context.getService(CoreService.class); // TODO check appId (currently hardcoded - should it be read from json node?) ApplicationId appId = coreService.registerApplication(REST_APP_ID); DeviceId deviceId = null; JsonNode node = json.get(DEVICE_ID); if (node != null) { deviceId = DeviceId.deviceId(node.asText()); } return new DefaultPacketRequest(trafficSelector, priority, appId, nodeId, Optional.ofNullable(deviceId)); }
Example #11
Source File: FlowsListCommand.java From onos with Apache License 2.0 | 6 votes |
/** * Removes the flows passed as argument after confirmation is provided * for each of them. * If no explicit confirmation is provided, the flow is not removed. * * @param flows list of flows to remove * @param flowService FlowRuleService object * @param coreService CoreService object */ public void removeFlowsInteractive(Iterable<FlowEntry> flows, FlowRuleService flowService, CoreService coreService) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); flows.forEach(flow -> { ApplicationId appId = coreService.getAppId(flow.appId()); System.out.print(String.format("Id=%s, AppId=%s. Remove? [y/N]: ", flow.id(), appId != null ? appId.name() : "<none>")); String response; try { response = br.readLine(); response = response.trim().replace("\n", ""); if ("y".equals(response)) { flowService.removeFlowRules(flow); } } catch (IOException e) { response = ""; } print(response); }); }
Example #12
Source File: FlowsListCommand.java From onos with Apache License 2.0 | 6 votes |
/** * Prints flows. * * @param d the device * @param flows the set of flows for that device * @param coreService core system service */ protected void printFlows(Device d, List<FlowEntry> flows, CoreService coreService) { List<FlowEntry> filteredFlows = filterFlows(flows); boolean empty = filteredFlows == null || filteredFlows.isEmpty(); print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : filteredFlows.size()); if (empty || countOnly) { return; } for (FlowEntry f : filteredFlows) { if (shortOutput) { print(SHORT_FORMAT, f.state(), f.bytes(), f.packets(), f.table(), f.priority(), f.selector().criteria(), printTreatment(f.treatment())); } else { ApplicationId appId = coreService.getAppId(f.appId()); print(LONG_FORMAT, Long.toHexString(f.id().value()), f.state(), f.bytes(), f.packets(), f.life(), f.liveType(), f.priority(), f.table(), appId != null ? appId.name() : "<none>", f.selector().criteria(), f.treatment()); } } }
Example #13
Source File: VirtualNetworkHostManagerTest.java From onos with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { virtualNetworkManagerStore = new DistributedVirtualNetworkStore(); CoreService coreService = new TestCoreService(); TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService); TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService()); virtualNetworkManagerStore.activate(); manager = new VirtualNetworkManager(); manager.store = virtualNetworkManagerStore; manager.coreService = coreService; NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher()); testDirectory = new TestServiceDirectory(); TestUtils.setField(manager, "serviceDirectory", testDirectory); manager.activate(); }
Example #14
Source File: VirtualNetworkFlowRuleManager.java From onos with Apache License 2.0 | 6 votes |
/** * Creates a new VirtualNetworkFlowRuleService object. * * @param virtualNetworkManager virtual network manager service * @param networkId a virtual network identifier */ public VirtualNetworkFlowRuleManager(VirtualNetworkService virtualNetworkManager, NetworkId networkId) { super(virtualNetworkManager, networkId, FlowRuleEvent.class); store = serviceDirectory.get(VirtualNetworkFlowRuleStore.class); idGenerator = serviceDirectory.get(CoreService.class) .getIdGenerator(VIRTUAL_FLOW_OP_TOPIC + networkId().toString()); providerRegistryService = serviceDirectory.get(VirtualProviderRegistryService.class); innerProviderService = new InternalFlowRuleProviderService(); providerRegistryService.registerProviderService(networkId(), innerProviderService); this.deviceService = manager.get(networkId, DeviceService.class); this.storeDelegate = new InternalStoreDelegate(); store.setDelegate(networkId, this.storeDelegate); }
Example #15
Source File: OpticalPathIntentCompilerTest.java From onos with Apache License 2.0 | 6 votes |
@Before public void setUp() { sut = new OpticalPathIntentCompiler(); coreService = createMock(CoreService.class); expect(coreService.registerApplication("org.onosproject.net.intent")) .andReturn(appId); sut.coreService = coreService; super.setUp(); intent = OpticalPathIntent.builder() .appId(appId) .src(d1p1) .dst(d3p1) .path(new DefaultPath(PID, links, ScalarWeight.toWeight(hops))) .lambda(createLambda()) .signalType(OchSignalType.FIXED_GRID) .build(); intentExtensionService = createMock(IntentExtensionService.class); intentExtensionService.registerCompiler(OpticalPathIntent.class, sut); intentExtensionService.unregisterCompiler(OpticalPathIntent.class); sut.intentManager = intentExtensionService; replay(coreService, intentExtensionService); }
Example #16
Source File: VirtualNetworkPathManagerTest.java From onos with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { virtualNetworkManagerStore = new DistributedVirtualNetworkStore(); CoreService coreService = new TestCoreService(); TestUtils.setField(virtualNetworkManagerStore, "coreService", coreService); TestUtils.setField(virtualNetworkManagerStore, "storageService", new TestStorageService()); virtualNetworkManagerStore.activate(); manager = new VirtualNetworkManager(); manager.store = virtualNetworkManagerStore; manager.coreService = coreService; NetTestTools.injectEventDispatcher(manager, new TestEventDispatcher()); testDirectory = new TestServiceDirectory(); TestUtils.setField(manager, "serviceDirectory", testDirectory); manager.activate(); }
Example #17
Source File: FlowRuleCodecTest.java From onos with Apache License 2.0 | 5 votes |
/** * Sets up for each test. Creates a context and fetches the flow rule * codec. */ @Before public void setUp() { context = new MockCodecContext(); flowRuleCodec = context.codec(FlowRule.class); assertThat(flowRuleCodec, notNullValue()); expect(mockCoreService.registerApplication(FlowRuleCodec.REST_APP_ID)) .andReturn(APP_ID).anyTimes(); expect(mockCoreService.getAppId(anyShort())).andReturn(APP_ID).anyTimes(); replay(mockCoreService); context.registerService(CoreService.class, mockCoreService); }
Example #18
Source File: K8sNetworkCodecTest.java From onos with Apache License 2.0 | 5 votes |
/** * Initial setup for this unit test. */ @Before public void setUp() { context = new MockCodecContext(); k8sNetworkCodec = new K8sNetworkCodec(); assertThat(k8sNetworkCodec, notNullValue()); expect(mockCoreService.registerApplication(REST_APP_ID)) .andReturn(APP_ID).anyTimes(); replay(mockCoreService); context.registerService(CoreService.class, mockCoreService); }
Example #19
Source File: LinkCollectionEncapIntentCompilerTest.java From onos with Apache License 2.0 | 5 votes |
@Before public void setUp() { sut = new LinkCollectionIntentCompiler(); coreService = createMock(CoreService.class); expect(coreService.registerApplication("org.onosproject.net.intent")).andReturn(appId); sut.coreService = coreService; domainService = createMock(DomainService.class); expect(domainService.getDomain(anyObject(DeviceId.class))).andReturn(LOCAL).anyTimes(); sut.domainService = domainService; super.setUp(); intentExtensionService = createMock(IntentExtensionService.class); intentExtensionService.registerCompiler(LinkCollectionIntent.class, sut); intentExtensionService.unregisterCompiler(LinkCollectionIntent.class); registrator = new IntentConfigurableRegistrator(); registrator.extensionService = intentExtensionService; registrator.cfgService = new ComponentConfigAdapter(); registrator.activate(); sut.registrator = registrator; sut.resourceService = new MockResourceService(); LinkCollectionCompiler.optimizeInstructions = false; LinkCollectionCompiler.copyTtl = false; replay(coreService, domainService, intentExtensionService); }
Example #20
Source File: MeterAddCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected void doExecute() { MeterService service = get(MeterService.class); CoreService coreService = get(CoreService.class); DeviceId deviceId = DeviceId.deviceId(uri); checkOptions(); MeterRequest.Builder builder = DefaultMeterRequest.builder() .forDevice(deviceId) .fromApp(coreService.registerApplication(appId)) .withUnit(unit) .withBands(bands); if (isBurst) { builder = builder.burst(); } MeterRequest request = builder.add(); Meter m = service.submit(request); log.info("Requested meter with id {}: {}", m.id().toString(), m.toString()); print("Requested meter with id %s: %s", m.id().toString(), m.toString()); }
Example #21
Source File: ConnectivityIntentCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected ApplicationId appId() { ApplicationId appIdForIntent; if (appId == null) { appIdForIntent = super.appId(); } else { CoreService service = get(CoreService.class); appIdForIntent = service.getAppId(appId); } return appIdForIntent; }
Example #22
Source File: FlowsListCommand.java From onos with Apache License 2.0 | 5 votes |
/** * Returns the list of devices sorted using the device ID URIs. * * @param deviceService device service * @param service flow rule service * @param coreService core service * @return sorted device list */ protected SortedMap<Device, List<FlowEntry>> getSortedFlows(DeviceService deviceService, FlowRuleService service, CoreService coreService) { SortedMap<Device, List<FlowEntry>> flows = new TreeMap<>(Comparators.ELEMENT_COMPARATOR); List<FlowEntry> rules; Iterable<Device> devices = null; if (uri == null) { devices = deviceService.getDevices(); } else { Device dev = deviceService.getDevice(DeviceId.deviceId(uri)); devices = (dev == null) ? deviceService.getDevices() : Collections.singletonList(dev); } for (Device d : devices) { if (predicate.equals(TRUE_PREDICATE)) { rules = newArrayList(service.getFlowEntries(d.id())); } else { rules = newArrayList(); for (FlowEntry f : service.getFlowEntries(d.id())) { if (predicate.test(f)) { rules.add(f); } } } rules.sort(Comparators.FLOW_RULE_COMPARATOR); if (suppressCoreOutput) { short coreAppId = coreService.getAppId("org.onosproject.core").id(); rules = rules.stream() .filter(f -> f.appId() != coreAppId) .collect(Collectors.toList()); } flows.put(d, rules); } return flows; }
Example #23
Source File: ApplicationsWebResource.java From onos with Apache License 2.0 | 5 votes |
/** * Registers an on or off platform application. * * @param name application name * @return 200 OK; 404; 401 * @onos.rsModel ApplicationId */ @POST @Produces(MediaType.APPLICATION_JSON) @Path("{name}/register") public Response registerAppId(@PathParam("name") String name) { CoreService service = get(CoreService.class); ApplicationId appId = service.registerApplication(name); return response(appId); }
Example #24
Source File: OFAgentManagerTest.java From onos with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { ofAgentStore = new DistributedOFAgentStore(); TestUtils.setField(ofAgentStore, "coreService", createMock(CoreService.class)); TestUtils.setField(ofAgentStore, "storageService", new TestStorageService()); TestUtils.setField(ofAgentStore, "eventExecutor", MoreExecutors.newDirectExecutorService()); ofAgentStore.activate(); expect(mockCoreService.registerApplication(anyObject())) .andReturn(APP_ID) .anyTimes(); replay(mockCoreService); expect(mockClusterService.getLocalNode()) .andReturn(LOCAL_NODE) .anyTimes(); replay(mockClusterService); expect(mockLeadershipService.runForLeadership(anyObject())) .andReturn(null) .anyTimes(); mockLeadershipService.addListener(anyObject()); mockLeadershipService.removeListener(anyObject()); mockLeadershipService.withdraw(anyObject()); replay(mockLeadershipService); target = new OFAgentManager(); target.coreService = mockCoreService; target.leadershipService = mockLeadershipService; target.virtualNetService = mockVirtualNetService; target.clusterService = mockClusterService; target.ofAgentStore = ofAgentStore; target.addListener(testListener); target.activate(); }
Example #25
Source File: SummaryCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected void doExecute() { IpAddress nodeIp = get(ClusterService.class).getLocalNode().ip(); Version version = get(CoreService.class).version(); long numNodes = activeNodes(get(ClusterService.class).getNodes()); int numDevices = get(DeviceService.class).getDeviceCount(); int numLinks = get(LinkService.class).getLinkCount(); int numHosts = get(HostService.class).getHostCount(); int numScc = get(TopologyService.class).currentTopology().clusterCount(); int numFlows = get(FlowRuleService.class).getFlowRuleCount(); long numIntents = get(IntentService.class).getIntentCount(); String clusterId = get(ClusterMetadataService.class).getClusterMetadata().getName(); if (outputJson()) { print("%s", new ObjectMapper().createObjectNode() .put("node", nodeIp.toString()) .put("version", version.toString()) .put("clusterId", clusterId) .put("nodes", numNodes) .put("devices", numDevices) .put("links", numLinks) .put("hosts", numHosts) .put("SCC(s)", numScc) .put("flows", numFlows) .put("intents", numIntents)); } else { print("node=%s, version=%s clusterId=%s", nodeIp, version, clusterId); print("nodes=%d, devices=%d, links=%d, hosts=%d, SCC(s)=%s, flows=%d, intents=%d", numNodes, numDevices, numLinks, numHosts, numScc, numFlows, numIntents); } }
Example #26
Source File: FlowsResourceTest.java From onos with Apache License 2.0 | 5 votes |
/** * Sets up the global values for all the tests. */ @Before public void setUpTest() { // Mock device service expect(mockDeviceService.getDevice(deviceId1)) .andReturn(device1); expect(mockDeviceService.getDevice(deviceId2)) .andReturn(device2); expect(mockDeviceService.getDevices()) .andReturn(ImmutableSet.of(device1, device2)); // Mock Core Service expect(mockCoreService.getAppId(anyShort())) .andReturn(NetTestTools.APP_ID).anyTimes(); expect(mockCoreService.getAppId(anyString())) .andReturn(NetTestTools.APP_ID).anyTimes(); expect(mockCoreService.registerApplication(FlowRuleCodec.REST_APP_ID)) .andReturn(APP_ID).anyTimes(); replay(mockCoreService); // Register the services needed for the test final CodecManager codecService = new CodecManager(); codecService.activate(); ServiceDirectory testDirectory = new TestServiceDirectory() .add(FlowRuleService.class, mockFlowService) .add(DeviceService.class, mockDeviceService) .add(CodecService.class, codecService) .add(CoreService.class, mockCoreService) .add(ApplicationService.class, mockApplicationService); setServiceDirectory(testDirectory); }
Example #27
Source File: ApplicationsWebResource.java From onos with Apache License 2.0 | 5 votes |
/** * Gets applicationId entry by either id or name. * * @param id id of application * @param name name of application * @return 200 OK; 404; 401 * @onos.rsModel ApplicationId */ @GET @Produces(MediaType.APPLICATION_JSON) @Path("ids/entry") public Response getAppIdByName(@QueryParam("id") String id, @QueryParam("name") String name) { CoreService service = get(CoreService.class); ApplicationId appId = null; if (id != null) { appId = service.getAppId(Short.valueOf(id)); } else if (name != null) { appId = service.getAppId(name); } return response(appId); }
Example #28
Source File: IntProgrammableImpl.java From onos with Apache License 2.0 | 5 votes |
private boolean setupBehaviour() { deviceId = this.data().deviceId(); flowRuleService = handler().get(FlowRuleService.class); coreService = handler().get(CoreService.class); appId = coreService.getAppId(PIPELINE_APP_NAME); if (appId == null) { log.warn("Application ID is null. Cannot initialize behaviour."); return false; } return true; }
Example #29
Source File: ApplicationIdListCommand.java From onos with Apache License 2.0 | 5 votes |
@Override protected void doExecute() { CoreService service = get(CoreService.class); List<ApplicationId> ids = newArrayList(service.getAppIds()); Collections.sort(ids, Comparators.APP_ID_COMPARATOR); if (outputJson()) { print("%s", json(ids)); } else { for (ApplicationId id : ids) { print("id=%d, name=%s", id.id(), id.name()); } } }
Example #30
Source File: XmppDeviceProviderTest.java From onos with Apache License 2.0 | 5 votes |
@Before public void setUp() throws IOException { coreService = createMock(CoreService.class); expect(coreService.registerApplication(APP_NAME)) .andReturn(appId).anyTimes(); replay(coreService); provider.coreService = coreService; provider.providerRegistry = deviceRegistry; provider.deviceService = deviceService; provider.providerService = providerService; provider.controller = xmppController; provider.activate(null); devices.clear(); }