Skip to content

Package: AccountServiceModule

AccountServiceModule

nameinstructionbranchcomplexitylinemethod
AccountServiceModule()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
initializeConfiguration()
M: 20 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.account.internal;
14:
15: import org.eclipse.kapua.commons.core.ServiceModule;
16: import org.eclipse.kapua.commons.event.ServiceEventClientConfiguration;
17: import org.eclipse.kapua.commons.event.ServiceEventModule;
18: import org.eclipse.kapua.commons.event.ServiceEventModuleConfiguration;
19: import org.eclipse.kapua.commons.event.ServiceInspector;
20: import org.eclipse.kapua.service.account.AccountService;
21: import org.eclipse.kapua.service.account.internal.setting.KapuaAccountSetting;
22: import org.eclipse.kapua.service.account.internal.setting.KapuaAccountSettingKeys;
23:
24: import javax.inject.Inject;
25: import java.util.List;
26:
27: /**
28: * {@link AccountService} {@link ServiceModule} implementation.
29: *
30: * @since 1.0.0
31: */
32: public class AccountServiceModule extends ServiceEventModule implements ServiceModule {
33:
34: private static final KapuaAccountSetting ACCOUNT_SETTING = KapuaAccountSetting.getInstance();
35:
36: @Inject
37: private AccountService accountService;
38:
39: @Override
40: protected ServiceEventModuleConfiguration initializeConfiguration() {
41: String address = ACCOUNT_SETTING.getString(KapuaAccountSettingKeys.ACCOUNT_EVENT_ADDRESS);
42:
43: List<ServiceEventClientConfiguration> eventBusClients = ServiceInspector.getEventBusClients(accountService, AccountService.class);
44:
45: return new ServiceEventModuleConfiguration(
46: address,
47: AccountEntityManagerFactory.getInstance(),
48: eventBusClients.toArray(new ServiceEventClientConfiguration[0]));
49: }
50:
51: }