mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 18:26:16 +01:00
Harmonize interface of XmlRepositoryDatabase
XmlRepositoryDatabase should not expose RepositoryPath objects
This commit is contained in:
@@ -41,6 +41,7 @@ import sonia.scm.repository.NamespaceAndName;
|
|||||||
import sonia.scm.repository.PathBasedRepositoryDAO;
|
import sonia.scm.repository.PathBasedRepositoryDAO;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryPathNotFoundException;
|
import sonia.scm.repository.RepositoryPathNotFoundException;
|
||||||
|
import sonia.scm.store.ConfigurationStore;
|
||||||
import sonia.scm.store.ConfigurationStoreFactory;
|
import sonia.scm.store.ConfigurationStoreFactory;
|
||||||
import sonia.scm.xml.AbstractXmlDAO;
|
import sonia.scm.xml.AbstractXmlDAO;
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ public class XmlRepositoryDAO
|
|||||||
* Field description
|
* Field description
|
||||||
*/
|
*/
|
||||||
public static final String STORE_NAME = "repositories";
|
public static final String STORE_NAME = "repositories";
|
||||||
private InitialRepositoryLocationResolver initialRepositoryLocationResolver;
|
private final InitialRepositoryLocationResolver initialRepositoryLocationResolver;
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
//~--- constructors ---------------------------------------------------------
|
||||||
|
|
||||||
@@ -72,7 +73,10 @@ public class XmlRepositoryDAO
|
|||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public XmlRepositoryDAO(ConfigurationStoreFactory storeFactory, InitialRepositoryLocationResolver initialRepositoryLocationResolver) {
|
public XmlRepositoryDAO(ConfigurationStoreFactory storeFactory, InitialRepositoryLocationResolver initialRepositoryLocationResolver) {
|
||||||
super(storeFactory.getStore(XmlRepositoryDatabase.class, STORE_NAME));
|
super(new SimpleStore(storeFactory.getStore(XmlRepositoryDatabasePersistence.class, STORE_NAME).get(), initialRepositoryLocationResolver));
|
||||||
|
if (initialRepositoryLocationResolver == null) {
|
||||||
|
throw new NullPointerException("resolver must not be null");
|
||||||
|
}
|
||||||
this.initialRepositoryLocationResolver = initialRepositoryLocationResolver;
|
this.initialRepositoryLocationResolver = initialRepositoryLocationResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,23 +105,12 @@ public class XmlRepositoryDAO
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(Repository repository) {
|
public void add(Repository repository) {
|
||||||
String path = initialRepositoryLocationResolver.getDirectory(repository).getAbsolutePath();
|
|
||||||
RepositoryPath repositoryPath = new RepositoryPath(path, repository.getId(), repository.clone());
|
|
||||||
synchronized (store) {
|
synchronized (store) {
|
||||||
db.add(repositoryPath);
|
db.add(repository);
|
||||||
storeDB();
|
storeDB();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Repository get(String id) {
|
|
||||||
RepositoryPath repositoryPath = db.get(id);
|
|
||||||
if (repositoryPath != null) {
|
|
||||||
return repositoryPath.getRepository();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Repository> getAll() {
|
public Collection<Repository> getAll() {
|
||||||
return db.getRepositories();
|
return db.getRepositories();
|
||||||
@@ -141,7 +134,7 @@ public class XmlRepositoryDAO
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected XmlRepositoryDatabase createNewDatabase() {
|
protected XmlRepositoryDatabase createNewDatabase() {
|
||||||
return new XmlRepositoryDatabase();
|
return new XmlRepositoryDatabase(new XmlRepositoryDatabasePersistence(), initialRepositoryLocationResolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -156,4 +149,26 @@ public class XmlRepositoryDAO
|
|||||||
return Paths.get(repositoryPath.get().getPath());
|
return Paths.get(repositoryPath.get().getPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class SimpleStore implements ConfigurationStore<XmlRepositoryDatabase> {
|
||||||
|
private final XmlRepositoryDatabase xmlRepositoryDatabase;
|
||||||
|
|
||||||
|
public SimpleStore(XmlRepositoryDatabasePersistence xmlRepositoryDatabasePersistence, InitialRepositoryLocationResolver initialRepositoryLocationResolver) {
|
||||||
|
if (xmlRepositoryDatabasePersistence == null) {
|
||||||
|
this.xmlRepositoryDatabase = new XmlRepositoryDatabase(new XmlRepositoryDatabasePersistence(), initialRepositoryLocationResolver);
|
||||||
|
} else {
|
||||||
|
this.xmlRepositoryDatabase = new XmlRepositoryDatabase(xmlRepositoryDatabasePersistence, initialRepositoryLocationResolver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XmlRepositoryDatabase get() {
|
||||||
|
return xmlRepositoryDatabase;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(XmlRepositoryDatabase obejct) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,40 +35,36 @@ package sonia.scm.repository.xml;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.repository.InitialRepositoryLocationResolver;
|
||||||
import sonia.scm.repository.NamespaceAndName;
|
import sonia.scm.repository.NamespaceAndName;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.xml.XmlDatabase;
|
import sonia.scm.xml.XmlDatabase;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
@XmlRootElement(name = "repository-db")
|
@XmlRootElement(name = "repository-db")
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class XmlRepositoryDatabase implements XmlDatabase<RepositoryPath> {
|
public class XmlRepositoryDatabase implements XmlDatabase<Repository> {
|
||||||
|
|
||||||
private Long creationTime;
|
private final InitialRepositoryLocationResolver initialRepositoryLocationResolver;
|
||||||
|
|
||||||
private Long lastModified;
|
private final XmlRepositoryDatabasePersistence storage;
|
||||||
|
|
||||||
@XmlJavaTypeAdapter(XmlRepositoryMapAdapter.class)
|
public XmlRepositoryDatabase(XmlRepositoryDatabasePersistence storage, InitialRepositoryLocationResolver initialRepositoryLocationResolver) {
|
||||||
@XmlElement(name = "repositories")
|
if (storage == null) {
|
||||||
private Map<String, RepositoryPath> repositoryPathMap = new LinkedHashMap<>();
|
throw new NullPointerException("storage must not be null");
|
||||||
|
}
|
||||||
|
if (initialRepositoryLocationResolver == null) {
|
||||||
|
throw new NullPointerException("resolver must not be null");
|
||||||
|
}
|
||||||
|
this.initialRepositoryLocationResolver = initialRepositoryLocationResolver;
|
||||||
|
this.storage = storage;
|
||||||
|
|
||||||
|
|
||||||
public XmlRepositoryDatabase() {
|
|
||||||
long c = System.currentTimeMillis();
|
|
||||||
creationTime = c;
|
|
||||||
lastModified = c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static String createKey(NamespaceAndName namespaceAndName)
|
static String createKey(NamespaceAndName namespaceAndName)
|
||||||
@@ -82,71 +78,63 @@ public class XmlRepositoryDatabase implements XmlDatabase<RepositoryPath> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(RepositoryPath repositoryPath)
|
public void add(Repository repository)
|
||||||
{
|
{
|
||||||
repositoryPathMap.put(createKey(repositoryPath.getRepository()), repositoryPath);
|
String path = initialRepositoryLocationResolver.getDirectory(repository).getAbsolutePath();
|
||||||
|
RepositoryPath repositoryPath = new RepositoryPath(path, repository.getId(), repository.clone());
|
||||||
|
storage.add(repositoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(NamespaceAndName namespaceAndName)
|
public boolean contains(NamespaceAndName namespaceAndName)
|
||||||
{
|
{
|
||||||
return repositoryPathMap.containsKey(createKey(namespaceAndName));
|
return storage.containsKey(createKey(namespaceAndName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(String id)
|
public boolean contains(String id)
|
||||||
{
|
{
|
||||||
return get(id) != null;
|
return storage.get(id) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(Repository repository)
|
public boolean contains(Repository repository)
|
||||||
{
|
{
|
||||||
return repositoryPathMap.containsKey(createKey(repository));
|
return storage.containsKey(createKey(repository));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Repository repository)
|
public void remove(Repository repository)
|
||||||
{
|
{
|
||||||
repositoryPathMap.remove(createKey(repository));
|
storage.remove(createKey(repository));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RepositoryPath remove(String id)
|
public Repository remove(String id)
|
||||||
{
|
{
|
||||||
return repositoryPathMap.remove(createKey(get(id).getRepository()));
|
return storage.remove(createKey(get(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Repository> getRepositories() {
|
public Collection<Repository> getRepositories() {
|
||||||
List<Repository> repositories = new ArrayList<>();
|
return storage.getRepositories();
|
||||||
for (RepositoryPath repositoryPath : repositoryPathMap.values()) {
|
|
||||||
Repository repository = repositoryPath.getRepository();
|
|
||||||
repositories.add(repository);
|
|
||||||
}
|
|
||||||
return repositories;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<RepositoryPath> values()
|
public Collection<Repository> values()
|
||||||
{
|
{
|
||||||
return repositoryPathMap.values();
|
return storage.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<RepositoryPath> getPaths() {
|
public Collection<RepositoryPath> getPaths() {
|
||||||
return repositoryPathMap.values();
|
return storage.getPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Repository get(NamespaceAndName namespaceAndName) {
|
public Repository get(NamespaceAndName namespaceAndName) {
|
||||||
RepositoryPath repositoryPath = repositoryPathMap.get(createKey(namespaceAndName));
|
return storage.get(namespaceAndName);
|
||||||
if (repositoryPath != null) {
|
|
||||||
return repositoryPath.getRepository();
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RepositoryPath get(String id) {
|
public Repository get(String id) {
|
||||||
return values().stream()
|
return values().stream()
|
||||||
.filter(repoPath -> repoPath.getId().equals(id))
|
.filter(repo -> repo.getId().equals(id))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
@@ -160,7 +148,7 @@ public class XmlRepositoryDatabase implements XmlDatabase<RepositoryPath> {
|
|||||||
@Override
|
@Override
|
||||||
public long getCreationTime()
|
public long getCreationTime()
|
||||||
{
|
{
|
||||||
return creationTime;
|
return storage.getCreationTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -172,7 +160,7 @@ public class XmlRepositoryDatabase implements XmlDatabase<RepositoryPath> {
|
|||||||
@Override
|
@Override
|
||||||
public long getLastModified()
|
public long getLastModified()
|
||||||
{
|
{
|
||||||
return lastModified;
|
return storage.getLastModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- set methods ----------------------------------------------------------
|
//~--- set methods ----------------------------------------------------------
|
||||||
@@ -186,7 +174,7 @@ public class XmlRepositoryDatabase implements XmlDatabase<RepositoryPath> {
|
|||||||
@Override
|
@Override
|
||||||
public void setCreationTime(long creationTime)
|
public void setCreationTime(long creationTime)
|
||||||
{
|
{
|
||||||
this.creationTime = creationTime;
|
storage.setCreationTime(creationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -198,6 +186,6 @@ public class XmlRepositoryDatabase implements XmlDatabase<RepositoryPath> {
|
|||||||
@Override
|
@Override
|
||||||
public void setLastModified(long lastModified)
|
public void setLastModified(long lastModified)
|
||||||
{
|
{
|
||||||
this.lastModified = lastModified;
|
storage.setLastModified(lastModified);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,172 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010, Sebastian Sdorra
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from this
|
||||||
|
* software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* http://bitbucket.org/sdorra/scm-manager
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
package sonia.scm.repository.xml;
|
||||||
|
|
||||||
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.repository.NamespaceAndName;
|
||||||
|
import sonia.scm.repository.Repository;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
@XmlRootElement(name = "repository-db")
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class XmlRepositoryDatabasePersistence {
|
||||||
|
|
||||||
|
private Long creationTime;
|
||||||
|
|
||||||
|
private Long lastModified;
|
||||||
|
|
||||||
|
@XmlJavaTypeAdapter(XmlRepositoryMapAdapter.class)
|
||||||
|
@XmlElement(name = "repositories")
|
||||||
|
private Map<String, RepositoryPath> repositoryPathMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
public XmlRepositoryDatabasePersistence() {
|
||||||
|
long c = System.currentTimeMillis();
|
||||||
|
creationTime = c;
|
||||||
|
lastModified = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static String createKey(NamespaceAndName namespaceAndName)
|
||||||
|
{
|
||||||
|
return namespaceAndName.getNamespace() + ":" + namespaceAndName.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
static String createKey(Repository repository)
|
||||||
|
{
|
||||||
|
return createKey(repository.getNamespaceAndName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(RepositoryPath repositoryPath)
|
||||||
|
{
|
||||||
|
repositoryPathMap.put(createKey(repositoryPath.getRepository()), repositoryPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(NamespaceAndName namespaceAndName)
|
||||||
|
{
|
||||||
|
return repositoryPathMap.containsKey(createKey(namespaceAndName));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(String id)
|
||||||
|
{
|
||||||
|
return get(id) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(Repository repository)
|
||||||
|
{
|
||||||
|
return repositoryPathMap.containsKey(createKey(repository));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove(Repository repository)
|
||||||
|
{
|
||||||
|
repositoryPathMap.remove(createKey(repository));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Repository remove(String key)
|
||||||
|
{
|
||||||
|
return repositoryPathMap.remove(key).getRepository();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<Repository> getRepositories() {
|
||||||
|
List<Repository> repositories = new ArrayList<>();
|
||||||
|
for (RepositoryPath repositoryPath : repositoryPathMap.values()) {
|
||||||
|
Repository repository = repositoryPath.getRepository();
|
||||||
|
repositories.add(repository);
|
||||||
|
}
|
||||||
|
return repositories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<Repository> values()
|
||||||
|
{
|
||||||
|
return repositoryPathMap.values().stream().map(RepositoryPath::getRepository).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<RepositoryPath> getPaths() {
|
||||||
|
return repositoryPathMap.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Repository get(NamespaceAndName namespaceAndName) {
|
||||||
|
RepositoryPath repositoryPath = repositoryPathMap.get(createKey(namespaceAndName));
|
||||||
|
if (repositoryPath != null) {
|
||||||
|
return repositoryPath.getRepository();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Repository get(String id) {
|
||||||
|
return values().stream()
|
||||||
|
.filter(repo -> repo.getId().equals(id))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCreationTime()
|
||||||
|
{
|
||||||
|
return creationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastModified()
|
||||||
|
{
|
||||||
|
return lastModified;
|
||||||
|
}
|
||||||
|
|
||||||
|
//~--- set methods ----------------------------------------------------------
|
||||||
|
|
||||||
|
public void setCreationTime(long creationTime)
|
||||||
|
{
|
||||||
|
this.creationTime = creationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastModified(long lastModified)
|
||||||
|
{
|
||||||
|
this.lastModified = lastModified;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean containsKey(String key) {
|
||||||
|
return repositoryPathMap.containsKey(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,7 +92,7 @@ public class XmlRepositoryMapAdapter extends XmlAdapter<XmlRepositoryList, Map<S
|
|||||||
repositoryPathMap.put(XmlRepositoryDatabase.createKey(repository), repositoryPath);
|
repositoryPathMap.put(XmlRepositoryDatabase.createKey(repository), repositoryPath);
|
||||||
}
|
}
|
||||||
} catch (JAXBException ex) {
|
} catch (JAXBException ex) {
|
||||||
throw new StoreException("failed to unmarshall object", ex);
|
throw new StoreException("failed to unmarshal object", ex);
|
||||||
}
|
}
|
||||||
return repositoryPathMap;
|
return repositoryPathMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import java.util.Collection;
|
|||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractXmlDAO<I extends ModelObject,
|
public abstract class AbstractXmlDAO<I extends ModelObject,
|
||||||
T extends XmlDatabase> implements GenericDAO<I>
|
T extends XmlDatabase<I>> implements GenericDAO<I>
|
||||||
{
|
{
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
|
|||||||
@@ -159,12 +159,13 @@ public class DefaultRepositoryManagerTest extends ManagerTestBase<Repository> {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteWithEnabledArchive() {
|
public void testDeleteWithEnabledArchive() {
|
||||||
Repository repository = createTestRepository();
|
manager = createRepositoryManager(true);
|
||||||
|
manager.init(contextProvider);
|
||||||
|
|
||||||
|
Repository repository = createTestRepository();
|
||||||
repository.setArchived(true);
|
repository.setArchived(true);
|
||||||
RepositoryManager drm = createRepositoryManager(true);
|
|
||||||
drm.init(contextProvider);
|
delete(manager, repository);
|
||||||
delete(drm, repository);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user