1 /* 2 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.openjdk.skara.jcheck; 24 25 import org.openjdk.skara.vcs.*; 26 27 import java.io.IOException; 28 import java.nio.file.Path; 29 import java.util.*; 30 31 class TestRepository implements ReadOnlyRepository { 32 private Branch currentBranch = null; 33 private Branch defaultBranch = null; 34 private List<Branch> branches = new ArrayList<Branch>(); 35 36 private Tag defaultTag = null; 37 private List<Tag> tags = new ArrayList<Tag>(); 38 39 public Branch currentBranch() throws IOException { 40 return currentBranch; 41 } 42 43 void setCurrentBranch(Branch branch) { 44 currentBranch = branch; 45 } 46 47 public Optional<Bookmark> currentBookmark() { 48 return Optional.empty(); 49 } 50 51 public Branch defaultBranch() throws IOException { 52 return defaultBranch; 53 } 54 55 void setDefaultBranch(Branch branch) throws IOException { 56 defaultBranch = branch; 57 } 58 59 public List<Branch> branches() throws IOException { 60 return branches; 61 } 62 63 void setBranches(List<Branch> branches) { 64 this.branches = branches; 65 } 66 67 public Optional<Tag> defaultTag() throws IOException { 68 return Optional.ofNullable(defaultTag); 69 } 70 71 void setDefaultTag(Tag tag) { 72 defaultTag = tag; 73 } 74 75 public List<Tag> tags() throws IOException { 76 return tags; 77 } 78 79 void setTags(List<Tag> tags) { 80 this.tags = tags; 81 } 82 83 public Hash head() throws IOException { 84 return null; 85 } 86 87 public Commits commits() throws IOException { 88 return null; 89 } 90 91 @Override 92 public Commits commits(int n) throws IOException { 93 return null; 94 } 95 96 public Commits commits(boolean reverse) throws IOException { 97 return null; 98 } 99 100 @Override 101 public Commits commits(int n, boolean reverse) throws IOException { 102 return null; 103 } 104 105 public Commits commits(String range) throws IOException { 106 return null; 107 } 108 109 public Commits commits(String range, boolean reverse) throws IOException { 110 return null; 111 } 112 113 @Override 114 public Commits commits(String range, int n) throws IOException { 115 return null; 116 } 117 118 @Override 119 public Commits commits(String range, int n, boolean reverse) throws IOException { 120 return null; 121 } 122 123 public Optional<Commit> lookup(Hash h) throws IOException { 124 return Optional.empty(); 125 } 126 127 public Optional<Commit> lookup(Branch b) throws IOException { 128 return Optional.empty(); 129 } 130 131 public Optional<Commit> lookup(Tag t) throws IOException { 132 return Optional.empty(); 133 } 134 135 public List<CommitMetadata> commitMetadata() throws IOException { 136 return List.of(); 137 } 138 139 public Path root() throws IOException { 140 return null; 141 } 142 143 public boolean exists() throws IOException { 144 return false; 145 } 146 147 public boolean isHealthy() throws IOException { 148 return false; 149 } 150 151 public boolean isEmpty() throws IOException { 152 return true; 153 } 154 155 @Override 156 public boolean isClean() throws IOException { 157 return true; 158 } 159 160 public Hash mergeBase(Hash first, Hash second) throws IOException { 161 return null; 162 } 163 164 @Override 165 public boolean isAncestor(Hash ancestor, Hash descendant) throws IOException { 166 return false; 167 } 168 169 public Optional<Hash> resolve(String ref) throws IOException { 170 return Optional.empty(); 171 } 172 173 public Optional<String> username() throws IOException { 174 return Optional.empty(); 175 } 176 177 public Optional<byte[]> show(Path p, Hash h) throws IOException { 178 return Optional.of(new byte[0]); 179 } 180 181 public List<FileEntry> files(Hash h, List<Path> paths) throws IOException { 182 return List.of(); 183 } 184 185 public void dump(FileEntry entry, Path to) throws IOException { 186 } 187 188 public Diff diff(Hash base, Hash head) throws IOException { 189 return null; 190 } 191 192 public Diff diff(Hash head) throws IOException { 193 return null; 194 } 195 196 public List<String> config(String key) throws IOException { 197 return null; 198 } 199 200 public Repository copyTo(Path destination) throws IOException { 201 return null; 202 } 203 204 public String pullPath(String remote) throws IOException { 205 return null; 206 } 207 208 public String pushPath(String remote) throws IOException { 209 return null; 210 } 211 212 public boolean isValidRevisionRange(String expression) throws IOException { 213 return false; 214 } 215 216 public Optional<String> upstreamFor(Branch b) throws IOException { 217 return Optional.empty(); 218 } 219 220 public List<StatusEntry> status(Hash from, Hash to) throws IOException { 221 return Collections.emptyList(); 222 } 223 224 public boolean contains(Branch b, Hash h) throws IOException { 225 return false; 226 } 227 228 public List<Reference> remoteBranches(String remote) throws IOException { 229 return null; 230 } 231 232 public List<String> remotes() throws IOException { 233 return null; 234 } 235 }