Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagobento committed Jan 3, 2024
1 parent 46979c3 commit d4fd042
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public void testAsDMNIncludedModel() {
final String namespace = "The Namespace";
final String type = "The type";
final String file = "my file.dmn";
final String filePath = "//users//some//" + file;
final String filePath = "users/some/" + file;
final Import anImport = new Import();
anImport.setName(new Name(modelName));
anImport.setNamespace(namespace);
Expand All @@ -423,7 +423,7 @@ public void testAsDMNIncludedModel() {
assertEquals(modelName, includedModel.getModelName());
assertEquals(namespace, includedModel.getNamespace());
assertEquals(type, includedModel.getImportType());
assertEquals(file, includedModel.getPath());
assertEquals(filePath, includedModel.getPath());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ public void testWrapPMMLItems() {
final IncludedModel includedModel5 = makePMMLIncludedModel(5);
final Import import1 = mock(Import.class);
final Import import2 = mock(Import.class);
final LocationURI import1URI = new LocationURI("/src/main/kie3");
final LocationURI import2URI = new LocationURI("/src/main/kie4");
final LocationURI import1URI = new LocationURI("src/main/kie3.pmml");
final LocationURI import2URI = new LocationURI("src/main/kie4.pmml");
final KieAssetsDropdownItem dropdownItem1 = mock(KieAssetsDropdownItem.class);
final KieAssetsDropdownItem dropdownItem2 = mock(KieAssetsDropdownItem.class);
final KieAssetsDropdownItem dropdownItem5 = mock(KieAssetsDropdownItem.class);
Expand Down Expand Up @@ -182,9 +182,9 @@ private PMMLIncludedModel makePMMLIncludedModel(final int id,
final int modelCount) {
return new PMMLIncludedModel("name" + id,
"com.kie.pmml",
"src/main/kie" + id,
"src/main/kie" + id + ".pmml",
PMML.getDefaultNamespace(),
"https://kie.org/pmml#src/main/kie" + id,
"https://kie.org/pmml#src/main/kie" + id + ".pmml",
modelCount);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void loadModelsPMMLFile() {

verify(includedModelServiceCallback).onSuccess(modelsCapture.capture());
assertEquals(1, modelsCapture.getValue().size());
assertEquals(PMML_FILE, modelsCapture.getValue().get(0).getPath());
assertEquals(PMML_PATH, modelsCapture.getValue().get(0).getPath());
assertEquals(PMML_FILE, modelsCapture.getValue().get(0).getModelName());
assertEquals(PMML.getDefaultNamespace(), modelsCapture.getValue().get(0).getImportType());
assertEquals(0, ((PMMLIncludedModel) modelsCapture.getValue().get(0)).getModelCount().intValue());
Expand Down Expand Up @@ -196,7 +196,7 @@ public void getPMMLDocumentsAsync() {

final List<JSITImport> imports = new ArrayList<>();
final JSITImport jsImportMock = mock(JSITImport.class);
when(jsImportMock.getLocationURI()).thenReturn(PMML_FILE);
when(jsImportMock.getLocationURI()).thenReturn(PMML_PATH);
imports.add(jsImportMock);

final Promise<Map<JSITImport, PMMLDocumentMetadata>> returnPromise = importsHelper.getPMMLDocumentsAsync(metadataMock, imports);
Expand All @@ -223,17 +223,17 @@ public void getPMMLDocumentsMetadataFromFilesEmptyFiles() {

@Test
public void getPMMLDocumentsMetadataFromFiles() {
final PMMLDocumentMetadata documentMetadata = new PMMLDocumentMetadata(PMML_FILE,
final PMMLDocumentMetadata documentMetadata = new PMMLDocumentMetadata(PMML_PATH,
PMML.getDefaultNamespace(),
Collections.emptyList());
final List<PMMLIncludedModel> includedModels = Arrays.asList(new PMMLIncludedModel(PMML_MODEL_NAME, "", PMML_FILE, PMML.getDefaultNamespace(), "https://kie.org/pmml#" + PMML_FILE, 0));
final List<PMMLIncludedModel> includedModels = Arrays.asList(new PMMLIncludedModel(PMML_MODEL_NAME, "", PMML_PATH, PMML.getDefaultNamespace(), "https://kie.org/pmml#" + PMML_FILE, 0));
when(dmnImportsContentService.getModelsPMMLFilesURIs()).thenReturn(promises.resolve(new String[]{PMML_PATH}));
when(dmnImportsContentService.loadFile(PMML_PATH)).thenReturn(promises.resolve(PMML_CONTENT));
doReturn(promises.resolve(documentMetadata)).when(dmnImportsContentService).getPMMLDocumentMetadata(PMML_PATH);
importsHelper.getPMMLDocumentsMetadataFromFiles(includedModels, pmmlMetadataServiceCallback);
verify(pmmlMetadataServiceCallback, times(1)).onSuccess(pmmlDocumentMetadataArgumentCaptor.capture());
assertEquals(1, pmmlDocumentMetadataArgumentCaptor.getValue().size());
assertEquals(PMML_FILE, pmmlDocumentMetadataArgumentCaptor.getValue().get(0).getPath());
assertEquals(PMML_PATH, pmmlDocumentMetadataArgumentCaptor.getValue().get(0).getPath());
assertEquals(PMML_MODEL_NAME, pmmlDocumentMetadataArgumentCaptor.getValue().get(0).getName());
assertEquals(PMML.getDefaultNamespace(), pmmlDocumentMetadataArgumentCaptor.getValue().get(0).getImportType());
assertTrue(pmmlDocumentMetadataArgumentCaptor.getValue().get(0).getModels().isEmpty());
Expand Down

0 comments on commit d4fd042

Please sign in to comment.