-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: jamal-khey <myjamal89@gmail.com>
- Loading branch information
1 parent
4fb0ead
commit dff6051
Showing
3 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.caseserver; | ||
|
||
import com.powsybl.caseserver.elasticsearch.CaseInfosRepository; | ||
import com.powsybl.caseserver.repository.CaseMetadataRepository; | ||
import com.powsybl.caseserver.services.SupervisionService; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
|
||
import static org.mockito.Mockito.times; | ||
import static org.mockito.Mockito.verify; | ||
|
||
/** | ||
* @author Jamal KHEYYAD <jamal.kheyyad at rte-international.com> | ||
*/ | ||
@RunWith(SpringRunner.class) | ||
@AutoConfigureMockMvc | ||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, properties = {"case-store-directory=/cases"}) | ||
@ContextConfigurationWithTestChannel | ||
public class SupervisionTest { | ||
@Autowired | ||
SupervisionService supervisionService; | ||
@Autowired | ||
CaseInfosRepository caseInfosRepository; | ||
@Autowired | ||
CaseMetadataRepository caseMetadataRepository; | ||
@Autowired | ||
CaseService caseService; | ||
|
||
@Autowired | ||
private MockMvc mvc; | ||
|
||
@Test | ||
public void testGetElementInfosCount() { | ||
supervisionService.getIndexedCaseElementsCount(); | ||
verify(caseInfosRepository, times(1)).count(); | ||
} | ||
|
||
@Test | ||
public void testDeleteElementInfos() { | ||
supervisionService.deleteIndexedDirectoryElements(); | ||
|
||
verify(caseInfosRepository, times(1)).count(); | ||
verify(caseInfosRepository, times(1)).deleteAll(); | ||
} | ||
|
||
|
||
} |