this(new BaseConfiguration());
}
+ @Override
public void exportProfile(RulesProfile profile, Writer writer) {
try {
ListMultimap<String, ActiveRule> activeRulesByConfigKey = arrangeByConfigKey(profile.getActiveRulesByRepository(CheckstyleConstants.REPOSITORY_KEY));
this.xmlProfileParser = xmlProfileParser;
}
+ @Override
public RulesProfile createProfile(ValidationMessages messages) {
return xmlProfileParser.parseResource(getClass().getClassLoader(), "org/sonar/plugins/checkstyle/profile-sonar-way.xml", messages);
}
}
+ @Override
public RulesProfile createProfile(ValidationMessages messages) {
return xmlProfileParser.parseResource(getClass().getClassLoader(), "org/sonar/plugins/checkstyle/profile-sun-conventions.xml", messages);
}
this.taskName = taskName;
}
+ @Override
public boolean supportsTask(final Task task) {
return taskName.equals(task.getTaskName());
}
this.classLoader = classLoader;
}
+ @Override
public AsmClass getClass(String internalName, DETAIL_LEVEL level) {
if (internalName == null) {
throw new IllegalStateException("You can try to load a class whose internalName = 'null'");
this.asmClass = asmClass;
}
+ @Override
public void visit(int version, int accessFlags, String internalName, String signature, String superClass, String[] interfaces) {
if (asmClass.getDetailLevel() == DETAIL_LEVEL.NOTHING) {
asmClass.setAccessFlags(accessFlags);
}
}
+ @Override
public FieldVisitor visitField(int access, String fieldName, String description, String signature, Object value) {
AsmField field = asmClass.getFieldOrCreateIt(fieldName);
field.setAccessFlags(access);
return null;
}
+ @Override
public MethodVisitor visitMethod(int access, String methodName, String description, String signature, String[] exceptions) {
AsmMethod method = asmClass.getMethodOrCreateIt(methodName + description);
if (isInheritedMethodSignature(method.getParent(), method.getKey())) {
return null;
}
+ @Override
public void visitEnd() {
asmClass.setDetailLevel(level);
}
emptyMethod = true;
}
+ @Override
public void visitFieldInsn(int opcode, String owner, String fieldName, String fieldDescription) {
AsmClass targetClass = asmClassProvider.getClass(owner, DETAIL_LEVEL.NOTHING);
AsmField targetField = targetClass.getFieldOrCreateIt(fieldName);
emptyMethod = false;
}
+ @Override
public void visitMethodInsn(int opcode, String owner, String methodName, String methodDescription) {
if (isNotCallToJavaArrayMethod(owner)) {
AsmClass targetClass = asmClassProvider.getClass(owner, DETAIL_LEVEL.STRUCTURE);
return internalName.charAt(0) != '[';
}
+ @Override
public void visitTryCatchBlock(Label start, Label end, Label handler, String exception) {
if (exception != null) {
AsmClass exceptionClass = asmClassProvider.getClass(exception, DETAIL_LEVEL.NOTHING);
emptyMethod = false;
}
+ @Override
public void visitTypeInsn(int opcode, String internalName) {
AsmClass usedClass = asmClassProvider.getClass(internalName, DETAIL_LEVEL.NOTHING);
method.addEdge(new AsmEdge(method, usedClass, SourceCodeEdgeUsage.USES, lineNumber));
emptyMethod = false;
}
+ @Override
public void visitLineNumber(final int line, final Label start) {
lineNumber = line;
}
+ @Override
public void visitEnd() {
method.setEmpty(emptyMethod);
}
+ @Override
public void visitIincInsn(int var, int increment) {
emptyMethod = false;
}
+ @Override
public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) {
emptyMethod = false;
}
+ @Override
public void visitInsn(int opcode) {
if (opcode != Opcodes.RETURN) {
emptyMethod = false;
}
}
+ @Override
public void visitIntInsn(int opcode, int operand) {
emptyMethod = false;
}
+ @Override
public void visitJumpInsn(int opcode, Label label) {
emptyMethod = false;
}
+ @Override
public void visitLdcInsn(Object cst) {
if (cst instanceof Type) {
Type type = (Type) cst;
emptyMethod = false;
}
+ @Override
public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
emptyMethod = false;
}
+ @Override
public void visitMultiANewArrayInsn(String desc, int dims) {
emptyMethod = false;
}
+ @Override
public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) {
emptyMethod = false;
}
+ @Override
public void visitVarInsn(int opcode, int var) {
emptyMethod = false;
}
public class DITVisitor extends BytecodeVisitor {
+ @Override
public void visitClass(AsmClass asmClass) {
int dit = calculateDepthOfInheritance(asmClass);
this.graph = graph;
}
+ @Override
public void visitClass(AsmClass asmClass) {
this.fromSourceClass = getSourceClass(asmClass);
}
+ @Override
public void visitEdge(AsmEdge edge) {
AsmClass toAsmClass = edge.getTargetAsmClass();
SourceClass toSourceClass = getSourceClass(toAsmClass);
this.fieldsToExcludeFromLcom4Calculation = conf.getFielsToExcludeFromLcom4Calculation();
}
+ @Override
public void visitClass(AsmClass asmClass) {
this.asmClass = asmClass;
unrelatedBlocks = new ArrayList<Set<AsmResource>>();
}
+ @Override
public void visitMethod(AsmMethod asmMethod) {
if (isMethodElligibleForLCOM4Computation(asmMethod)) {
ensureBlockIsCreated(asmMethod);
}
+ @Override
public void leaveClass(AsmClass asmClass) {
removeIsolatedMethodBlocks();
public class NOCVisitor extends BytecodeVisitor {
+ @Override
public void visitClass(AsmClass asmClass) {
getSourceClass(asmClass).add(Metric.NOC, asmClass.getNumberOfChildren());
private Set<AsmMethod> distinctCallToExternalMethods;
private int rfc = 0;
+ @Override
public void visitClass(AsmClass asmClass) {
rfc = 0;
this.asmClass = asmClass;
distinctCallToExternalMethods = new HashSet<AsmMethod>();
}
+ @Override
public void visitMethod(AsmMethod asmMethod) {
if (asmMethod.isBodyLoaded() && !asmMethod.isAccessor()) {
rfc++;
}
}
+ @Override
public void visitEdge(AsmEdge edge) {
if (edge.getTargetAsmClass() != asmClass && edge.getUsage() == SourceCodeEdgeUsage.CALLS_METHOD
&& !((AsmMethod) edge.getTo()).isAccessor()) {
}
}
+ @Override
public void leaveClass(AsmClass asmClass) {
rfc += distinctCallToExternalMethods.size();
getSourceClass(asmClass).add(Metric.RFC, rfc);
}
private static final Ordering<CheckMessage> CHECK_MESSAGE_ORDERING = new Ordering<CheckMessage>() {
+ @Override
public int compare(CheckMessage o1, CheckMessage o2) {
return ObjectUtils.compare(o1.getLine(), o2.getLine());
}
this(project, languages, def, pom, new FileFilter[0]);
}
+ @Override
public File getBasedir() {
return def.getBaseDir();
}
+ @Override
public File getBuildDir() {
if (pom != null) {
return resolvePath(pom.getBuild().getDirectory());
}
}
+ @Override
public File getBuildOutputDir() {
if (pom != null) {
return resolvePath(pom.getBuild().getOutputDirectory());
/**
* @deprecated since 2.6, because should be immutable
*/
+ @Override
@Deprecated
public DefaultProjectFileSystem addSourceDir(File dir) {
if (dir == null) {
/**
* @deprecated since 2.6, because should be immutable
*/
+ @Override
@Deprecated
public DefaultProjectFileSystem addTestDir(File dir) {
if (dir == null) {
/**
* TODO Godin: seems that used only by Cobertura and Clover
*/
+ @Override
public File getReportOutputDir() {
if (pom != null) {
return resolvePath(pom.getReporting().getOutputDirectory());
this.settings = settings;
}
+ @Override
public String getId() {
return settings.getString(CoreProperties.SERVER_ID);
}
+ @Override
public String getVersion() {
return settings.getString(CoreProperties.SERVER_VERSION);
}
+ @Override
public Date getStartedAt() {
String dateString = settings.getString(CoreProperties.SERVER_STARTTIME);
if (dateString != null) {
return null;
}
+ @Override
public String getURL() {
return StringUtils.removeEnd(StringUtils.defaultIfBlank(settings.getString("sonar.host.url"), "http://localhost:9000"), "/");
}
}
}
+ @Override
public Project getProject() {
return currentProject;
}
lock.unlock();
}
+ @Override
public Measure getMeasure(Resource resource, Metric metric) {
Bucket bucket = buckets.get(resource);
if (bucket != null) {
return null;
}
+ @Override
public <M> M getMeasures(Resource resource, MeasuresFilter<M> filter) {
Bucket bucket = buckets.get(resource);
if (bucket != null) {
/**
* the measure is updated if it's already registered.
*/
+ @Override
public Measure addMeasure(Resource resource, Measure measure) {
Bucket bucket = checkIndexed(resource);
if (bucket != null && !bucket.isExcluded()) {
//
//
+ @Override
public Dependency addDependency(Dependency dependency) {
Dependency existingDep = getEdge(dependency.getFrom(), dependency.getTo());
if (existingDep != null) {
incomingDeps.put(dependency.getFrom(), dependency);
}
+ @Override
public Set<Dependency> getDependencies() {
return dependencies;
}
/**
* {@inheritDoc}
*/
+ @Override
public List<Violation> getViolations(ViolationQuery violationQuery) {
Resource resource = violationQuery.getResource();
if (resource == null) {
return filteredViolations;
}
+ @Override
public void addViolation(Violation violation, boolean force) {
Resource resource = violation.getResource();
if (resource == null) {
//
//
+ @Override
public void addLink(ProjectLink link) {
persistence.saveLink(currentProject, link);
}
+ @Override
public void deleteLink(String key) {
persistence.deleteLink(currentProject, key);
}
//
//
+ @Override
public List<Event> getEvents(Resource resource) {
// currently events are not cached in memory
return persistence.getEvents(resource);
}
+ @Override
public void deleteEvent(Event event) {
persistence.deleteEvent(event);
}
+ @Override
public Event addEvent(Resource resource, String name, String description, String category, Date date) {
Event event = new Event(name, description, category);
event.setDate(date);
return null;
}
+ @Override
public void setSource(Resource reference, String source) {
Bucket bucket = checkIndexed(reference);
if (bucket != null && !bucket.isExcluded()) {
}
}
+ @Override
public String getSource(Resource resource) {
return persistence.getSource(resource);
}
/**
* Does nothing if the resource is already registered.
*/
+ @Override
public Resource addResource(Resource resource) {
Bucket bucket = doIndex(resource);
return bucket != null ? bucket.getResource() : null;
}
+ @Override
public <R extends Resource> R getResource(R reference) {
Bucket bucket = buckets.get(reference);
if (bucket != null) {
return excluded;
}
+ @Override
public List<Resource> getChildren(Resource resource) {
return getChildren(resource, false);
}
return children;
}
+ @Override
public Resource getParent(Resource resource) {
Bucket bucket = getBucket(resource, false);
if (bucket != null && bucket.getParent() != null) {
return null;
}
+ @Override
public boolean index(Resource resource) {
Bucket bucket = doIndex(resource);
return bucket != null && !bucket.isExcluded();
return doIndex(resource, resource.getParent());
}
+ @Override
public boolean index(Resource resource, Resource parentReference) {
Bucket bucket = doIndex(resource, parentReference);
return bucket != null && !bucket.isExcluded();
return bucket;
}
+ @Override
public boolean isExcluded(Resource reference) {
Bucket bucket = getBucket(reference, true);
return bucket != null && bucket.isExcluded();
}
+ @Override
public boolean isIndexed(Resource reference, boolean acceptExcluded) {
return getBucket(reference, acceptExcluded) != null;
}
this.failIfNoChannelToConsumeOneCharacter = builder.failIfNoChannelToConsumeOneCharacter;
}
+ @Override
public boolean consume(CodeReader code, OUTPUT output) {
int nextChar = code.peek();
while (nextChar != -1) {
setCaseInsensitive(true);
}
+ @Override
public KeywordsTokenizer clone() {
KeywordsTokenizer clone = super.clone();
clone.setCaseInsensitive(true);
colorizedCode.append(htmlTag);
}
+ @Override
public String toString() {
return colorizedCode.toString();
}
this(HtmlOptions.DEFAULT);
}
+ @Override
public String render(Reader code, List<? extends Channel<HtmlCodeBuilder>> tokenizers) {
try {
List<Channel<HtmlCodeBuilder>> allTokenizers = new ArrayList<Channel<HtmlCodeBuilder>>();
this.startToken = startToken.toCharArray();
}
+ @Override
public boolean consume(CodeReader code, HtmlCodeBuilder codeBuilder) {
if (code.peek() == startToken[0] && Arrays.equals(code.peek(startToken.length), startToken)) {
codeBuilder.appendWithoutTransforming(tagBefore);
this.matcher = Pattern.compile(DEFAULT_REGEX).matcher("");
}
+ @Override
public boolean consume(CodeReader code, HtmlCodeBuilder codeBuilder) {
if (code.popTo(matcher, tmpBuilder) > 0) {
if (isKeyword(tmpBuilder.toString())) {
this.caseInsensitive = caseInsensitive;
}
+ @Override
public KeywordsTokenizer clone() {
KeywordsTokenizer clone = new KeywordsTokenizer(tagBefore, tagAfter, keywords, matcher.pattern().pattern());
clone.caseInsensitive = caseInsensitive;
startToken)));
}
+ @Override
public boolean consume(CodeReader code, HtmlCodeBuilder codeBuilder) {
if (hasNextToken(code, codeBuilder)) {
codeBuilder.appendWithoutTransforming(tagBefore);
*/
public abstract class NotThreadSafeTokenizer extends Tokenizer implements Cloneable {
+ @Override
public abstract NotThreadSafeTokenizer clone();
}
return false;
}
+ @Override
public RegexpTokenizer clone() {
return new RegexpTokenizer(tagBefore, tagAfter, matcher.pattern().pattern());
}
registerColumnType(Types.CLOB, "nvarchar(max)");
}
+ @Override
public String getTypeName(int code, int length, int precision, int scale) {
if (code != 2005) {
return super.getTypeName(code, length, precision, scale);
* Note that usage of this method is discouraged, because it allows to construct and execute queries without additional exception handling,
* which done in methods of this class.
*/
+ @Override
public EntityManager getEntityManager() {
return entityManager;
}
+ @Override
public void start() {
entityManager = connector.createEntityManager();
index = 0;
}
+ @Override
public void stop() {
commit();
if (entityManager != null && entityManager.isOpen()) {
}
}
+ @Override
public void commit() {
if (entityManager != null && inTransaction) {
if (entityManager.isOpen()) {
}
}
+ @Override
public void rollback() {
if (entityManager != null && inTransaction) {
entityManager.getTransaction().rollback();
}
}
+ @Override
public <T> T save(T model) {
startTransaction();
internalSave(model, true);
return model;
}
+ @Override
public Object saveWithoutFlush(Object model) {
startTransaction();
internalSave(model, false);
return model;
}
+ @Override
public boolean contains(Object model) {
startTransaction();
return entityManager.contains(model);
}
+ @Override
public void save(Object... models) {
startTransaction();
for (Object model : models) {
}
}
+ @Override
public Object merge(Object model) {
startTransaction();
return entityManager.merge(model);
}
+ @Override
public void remove(Object model) {
startTransaction();
entityManager.remove(model);
}
}
+ @Override
public void removeWithoutFlush(Object model) {
startTransaction();
entityManager.remove(model);
}
+ @Override
public <T> T reattach(Class<T> entityClass, Object primaryKey) {
startTransaction();
return entityManager.getReference(entityClass, primaryKey);
* Note that not recommended to directly execute {@link Query#getSingleResult()}, because it will bypass exception handling,
* which done in {@link #getSingleResult(Query, Object)}.
*/
+ @Override
public Query createQuery(String hql) {
startTransaction();
return entityManager.createQuery(hql);
* @return the result or <code>defaultValue</code>, if not found
* @throws NonUniqueResultException if more than one result
*/
+ @Override
public <T> T getSingleResult(Query query, T defaultValue) {
/*
* See http://jira.codehaus.org/browse/SONAR-2225
}
}
+ @Override
public <T> T getEntity(Class<T> entityClass, Object id) {
startTransaction();
return getEntityManager().find(entityClass, id);
* @return the result or <code>null</code>, if not found
* @throws NonUniqueResultException if more than one result
*/
+ @Override
public <T> T getSingleResult(Class<T> entityClass, Object... criterias) {
try {
return getSingleResult(getQueryForCriterias(entityClass, true, criterias), (T) null);
}
}
+ @Override
public <T> List<T> getResults(Class<T> entityClass, Object... criterias) {
return getQueryForCriterias(entityClass, true, criterias).getResultList();
}
+ @Override
public <T> List<T> getResults(Class<T> entityClass) {
return getQueryForCriterias(entityClass, false, (Object[]) null).getResultList();
}
}
public static final OutputStream DEV_NULL = new OutputStream() {
+ @Override
public void write(int b) {
}
};
* @param ruleKey the rule key
* @return the rule
*/
+ @Override
public Rule getPluginRule(String pluginKey, String ruleKey) {
Map<String, Rule> rulesByKey = getPluginRulesIndexedByKey(pluginKey);
return rulesByKey.get(ruleKey);
this.encoding = encoding;
}
+ @Override
public Reader getReader() throws Exception {
return new InputStreamReader(new FileInputStream(file), encoding);
}
+ @Override
public String getFileName() {
return this.file.getAbsolutePath();
}
this.name = name;
}
+ @Override
public Reader getReader() {
return new StringReader(source_code);
}
+ @Override
public String getFileName() {
return name;
}
return this.index;
}
+ @Override
public int hashCode() {
return hashCode;
}
this.hashCode = hashCode;
}
+ @Override
public boolean equals(Object o) {
if (!(o instanceof TokenEntry)) {
return false;
public abstract class CodeLoaderWithoutCache extends CodeLoader {
+ @Override
public final List<String> getCode() {
return load();
}
this.encoding = encoding;
}
+ @Override
public Reader getReader() throws Exception {
return new InputStreamReader(new FileInputStream(file), encoding);
}
+ @Override
public String getFileName() {
return this.file.getAbsolutePath();
}
this.expectedParts = expectedParts;
}
+ @Override
public boolean matchesSafely(CloneGroup cloneGroup) {
// Check length
if (expectedLen != cloneGroup.getCloneUnitLength()) {
builder.append(line + " \r");
}
+ @Override
public String toString() {
return builder.toString();
}
return ouput.append(character);
}
+ @Override
public String toString() {
return ouput.toString();
}
}
}
+ @Override
protected Object createCheck(ActiveRule activeRule) {
Object object = checksByKey.get(activeRule.getConfigKey());
if (object != null) {
import org.apache.commons.codec.binary.Base64;
final class Base64Cipher extends Cipher {
+ @Override
String encrypt(String clearText) {
return new String(Base64.encodeBase64(clearText.getBytes()));
}
+ @Override
String decrypt(String encryptedText) {
return new String(Base64.decodeBase64(encryptedText));
}
this.language = language;
}
+ @Override
public String getName() {
return getKey();
}
+ @Override
public String getLongName() {
return null;
}
+ @Override
public String getDescription() {
return null;
}
+ @Override
public Language getLanguage() {
return language;
}
+ @Override
public String getScope() {
return Scopes.DIRECTORY;
}
+ @Override
public String getQualifier() {
return Qualifiers.DIRECTORY;
}
+ @Override
public Resource getParent() {
return null;
}
+ @Override
public boolean matchFilePattern(String antPattern) {
WildcardPattern matcher = WildcardPattern.create(antPattern, "/");
return matcher.match(getKey());
*
* @see Resource#getParent()
*/
+ @Override
public Directory getParent() {
if (parent == null) {
parent = new Directory(directoryKey);
*
* @see Resource#matchFilePattern(String)
*/
+ @Override
public boolean matchFilePattern(String antPattern) {
WildcardPattern matcher = WildcardPattern.create(antPattern, "/");
return matcher.match(getKey());
*
* @see Resource#getName()
*/
+ @Override
public String getName() {
return filename;
}
*
* @see Resource#getLongName()
*/
+ @Override
public String getLongName() {
return getKey();
}
*
* @see Resource#getDescription()
*/
+ @Override
public String getDescription() {
return null;
}
*
* @see Resource#getLanguage()
*/
+ @Override
public Language getLanguage() {
return language;
}
/**
* @return SCOPE_ENTITY
*/
+ @Override
public final String getScope() {
return SCOPE;
}
*
* @return QUALIFIER_UNIT_TEST_CLASS
*/
+ @Override
public String getQualifier() {
return qualifier;
}
/**
* {@inheritDoc}
*/
+ @Override
public JavaPackage getParent() {
if (parent == null) {
parent = new JavaPackage(packageKey);
/**
* @return null
*/
+ @Override
public String getDescription() {
return null;
}
/**
* @return Java
*/
+ @Override
public Language getLanguage() {
return Java.INSTANCE;
}
/**
* {@inheritDoc}
*/
+ @Override
public String getName() {
return filename;
}
/**
* {@inheritDoc}
*/
+ @Override
public String getLongName() {
return longName;
}
/**
* @return SCOPE_ENTITY
*/
+ @Override
public String getScope() {
return Scopes.FILE;
}
/**
* @return QUALIFIER_UNIT_TEST_CLASS or QUALIFIER_CLASS depending whether it is a unit test class
*/
+ @Override
public String getQualifier() {
return unitTest ? Qualifiers.UNIT_TEST_FILE : Qualifiers.CLASS;
}
/**
* {@inheritDoc}
*/
+ @Override
public boolean matchFilePattern(String antPattern) {
if (unitTest) {
return false;
/**
* {@inheritDoc}
*/
+ @Override
public boolean matchFilePattern(String antPattern) {
return false;
}
/**
* {@inheritDoc}
*/
+ @Override
public String getDescription() {
return null;
}
/**
* @return SCOPE_SPACE
*/
+ @Override
public String getScope() {
return Scopes.DIRECTORY;
}
/**
* @return QUALIFIER_PACKAGE
*/
+ @Override
public String getQualifier() {
return Qualifiers.PACKAGE;
}
/**
* {@inheritDoc}
*/
+ @Override
public String getName() {
return getKey();
}
/**
* {@inheritDoc}
*/
+ @Override
public Resource<?> getParent() {
return null;
}
/**
* {@inheritDoc}
*/
+ @Override
public String getLongName() {
return null;
}
/**
* @return Java
*/
+ @Override
public Language getLanguage() {
return Java.INSTANCE;
}
return packaging;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public String getLongName() {
return name;
}
+ @Override
public String getDescription() {
return description;
}
/**
* @return the project language
*/
+ @Override
public Language getLanguage() {
return language;
}
/**
* @return the scope of the current object
*/
+ @Override
public String getScope() {
return Scopes.PROJECT;
}
/**
* @return the qualifier of the current object
*/
+ @Override
public String getQualifier() {
return isRoot() ? Qualifiers.PROJECT : Qualifiers.MODULE;
}
return false;
}
+ @Override
public Project getParent() {
return parent;
}
}
private final ThreadLocal<Reference<DateFormat>> cache = new ThreadLocal<Reference<DateFormat>>() {
+ @Override
public Reference<DateFormat> get() {
Reference<DateFormat> softRef = super.get();
if (softRef == null || softRef.get() == null) {
return (DateFormat) ((Reference) cache.get()).get();
}
+ @Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return getDateFormat().format(date, toAppendTo, fieldPosition);
}
+ @Override
public Date parse(String source, ParsePosition pos) {
return getDateFormat().parse(source, pos);
}
auth = new PasswordAuthentication(user, password == null ? new char[0] : password.toCharArray());
}
+ @Override
protected PasswordAuthentication getPasswordAuthentication() {
return auth;
}
}
}
+ @Override
public Locale getLocale() {
return locale;
}
final List<Throwable> throwables = Lists.newArrayList();
final ThreadGroup tg = new ThreadGroup("shouldBeThreadSafe") {
+ @Override
public void uncaughtException(Thread t, Throwable e) {
throwables.add(e);
super.uncaughtException(t, e);
for (int i = 0; i < threads.length; ++i) {
threads[i] = new Thread(tg, "JUnit Thread " + i) {
+ @Override
public void run() {
int i = 0;
try {
int count = 0;
+ @Override
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
count++;
Properties props = new Properties();
public class RedirectServlet extends GenericServlet {
+ @Override
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
((HttpServletResponse)response).sendRedirect("/");
}
}
}
+ @Override
public String getPermanentServerId() {
return settings.getString(CoreProperties.PERMANENT_SERVER_ID);
}
+ @Override
public String getId() {
return id;
}
+ @Override
public String getVersion() {
return version;
}
+ @Override
public Date getStartedAt() {
return startedAt;
}
return StringUtils.defaultIfEmpty(result, "");
}
+ @Override
public String getURL() {
return null;
}
class FakeServer extends Server {
+ @Override
public String getId() {
return null;
}
+ @Override
public String getVersion() {
return null;
}
+ @Override
public Date getStartedAt() {
return null;
}
+ @Override
public String getURL() {
return null;
}
+ @Override
public String getPermanentServerId() {
return null;
}
super("fake", "java");
}
+ @Override
public List<Rule> createRules() {
Rule rule1 = Rule.create("fake", "rule1", "One");
rule1.setDescription("Description of One");
super("rule-without-name-repo", "java");
}
+ @Override
public List<Rule> createRules() {
// Rules must not have empty name
Rule rule1 = Rule.create("fake", "rule1", null);
super("rule-without-description-repo", "java");
}
+ @Override
public List<Rule> createRules() {
// Rules must not have empty description
Rule rule1 = Rule.create("fake", "rule1", "Rule 1");
super("volume", "java");
}
+ @Override
public List<Rule> createRules() {
List<Rule> rules = new ArrayList<Rule>();
for (int i = 0; i < SIZE; i++) {
public final class JdkUtils extends WSUtils {
+ @Override
public String format(Date date, String format) {
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
return dateFormat.format(date);
}
+ @Override
public String encodeUrl(String url) {
try {
return URLEncoder.encode(url, "UTF-8");
}
}
+ @Override
public String execute(Query<?> query) {
return executeRequest(newGetRequest(query));
}
+ @Override
public String execute(CreateQuery<?> query) {
return executeRequest(newPostRequest(query));
}
+ @Override
public String execute(UpdateQuery<?> query) {
return executeRequest(newPutRequest(query));
}
+ @Override
public String execute(DeleteQuery query) {
return executeRequest(newDeleteRequest(query));
}
this.server = server;
}
+ @Override
public String execute(Query<?> query) {
return executeRequest(newGetMethod(query));
}
+ @Override
public String execute(CreateQuery<?> query) {
return executeRequest(newPostMethod(query));
}
+ @Override
public String execute(UpdateQuery<?> query) {
return executeRequest(newPutMethod(query));
}
+ @Override
public String execute(DeleteQuery query) {
return executeRequest(newDeleteMethod(query));
}
public class TimeMachineUnmarshaller extends AbstractUnmarshaller<TimeMachine> {
+ @Override
protected TimeMachine parse(Object json) {
WSUtils utils = WSUtils.getINSTANCE();
Object cols = utils.getField(json, "cols");
}
static class EmptyQuery extends Query<Metric> {
+ @Override
public String getUrl() {
return "/api/empty";
}
+ @Override
public Class<Metric> getModelClass() {
return Metric.class;
}