mirror of https://github.com/apache/archiva.git
fix unit tests
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1418123 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2c11134559
commit
052eb24e53
|
@ -24,6 +24,7 @@ import org.apache.archiva.admin.model.beans.ArchivaLdapConfiguration;
|
||||||
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
|
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
|
||||||
import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin;
|
import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin;
|
||||||
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
|
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
|
||||||
|
import org.apache.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.archiva.configuration.Configuration;
|
import org.apache.archiva.configuration.Configuration;
|
||||||
import org.apache.archiva.configuration.IndeterminateConfigurationException;
|
import org.apache.archiva.configuration.IndeterminateConfigurationException;
|
||||||
import org.apache.archiva.configuration.RedbackRuntimeConfiguration;
|
import org.apache.archiva.configuration.RedbackRuntimeConfiguration;
|
||||||
|
@ -32,6 +33,8 @@ import org.apache.archiva.redback.configuration.UserConfiguration;
|
||||||
import org.apache.archiva.redback.configuration.UserConfigurationException;
|
import org.apache.archiva.redback.configuration.UserConfigurationException;
|
||||||
import org.apache.archiva.redback.configuration.UserConfigurationKeys;
|
import org.apache.archiva.redback.configuration.UserConfigurationKeys;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
@ -45,10 +48,14 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Service( "userConfiguration#archiva" )
|
@Service( "userConfiguration#archiva" )
|
||||||
public class DefaultArchivaRuntimeConfigurationAdmin
|
public class DefaultArchivaRuntimeConfigurationAdmin
|
||||||
extends AbstractRepositoryAdmin
|
|
||||||
implements ArchivaRuntimeConfigurationAdmin, UserConfiguration
|
implements ArchivaRuntimeConfigurationAdmin, UserConfiguration
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected Logger log = LoggerFactory.getLogger( getClass() );
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named( value = "userConfiguration#redback" )
|
@Named( value = "userConfiguration#redback" )
|
||||||
UserConfiguration userConfiguration;
|
UserConfiguration userConfiguration;
|
||||||
|
@ -110,18 +117,18 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
||||||
|
|
||||||
public ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
|
public ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
|
||||||
{
|
{
|
||||||
return build( getArchivaConfiguration().getConfiguration().getRedbackRuntimeConfiguration() );
|
return build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
|
public void updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
|
||||||
throws RepositoryAdminException
|
throws RepositoryAdminException
|
||||||
{
|
{
|
||||||
RedbackRuntimeConfiguration runtimeConfiguration = build( archivaRuntimeConfiguration );
|
RedbackRuntimeConfiguration runtimeConfiguration = build( archivaRuntimeConfiguration );
|
||||||
Configuration configuration = getArchivaConfiguration().getConfiguration();
|
Configuration configuration = archivaConfiguration.getConfiguration();
|
||||||
configuration.setRedbackRuntimeConfiguration( runtimeConfiguration );
|
configuration.setRedbackRuntimeConfiguration( runtimeConfiguration );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getArchivaConfiguration().save( configuration );
|
archivaConfiguration.save( configuration );
|
||||||
}
|
}
|
||||||
catch ( RegistryException e )
|
catch ( RegistryException e )
|
||||||
{
|
{
|
||||||
|
@ -135,7 +142,15 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
||||||
|
|
||||||
private ArchivaRuntimeConfiguration build( RedbackRuntimeConfiguration runtimeConfiguration )
|
private ArchivaRuntimeConfiguration build( RedbackRuntimeConfiguration runtimeConfiguration )
|
||||||
{
|
{
|
||||||
return new BeanReplicator().replicateBean( runtimeConfiguration, ArchivaRuntimeConfiguration.class );
|
ArchivaRuntimeConfiguration archivaRuntimeConfiguration = new BeanReplicator().replicateBean( runtimeConfiguration, ArchivaRuntimeConfiguration.class );
|
||||||
|
|
||||||
|
if (archivaRuntimeConfiguration.getArchivaLdapConfiguration() == null)
|
||||||
|
{
|
||||||
|
// prevent NPE
|
||||||
|
archivaRuntimeConfiguration.setArchivaLdapConfiguration( new ArchivaLdapConfiguration() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return archivaRuntimeConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RedbackRuntimeConfiguration build( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
|
private RedbackRuntimeConfiguration build( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
|
||||||
|
|
|
@ -52,5 +52,5 @@
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean name="repositorySessionFactory" class="org.apache.archiva.webtest.memory.TestRepositorySessionFactory"/>
|
<bean name="repositorySessionFactory" class="org.apache.archiva.webtest.memory.TestRepositorySessionFactory"/>
|
||||||
|
<alias name="userConfiguration#archiva" alias="userConfiguration#default"/>
|
||||||
</beans>
|
</beans>
|
||||||
|
|
|
@ -65,5 +65,5 @@
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean name="RoleManagerStub" class="org.apache.archiva.web.rss.RoleManagerStub"/>
|
<bean name="RoleManagerStub" class="org.apache.archiva.web.rss.RoleManagerStub"/>
|
||||||
|
<alias name="userConfiguration#archiva" alias="userConfiguration#default"/>
|
||||||
</beans>
|
</beans>
|
|
@ -21,13 +21,11 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:context="http://www.springframework.org/schema/context"
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
http://www.springframework.org/schema/context
|
http://www.springframework.org/schema/context
|
||||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
|
||||||
http://cxf.apache.org/jaxrs
|
default-lazy-init="true">
|
||||||
http://cxf.apache.org/schemas/jaxrs.xsd" default-lazy-init="true">
|
|
||||||
|
|
||||||
<context:annotation-config/>
|
<context:annotation-config/>
|
||||||
<context:component-scan
|
<context:component-scan
|
||||||
|
@ -83,5 +81,5 @@
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
|
<alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
|
||||||
|
<alias name="userConfiguration#archiva" alias="userConfiguration#default"/>
|
||||||
</beans>
|
</beans>
|
|
@ -49,5 +49,5 @@
|
||||||
</props>
|
</props>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
<alias name="userConfiguration#archiva" alias="userConfiguration#default"/>
|
||||||
</beans>
|
</beans>
|
||||||
|
|
Loading…
Reference in New Issue