-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add repositories info so the generation of docs TIP and overall TIR have the info they need to render the doc. #100
base: feature/moveLevaDoc
Are you sure you want to change the base?
Changes from 19 commits
a6bd3d9
1a4cf0f
f29d06b
42e8385
c87ed12
1e20f00
b9a871f
ba6df8b
e7812ea
9f3f3ef
8dcb4c8
badfc5d
03db887
9a4a6f9
3ee8932
24ebad9
aedf1ed
c1f6462
b26ff81
9952740
e874179
84746f3
429d5d0
5a7eb06
7b946bc
2f47b39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ class LevaDocDataFixture { | |
data.build = buildJobParams(projectFixture) | ||
data.git = buildGitData(projectFixture) | ||
data.openshift = [targetApiUrl:"https://openshift-sample"] | ||
data.repositories = new ProjectRepositoryFixture().load() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously we were using getModuleData() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getModuleData is still used to generate component information sent. Please notice that when documents use component information they do not use repositories information. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1- The data in getModuleDatais the same you put here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1-That is not true. While the previous contains only info for a component, new code cotains different information for each code. |
||
return data | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,11 @@ import de.redsix.pdfcompare.env.SimpleEnvironment | |
import groovy.util.logging.Slf4j | ||
import org.apache.commons.io.FileUtils | ||
|
||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
import java.nio.file.Paths | ||
import java.nio.file.StandardCopyOption | ||
|
||
@Slf4j | ||
class LevaDocTestValidator { | ||
|
||
|
@@ -23,7 +28,12 @@ class LevaDocTestValidator { | |
boolean validatePDF(String buildId) { | ||
unzipGeneratedArtifact(buildId) | ||
if (GENERATE_EXPECTED_PDF_FILES) { | ||
copyDocWhenRecording(buildId) | ||
boolean comparisonResult = compareFiles(buildId) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove all this part as it will add a lot of time to the test, when if this is GENERATE_EXPECTED_PDF_FILES=true, we expect to copy the results. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please take a look at the whole change, not just two lines. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, don't put this code, this will add a lot of time and not needed Victor to so2: It is not needed for you because you did not took time debugging and fixing a single document. Why do I have to update all of them when only one is wrong? Just because you do not like the idea of having two more lines of code? It is nonsense. |
||
if (! comparisonResult) { | ||
log.info("validatePDF - Comparison returned differences.") | ||
log.info("validatePDF - Updating expected pdf since GENERATE_EXPECTED_PDF_FILES=true.") | ||
copyDocWhenRecording(buildId) | ||
} | ||
return true | ||
} else { | ||
return compareFiles(buildId) | ||
|
@@ -34,7 +44,7 @@ class LevaDocTestValidator { | |
String actualPath = actualDoc(buildId).absolutePath | ||
File expectedFile = expectedDoc(buildId, projectFixture.component) | ||
String expectedPath = expectedFile.absolutePath | ||
log.info("validatePDF - Expected pdf:${expectedPath}") | ||
log.info("validatePDF - Expected pdf: ${expectedPath}") | ||
|
||
String diffFileName = pdfDiffFileName(expectedFile) | ||
|
||
|
@@ -49,6 +59,17 @@ class LevaDocTestValidator { | |
} else { | ||
FileUtils.copyFile(actualDoc(buildId), reportPdfDoc(buildId)) | ||
} | ||
|
||
if (!filesAreEqual) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the else of the line 59. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll do that if previous change is accepted. If not, we'll remove this lines because they are related to the previous ones. |
||
String generatedPdfSavedCopyFileName = generatedPdfSavedCopyFileName(actualPath) | ||
Path generatedPdfSource = java.nio.file.Paths.get(actualPath) | ||
Path generatedPdfSavedCopy = Paths.get(generatedPdfSavedCopyFileName) | ||
Files.copy(generatedPdfSource, generatedPdfSavedCopy, | ||
StandardCopyOption.REPLACE_EXISTING) | ||
log.info("validatePDF - Built pdf (saved because different from expected): " + | ||
"${generatedPdfSavedCopyFileName}") | ||
} | ||
|
||
return filesAreEqual | ||
} | ||
|
||
|
@@ -61,6 +82,10 @@ class LevaDocTestValidator { | |
return "${SAVED_DOCUMENTS}/${expectedFile.name.take(expectedFile.name.lastIndexOf('.'))}-diff" | ||
} | ||
|
||
String generatedPdfSavedCopyFileName(String actualPath){ | ||
return "${SAVED_DOCUMENTS}/generated-${actualPath.substring(actualPath.lastIndexOf('/') +1)}" | ||
} | ||
|
||
private void unzipGeneratedArtifact(String buildId) { | ||
String source = "${tempFolder.absolutePath}/artifacts/${getArtifactName(buildId, projectFixture.component)}.zip" | ||
String destination = "${tempFolder.absolutePath}" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.ods.doc.gen.leva.doc.fixture | ||
|
||
class ProjectRepositoryFixture { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file does not scale to more projects There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yours neither. This makes it possible to test ordgp project. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this is not true. This data does not scale at all Victor to so2: Please, take a look to the code we have to live with just because you can tell us ours is bad while we cannot tell you yours can be improved. |
||
|
||
List load() { | ||
return [ | ||
[ | ||
"id": "backend", | ||
"type": "ods", | ||
"data": [ | ||
"git": [ | ||
"branch": "master", | ||
"commit": "138495888301232315f5455aeb17cc635982ba2c", | ||
"createdExecutionCommit": "", | ||
"baseTag": "ods-generated-v3.0-3.0-0b11-D", | ||
"targetTag": "ods-generated-v3.0-3.0-0b11-D", | ||
] | ||
] | ||
], | ||
[ | ||
"id": "frontend", | ||
"type": "ods", | ||
"data": [ | ||
"git": [ | ||
"branch": "master", | ||
"commit": "3b5a62fbb2307d95360da386408b7f668f0e89ae", | ||
"createdExecutionCommit": "", | ||
"baseTag": "ods-generated-v3.0-3.0-0b11-D", | ||
"targetTag": "ods-generated-v3.0-3.0-0b11-D", | ||
] | ||
] | ||
], | ||
[ | ||
"id": "test", | ||
"type": "ods-test", | ||
"data": [ | ||
"git": [ | ||
"branch": "master", | ||
"commit": "417c5b12c0af838cf0b843feb16ee5b7b1dab4ec", | ||
"createdExecutionCommit": "", | ||
"baseTag": "ods-generated-v3.0-3.0-0b11-D", | ||
"targetTag": "ods-generated-v3.0-3.0-0b11-D", | ||
] | ||
] | ||
] | ||
] | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the other class you said repo.name:
String repoName = repo.id as String
repoName = "${projectId}-${repoName}"
Here is different?
And when is possible to don't have the repo.name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs more work.
Seems to be in the original commit you forgot about this information.
We are now determining how to obtain this information.
Thanks for pointing to it.