Repository: archiva Updated Branches: refs/heads/master be86b55e5 -> 4ad5e63c6
add a new module with mock for test Project: http://git-wip-us.apache.org/repos/asf/archiva/repo Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/e62d96a1 Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/e62d96a1 Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/e62d96a1 Branch: refs/heads/master Commit: e62d96a1fa22bc477ef1e3cbfdc8404e07864cad Parents: be86b55 Author: Olivier Lamy <[email protected]> Authored: Thu Oct 1 14:51:45 2015 +1000 Committer: Olivier Lamy <[email protected]> Committed: Thu Oct 1 14:51:45 2015 +1000 ---------------------------------------------------------------------- .../archiva-base/archiva-mock/pom.xml | 55 ++++++++++++++++++ .../mock/MockRepositorySessionFactory.java | 61 ++++++++++++++++++++ .../main/resources/META-INF/spring-context.xml | 33 +++++++++++ .../archiva-repository-admin-default/pom.xml | 6 ++ .../mock/MockRepositorySessionFactory.java | 58 ------------------- archiva-modules/archiva-base/pom.xml | 1 + pom.xml | 5 ++ 7 files changed, 161 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/archiva/blob/e62d96a1/archiva-modules/archiva-base/archiva-mock/pom.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-mock/pom.xml b/archiva-modules/archiva-base/archiva-mock/pom.xml new file mode 100644 index 0000000..bbe2e8c --- /dev/null +++ b/archiva-modules/archiva-base/archiva-mock/pom.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-base</artifactId> + <version>2.2.1-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>archiva-mock</artifactId> + <packaging>jar</packaging> + <name>Archiva Base :: Mocks</name> + <dependencies> + + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.archiva</groupId> + <artifactId>metadata-repository-api</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/archiva/blob/e62d96a1/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java new file mode 100644 index 0000000..303d2e0 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java @@ -0,0 +1,61 @@ +package org.apache.archiva.mock; + +/* + * 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 org.apache.archiva.metadata.repository.AbstractMetadataRepository; +import org.apache.archiva.metadata.repository.MetadataRepository; +import org.apache.archiva.metadata.repository.RepositorySession; +import org.apache.archiva.metadata.repository.RepositorySessionFactory; +import org.springframework.stereotype.Service; + +/** + * @author Olivier Lamy + */ +@Service( "repositorySessionFactory#mock" ) +public class MockRepositorySessionFactory + implements RepositorySessionFactory +{ + @Override + public RepositorySession createSession() + { + return new RepositorySession( null, null ) + { + @Override + public void close() + { + return; + } + + @Override + public void save() + { + // no op + } + + @Override + public MetadataRepository getRepository() + { + return new AbstractMetadataRepository() + { + }; + } + }; + } +} http://git-wip-us.apache.org/repos/asf/archiva/blob/e62d96a1/archiva-modules/archiva-base/archiva-mock/src/main/resources/META-INF/spring-context.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-mock/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-mock/src/main/resources/META-INF/spring-context.xml new file mode 100644 index 0000000..2c9156d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-mock/src/main/resources/META-INF/spring-context.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> + +<!-- + ~ 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. + --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true"> + + + <context:annotation-config /> + <context:component-scan base-package="org.apache.archiva.mock"/> + +</beans> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/archiva/blob/e62d96a1/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index 9927f88..f91ed77 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -229,6 +229,12 @@ <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-mock</artifactId> + <scope>test</scope> + </dependency> + </dependencies> <build> http://git-wip-us.apache.org/repos/asf/archiva/blob/e62d96a1/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java deleted file mode 100644 index d26a704..0000000 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.apache.archiva.admin.mock; -/* - * 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 org.apache.archiva.metadata.repository.AbstractMetadataRepository; -import org.apache.archiva.metadata.repository.MetadataRepository; -import org.apache.archiva.metadata.repository.RepositorySession; -import org.apache.archiva.metadata.repository.RepositorySessionFactory; -import org.springframework.stereotype.Service; - -/** - * @author Olivier Lamy - */ -@Service( "repositorySessionFactory#mock" ) -public class MockRepositorySessionFactory - implements RepositorySessionFactory -{ - @Override - public RepositorySession createSession() - { - return new RepositorySession( null, null ) - { - @Override - public void close() - { - return; - } - - @Override - public void save() - { - // no op - } - - @Override - public MetadataRepository getRepository() - { - return new AbstractMetadataRepository() {}; - } - }; - } -} http://git-wip-us.apache.org/repos/asf/archiva/blob/e62d96a1/archiva-modules/archiva-base/pom.xml ---------------------------------------------------------------------- diff --git a/archiva-modules/archiva-base/pom.xml b/archiva-modules/archiva-base/pom.xml index cf2c25f..3a5da0d 100644 --- a/archiva-modules/archiva-base/pom.xml +++ b/archiva-modules/archiva-base/pom.xml @@ -32,6 +32,7 @@ <modules> <module>archiva-test-utils</module> <module>archiva-common</module> + <module>archiva-mock</module> <module>archiva-filelock</module> <module>archiva-model</module> <module>archiva-configuration</module> http://git-wip-us.apache.org/repos/asf/archiva/blob/e62d96a1/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 3d58f71..692b5fd 100644 --- a/pom.xml +++ b/pom.xml @@ -287,6 +287,11 @@ </dependency> <dependency> <groupId>org.apache.archiva</groupId> + <artifactId>archiva-mock</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.archiva</groupId> <artifactId>archiva-filelock</artifactId> <version>${project.version}</version> </dependency>
