1 package org.apache.maven.archiva.web.action.reports;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import com.opensymphony.xwork2.Action;
23 import org.apache.archiva.metadata.model.MetadataFacet;
24 import org.apache.archiva.metadata.repository.MetadataRepository;
25 import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
26 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
27 import org.apache.archiva.reports.RepositoryProblemFacet;
28 import org.apache.commons.io.IOUtils;
29 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
30 import org.easymock.MockControl;
32 import java.io.IOException;
33 import java.util.ArrayList;
34 import java.util.Arrays;
35 import java.util.Collections;
36 import java.util.Date;
37 import java.util.List;
40 * Test the GenerationReportAction. Note that we are testing for <i>current</i> behaviour, however there are several
41 * instances below where other behaviour may actually be more appropriate (eg the error handling, download stats should
42 * never forward to HTML page, etc). This is also missing tests for various combinations of paging at this point.
44 public class GenerateReportActionTest
45 extends PlexusInSpringTestCase
47 private GenerateReportAction action;
49 private static final String SNAPSHOTS = "snapshots";
51 private static final String INTERNAL = "internal";
53 private static final String GROUP_ID = "groupId";
55 private RepositoryStatisticsManager repositoryStatisticsManager;
57 private MockControl repositoryStatisticsManagerControl;
59 private MockControl metadataRepositoryControl;
61 private MetadataRepository metadataRepository;
63 private static final String PROBLEM = "problem";
66 protected void setUp()
71 action = (GenerateReportAction) lookup( Action.class, "generateReport" );
73 repositoryStatisticsManagerControl = MockControl.createControl( RepositoryStatisticsManager.class );
74 repositoryStatisticsManager = (RepositoryStatisticsManager) repositoryStatisticsManagerControl.getMock();
75 action.setRepositoryStatisticsManager( repositoryStatisticsManager );
77 metadataRepositoryControl = MockControl.createControl( MetadataRepository.class );
78 metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
79 action.setMetadataRepository( metadataRepository );
82 private void prepareAction( List<String> selectedRepositories, List<String> availableRepositories )
84 action.setSelectedRepositories( selectedRepositories );
87 assertEquals( Arrays.asList( GenerateReportAction.ALL_REPOSITORIES, INTERNAL, SNAPSHOTS ),
88 action.getRepositoryIds() );
89 assertEquals( availableRepositories, action.getAvailableRepositories() );
92 public void testGenerateStatisticsInvalidRowCount()
94 repositoryStatisticsManagerControl.replay();
95 prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
97 action.setRowCount( 0 );
98 String result = action.generateStatistics();
99 assertEquals( Action.INPUT, result );
100 assertTrue( action.hasFieldErrors() );
101 repositoryStatisticsManagerControl.verify();
104 public void testGenerateStatisticsInvalidEndDate()
106 repositoryStatisticsManagerControl.replay();
107 prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
109 action.setStartDate( "2009/12/12" );
110 action.setEndDate( "2008/11/11" );
111 String result = action.generateStatistics();
112 assertEquals( Action.INPUT, result );
113 assertTrue( action.hasFieldErrors() );
114 repositoryStatisticsManagerControl.verify();
117 public void testGenerateStatisticsMalformedEndDate()
119 repositoryStatisticsManagerControl.replay();
120 prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
122 action.setEndDate( "This is not a date" );
123 String result = action.generateStatistics();
125 // TODO: should be an input error
126 assertEquals( Action.ERROR, result );
127 assertTrue( action.hasActionErrors() );
128 repositoryStatisticsManagerControl.verify();
131 public void testGenerateStatisticsInvalidEndDateMultiRepo()
133 repositoryStatisticsManagerControl.replay();
134 prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
136 action.setStartDate( "2009/12/12" );
137 action.setEndDate( "2008/11/11" );
138 String result = action.generateStatistics();
139 assertEquals( Action.INPUT, result );
140 assertTrue( action.hasFieldErrors() );
141 repositoryStatisticsManagerControl.verify();
144 public void testGenerateStatisticsMalformedEndDateMultiRepo()
146 repositoryStatisticsManagerControl.replay();
147 prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
149 action.setEndDate( "This is not a date" );
150 String result = action.generateStatistics();
152 // TODO: should be an input error
153 assertEquals( Action.ERROR, result );
154 assertTrue( action.hasActionErrors() );
155 repositoryStatisticsManagerControl.verify();
158 public void testGenerateStatisticsNoRepos()
160 repositoryStatisticsManagerControl.replay();
161 prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
163 String result = action.generateStatistics();
164 assertEquals( Action.INPUT, result );
165 assertTrue( action.hasFieldErrors() );
166 repositoryStatisticsManagerControl.verify();
169 public void testGenerateStatisticsSingleRepo()
172 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( INTERNAL,
175 Collections.singletonList( createDefaultStats() ) );
177 repositoryStatisticsManagerControl.replay();
178 prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
180 String result = action.generateStatistics();
181 assertSuccessResult( result );
182 repositoryStatisticsManagerControl.verify();
185 public void testGenerateStatisticsSingleRepoNoStats()
189 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( INTERNAL,
192 Collections.<Object>emptyList() );
193 repositoryStatisticsManagerControl.replay();
194 prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
196 String result = action.generateStatistics();
197 assertEquals( Action.ERROR, result );
198 assertTrue( action.hasActionErrors() );
200 repositoryStatisticsManagerControl.verify();
203 public void testGenerateStatisticsOvershotPages()
207 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( INTERNAL,
210 Collections.singletonList( createDefaultStats() ) );
211 repositoryStatisticsManagerControl.replay();
213 prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
215 String result = action.generateStatistics();
216 assertEquals( Action.ERROR, result );
217 assertTrue( action.hasActionErrors() );
218 repositoryStatisticsManagerControl.verify();
221 public void testGenerateStatisticsMultipleRepoNoResults()
225 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( SNAPSHOTS,
228 Collections.<Object>emptyList() );
229 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( INTERNAL,
232 Collections.<Object>emptyList() );
233 repositoryStatisticsManagerControl.replay();
234 prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
236 String result = action.generateStatistics();
237 assertEquals( GenerateReportAction.BLANK, result );
238 assertFalse( action.hasActionErrors() );
239 assertFalse( action.hasActionMessages() );
240 assertFalse( action.hasFieldErrors() );
242 repositoryStatisticsManagerControl.verify();
245 public void testGenerateStatisticsMultipleRepo()
249 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( SNAPSHOTS,
252 Collections.singletonList( createDefaultStats() ) );
253 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( INTERNAL,
256 Collections.singletonList( createDefaultStats() ) );
258 repositoryStatisticsManagerControl.replay();
259 prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
261 String result = action.generateStatistics();
262 assertSuccessResult( result );
263 repositoryStatisticsManagerControl.verify();
266 public void testDownloadStatisticsSingleRepo()
269 Date date = new Date();
270 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( SNAPSHOTS,
273 Collections.singletonList( createStats( date ) ) );
274 repositoryStatisticsManagerControl.replay();
276 prepareAction( Arrays.asList( SNAPSHOTS ), Arrays.asList( INTERNAL ) );
278 String result = action.downloadStatisticsReport();
279 assertEquals( GenerateReportAction.SEND_FILE, result );
280 assertFalse( action.hasActionErrors() );
281 assertFalse( action.hasFieldErrors() );
284 "Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes,Jars,Wars\n" +
285 date + ",0,0,0,0,0,0,0,0,0\n", IOUtils.toString( action.getInputStream() ) );
286 repositoryStatisticsManagerControl.verify();
289 public void testDownloadStatisticsMultipleRepos()
292 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( SNAPSHOTS,
295 Collections.singletonList( createDefaultStats() ) );
296 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( INTERNAL,
299 Collections.singletonList( createDefaultStats() ) );
300 repositoryStatisticsManagerControl.replay();
301 prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
303 String result = action.downloadStatisticsReport();
304 assertEquals( GenerateReportAction.SEND_FILE, result );
305 assertFalse( action.hasActionErrors() );
306 assertFalse( action.hasFieldErrors() );
308 assertMultiRepoCsvResult();
309 repositoryStatisticsManagerControl.verify();
312 public void testDownloadStatisticsMalformedEndDateMultiRepo()
314 repositoryStatisticsManagerControl.replay();
315 prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
317 action.setEndDate( "This is not a date" );
318 String result = action.downloadStatisticsReport();
320 // TODO: should be an input error
321 assertEquals( Action.ERROR, result );
322 assertTrue( action.hasActionErrors() );
323 repositoryStatisticsManagerControl.verify();
326 public void testDownloadStatisticsMalformedEndDateSingleRepo()
328 repositoryStatisticsManagerControl.replay();
329 prepareAction( Arrays.asList( SNAPSHOTS ), Arrays.asList( INTERNAL ) );
331 action.setEndDate( "This is not a date" );
332 String result = action.downloadStatisticsReport();
334 // TODO: should be an input error
335 assertEquals( Action.ERROR, result );
336 assertTrue( action.hasActionErrors() );
337 repositoryStatisticsManagerControl.verify();
340 public void testDownloadStatisticsInvalidEndDateMultiRepo()
342 repositoryStatisticsManagerControl.replay();
343 prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
345 action.setStartDate( "2009/12/12" );
346 action.setEndDate( "2008/11/11" );
347 String result = action.downloadStatisticsReport();
348 assertEquals( Action.INPUT, result );
349 assertTrue( action.hasFieldErrors() );
350 repositoryStatisticsManagerControl.verify();
353 public void testDownloadStatisticsInvalidEndDateSingleRepo()
355 repositoryStatisticsManagerControl.replay();
356 prepareAction( Arrays.asList( SNAPSHOTS ), Arrays.asList( INTERNAL ) );
358 action.setStartDate( "2009/12/12" );
359 action.setEndDate( "2008/11/11" );
360 String result = action.downloadStatisticsReport();
361 assertEquals( Action.INPUT, result );
362 assertTrue( action.hasFieldErrors() );
363 repositoryStatisticsManagerControl.verify();
366 public void testDownloadStatisticsSingleRepoNoStats()
370 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( INTERNAL,
373 Collections.<Object>emptyList() );
374 repositoryStatisticsManagerControl.replay();
375 prepareAction( Collections.singletonList( INTERNAL ), Collections.singletonList( SNAPSHOTS ) );
377 String result = action.downloadStatisticsReport();
378 assertEquals( Action.ERROR, result );
379 assertTrue( action.hasActionErrors() );
380 repositoryStatisticsManagerControl.verify();
383 public void testDownloadStatisticsNoRepos()
385 repositoryStatisticsManagerControl.replay();
386 prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
388 String result = action.downloadStatisticsReport();
389 assertEquals( Action.INPUT, result );
390 assertTrue( action.hasFieldErrors() );
391 repositoryStatisticsManagerControl.verify();
394 public void testDownloadStatisticsMultipleRepoNoResults()
398 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( SNAPSHOTS,
401 Collections.<Object>emptyList() );
402 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( INTERNAL,
405 Collections.<Object>emptyList() );
406 repositoryStatisticsManagerControl.replay();
407 prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
409 String result = action.downloadStatisticsReport();
410 assertEquals( GenerateReportAction.BLANK, result );
411 assertFalse( action.hasActionErrors() );
412 assertFalse( action.hasActionMessages() );
413 assertFalse( action.hasFieldErrors() );
414 repositoryStatisticsManagerControl.verify();
417 public void testDownloadStatisticsMultipleRepoInStrutsFormat()
420 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( SNAPSHOTS,
423 Collections.singletonList( createDefaultStats() ) );
424 repositoryStatisticsManagerControl.expectAndReturn( repositoryStatisticsManager.getStatisticsInRange( INTERNAL,
427 Collections.singletonList( createDefaultStats() ) );
428 repositoryStatisticsManagerControl.replay();
429 prepareAction( Arrays.asList( SNAPSHOTS, INTERNAL ), Collections.<String>emptyList() );
431 action.setSelectedRepositories( Collections.singletonList( "[" + SNAPSHOTS + "],[" + INTERNAL + "]" ) );
432 String result = action.downloadStatisticsReport();
433 assertEquals( GenerateReportAction.SEND_FILE, result );
434 assertFalse( action.hasActionErrors() );
435 assertFalse( action.hasFieldErrors() );
437 assertMultiRepoCsvResult();
438 repositoryStatisticsManagerControl.verify();
441 public void testHealthReportSingleRepo()
444 RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
445 RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", INTERNAL );
447 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
448 RepositoryProblemFacet.FACET_ID ),
449 Arrays.asList( problem1.getName(), problem2.getName() ) );
450 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
451 RepositoryProblemFacet.FACET_ID,
452 problem1.getName() ),
454 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
455 RepositoryProblemFacet.FACET_ID,
456 problem2.getName() ),
458 metadataRepositoryControl.replay();
460 action.setRepositoryId( INTERNAL );
462 prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
464 String result = action.execute();
465 assertSuccessResult( result );
467 assertEquals( Collections.singleton( INTERNAL ), action.getRepositoriesMap().keySet() );
468 assertEquals( Arrays.asList( problem1, problem2 ), action.getRepositoriesMap().get( INTERNAL ) );
470 metadataRepositoryControl.verify();
473 public void testHealthReportInvalidRowCount()
476 metadataRepositoryControl.replay();
478 action.setRowCount( 0 );
479 action.setRepositoryId( INTERNAL );
481 prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
483 String result = action.execute();
484 assertEquals( Action.INPUT, result );
485 assertFalse( action.hasActionErrors() );
486 assertTrue( action.hasFieldErrors() );
488 metadataRepositoryControl.verify();
491 public void testHealthReportAllRepos()
494 RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
495 RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", SNAPSHOTS );
496 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
497 RepositoryProblemFacet.FACET_ID ),
498 Arrays.asList( problem1.getName() ) );
499 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( SNAPSHOTS,
500 RepositoryProblemFacet.FACET_ID ),
501 Arrays.asList( problem2.getName() ) );
502 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
503 RepositoryProblemFacet.FACET_ID,
504 problem1.getName() ),
506 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( SNAPSHOTS,
507 RepositoryProblemFacet.FACET_ID,
508 problem2.getName() ),
510 metadataRepositoryControl.replay();
512 action.setRepositoryId( GenerateReportAction.ALL_REPOSITORIES );
514 prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
516 String result = action.execute();
517 assertSuccessResult( result );
519 assertEquals( Arrays.asList( INTERNAL, SNAPSHOTS ), new ArrayList<String>(
520 action.getRepositoriesMap().keySet() ) );
521 assertEquals( Arrays.asList( problem1 ), action.getRepositoriesMap().get( INTERNAL ) );
522 assertEquals( Arrays.asList( problem2 ), action.getRepositoriesMap().get( SNAPSHOTS ) );
524 metadataRepositoryControl.verify();
527 public void testHealthReportSingleRepoByCorrectGroupId()
530 RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
531 RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", INTERNAL );
532 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
533 RepositoryProblemFacet.FACET_ID ),
534 Arrays.asList( problem1.getName(), problem2.getName() ) );
535 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
536 RepositoryProblemFacet.FACET_ID,
537 problem1.getName() ),
539 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
540 RepositoryProblemFacet.FACET_ID,
541 problem2.getName() ),
543 metadataRepositoryControl.replay();
545 action.setGroupId( GROUP_ID );
546 action.setRepositoryId( INTERNAL );
548 prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
550 String result = action.execute();
551 assertSuccessResult( result );
553 assertEquals( Collections.singleton( INTERNAL ), action.getRepositoriesMap().keySet() );
554 assertEquals( Arrays.asList( problem1, problem2 ), action.getRepositoriesMap().get( INTERNAL ) );
556 metadataRepositoryControl.verify();
559 public void testHealthReportSingleRepoByCorrectGroupIdAllRepositories()
562 RepositoryProblemFacet problem1 = createProblem( GROUP_ID, "artifactId", INTERNAL );
563 RepositoryProblemFacet problem2 = createProblem( GROUP_ID, "artifactId-2", SNAPSHOTS );
564 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
565 RepositoryProblemFacet.FACET_ID ),
566 Arrays.asList( problem1.getName() ) );
567 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( SNAPSHOTS,
568 RepositoryProblemFacet.FACET_ID ),
569 Arrays.asList( problem2.getName() ) );
570 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( INTERNAL,
571 RepositoryProblemFacet.FACET_ID,
572 problem1.getName() ),
574 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacet( SNAPSHOTS,
575 RepositoryProblemFacet.FACET_ID,
576 problem2.getName() ),
578 metadataRepositoryControl.replay();
580 action.setGroupId( GROUP_ID );
581 action.setRepositoryId( GenerateReportAction.ALL_REPOSITORIES );
583 prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
585 String result = action.execute();
586 assertSuccessResult( result );
588 assertEquals( Arrays.asList( INTERNAL, SNAPSHOTS ), new ArrayList<String>(
589 action.getRepositoriesMap().keySet() ) );
590 assertEquals( Arrays.asList( problem1 ), action.getRepositoriesMap().get( INTERNAL ) );
591 assertEquals( Arrays.asList( problem2 ), action.getRepositoriesMap().get( SNAPSHOTS ) );
593 metadataRepositoryControl.verify();
596 public void testHealthReportSingleRepoByIncorrectGroupId()
599 metadataRepositoryControl.expectAndReturn( metadataRepository.getMetadataFacets( INTERNAL,
600 RepositoryProblemFacet.FACET_ID ),
601 Collections.<MetadataFacet>emptyList() );
602 metadataRepositoryControl.replay();
604 action.setGroupId( "not.it" );
605 action.setRepositoryId( INTERNAL );
607 prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
609 String result = action.execute();
610 assertEquals( GenerateReportAction.BLANK, result );
611 assertFalse( action.hasActionErrors() );
612 assertFalse( action.hasFieldErrors() );
614 metadataRepositoryControl.verify();
617 private void assertMultiRepoCsvResult()
621 "Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes,Jars,Wars\n" +
622 "snapshots,0,0,0,0,0,0,0,0,0\n" + "internal,0,0,0,0,0,0,0,0,0\n", IOUtils.toString(
623 action.getInputStream() ) );
626 private RepositoryProblemFacet createProblem( String groupId, String artifactId, String repoId )
628 RepositoryProblemFacet problem = new RepositoryProblemFacet();
629 problem.setRepositoryId( repoId );
630 problem.setNamespace( groupId );
631 problem.setProject( artifactId );
632 problem.setProblem( PROBLEM );
636 public void testHealthReportNoRepositoryId()
639 prepareAction( Collections.<String>emptyList(), Arrays.asList( SNAPSHOTS, INTERNAL ) );
641 String result = action.execute();
642 assertEquals( Action.INPUT, result );
643 assertTrue( action.hasFieldErrors() );
646 private void assertSuccessResult( String result )
648 assertEquals( Action.SUCCESS, result );
649 assertFalse( action.hasActionErrors() );
650 assertFalse( action.hasFieldErrors() );
653 private RepositoryStatistics createDefaultStats()
655 return createStats( new Date() );
658 private RepositoryStatistics createStats( Date date )
660 RepositoryStatistics stats = new RepositoryStatistics();
661 stats.setScanStartTime( date );