Commit 54cd8a2f authored by Matija Obreza's avatar Matija Obreza

SGSVUpdate tests

parent 1362dae5
......@@ -18,8 +18,14 @@ package org.genesys2.server.persistence.domain;
import org.genesys2.server.model.impl.FaoInstituteSetting;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
public interface FaoInstituteSettingRepository extends JpaRepository<FaoInstituteSetting, Long> {
FaoInstituteSetting findByInstCodeAndSetting(String instCode, String setting);
@Modifying
@Query("DELETE FROM FaoInstituteSetting fis WHERE fis.instCode = ?1")
void deleteFor(String instCode);
}
......@@ -59,4 +59,6 @@ public interface InstituteService {
void setUniqueAcceNumbs(FaoInstitute faoInstitute, boolean uniqueAcceNumbs);
void delete(String instCode);
}
......@@ -213,10 +213,10 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
// Including null's
result.add(accn);
if (accn == null) {
FaoInstitute inst = instituteRepository.findByCode(aid3.getHoldingInstitute());
if (inst == null)
// FaoInstitute inst = instituteRepository.findByCode(aid3.getHoldingInstitute());
if (LOG.isDebugEnabled())
// Only log full miss
LOG.debug("No accession " + aid3 + " in " + inst);
LOG.debug("No accession " + aid3);
}
}
return result;
......
......@@ -179,4 +179,14 @@ public class InstituteServiceImpl implements InstituteService {
return organizationRepository.getOrganizations(faoInstitute);
}
@Override
@Transactional
@PreAuthorize("hasRole('ADMINISTRATOR')")
public void delete(String instCode) {
FaoInstitute institute = getInstitute(instCode);
if (institute!=null) {
instituteSettingRepository.deleteFor(institute.getCode());
instituteRepository.delete(institute);
}
}
}
......@@ -15,7 +15,10 @@ class SGSVEntry implements AccessionIdentifier3 {
String boxNo;
String depositDate;
Float quantity;
public SGSVEntry() {
}
public SGSVEntry(String[] entry) {
instCode = entry[1];
acceNumb = entry[4];
......
......@@ -14,10 +14,10 @@ import static org.junit.Assert.fail;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
classes = JpaTest.Config.class,
classes = TokensCleanupTest.Config.class,
initializers = PropertyPlacholderInitializer.class
)
public class JpaTest {
public class TokensCleanupTest {
@Import(JpaDataConfig.class)
public static class Config {
......
......@@ -29,4 +29,4 @@ log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=info, stdout
log4j.category.org.crophub=info
log4j.category.org.genesys2=debug
#Hibernate specific properties
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.connection.autocommit=false
hibernate.connection.autocommit=true
hibernate.hbm2ddl.auto=update
hibernate.search.default.indexBase=./lucene/
hibernate.search.default.exclusive_index_use=false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment