mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
Use default implementation to keep compatibility
This commit is contained in:
@@ -45,5 +45,7 @@ public interface NamespaceStrategy {
|
||||
*
|
||||
* @return namespace can be changed
|
||||
*/
|
||||
boolean canBeChanged();
|
||||
default boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,4 @@ public class CurrentYearNamespaceStrategy implements NamespaceStrategy {
|
||||
public String createNamespace(Repository repository) {
|
||||
return String.valueOf(Year.now(clock).getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,9 +32,4 @@ public class RepositoryTypeNamespaceStrategy implements NamespaceStrategy {
|
||||
public String createNamespace(Repository repository) {
|
||||
return repository.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,4 @@ public class UsernameNamespaceStrategy implements NamespaceStrategy {
|
||||
public String createNamespace(Repository repository) {
|
||||
return SecurityUtils.getSubject().getPrincipal().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,11 +80,6 @@ class NamespaceStrategyResourceTest {
|
||||
public String createNamespace(Repository repository) {
|
||||
return "awesome";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class SuperNamespaceStrategy implements NamespaceStrategy {
|
||||
@@ -92,11 +87,6 @@ class NamespaceStrategyResourceTest {
|
||||
public String createNamespace(Repository repository) {
|
||||
return "super";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class MegaNamespaceStrategy implements NamespaceStrategy {
|
||||
@@ -104,10 +94,5 @@ class NamespaceStrategyResourceTest {
|
||||
public String createNamespace(Repository repository) {
|
||||
return "mega";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,17 +66,12 @@ class NamespaceStrategyProviderTest {
|
||||
return new LinkedHashSet<>(Arrays.asList(new Trillian(), new Zaphod(), new Arthur()));
|
||||
}
|
||||
|
||||
private static class Trillian implements NamespaceStrategy {
|
||||
private static class Trillian implements NamespaceStrategy{
|
||||
|
||||
@Override
|
||||
public String createNamespace(Repository repository) {
|
||||
return "trillian";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Zaphod implements NamespaceStrategy {
|
||||
@@ -85,11 +80,6 @@ class NamespaceStrategyProviderTest {
|
||||
public String createNamespace(Repository repository) {
|
||||
return "zaphod";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Arthur implements NamespaceStrategy {
|
||||
@@ -98,11 +88,6 @@ class NamespaceStrategyProviderTest {
|
||||
public String createNamespace(Repository repository) {
|
||||
return "arthur";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import sonia.scm.ScmConstraintViolationException;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class NamespaceStrategyValidatorTest {
|
||||
|
||||
@@ -52,11 +52,6 @@ class NamespaceStrategyValidatorTest {
|
||||
public String createNamespace(Repository repository) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeChanged() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user