001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.maven.scm.tck.command.info; 020 021import java.io.File; 022import java.time.OffsetDateTime; 023import java.time.ZoneOffset; 024 025import org.apache.maven.scm.ScmFileSet; 026import org.apache.maven.scm.ScmTckTestCase; 027import org.apache.maven.scm.command.info.InfoItem; 028import org.apache.maven.scm.command.info.InfoScmResult; 029import org.apache.maven.scm.provider.ScmProvider; 030import org.junit.Test; 031 032import static org.junit.Assert.assertEquals; 033 034/** 035 * This test tests the info command. 036 * 037 */ 038public abstract class InfoCommandTckTest extends ScmTckTestCase { 039 040 @Test 041 public void testInfoCommandWithJustBasedir() throws Exception { 042 ScmProvider scmProvider = getScmManager().getProviderByUrl(getScmUrl()); 043 InfoScmResult result = scmProvider.info(getScmRepository().getProviderRepository(), getScmFileSet(), null); 044 assertResultIsSuccess(result); 045 assertEquals(1, result.getInfoItems().size()); 046 InfoItem item = result.getInfoItems().get(0); 047 assertEquals("Mark Struberg <struberg@yahoo.de>", item.getLastChangedAuthor()); 048 assertEquals("92f139dfec4d1dfb79c3cd2f94e83bf13129668b", item.getRevision()); 049 assertEquals( 050 OffsetDateTime.of(2009, 03, 15, 19, 14, 02, 0, ZoneOffset.ofHours(1)), item.getLastChangedDateTime()); 051 } 052 053 @Test 054 public void testInfoCommandFromBasedirDifferentFromWorkingCopyDirectory() throws Exception { 055 ScmProvider scmProvider = getScmManager().getProviderByUrl(getScmUrl()); 056 ScmFileSet fileSet = new ScmFileSet(new File(getWorkingCopy(), "src/main"), new File("java/Application.java")); 057 InfoScmResult result = scmProvider.info(getScmRepository().getProviderRepository(), fileSet, null); 058 assertResultIsSuccess(result); 059 assertEquals(1, result.getInfoItems().size()); 060 InfoItem item = result.getInfoItems().get(0); 061 assertEquals("Mark Struberg <struberg@yahoo.de>", item.getLastChangedAuthor()); 062 assertEquals("92f139dfec4d1dfb79c3cd2f94e83bf13129668b", item.getRevision()); 063 assertEquals( 064 OffsetDateTime.of(2009, 03, 15, 19, 14, 02, 0, ZoneOffset.ofHours(1)), item.getLastChangedDateTime()); 065 } 066}