]> source.dussan.org Git - archiva.git/commitdiff
Fixing test errors after refactoring
authorMartin Stockhammer <martin_s@apache.org>
Fri, 28 Jun 2019 15:15:21 +0000 (17:15 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Fri, 28 Jun 2019 15:15:21 +0000 (17:15 +0200)
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/src/test/java/RepositoryProviderMock.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/log4j2-test.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/FilesystemStorage.java
archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java
archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/maven2/MavenRepositoryProviderTest.java

index f871fbb896527a71d0449cf7cb298d15edb53106..ea7b0f6533efcedfd9c8989f49962c6d9b2a2fbd 100644 (file)
@@ -21,10 +21,13 @@ package $package;
 
 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.configuration.RepositoryGroupConfiguration;
 import org.apache.archiva.repository.BasicManagedRepository;
 import org.apache.archiva.repository.BasicRemoteRepository;
 import org.apache.archiva.repository.EditableManagedRepository;
 import org.apache.archiva.repository.EditableRemoteRepository;
+import org.apache.archiva.repository.RepositoryGroup;
+import org.apache.archiva.repository.EditableRepositoryGroup;
 import org.apache.archiva.repository.ManagedRepository;
 import org.apache.archiva.repository.PasswordCredentials;
 import org.apache.archiva.repository.ReleaseScheme;
@@ -233,4 +236,21 @@ public class RepositoryProviderMock implements RepositoryProvider
     public <T> void raise(org.apache.archiva.repository.RepositoryEvent<T> event) {
 
     }
+
+    @Override
+    public RepositoryGroupConfiguration getRepositoryGroupConfiguration(RepositoryGroup repositoryGroup) throws RepositoryException {
+        return null;
+    }
+
+    @Override
+    public RepositoryGroup createRepositoryGroup(RepositoryGroupConfiguration configuration) throws RepositoryException {
+        return null;
+    }
+
+    @Override
+    public void updateRepositoryGroupInstance(EditableRepositoryGroup repositoryGroup, RepositoryGroupConfiguration configuration) throws RepositoryException {
+
+    }
+
+
 }
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/log4j2-test.xml
new file mode 100644 (file)
index 0000000..2953700
--- /dev/null
@@ -0,0 +1,103 @@
+<?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.
+  -->
+
+
+<configuration status="debug">
+
+  <properties>
+    <property name="logsDirectory">${sys:appserver.base}/logs</property>
+  </properties>
+
+  <appenders>
+    <Console name="console" target="SYSTEM_OUT" level="info">
+      <!--PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/-->
+      <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n}" />
+    </Console>
+    <RollingRandomAccessFile name="rolling" fileName="${logsDirectory}/archiva.log"
+                     filePattern="${logsDirectory}/archiva-%d{MM-dd-yyyy}.log"
+
+                             immediateFlush="true" append="true">
+      <PatternLayout>
+        <pattern>%d [%t] %-5p %c %x - %m%n</pattern>
+      </PatternLayout>
+      <Policies>
+        <TimeBasedTriggeringPolicy />
+      </Policies>
+    </RollingRandomAccessFile>
+  </appenders>
+  <loggers>
+
+    <!-- apache httpclient debug content transfer-->
+    <!--
+    <logger name="org.apache.http.wire">
+      <level value="debug"/>
+    </logger>
+    <logger name="org.apache.http.headers" level="debug"/>
+    -->
+
+
+
+    <logger name="org.apache.archiva.indexer.maven.search.MavenRepositorySearch" level="info"/>
+
+    <logger name="org.apache.archiva.common.plexusbridge.MavenIndexerUtils" level="info"/>
+
+    <logger name="JPOX" level="error"/>
+
+    <logger name="org.apache.commons.configuration.DefaultConfigurationBuilder" level="error"/>
+
+    <logger name="org.apache.archiva.admin.repository.managed" level="info"/>
+
+    <logger name="org.springframework" level="info"/>
+
+    <logger name="org.codehaus.plexus" level="info"/>
+
+    <logger name="org.codehaus.redback" level="info"/>
+
+    <logger name="org.apache.cxf" level="info"/>
+
+    <logger name="org.quartz" level="info"/>
+
+    <logger name="org.apache.archiva.indexer.merger" level="info"/>
+
+    <logger name="org.apache.archiva.metadata.repository.stats.DefaultRepositoryStatisticsManager" level="debug" />
+
+    <logger name="org.apache.archiva.scheduler.repository.DefaultRepositoryArchivaTaskScheduler" level="debug"/>
+
+    <logger name="org.apache.archiva.web.security.ArchivaAuthorizer" level="debug"/>
+
+    <logger name="org.apache.archiva.redback.rest.services.DefaultRoleManagementService" level="debug"/>
+
+    <logger name="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry" level="debug"/>
+
+    <logger name="org.apache.archiva.redback.components.taskqueue.DefaultTaskQueue" level="info" />
+
+    <logger name="org.apache.archiva" level="debug" />
+    <!--
+    <logger name="org.apache.archiva.scheduler.indexing" level="debug"/>
+    -->
+
+    <root level="info" includeLocation="true">
+      <appender-ref ref="console"/>
+      <appender-ref ref="rolling"/>
+    </root>
+  </loggers>
+</configuration>
+
+
index 65b5610be46d9eaeae4696191edf17a029ef7afc..f24b311370fd0399204d4ee110f6aca877ec3f0b 100644 (file)
@@ -49,6 +49,9 @@ public class FilesystemStorage implements RepositoryStorage {
     private final FileLockManager fileLockManager;
 
     public FilesystemStorage(Path basePath, FileLockManager fileLockManager) throws IOException {
+        if (!Files.exists(basePath)) {
+            Files.createDirectories(basePath);
+        }
         this.basePath = basePath.normalize().toRealPath();
         this.fileLockManager = fileLockManager;
     }
index f0d81e2463d52ae09e5f074ed5d86f42a171a1c1..403bb9fb4c63734bed7094f2f812748b0a34b269 100644 (file)
@@ -96,11 +96,12 @@ public class ManagedDefaultRepositoryContent
         super(artifactMappingProviders==null ? Collections.singletonList( new DefaultArtifactMappingProvider() ) : artifactMappingProviders);
         setFileTypes( fileTypes );
         setRepository( repository );
+        final Path repositoryDir = getRepoDir();
         try {
-            storage = new FilesystemStorage(getRepoDir(), lockManager);
+            storage = new FilesystemStorage(repositoryDir, lockManager);
         } catch (IOException e) {
-            log.error("Could not initialize the filesystem storage to repository: {}", getRepoDir());
-            throw new RuntimeException("Fatal error. Could not initialize the filesystem storage for "+getRepoDir());
+            log.error("Could not initialize the filesystem storage to repository {}: {}", repositoryDir, e.getMessage(), e);
+            throw new RuntimeException("Fatal error. Could not initialize the filesystem storage for "+repositoryDir+": "+e.getMessage());
         }
     }
 
index 0a04dad2fcb7dd402bd9101fa7783a590c809136..39396d6d58aff62d2e21a76c2d0177993342147e 100644 (file)
@@ -356,7 +356,7 @@ public class MavenRepositoryProviderTest
         assertEquals("0 0 03 ? * MON", grp.getSchedulingDefinition());
         IndexCreationFeature indexCreationFeature = grp.getFeature( IndexCreationFeature.class ).get();
         try {
-            assertEquals(new URI("file://.index-abc"), indexCreationFeature.getIndexPath());
+            assertEquals(new URI(".index-abc"), indexCreationFeature.getIndexPath());
         } catch (URISyntaxException e) {
             e.printStackTrace();
         }