mirror of https://github.com/apache/archiva.git
[MRM-1025] make sure listeners work in delete artifact action
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@825884 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e89326d687
commit
116d2d2387
|
@ -120,7 +120,7 @@ public class DeleteArtifactAction
|
|||
*/
|
||||
private DatabaseConsumers databaseConsumers;
|
||||
|
||||
/** @plexus.requirement */
|
||||
/** @plexus.requirement role="org.apache.maven.archiva.repository.events.RepositoryListener" */
|
||||
private List<RepositoryListener> listeners;
|
||||
|
||||
private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[] { ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
|
||||
|
@ -410,4 +410,9 @@ public class DeleteArtifactAction
|
|||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public List<RepositoryListener> getListeners()
|
||||
{
|
||||
return listeners;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package org.apache.maven.archiva.web.action;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
||||
|
||||
public class DeleteArtifactActionTest
|
||||
extends PlexusInSpringTestCase
|
||||
{
|
||||
public void testGetListeners()
|
||||
throws Exception
|
||||
{
|
||||
DeleteArtifactAction action = (DeleteArtifactAction) lookup( Action.class.getName(), "deleteArtifactAction" );
|
||||
assertNotNull( action );
|
||||
assertNotNull( action.getListeners() );
|
||||
assertFalse( action.getListeners().isEmpty() );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package org.apache.maven.archiva.web.action.admin.repositories;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
||||
import org.apache.maven.archiva.database.Constraint;
|
||||
import org.apache.maven.archiva.database.ObjectNotFoundException;
|
||||
import org.apache.maven.archiva.database.RepositoryProblemDAO;
|
||||
import org.apache.maven.archiva.model.RepositoryProblem;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stub class for Archiva DAO to avoid having to set up a database for tests.
|
||||
*
|
||||
* @todo a mock would be better, but that won't play nicely with Plexus injection.
|
||||
*/
|
||||
public class RepositoryProblemDAOStub
|
||||
implements RepositoryProblemDAO
|
||||
{
|
||||
public List<RepositoryProblem> queryRepositoryProblems( Constraint constraint )
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
throw new UnsupportedOperationException( "not implemented for stub" );
|
||||
}
|
||||
|
||||
public RepositoryProblem saveRepositoryProblem( RepositoryProblem problem )
|
||||
throws ArchivaDatabaseException
|
||||
{
|
||||
throw new UnsupportedOperationException( "not implemented for stub" );
|
||||
}
|
||||
|
||||
public void deleteRepositoryProblem( RepositoryProblem problem )
|
||||
throws ArchivaDatabaseException
|
||||
{
|
||||
throw new UnsupportedOperationException( "not implemented for stub" );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
<!--
|
||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
||||
~ or more contributor license agreements. See the NOTICE file
|
||||
~ distributed with this work for additional information
|
||||
~ regarding copyright ownership. The ASF licenses this file
|
||||
~ to you under the Apache License, Version 2.0 (the
|
||||
~ "License"); you may not use this file except in compliance
|
||||
~ with the License. You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<plexus>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.archiva.database.ArchivaDAO</role>
|
||||
<role-hint>jdo</role-hint>
|
||||
<implementation>org.apache.maven.archiva.web.action.admin.repositories.ArchivaDAOStub</implementation>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
|
||||
<field-name>configuration</field-name>
|
||||
</requirement>
|
||||
</requirements>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.archiva.database.RepositoryProblemDAO</role>
|
||||
<role-hint>jdo</role-hint>
|
||||
<implementation>org.apache.maven.archiva.web.action.admin.repositories.RepositoryProblemDAOStub</implementation>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.archiva.database.ProjectModelDAO</role>
|
||||
<role-hint>jdo</role-hint>
|
||||
<implementation>org.apache.maven.archiva.web.action.admin.repositories.ProjectModelDAOStub</implementation>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.archiva.database.ArtifactDAO</role>
|
||||
<role-hint>jdo</role-hint>
|
||||
<implementation>org.apache.maven.archiva.web.action.admin.repositories.ArtifactDAOStub</implementation>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.archiva.security.UserRepositories</role>
|
||||
<role-hint>default</role-hint>
|
||||
<implementation>org.apache.maven.archiva.security.UserRepositoriesStub</implementation>
|
||||
</component>
|
||||
</components>
|
||||
</plexus>
|
Loading…
Reference in New Issue