Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
urgi-is
FAIDARE
Commits
a3697d9f
Commit
a3697d9f
authored
Apr 07, 2021
by
Jeremy Destin
Committed by
Célia Michotey
Aug 20, 2021
Browse files
Fix: Fix the tests by adding mcdp service to the tests. Clean some code.
parent
f07a9089
Changes
4
Hide whitespace changes
Inline
Side-by-side
backend/src/main/java/fr/inra/urgi/faidare/elasticsearch/repository/impl/ESGenericGetByIdRepository.java
View file @
a3697d9f
package
fr.inra.urgi.faidare.elasticsearch.repository.impl
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectWriter
;
import
fr.inra.urgi.faidare.elasticsearch.ESRequestFactory
;
import
fr.inra.urgi.faidare.elasticsearch.ESResponseParser
;
import
fr.inra.urgi.faidare.elasticsearch.document.DocumentAnnotationUtil
;
...
...
@@ -66,19 +64,6 @@ public class ESGenericGetByIdRepository<VO> implements ESGetByIdRepository<VO> {
// Parse result list
List
<?
extends
VO
>
resultList
=
parser
.
parseHits
(
result
,
voClass
);
System
.
out
.
println
(
""
);
System
.
out
.
println
(
"BEGIN"
);
System
.
out
.
println
(
""
);
ObjectWriter
ow
=
new
ObjectMapper
().
writer
().
withDefaultPrettyPrinter
();
String
json
=
ow
.
writeValueAsString
(
result
);
System
.
out
.
println
(
json
);
System
.
out
.
println
(
"END"
);
System
.
out
.
println
(
""
);
if
(
resultList
!=
null
&&
!
resultList
.
isEmpty
())
{
if
(
resultList
.
size
()
>
1
)
{
// Should never happen
...
...
backend/src/test/java/fr/inra/urgi/faidare/repository/es/setup/ESSetUp.java
View file @
a3697d9f
...
...
@@ -103,7 +103,7 @@ public class ESSetUp {
if
(
response
.
hasFailures
())
{
System
.
err
.
println
(
response
.
buildFailureMessage
());
throw
new
RuntimeException
(
"Indexing failed (index name: '"
+
indexName
+
"'"
);
throw
new
RuntimeException
(
"Indexing failed (index name: '"
+
indexName
+
"'
)
"
);
}
}
...
...
frontend/src/app/germplasm-card/germplasm-card.component.spec.ts
View file @
a3697d9f
...
...
@@ -14,8 +14,22 @@ import { CardSectionComponent } from '../card-section/card-section.component';
import
{
CardRowComponent
}
from
'
../card-row/card-row.component
'
;
import
{
CardTableComponent
}
from
'
../card-table/card-table.component
'
;
import
{
MapComponent
}
from
'
../map/map.component
'
;
import
{
BrapiGermplasmAttributes
,
BrapiGermplasmPedigree
,
BrapiResult
,
BrapiSibling
}
from
'
../models/brapi.model
'
;
import
{
Donor
,
Germplasm
,
GermplasmInstitute
,
GermplasmSet
,
Institute
,
Site
}
from
'
../models/gnpis.model
'
;
import
{
BrapiCollectingSite
,
BrapiGermplasmAttributes
,
BrapiGermplasmMcpd
,
BrapiGermplasmPedigree
,
BrapiInstitute
,
BrapiResult
,
BrapiSibling
}
from
'
../models/brapi.model
'
;
import
{
Donor
,
Germplasm
,
GermplasmInstitute
,
GermplasmSet
,
Institute
}
from
'
../models/gnpis.model
'
;
import
{
DataDiscoverySource
}
from
'
../models/data-discovery.model
'
;
import
{
MockComponent
}
from
'
ng-mocks
'
;
import
{
XrefsComponent
}
from
'
../xrefs/xrefs.component
'
;
...
...
@@ -84,6 +98,17 @@ describe('GermplasmCardComponent', () => {
logo
:
null
};
const
brapiInstitute
:
BrapiInstitute
=
{
instituteName
:
'
INRAE URGI
'
,
instituteCode
:
'
78000
'
,
acronym
:
'
INRAE
'
,
organisation
:
'
inrae
'
,
instituteType
:
'
lab
'
,
webSite
:
'
www.labo.fr
'
,
instituteAddress
:
'
18
'
,
logo
:
null
};
const
gnpisGermplasmInstitute
:
GermplasmInstitute
=
{
...
gnpisInstitute
,
institute
:
gnpisInstitute
,
...
...
@@ -96,6 +121,20 @@ describe('GermplasmCardComponent', () => {
distributionStatus
:
null
};
const
collectingSite
:
BrapiCollectingSite
=
{
locationDbId
:
'
FR-78-INRAE
'
,
locationName
:
'
Versailles
'
,
coordinateUncertainty
:
null
,
elevation
:
null
,
georeferencingMethod
:
null
,
latitudeDecimal
:
null
,
latitudeDegrees
:
null
,
locationDescription
:
null
,
longitudeDecimal
:
null
,
longitudeDegrees
:
null
,
spatialReferenceSystem
:
null
,
};
const
gnpisDonor
:
Donor
=
{
donorInstitute
:
gnpisInstitute
,
donorGermplasmPUI
:
'
12
'
,
...
...
@@ -181,6 +220,57 @@ describe('GermplasmCardComponent', () => {
'
schema:includedInDataCatalog
'
:
source
};
const
germplasmMcpdTest
:
BrapiGermplasmMcpd
=
{
groupId
:
'
0
'
,
accessionNames
:
[
'
test accession
'
],
accessionNumber
:
'
01
'
,
acquisitionDate
:
'
2021
'
,
acquisitionSourceCode
:
'
FR-urgi
'
,
alternateIDs
:
[
'
Id1
'
,
'
Id2
'
],
ancestralData
:
null
,
biologicalStatusOfAccessionCode
:
'
maintained
'
,
breedingInstitutes
:
brapiInstitute
,
collectingInfo
:
{
collectingDate
:
'
2021
'
,
collectingInstitutes
:
brapiInstitute
,
collectingMissionIdentifier
:
'
007
'
,
collectingNumber
:
'
3
'
,
collectors
:
'
urgi
'
,
materialType
:
'
germplasm
'
,
collectingSite
:
collectingSite
,
},
commonCropName
:
'
wheat
'
,
countryOfOriginCode
:
'
FR
'
,
donorInfo
:
{
donorAccessionNumber
:
'
ING007
'
,
donorInstitute
:
brapiInstitute
,
donationDate
:
'
2021
'
,
},
genus
:
'
Triti
'
,
germplasmDbId
:
'
Fr-007
'
,
germplasmPUI
:
'
urn/fr-007
'
,
instituteCode
:
'
FR-INRAE
'
,
mlsStatus
:
'
0
'
,
remarks
:
null
,
safetyDuplicateInstitutes
:
null
,
species
:
'
Triti
'
,
speciesAuthority
:
null
,
storageTypeCodes
:
null
,
subtaxon
:
null
,
subtaxonAuthority
:
null
,
breederAccessionNumber
:
null
,
breedingCreationYear
:
null
,
catalogRegistrationYear
:
null
,
catalogDeregistrationYear
:
null
,
originLocationDbId
:
'
FR-Ver
'
,
originLocationName
:
'
Versailles
'
,
holdingInstitute
:
brapiInstitute
,
holdingGenbank
:
brapiInstitute
,
geneticNature
:
'
hybrid
'
,
presenceStatus
:
null
,
distributorInfos
:
null
};
const
gnpisService
=
jasmine
.
createSpyObj
(
'
GnpisService
'
,
[
'
getGermplasm
'
,
...
...
@@ -194,12 +284,14 @@ describe('GermplasmCardComponent', () => {
'
BrapiService
'
,
[
// 'germplasmProgeny',
'
germplasmPedigree
'
,
'
germplasmAttributes
'
'
germplasmAttributes
'
,
'
germplasmMcpd
'
]
);
// brapiService.germplasmProgeny.and.returnValue(of(brapiGermplasmProgeny));
brapiService
.
germplasmPedigree
.
and
.
returnValue
(
of
(
brapiGermplasmPedigree
));
brapiService
.
germplasmAttributes
.
and
.
returnValue
(
of
(
brapiGermplasmAttributes
));
brapiService
.
germplasmMcpd
.
and
.
returnValue
(
of
(
germplasmMcpdTest
));
const
activatedRouteParams
=
{
...
...
frontend/src/app/models/brapi.model.ts
View file @
a3697d9f
...
...
@@ -194,19 +194,7 @@ export interface BrapiGermplasmMcpd extends BrapiHasDocumentationURL {
collectingNumber
:
string
;
collectors
:
string
;
materialType
:
string
;
collectingSite
:
{
locationDbId
:
string
;
locationName
:
string
;
coordinateUncertainty
:
string
;
elevation
:
string
;
georeferencingMethod
:
string
;
latitudeDecimal
:
string
;
latitudeDegrees
:
string
;
locationDescription
:
string
;
longitudeDecimal
:
string
;
longitudeDegrees
:
string
;
spatialReferenceSystem
:
string
;
};
collectingSite
:
BrapiCollectingSite
};
commonCropName
:
string
;
countryOfOriginCode
:
string
;
...
...
@@ -258,6 +246,20 @@ export interface BrapiInstitute {
logo
:
string
;
}
export
interface
BrapiCollectingSite
{
locationDbId
:
string
;
locationName
:
string
;
coordinateUncertainty
:
string
;
elevation
:
string
;
georeferencingMethod
:
string
;
latitudeDecimal
:
string
;
latitudeDegrees
:
string
;
locationDescription
:
string
;
longitudeDecimal
:
string
;
longitudeDegrees
:
string
;
spatialReferenceSystem
:
string
;
}
export
interface
BrapiTaxonIds
{
sourceName
:
string
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment