why embedded mongo process not stoping by mongodExecutable.stop()?

Viewed 61

Embedded mongo started successful with below code,,but not stoping by mongodExecutable.stop(),this suppose to stop the running mongo. what can be the issue, The below code

 public class Test
       {
 private static final String CONNECTION_STRING = "mongodb://%s:%d";

    private static MongodExecutable mongodExecutable;
    ObjectMapper mapper = new ObjectMapper();
    private static MongodProcess mongod = null;
   

    @After
   public void clean() {
        //mongodExecutable.stop();
        if(mongod.isProcessRunning()) {
        //mongod.stopInternal();
        mongodExecutable.stop();
    }}

    @Before
   public void setup() throws Exception {
        String ip = "localhost";
        int port = 27017;
        

        IMongodConfig mongodConfig = new MongodConfigBuilder().version(Version.Main.PRODUCTION)
            .net(new Net(ip, port, Network.localhostIsIPv6()))
            .build();

        MongodStarter starter = MongodStarter.getDefaultInstance();
        mongodExecutable = starter.prepare(mongodConfig);
        mongod=mongodExecutable.start();
    }

    @Test
    public void testfeature() throws Exception {
         assertEquals(1, 1);
       
        
    }
 }
0 Answers
Related