<commit_before>package com.hazelcast.spi.impl.servicemanager.impl;

import com.hazelcast.concurrent.lock.LockService;
import com.hazelcast.config.Config;
import com.hazelcast.config.ServiceConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.impl.MapService;
import com.hazelcast.spi.ConfigurableService;
import com.hazelcast.spi.ManagedService;
import com.hazelcast.spi.NodeEngine;
import com.hazelcast.spi.impl.NodeEngineImpl;
import com.hazelcast.spi.impl.servicemanager.ServiceInfo;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.annotation.ParallelTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import javax.swing.*;
import java.util.List;
import java.util.Properties;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

@RunWith(HazelcastParallelClassRunner.class)
@Category({QuickTest.class, ParallelTest.class})
public class ServiceManagerImplTest extends HazelcastTestSupport {

    private ServiceManagerImpl serviceManager;

    @Before
    public void setup() {
        Config config = new Config();

        ServiceConfig serviceConfig = new ServiceConfig()
                .setClassName(FooService.class.getName())
                .setEnabled(true)
                .setName("fooService");
        config.getServicesConfig().addServiceConfig(serviceConfig);

        HazelcastInstance hz = createHazelcastInstance(config);
        NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
        serviceManager = new ServiceManagerImpl(nodeEngine);
        serviceManager.start();
    }

    static class FooService implements ManagedService, ConfigurableService {
        volatile boolean initCalled;
        volatile boolean configureCalled;

        @Override
        public void configure(Object configObject) {
            this.configureCalled = true;
        }
<commit_msg>Use service manager from a started instance instead of creating your own<commit_after>package com.hazelcast.spi.impl.servicemanager.impl;

import com.hazelcast.concurrent.lock.LockService;
import com.hazelcast.config.Config;
import com.hazelcast.config.ServiceConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.impl.MapService;
import com.hazelcast.spi.ConfigurableService;
import com.hazelcast.spi.ManagedService;
import com.hazelcast.spi.NodeEngine;
import com.hazelcast.spi.impl.NodeEngineImpl;
import com.hazelcast.spi.impl.servicemanager.ServiceInfo;
import com.hazelcast.test.HazelcastParallelClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.annotation.ParallelTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import javax.swing.*;
import java.util.List;
import java.util.Properties;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

@RunWith(HazelcastParallelClassRunner.class)
@Category({QuickTest.class, ParallelTest.class})
public class ServiceManagerImplTest extends HazelcastTestSupport {

    private ServiceManagerImpl serviceManager;

    @Before
    public void setup() {
        Config config = new Config();

        ServiceConfig serviceConfig = new ServiceConfig()
                .setClassName(FooService.class.getName())
                .setEnabled(true)
                .setName("fooService");
        config.getServicesConfig().addServiceConfig(serviceConfig);

        HazelcastInstance hz = createHazelcastInstance(config);
        NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
        serviceManager = (ServiceManagerImpl) nodeEngine.getServiceManager();
    }

    static class FooService implements ManagedService, ConfigurableService {
        volatile boolean initCalled;
        volatile boolean configureCalled;

        @Override
        public void configure(Object configObject) {
            this.configureCalled = true;
        }

{'fraction_non_alphanumeric': 0.08680714612918003, 'fraction_numerical': 0.0, 'mean_word_length': 4.371463714637146, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5400940', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1236, 'n_words': 234}