001package org.apache.maven.scm.provider.accurev.cli; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import static org.junit.Assert.assertNotNull; 023import static org.junit.Assert.assertNull; 024 025import java.io.IOException; 026 027import org.apache.maven.scm.log.DefaultLog; 028import org.apache.maven.scm.log.ScmLogger; 029import org.junit.Test; 030 031public class StatConsumerTest 032{ 033 034 @Test 035 public void testIgnored() 036 throws Exception 037 { 038 // At this stage we do not actually need to know the status apart from a file/directory 039 // being ignored. 040 assertNull( consume( "/stat.ignored.xml" ) ); 041 } 042 043 @Test 044 public void testBacked() 045 throws Exception 046 { 047 assertNotNull( consume( "/stat.backed.xml" ) ); 048 }; 049 050 @Test 051 public void testNoWorkspace() 052 throws Exception 053 { 054 // We don't care about files outside a workspace 055 consume( "/stat.noworkspace.xml" ); 056 } 057 058 private String consume( String resource ) 059 throws IOException 060 { 061 ScmLogger logger = new DefaultLog(); 062 StatConsumer consumer = new StatConsumer( logger ); 063 064 AccuRevJUnitUtil.consume( resource, consumer ); 065 return consumer.getStatus(); 066 } 067 068}