import org.fluentlenium.adapter.FluentTest;
import org.junit.ClassRule;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

import static org.assertj.core.api.Assertions.assertThat;

public class IntegrationTest extends FluentTest {
  public WebDriver webDriver = new HtmlUnitDriver();

  @Override
  public WebDriver getDefaultDriver() {
    return webDriver;
  }

  @ClassRule
  public static ServerRule server = new ServerRule();

  @Test
  public void rootTest() {
    goTo("http://localhost:4567/");
    assertThat(pageSource()).contains("Shipping Calculator");
  }

  @Test
  public void resultsTest_returnsCostCorrectly() {
    goTo("http://localhost:4567/");
    fill("#length").with("10");
    fill("#width").with("10");
    fill("#height").with("10");
    fill("#weight").with("5");
    fill("#distance").with("100");
    submit(".btn");
    assertThat(pageSource()).contains("Cost to Ship: 5000");
  }

}

import org.fluentlenium.adapter.FluentTest;
import org.junit.ClassRule;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

import static org.assertj.core.api.Assertions.assertThat;

public class IntegrationTest extends FluentTest {
  public WebDriver webDriver = new HtmlUnitDriver();

  @Override
  public WebDriver getDefaultDriver() {
    return webDriver;
  }

  @ClassRule
  public static ServerRule server = new ServerRule();

  @Test
  public void rootTest() {
    goTo("http://localhost:4567/");
    assertThat(pageSource()).contains("Shipping Calculator");
  }

  @Test
  public void resultsTest_returnsCostCorrectly() {
    goTo("http://localhost:4567/");
    fill("#length").with("10");
    fill("#width").with("10");
    fill("#height").with("10");
    fill("#weight").with("5");
    fill("#distance").with("100");
    submit(".btn");
    assertThat(pageSource()).contains("Base Shipping Cost: $50.00");
  }

}

Correct expected output for integration test


package uk.ac.ebi.quickgo.annotation.service.converter;

import uk.ac.ebi.quickgo.annotation.common.document.AnnotationDocument;
import uk.ac.ebi.quickgo.annotation.model.Annotation;

/**
 * @author Tony Wardell
 * Date: 26/04/2016
 * Time: 16:47
 * Created with IntelliJ IDEA.
 */
public interface AnnotationDocConverter {

    /**
     * Convert an Annotation Document into a model to be returned to the user
     * @param annotationDocument  A document retrieved from the Annotation data source
     * @return an Annotation model
     */
    Annotation convert(AnnotationDocument annotationDocument);
}

package uk.ac.ebi.quickgo.annotation.service.converter;

import uk.ac.ebi.quickgo.annotation.common.document.AnnotationDocument;
import uk.ac.ebi.quickgo.annotation.model.Annotation;

/**
 * Converts an {@link AnnotationDocument} into an instance of {@link Annotation}.
 *
 * @author Tony Wardell
 * Date: 26/04/2016
 * Time: 16:47
 */
public interface AnnotationDocConverter {

    /**
     * Convert an Annotation Document into a model to be returned to the user
     * @param annotationDocument  A document retrieved from the Annotation data source
     * @return an Annotation model
     */
    Annotation convert(AnnotationDocument annotationDocument);
}

Improve more JavaDoc to interface.

Improve more JavaDoc to interface.


/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.camel;

/**
 * A processor is used to implement the
 *  Event Driven Consumer
 * and  Message Translator
 * patterns and to process message exchanges.
 *
 * @version
 */
public interface Processor {

    /**
     * Processes the message exchange
     *
     * @param exchange the message exchange
     * @throws Exception if an internal processing error has occurred.
     */
    void process(Exchange exchange) throws Exception;
}

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.camel;

/**
 * A processor is used to implement the
 *  Event Driven Consumer
 * and  Message Translator
 * patterns and to process message exchanges.
 *

 * Notice if you use a {@link Processor} in a Camel route, then make sure to write the {@link Processor}
 * in a thread-safe way, as the Camel routes can potentially be executed by concurrent threads, and therefore
 * multiple threads can call the same {@link Processor} instance.
 *
 * @version
 */
public interface Processor {

    /**
     * Processes the message exchange
     *
     * @param exchange the message exchange
     * @throws Exception if an internal processing error has occurred.
     */
    void process(Exchange exchange) throws Exception;
}

Add to javadoc about thread safety in a processor in a route


// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.sdk.internal.wip.protocol.input;

import java.util.List;

import org.chromium.sdk.internal.protocolparser.JsonOptionalField;
import org.chromium.sdk.internal.protocolparser.JsonProtocolParseException;
import org.chromium.sdk.internal.protocolparser.JsonSubtypeCasting;
import org.chromium.sdk.internal.protocolparser.JsonType;

@JsonType(subtypesChosenManually=true)
public interface WipTabList {
  @JsonSubtypeCasting List<TabDescription> asTabList() throws JsonProtocolParseException;

  @JsonType interface TabDescription {
    String id();
    String faviconUrl();
    String title();
    String url();

    String thumbnailUrl();

    // TODO: consider adding enum here
    String type();

    @JsonOptionalField
    String devtoolsFrontendUrl();

    @JsonOptionalField
    String webSocketDebuggerUrl();
  }
}

// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.sdk.internal.wip.protocol.input;

import java.util.List;

import org.chromium.sdk.internal.protocolparser.JsonOptionalField;
import org.chromium.sdk.internal.protocolparser.JsonProtocolParseException;
import org.chromium.sdk.internal.protocolparser.JsonSubtypeCasting;
import org.chromium.sdk.internal.protocolparser.JsonType;

@JsonType(subtypesChosenManually=true)
public interface WipTabList {
  @JsonSubtypeCasting List<TabDescription> asTabList() throws JsonProtocolParseException;

  @JsonType interface TabDescription {
    String id();
    String faviconUrl();
    String title();
    String url();

    String thumbnailUrl();

    // TODO: consider adding enum here
    String type();

    @JsonOptionalField
    String description();

    @JsonOptionalField
    String devtoolsFrontendUrl();

    @JsonOptionalField
    String webSocketDebuggerUrl();
  }
}

Add new tab JSON field

Add new tab JSON field

Review URL: https://codereview.chromium.org/14329012


package com.vaguehope.onosendai.update;

import android.content.Intent;

import com.vaguehope.onosendai.images.HybridBitmapCache;
import com.vaguehope.onosendai.storage.AttachmentStorage;
import com.vaguehope.onosendai.storage.DbBindingService;
import com.vaguehope.onosendai.util.LogWrapper;

/*
 * TODO move this class?
 */
public class CleanupService extends DbBindingService {

	protected static final LogWrapper LOG = new LogWrapper("CS");

	public CleanupService () {
		super("OnosendaiCleanupService", LOG);
	}

	@Override
	protected void doWork (final Intent i) {
		try {
			AttachmentStorage.cleanTempOutputDir(this); // FIXME what if attachment in use in Outbox?
			HybridBitmapCache.cleanCacheDir(this);
			if (!waitForDbReady()) return;
			getDb().vacuum();
			LOG.i("Clean up complete.");
		}
		catch (final Exception e) { // NOSONAR want to log all errors.
			LOG.e("Clean up failed.", e);
		}
	}

}

package com.vaguehope.onosendai.update;

import android.content.Intent;

import com.vaguehope.onosendai.images.HybridBitmapCache;
import com.vaguehope.onosendai.storage.AttachmentStorage;
import com.vaguehope.onosendai.storage.DbBindingService;
import com.vaguehope.onosendai.util.LogWrapper;

/*
 * TODO move this class?
 */
public class CleanupService extends DbBindingService {

	protected static final LogWrapper LOG = new LogWrapper("CS");

	public CleanupService () {
		super("OnosendaiCleanupService", LOG);
	}

	@Override
	protected void doWork (final Intent i) {
		try {
			AttachmentStorage.cleanTempOutputDir(this); // FIXME what if attachment in use in Outbox?
			HybridBitmapCache.cleanCacheDir(this);
			if (!waitForDbReady()) return;
//			getDb().vacuum();
			LOG.i("Clean up complete.");
		}
		catch (final Exception e) { // NOSONAR want to log all errors.
			LOG.e("Clean up failed.", e);
		}
	}

}

Disable DB vacuum cleanup step and it was not the root cause of the problem.


package net.sf.jabref.model.metadata;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;

public class ContentSelectors {

    private HashMap<String, List<String>> contentSelectors;

    public ContentSelectors() {
        contentSelectors = new HashMap<>();
    }

    public void addContentSelector(String fieldName, List<String> selectors) {
        Objects.requireNonNull(fieldName);
        Objects.requireNonNull(selectors);

        this.contentSelectors.put(fieldName, selectors);
    }

    public List<String> getSelectorsForField(String fieldName) {
        List<String> result = contentSelectors.get(fieldName);

        if(result == null){
            result = Collections.emptyList();
        }

        return result;
    }

    public void removeSelector(String fieldName) {
        contentSelectors.remove(fieldName);
    }

    public static ContentSelectors parse(List<String> selectors) {
        //fixme: do the actual parsing

        return null;
    }

    public List<String> getAsStringList() {
        // fixme: do the actual serialization

        return null;
    }

    public HashMap<String, List<String>> getSelectorData() {
        return contentSelectors;
    }
}

package net.sf.jabref.model.metadata;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class ContentSelectors {

    private final Map<String, List<String>> contentSelectors;

    public ContentSelectors() {
        contentSelectors = new HashMap<>();
    }

    public void addContentSelector(String fieldName, List<String> selectors) {
        Objects.requireNonNull(fieldName);
        Objects.requireNonNull(selectors);

        this.contentSelectors.put(fieldName, selectors);
    }

    public List<String> getSelectorsForField(String fieldName) {
        List<String> result = contentSelectors.get(fieldName);

        if (result == null) {
            result = Collections.emptyList();
        }

        return result;
    }

    public void removeSelector(String fieldName) {
        contentSelectors.remove(fieldName);
    }

    public static ContentSelectors parse(List<String> selectors) {
        //fixme: do the actual parsing

        return null;
    }

    public List<String> getAsStringList() {
        // fixme: do the actual serialization

        return null;
    }

    public Map<String, List<String>> getSelectorData() {
        return contentSelectors;
    }
}

Fix codacy, use Interface instead of concrete type


/**
 * Copyright (C) 2009-2017 Simonsoft Nordic AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package se.simonsoft.cms.item.command;

import se.simonsoft.cms.item.CmsItemId;

public class ExternalCommand {

	private CmsItemId itemId;
	private String action;
	private String jsonargs = null;

	public ExternalCommand(CmsItemId itemId, String action, String jsonArgs) {
		this.itemId = itemId;
		this.action = action;
		this.jsonargs = jsonArgs;
	}

	public String getAction() {
		return action;
	}

	public CmsItemId getItemId() {
		return itemId;
	}

	public <T> T getArgs(Class<T> argumentsWrapperClass) {

		// TODO: Parse jsonargs into the requested type.
		return null;
	}
}

/**
 * Copyright (C) 2009-2017 Simonsoft Nordic AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package se.simonsoft.cms.item.command;

import se.simonsoft.cms.item.CmsItemId;

public class ExternalCommand {

	protected CmsItemId itemId;
	protected String action;
	protected String jsonargs = null;

	public ExternalCommand(CmsItemId itemId, String action, String jsonArgs) {
		this.itemId = itemId;
		this.action = action;
		this.jsonargs = jsonArgs;
	}

	public String getAction() {
		return action;
	}

	public CmsItemId getItemId() {
		return itemId;
	}

	public <T> T getArgs(Class<T> argumentsWrapperClass) {

		// TODO: Parse jsonargs into the requested type.
		return null;
	}
}

Enable extending classes to access fields.


package groovy.io;

import groovy.text.SimpleTemplateEngine;
import groovy.text.Template;
import junit.framework.TestCase;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;

public class PlatformLineWriterTest extends TestCase {

    public void testPlatformLineWriter() throws IOException, ClassNotFoundException {
        String LS = System.getProperty("line.separator");
        Map binding = new HashMap();
        binding.put("first", "Tom");
        binding.put("last", "Adams");
        Template template = new SimpleTemplateEngine().createTemplate("<%= first %>\n<% println last %>");
        StringWriter stringWriter = new StringWriter();
        Writer platformWriter = new PlatformLineWriter(stringWriter);
        template.make(binding).writeTo(platformWriter);
        assertEquals("Tom" + LS + "Adams" + LS, stringWriter.toString());
    }
}

package groovy.io;

import groovy.lang.Binding;
import groovy.lang.GroovyShell;
import junit.framework.TestCase;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;

public class PlatformLineWriterTest extends TestCase {

    public void testPlatformLineWriter() throws IOException, ClassNotFoundException {
        String LS = System.getProperty("line.separator");
        Binding binding = new Binding();
        binding.setVariable("first", "Tom");
        binding.setVariable("last", "Adams");
        StringWriter stringWriter = new StringWriter();
        Writer platformWriter = new PlatformLineWriter(stringWriter);
        GroovyShell shell = new GroovyShell(binding);
        platformWriter.write(shell.evaluate("\"$first\\n$last\\n\"").toString());
        assertEquals("Tom" + LS + "Adams" + LS, stringWriter.toString());
        stringWriter = new StringWriter();
        platformWriter = new PlatformLineWriter(stringWriter);
        platformWriter.write(shell.evaluate("\"$first\\r\\n$last\\r\\n\"").toString());
        assertEquals("Tom" + LS + "Adams" + LS, stringWriter.toString());
    }
}

Remove dependency on templating module

Remove dependency on templating module


package uk.ac.ebi.quickgo.client.service.loader.presets.ff;

/**
 * Represents the column indices required to create a {@link RawNamedPreset} instance.
 *
 * Created 13/09/16
 * @author Edd
 */
interface RawNamedPresetColumns {
    int getIdPosition();

    int getNamePosition();

    int getDescriptionPosition();

    int getRelevancyPosition();

    int getURLPosition();

    int getMaxRequiredColumnCount();

    int getAssociationPosition();

    int getGoEvidencePosition();
}

package uk.ac.ebi.quickgo.client.service.loader.presets.ff;

/**
 * Represents the column indices required to create a {@link RawNamedPreset} instance.
 *
 * Created 13/09/16
 * @author Edd
 */
public interface RawNamedPresetColumns {
    int getIdPosition();

    int getNamePosition();

    int getDescriptionPosition();

    int getRelevancyPosition();

    int getURLPosition();

    int getMaxRequiredColumnCount();

    int getAssociationPosition();
}

Make the interface public so it can be used more widely, remove getGoEvidencePosition()


package hu.advancedweb.scott.runtime;

import org.junit.runner.Description;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;

/**
 * An alternative way to produce the detailed failure reports is to register this JUnit listener.
 *
 * @see ScottReportingRule
 * @author David Csakvari
 */
public class ScottRunListener extends RunListener {

	private Description description;

	@Override
	public void testStarted(Description description) throws Exception {
		this.description = description;
		super.testStarted(description);
	}

	@Override
	public void testFailure(Failure failure) throws Exception {
		// TODO: the simple System.out.println really not fits nicely into the test reports.
		// try changing the original exception's message with reflection. See issue #8.

		System.out.println(failure.getTestHeader() + " FAILED!");
		System.out.println(FailureRenderer.render(description, failure.getException()));
		super.testFailure(failure);
	}
}

package hu.advancedweb.scott.runtime;

import java.lang.reflect.Field;

import org.junit.runner.Description;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;

/**
 * An alternative way to produce the detailed failure reports is to register this JUnit listener.
 *
 * @see ScottReportingRule
 * @author David Csakvari
 */
public class ScottRunListener extends RunListener {

	private Description description;

	@Override
	public void testStarted(Description description) throws Exception {
		this.description = description;
		super.testStarted(description);
	}

	@Override
	public void testFailure(Failure failure) throws Exception {
		String scottReport = FailureRenderer.render(description, failure.getException());
		setExceptionMessage(failure.getException(), scottReport);
		super.testFailure(failure);
	}

	private void setExceptionMessage(Object object, Object fieldValue) {
	    final String fieldName = "detailMessage";
		Class<?> clazz = object.getClass();
	    while (clazz != null) {
	        try {
	            Field field = clazz.getDeclaredField(fieldName);
	            field.setAccessible(true);
	            field.set(object, fieldValue);
	            return;
	        } catch (NoSuchFieldException e) {
	            clazz = clazz.getSuperclass();
	        } catch (Exception e) {
	            throw new IllegalStateException(e);
	        }
	    }
	}
}

Update exception message in run listener rather than just sysoutting the report.


package com.socgen.finit.easymargin;

import com.socgen.finit.easymargin.converter.TradeFileHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.orm.hibernate4.HibernateExceptionTranslator;
import java.util.Arrays;

@Slf4j
@SpringBootApplication
@Import(DefaultConfig.class)
public class Application {

    @Autowired
    TradeFileHandler tradeFileHandler;

    public static void main(String[] args) {

        ApplicationContext ctx = SpringApplication.run(Application.class, args);

        log.info("Let's inspect the beans provided by Spring Boot:");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            log.info(beanName);
        }
    }

    @Bean
    public HibernateExceptionTranslator hibernateExceptionTranslator() {
        return new HibernateExceptionTranslator();
    }
}

package com.socgen.finit.easymargin;

import com.socgen.finit.easymargin.converter.TradeFileHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.orm.hibernate4.HibernateExceptionTranslator;

import java.util.Arrays;

@Slf4j
@SpringBootApplication
@Import(DefaultConfig.class)
public class Application {

    @Autowired
    TradeFileHandler tradeFileHandler;

    public static void main(String[] args) {

        ApplicationContext ctx = SpringApplication.run(Application.class, args);

        log.info("Let's inspect the beans provided by Spring Boot:");

        String[] beanNames = ctx.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        for (String beanName : beanNames) {
            log.info(beanName);
        }

        log.info("Server started - URL : http//localhost:" +
                ctx.getEnvironment().getProperty("server.port"));
    }

    @Bean
    public HibernateExceptionTranslator hibernateExceptionTranslator() {
        return new HibernateExceptionTranslator();
    }
}

Add automatic launch with maven test phase


package de.hfu.studiportal.data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class ExamCategory implements Serializable {

	private static final long serialVersionUID = -5178814560848378523L;
	private List<Exam> examList;
	private String categoryName;

	public ExamCategory(String categoryName) {
		this.setCategoryName(categoryName);
		this.examList = new ArrayList<>();

	}

	public String getCategoryName() {
		return this.categoryName;

	}

	public void setCategoryName(String newName) {
		this.categoryName = newName.replace(":", "").replace("*", "");

	}

	public void addExam(Exam e) {
		this.examList.add(e);

	}

	public void removeExam(Exam e) {
		this.examList.remove(e);

	}

	public void removeExam(int index) {
		this.examList.remove(index);

	}

	public int getExamCount() {
		return this.examList.size();

	}

	public Exam getExam(int index) {
		return this.examList.get(index);

	}

	public List<Exam> getAllExams() {
		return new ArrayList<>(this.examList);

	}
}

package de.hfu.studiportal.data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class ExamCategory implements Serializable {

	private static final long serialVersionUID = -5178814560848378523L;
	private List<Exam> examList;
	private String categoryName;

	public ExamCategory(String categoryName) {
		this.setCategoryName(categoryName);
		this.examList = new ArrayList<>();

	}

	public String getCategoryName() {
		return this.categoryName;

	}

	public void setCategoryName(String newName) {
		//Replace long terms with short ones to keep the titles short.
		//Replacing only parts of the title will reserve the meaning (even with unknown titles)
		this.categoryName = newName.replace(":", "").replace("*", "")
				.replace("Module/Teilmodule", "Module").replace("(ECTS) ", "")
				.replace("Bestandene Module", "Bestanden").trim();

	}

	public void addExam(Exam e) {
		this.examList.add(e);

	}

	public void removeExam(Exam e) {
		this.examList.remove(e);

	}

	public void removeExam(int index) {
		this.examList.remove(index);

	}

	public int getExamCount() {
		return this.examList.size();

	}

	public Exam getExam(int index) {
		return this.examList.get(index);

	}

	public List<Exam> getAllExams() {
		return new ArrayList<>(this.examList);

	}
}

Optimize category titles through replacing


package io.cattle.platform.agent.instance.service.impl;

import static io.cattle.platform.core.model.tables.NicTable.*;
import io.cattle.platform.agent.instance.service.InstanceNicLookup;
import io.cattle.platform.core.dao.GenericMapDao;
import io.cattle.platform.core.model.Instance;
import io.cattle.platform.core.model.Nic;
import io.cattle.platform.object.ObjectManager;

import java.util.List;

import javax.inject.Inject;

/**
 * This class is invoked on instance healthcheck changes
 *
 *
 */
public class ContainerNicLookup extends NicPerVnetNicLookup implements InstanceNicLookup {
    @Inject
    ObjectManager objectManager;

    @Inject
    GenericMapDao mapDao;

    @Override
    public List<? extends Nic> getNics(Object obj) {
        if (!(obj instanceof Instance)) {
            return null;
        }
        Instance container = (Instance) obj;
        return create().selectFrom(NIC)
                .where(NIC.INSTANCE_ID.eq(container.getId())
                        .and(NIC.REMOVED.isNull()))
                .fetch();
    }
}

package io.cattle.platform.agent.instance.service.impl;

import static io.cattle.platform.core.model.tables.NicTable.*;
import io.cattle.platform.agent.instance.service.InstanceNicLookup;
import io.cattle.platform.core.dao.GenericMapDao;
import io.cattle.platform.core.model.Instance;
import io.cattle.platform.core.model.Nic;
import io.cattle.platform.object.ObjectManager;

import java.util.List;

import javax.inject.Inject;

/**
 * This class is invoked on instance healthcheck changes
 *
 *
 */
public class ContainerNicLookup extends NicPerVnetNicLookup implements InstanceNicLookup {
    @Inject
    ObjectManager objectManager;

    @Inject
    GenericMapDao mapDao;

    @Override
    public List<? extends Nic> getNics(Object obj) {
        if (!(obj instanceof Instance)) {
            return null;
        }
        Instance container = (Instance) obj;
        return create().selectFrom(NIC)
                .where(NIC.INSTANCE_ID.eq(container.getId()))
                .fetch();
    }
}

Fix metadata update on instance.remove

Fix metadata update on instance.remove

Omit non-removed check when search for instance nic (nic can be already
removed by the time config item post handler runs for the instance)


package org.metaborg.spoofax.eclipse.resource;

import java.util.Collection;

import org.apache.commons.vfs2.Capability;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.provider.AbstractFileName;
import org.apache.commons.vfs2.provider.AbstractFileSystem;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;

public class EclipseResourceFileSystem extends AbstractFileSystem {
    private final IWorkspaceRoot root;

    public EclipseResourceFileSystem(FileName rootName, FileObject parentLayer, FileSystemOptions fileSystemOptions) {
        super(rootName, parentLayer, fileSystemOptions);
        this.root = ResourcesPlugin.getWorkspace().getRoot();
    }

    @Override protected FileObject createFile(AbstractFileName name) throws Exception {
        return new EclipseResourceFileObject(name, root, this);
    }

    @Override protected void addCapabilities(Collection<Capability> caps) {
        caps.addAll(EclipseResourceProvider.capabilities);
    }
}

package org.metaborg.spoofax.eclipse.resource;

import java.io.File;
import java.io.IOException;
import java.util.Collection;

import org.apache.commons.vfs2.Capability;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.FileObject;
import org.apache.commons.vfs2.FileSelector;
import org.apache.commons.vfs2.FileSystemOptions;
import org.apache.commons.vfs2.provider.AbstractFileName;
import org.apache.commons.vfs2.provider.AbstractFileSystem;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;

public class EclipseResourceFileSystem extends AbstractFileSystem {
    private final IWorkspaceRoot root;

    public EclipseResourceFileSystem(FileName rootName, FileObject parentLayer, FileSystemOptions fileSystemOptions) {
        super(rootName, parentLayer, fileSystemOptions);
        this.root = ResourcesPlugin.getWorkspace().getRoot();
    }

    @Override protected FileObject createFile(AbstractFileName name) throws Exception {
        return new EclipseResourceFileObject(name, root, this);
    }

    @Override protected void addCapabilities(Collection<Capability> caps) {
        caps.addAll(EclipseResourceProvider.capabilities);
    }

    @Override protected File doReplicateFile(FileObject file, FileSelector selector) throws Exception {
        final EclipseResourceFileObject eclipseResource = (EclipseResourceFileObject) file;
        final IResource resource = eclipseResource.resource();
        if(resource == null) {
            throw new IOException("Cannot get Eclipse resource corresponding to " + file);
        }
        IPath path = resource.getRawLocation();
        if(path == null) {
            path = resource.getLocation();
        }
        if(path == null) {
            throw new IOException("Resource " + file + " does not reside on the local file system");
        }
        return path.makeAbsolute().toFile();
    }
}

Implement local file replication for the Eclipse file system.


package testCal;

import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import cal.InputHandler;

public class InputHandlerTest {

  private InputHandler inputHandler;

  @Before
  public void setUp() throws Exception {
    inputHandler = new InputHandler();

  }

  @After
  public void tearDown() throws Exception {
    inputHandler = null;
  }

  @Test
  public void testIsExpression1() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("1");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression2() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("10+1-1*100/10");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression3() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("(1+22)*3");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression4() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("(-1)-1");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression5() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("2.11*3.99999");
    assertEquals(expected, actual);
  }

}

package testCal;

import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import cal.InputHandler;

public class InputHandlerTest {

  private InputHandler inputHandler;

  @Before
  public void setUp() throws Exception {
    inputHandler = new InputHandler();

  }

  @After
  public void tearDown() throws Exception {
    inputHandler = null;
  }

  @Test
  public void testIsExpression1() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("1");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression2() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("10+1-1*100/10");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression3() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("(1+22)*3");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression4() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("(-1)-1");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression5() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("2.11*3.99999");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression6() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("1*(22+3.33)");
    assertEquals(expected, actual);
  }

  @Test
  public void testIsExpression7() {
    boolean expected = true;
    boolean actual = inputHandler.setInput("1*(2+3)");
    assertEquals(expected, actual);
  }
}

Add test case for input handler where it cannot pass


package xyz.brassgoggledcoders.steamagerevolution.modules.steam.tileentities;

import javax.annotation.Nonnull;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import xyz.brassgoggledcoders.steamagerevolution.utils.RenderUtil;

public class TileEntityCastingBenchRenderer extends TileEntitySpecialRenderer<TileEntityCastingBench> {

	protected static Minecraft mc = Minecraft.getMinecraft();

	@Override
	public void renderTileEntityFast(@Nonnull TileEntityCastingBench tile, double x, double y, double z,
			float partialTicks, int destroyStage, float partial, net.minecraft.client.renderer.BufferBuilder buffer) {
		FluidTank tank = tile.tank;
		FluidStack liquid = tank.getFluid();

		if(liquid != null) {

			float height = ((float) liquid.amount) / (float) tank.getCapacity();

			float d = RenderUtil.FLUID_OFFSET;
			RenderUtil.renderFluidCuboid(liquid, tile.getPos(), x, y, z, d, d + 0.2F, d, 1d - d, height - d, 1d - d);
		}
	}
}

package xyz.brassgoggledcoders.steamagerevolution.modules.steam.tileentities;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import xyz.brassgoggledcoders.steamagerevolution.utils.RenderUtil;

public class TileEntityCastingBenchRenderer extends TileEntitySpecialRenderer<TileEntityCastingBench> {

	protected static Minecraft mc = Minecraft.getMinecraft();

	@Override
	public void render(TileEntityCastingBench tile, double x, double y, double z, float partialTicks, int destroyStage,
			float alpha) {
		FluidTank tank = tile.tank;
		FluidStack liquid = tank.getFluid();

		if(liquid != null) {

			float height = ((float) liquid.amount) / (float) tank.getCapacity();

			float d = RenderUtil.FLUID_OFFSET;
			RenderUtil.renderFluidCuboid(liquid, tile.getPos(), x, y, z, d, d + 0.2F, d, 1d - d, height - d, 1d - d);
		}
	}
}

Fix 'casting bench' fluid rendering

Fix 'casting bench' fluid rendering


/*******************************************************************************
 * Copyright 2012-present Pixate, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.pixate.freestyle;

/**
 * Holds version information. This info, for example, is being used with the
 * pings.
 *
 * @author Shalom Gibly
 */
public interface Version {
    public static String PIXATE_FREESTYLE_VERSION = "0.3.2";
    public static int PIXATE_FREESTYLE_API_VERSION = 2;
}

/*******************************************************************************
 * Copyright 2012-present Pixate, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.pixate.freestyle;

/**
 * Holds version information. This info, for example, is being used with the
 * pings.
 *
 * @author Shalom Gibly
 */
public interface Version {
    public static String PIXATE_FREESTYLE_VERSION = "0.3.3";
    public static int PIXATE_FREESTYLE_API_VERSION = 2;
}

Update freestyle version to 0.3.3.

Update freestyle version to 0.3.3.


package embl.ebi.variation.commons.models.converters.data;

import org.springframework.core.convert.converter.Converter;
import com.mongodb.DBObject;
import org.opencb.biodata.models.variant.Variant;

/**
 * Created by tom on 21/09/16.
 */
public class VariantWriteConverter implements Converter<Variant, DBObject> {

    @Override
    public DBObject convert(Variant variant) {
        return null;
    }

}

package embl.ebi.variation.commons.models.converters.data;

import org.opencb.opencga.storage.mongodb.variant.DBObjectToVariantConverter;
import org.springframework.core.convert.converter.Converter;
import com.mongodb.DBObject;
import org.opencb.biodata.models.variant.Variant;

/**
 * Created by tom on 21/09/16.
 */
public class VariantWriteConverter implements Converter<Variant, DBObject> {

    @Override
    public DBObject convert(Variant variant) {
        DBObjectToVariantConverter dbObjectToVariantConverter = new DBObjectToVariantConverter();
        return dbObjectToVariantConverter.convertToStorageType(variant);
    }

}

Convert by wrapping DBObjectToVariantConverter for variant to dbobject


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.flink.streaming.connectors.kafka;

/**
 * IT cases for the {@link FlinkKafkaProducer09}.
 */
@SuppressWarnings("serial")
public class Kafka09ProducerITCase extends KafkaProducerTestBase {
	@Override
	public void testExactlyOnceRegularSink() throws Exception {
		// Kafka08 does not support exactly once semantic
	}

	@Override
	public void testExactlyOnceCustomOperator() throws Exception {
		// Kafka08 does not support exactly once semantic
	}

	@Override
	public void testOneToOneAtLeastOnceCustomOperator() throws Exception {
		// Disable this test since FlinkKafka09Producer doesn't support custom operator mode
	}
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.flink.streaming.connectors.kafka;

/**
 * IT cases for the {@link FlinkKafkaProducer09}.
 */
@SuppressWarnings("serial")
public class Kafka09ProducerITCase extends KafkaProducerTestBase {
	@Override
	public void testExactlyOnceRegularSink() throws Exception {
		// Kafka09 does not support exactly once semantic
	}

	@Override
	public void testExactlyOnceCustomOperator() throws Exception {
		// Kafka09 does not support exactly once semantic
	}

	@Override
	public void testOneToOneAtLeastOnceRegularSink() throws Exception {
		// For some reasons this test is sometimes failing in Kafka09 while the same code works in Kafka010. Disabling
		// this test because everything indicates those failures might be caused by unfixed bugs in Kafka 0.9 branch
	}

	@Override
	public void testOneToOneAtLeastOnceCustomOperator() throws Exception {
		// Disable this test since FlinkKafka09Producer doesn't support custom operator mode
	}
}

[FLINK-8022][kafka-tests] Disable at-least-once tests for Kafka 0.9

For some reasons this test is sometimes failing in Kafka09 while the same code works in Kafka010.
Disabling this test because everything indicates those failures might be caused by unfixed bugs
in Kafka 0.9 branch

This closes #5316.


package io.scalecube.services.api;

import java.util.Objects;

public class Address {
  private final String host;
  private final int port;

  public static Address create(String host, int port) {
    return new Address(host, port);
  }

  private Address(String host, int port) {
    this.host = host;
    this.port = port;
  }

  public String host() {
    return this.host;
  }

  public int port() {
    return this.port;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Address address = (Address) o;
    return port == address.port && Objects.equals(host, address.host);
  }

  @Override
  public int hashCode() {
    return Objects.hash(host, port);
  }

  @Override
  public String toString() {
    return this.host + ":" + this.port;
  }
}

package io.scalecube.services.api;

import java.util.Objects;

public class Address {

  private final String host;
  private final int port;

  private Address(String host, int port) {
    this.host = host;
    this.port = port;
  }

  /**
   * Create address.
   *
   * @param host host
   * @param port port
   * @return address
   */
  public static Address create(String host, int port) {
    return new Address(host, port);
  }

  /**
   * Create address.
   *
   * @param hostAndPort host:port
   * @return address
   */
  public static Address from(String hostAndPort) {
    String[] split = hostAndPort.split(":");
    if (split.length != 2) {
      throw new IllegalArgumentException();
    }
    String host = split[0];
    int port = Integer.parseInt(split[1]);
    return new Address(host, port);
  }

  public String host() {
    return this.host;
  }

  public int port() {
    return this.port;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Address address = (Address) o;
    return port == address.port && Objects.equals(host, address.host);
  }

  @Override
  public int hashCode() {
    return Objects.hash(host, port);
  }

  @Override
  public String toString() {
    return this.host + ":" + this.port;
  }
}

Set convenient .from method in address

Set convenient .from method in address


package com.axellience.vuegwtdemo.client;

import com.axellience.vuegwt.client.gwtextension.VueGwtPanel;
import com.axellience.vuegwt.client.jsnative.Vue;
import com.axellience.vuegwtdemo.client.components.counterwithtemplate.CounterWithTemplateComponent;
import com.axellience.vuegwtdemo.client.components.todolist.TodoListComponent;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define onModuleLoad()
 */
public class VueGwtDemoApp implements EntryPoint
{
    /**
     * This is the entry point method.
     */
    public void onModuleLoad()
    {
        // Create a simple GWT panel containing a CounterWithTemplateComponent
        RootPanel
            .get("simpleCounterComponentContainer")
            .add(new VueGwtPanel(CounterWithTemplateComponent.class));

        Vue.attach("#todoListComponentContainer", TodoListComponent.class);
    }
}

package com.axellience.vuegwtdemo.client;

import com.axellience.vuegwt.client.gwtextension.VueGwtPanel;
import com.axellience.vuegwt.client.jsnative.Vue;
import com.axellience.vuegwtdemo.client.components.counterwithtemplate.CounterWithTemplateComponent;
import com.axellience.vuegwtdemo.client.components.todolist.TodoListComponent;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define onModuleLoad()
 */
public class VueGwtDemoApp implements EntryPoint
{
    /**
     * This is the entry point method.
     */
    public void onModuleLoad()
    {
        // Create a simple GWT panel containing a CounterWithTemplateComponent
        RootPanel
            .get("simpleCounterComponentContainer")
            .add(new VueGwtPanel<>(CounterWithTemplateComponent.class));

        Vue.attach("#todoListComponentContainer", TodoListComponent.class);
    }
}

Fix VueGwtPanel not being typed in the Demo app


package org.wildfly.swarm.it.vaadin;

import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.wildfly.swarm.it.AbstractIntegrationTest;

import static org.fest.assertions.Assertions.assertThat;

/**
 * @author Bob McWhirter
 */
@RunWith(Arquillian.class)
public class VaadinApplicationIT extends AbstractIntegrationTest {

    @Drone
    PhantomJSDriver browser;

    @Test
    public void testIt() throws Exception {
        browser.manage().window().setSize( new Dimension(1024, 768));
        browser.navigate().to("http://localhost:8080/");

        browser.findElementByClassName( "v-button" ).click();
        WebElement notification = browser.findElementByClassName("v-Notification");

        assertThat( notification.getText() ).contains( "Howdy at" );
    }
}

package org.wildfly.swarm.it.vaadin;

import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.wildfly.swarm.it.AbstractIntegrationTest;

import static org.fest.assertions.Assertions.assertThat;

/**
 * @author Bob McWhirter
 */
//@RunWith(Arquillian.class)
public class VaadinApplicationIT extends AbstractIntegrationTest {

    @Drone
    PhantomJSDriver browser;

    //disabled until SWARM-249
    //@Test
    public void testIt() throws Exception {
        browser.manage().window().setSize( new Dimension(1024, 768));
        browser.navigate().to("http://localhost:8080/");

        browser.findElementByClassName( "v-button" ).click();
        WebElement notification = browser.findElementByClassName("v-Notification");

        assertThat( notification.getText() ).contains( "Howdy at" );
    }
}

Disable Vaadin test until SWARM-249 is resolved.


package org.opennms.netmgt.dao.db;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class PopulatedTemporaryDatabaseTestCase extends
        TemporaryDatabaseTestCase {

    private InstallerDb installerDb;

    private ByteArrayOutputStream m_outputStream;

    protected void setUp() throws Exception {
        super.setUp();

        initializeDatabase();
    }

    protected void initializeDatabase() throws Exception {
        if (!isEnabled()) {
            return;
        }

        installerDb = new InstallerDb();

        // Create a ByteArrayOutputSteam to effectively throw away output.
        resetOutputStream();
        installerDb.setDatabaseName(getTestDatabase());
        installerDb.setDataSource(getDataSource());

        installerDb.setCreateSqlLocation(
            "../opennms-daemon/src/main/filtered/etc/create.sql");

        installerDb.setStoredProcedureDirectory(
            "../opennms-daemon/src/main/filtered/etc");

        //installerDb.setDebug(true);

        installerDb.readTables();

        installerDb.createSequences();
        installerDb.updatePlPgsql();
        installerDb.addStoredProcedures();

        installerDb.createTables();

        installerDb.closeConnection();
    }

    public ByteArrayOutputStream getOutputStream() {
        return m_outputStream;
    }

    public void resetOutputStream() {
        m_outputStream = new ByteArrayOutputStream();
        installerDb.setOutputStream(new PrintStream(m_outputStream));
    }
}

package org.opennms.netmgt.dao.db;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class PopulatedTemporaryDatabaseTestCase extends
        TemporaryDatabaseTestCase {

    private InstallerDb m_installerDb;

    private ByteArrayOutputStream m_outputStream;

    protected void setUp() throws Exception {
        super.setUp();

        initializeDatabase();
    }

    protected void initializeDatabase() throws Exception {
        if (!isEnabled()) {
            return;
        }

        m_installerDb = new InstallerDb();

        // Create a ByteArrayOutputSteam to effectively throw away output.
        resetOutputStream();
        m_installerDb.setDatabaseName(getTestDatabase());
        m_installerDb.setDataSource(getDataSource());

        m_installerDb.setCreateSqlLocation(
            "../opennms-daemon/src/main/filtered/etc/create.sql");

        m_installerDb.setStoredProcedureDirectory(
            "../opennms-daemon/src/main/filtered/etc");

        //installerDb.setDebug(true);

        m_installerDb.readTables();

        m_installerDb.createSequences();
        m_installerDb.updatePlPgsql();
        m_installerDb.addStoredProcedures();

        m_installerDb.createTables();

        m_installerDb.closeConnection();
    }

    public ByteArrayOutputStream getOutputStream() {
        return m_outputStream;
    }

    public void resetOutputStream() {
        m_outputStream = new ByteArrayOutputStream();
        m_installerDb.setOutputStream(new PrintStream(m_outputStream));
    }
}

Fix the name for the installerDb field to match our conventions.


package com.bloatit.framework;

import java.util.Date;

import com.bloatit.framework.right.OfferRight;
import com.bloatit.framework.right.RightManager.Action;
import com.bloatit.model.data.DaoComment;
import com.bloatit.model.data.DaoKudosable;
import com.bloatit.model.data.DaoOffer;

public final class Offer extends Kudosable {

    private final DaoOffer dao;

    public static Offer create(final DaoOffer dao) {
        if (dao == null) {
            return null;
        }
        return new Offer(dao);
    }

    public Offer(final DaoOffer dao) {
        super();
        this.dao = dao;
    }

    public DaoOffer getDao() {
        return dao;
    }

    public Date getDateExpire() {
        return dao.getDateExpire();
    }

    public boolean canSetdatExpire() {
        return new OfferRight.DateExpire().canAccess(calculateRole(this), Action.WRITE);
    }

    public void setDateExpire(final Date dateExpire) {
        new OfferRight.DateExpire().tryAccess(calculateRole(this), Action.WRITE);
        dao.setDateExpire(dateExpire);
    }

    public Demand getDemand() {
        return Demand.create(dao.getDemand());
    }

    public Description getDescription() {
        return new Description(dao.getDescription());
    }

    @Override
    protected DaoKudosable getDaoKudosable() {
        return dao;
    }

}

package com.bloatit.framework;

import java.math.BigDecimal;
import java.util.Date;

import com.bloatit.framework.right.OfferRight;
import com.bloatit.framework.right.RightManager.Action;
import com.bloatit.model.data.DaoComment;
import com.bloatit.model.data.DaoKudosable;
import com.bloatit.model.data.DaoOffer;

public final class Offer extends Kudosable {

    private final DaoOffer dao;

    public static Offer create(final DaoOffer dao) {
        if (dao == null) {
            return null;
        }
        return new Offer(dao);
    }

    public Offer(final DaoOffer dao) {
        super();
        this.dao = dao;
    }

    public DaoOffer getDao() {
        return dao;
    }

    public Date getDateExpire() {
        return dao.getDateExpire();
    }

    public boolean canSetdatExpire() {
        return new OfferRight.DateExpire().canAccess(calculateRole(this), Action.WRITE);
    }

    public void setDateExpire(final Date dateExpire) {
        new OfferRight.DateExpire().tryAccess(calculateRole(this), Action.WRITE);
        dao.setDateExpire(dateExpire);
    }

    public Demand getDemand() {
        return Demand.create(dao.getDemand());
    }

    public Description getDescription() {
        return new Description(dao.getDescription());
    }

    public BigDecimal getAmount() {
        return dao.getAmount();
    }

    @Override
    protected DaoKudosable getDaoKudosable() {
        return dao;
    }

}

Add get amount method in offer

Add get amount method in offer


package org.flymine.dataconversion;

/*
 * Copyright (C) 2002-2003 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

 /**
 * Abstract parent class of all DataConverters
 * @author Mark Woodbridge
 */
 public abstract class DataConverter
{
    protected ItemWriter writer;

    /**
    * Constructor that should be called by children
    * @param writer an ItemWriter used to handle the resultant Items
    */
    public DataConverter(ItemWriter writer) {
        this.writer = writer;
    }

    /**
    * Perform the data conversion
    * @throws Exception if an error occurs during processing
    */
    public abstract void process() throws Exception;
}

package org.flymine.dataconversion;

/*
 * Copyright (C) 2002-2003 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.util.Map;
import java.util.HashMap;

/**
 * Abstract parent class of all DataConverters
 * @author Mark Woodbridge
 */
 public abstract class DataConverter
{
    protected ItemWriter writer;
    protected Map aliases = new HashMap();
    protected int nextClsId = 0;

    /**
    * Constructor that should be called by children
    * @param writer an ItemWriter used to handle the resultant Items
    */
    public DataConverter(ItemWriter writer) {
        this.writer = writer;
    }

    /**
    * Perform the data conversion
    * @throws Exception if an error occurs during processing
    */
    public abstract void process() throws Exception;

    /**
     * Uniquely alias a className
     * @param className the class name
     * @return the alias
     */
    protected String alias(String className) {
        String alias = (String) aliases.get(className);
        if (alias != null) {
            return alias;
        }
        String nextIndex = "" + (nextClsId++);
        aliases.put(className, nextIndex);
        return nextIndex;
    }
}

Add functionality to alias classes

Add functionality to alias classes


package com.timgroup.tucker.info.component;

import com.timgroup.tucker.info.Component;
import com.timgroup.tucker.info.Report;
import com.timgroup.tucker.info.Status;

/**
 * Reports version information about the JVM in which this application is running.
 * <p>
 * The version comes from a query of the java system properties.
 *
 * @see java.lang.System#getProperties
 */
public class JvmVersionComponent extends Component {
    public static final String versionInfoString;

    static {
        String basicVersion = System.getProperty("java.version");
        String vendorVersion = System.getProperty("java.vendor.version");
        if (basicVersion.equals("10") || basicVersion.startsWith("10.") || basicVersion.equals("11") || basicVersion.startsWith("11.")) {
            versionInfoString = basicVersion + " (" + vendorVersion + ")";
        }
        else {
            versionInfoString = basicVersion;
        }
    }

    public JvmVersionComponent() {
        super("jvmversion", "JVM Version");
    }

    @Override
    public Report getReport() {
        return new Report(Status.INFO, versionInfoString);
    }

}

package com.timgroup.tucker.info.component;

import com.timgroup.tucker.info.Component;
import com.timgroup.tucker.info.Report;
import com.timgroup.tucker.info.Status;

/**
 * Reports version information about the JVM in which this application is running.
 * <p>
 * The version comes from a query of the java system properties.
 *
 * @see java.lang.System#getProperties
 */
public class JvmVersionComponent extends Component {
    public static final String versionInfoString;

    static {
        String vendorVersion = System.getProperty("java.vendor.version");
        String basicVersion = System.getProperty("java.version");
        if (vendorVersion != null) {
            versionInfoString = basicVersion + " (" + vendorVersion + ")";
        }
        else {
            versionInfoString = basicVersion;
        }
    }

    public JvmVersionComponent() {
        super("jvmversion", "JVM Version");
    }

    @Override
    public Report getReport() {
        return new Report(Status.INFO, versionInfoString);
    }

}

Simplify formatting JVM version and avoid having to configure each new release


package markehme.factionsplus.sublisteners;

import markehme.factionsplus.Utilities;
import markehme.factionsplus.MCore.FPUConf;

import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;

public class PeacefulSubListener {

	public EventFactionsMembershipChange eventFactionsMembershipChange(EventFactionsMembershipChange event) {
		if(event.getReason() != MembershipChangeReason.JOIN) return event;

		double boostValue = FPUConf.get(event.getUSender().getUniverse()).peacefulPowerBoost;

		if(boostValue> 0 && Utilities.isPeaceful(event.getUSender().getFaction())) {
			Utilities.addPower(event.getUSender(), boostValue);
		}

		return event;
	}
}

package markehme.factionsplus.sublisteners;

import markehme.factionsplus.Utilities;
import markehme.factionsplus.MCore.FPUConf;

import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;

public class PeacefulSubListener {

	public EventFactionsMembershipChange eventFactionsMembershipChange(EventFactionsMembershipChange event) {
		if(event.getReason() != MembershipChangeReason.JOIN) return event;

		double boostValue = FPUConf.get(event.getUSender().getUniverse()).peacefulPowerBoost;

		if(boostValue> 0 && (event.getUSender().getFaction().getFlag(FFlag.PEACEFUL))) {
			Utilities.addPower(event.getUSender(), boostValue);
		}

		return event;
	}
}

Check the FFlag instead of the utility

Check the FFlag instead of the utility


package net.bloople.stories;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

public class NodesAdapter extends RecyclerView.Adapter<NodesAdapter.ViewHolder> {
    private List<Node> nodes;

    public static class ViewHolder extends RecyclerView.ViewHolder {
        public TextView textView;
        public ViewHolder(View view) {
            super(view);
            textView = (TextView)view.findViewById(R.id.text_view);
        }
    }

    public NodesAdapter(List<Node> inNodes) {
        nodes = inNodes;
    }

    // Create new views (invoked by the layout manager)
    @Override
    public NodesAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.node_view, parent,
                false);

        return new ViewHolder(view);
    }

    // Replace the contents of a view (invoked by the layout manager)
    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        TextView tv = holder.textView;

        tv.setText(nodes.get(position).content());

        if(position == 0) {
            tv.setPadding(
                    tv.getPaddingLeft(),
                    tv.getPaddingBottom(),
                    tv.getPaddingRight(),
                    tv.getPaddingBottom()
            );
        }
    }

    // Return the size of your dataset (invoked by the layout manager)
    @Override
    public int getItemCount() {
        return nodes.size();
    }
}

package net.bloople.stories;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

public class NodesAdapter extends RecyclerView.Adapter<NodesAdapter.ViewHolder> {
    private List<Node> nodes;

    public static class ViewHolder extends RecyclerView.ViewHolder {
        public TextView textView;
        public ViewHolder(View view) {
            super(view);
            textView = (TextView)view.findViewById(R.id.text_view);
        }
    }

    public NodesAdapter(List<Node> inNodes) {
        nodes = inNodes;
    }

    // Create new views (invoked by the layout manager)
    @Override
    public NodesAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.node_view, parent,
                false);

        return new ViewHolder(view);
    }

    // Replace the contents of a view (invoked by the layout manager)
    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        TextView tv = holder.textView;

        tv.setText(nodes.get(position).content());

        tv.setPadding(
            tv.getPaddingLeft(),
            (position == 0 ? tv.getPaddingBottom() : 0),
            tv.getPaddingRight(),
            tv.getPaddingBottom()
        );
    }

    // Return the size of your dataset (invoked by the layout manager)
    @Override
    public int getItemCount() {
        return nodes.size();
    }
}

Reset the padding on each TextView when the RecyclerView binds it


package org.wikipedia.json;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.google.gson.reflect.TypeToken;

import org.wikipedia.crash.RemoteLogException;
import org.wikipedia.page.tabs.Tab;
import org.wikipedia.util.log.L;

import java.util.Collections;
import java.util.List;

public final class TabUnmarshaller {
    private static final TypeToken<List<Tab>> TYPE_TOKEN = new TypeToken<List<Tab>>() { };

    @NonNull public static List<Tab> unmarshal(@Nullable String json) {
        List<Tab> object = null;
        try {
            object = GsonUnmarshaller.unmarshal(TYPE_TOKEN, json);
        } catch (Exception e) {
            // Catch all. Any Exception can be thrown when unmarshalling.
            L.logRemoteErrorIfProd(new RemoteLogException(e).put("json", json));
        }
        if (object == null) {
            object = Collections.emptyList();
        }
        return object;
    }

    private TabUnmarshaller() { }
}

package org.wikipedia.json;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.google.gson.reflect.TypeToken;

import org.wikipedia.crash.RemoteLogException;
import org.wikipedia.page.PageBackStackItem;
import org.wikipedia.page.tabs.Tab;
import org.wikipedia.util.log.L;

import java.util.Collections;
import java.util.List;

public final class TabUnmarshaller {
    private static final TypeToken<List<Tab>> TYPE_TOKEN = new TypeToken<List<Tab>>() { };

    @NonNull public static List<Tab> unmarshal(@Nullable String json) {
        List<Tab> object = null;
        try {
            object = GsonUnmarshaller.unmarshal(TYPE_TOKEN, json);
        } catch (Exception e) {
            // Catch all. Any Exception can be thrown when unmarshalling.
            L.logRemoteErrorIfProd(new RemoteLogException(e).put("json", json));
        }
        if (object == null) {
            object = Collections.emptyList();
        }

        // T152980
        // When upgrading from much older versions (namely, 2.1.141 or earlier), the serialized
        // tab list may be in a format that causes WikiSite objects to have null Uri components.
        // If we encounter one of these occurrences, just clear out the entire tab list.
        // to be on the safe side.
        // TODO: Remove when the incidence of this is sufficiently diminished (April 2017?)
        boolean bad = false;
        for (Tab tab : object) {
            for (PageBackStackItem item : tab.getBackStack()) {
                if (TextUtils.isEmpty(item.getTitle().getWikiSite().authority())
                        || TextUtils.isEmpty(item.getHistoryEntry().getTitle().getWikiSite().authority())) {
                    L.logRemoteErrorIfProd(new IllegalArgumentException("Format error in serialized tab list."));
                    bad = true;
                    break;
                }
            }
        }
        if (bad) {
            object.clear();
        }

        return object;
    }

    private TabUnmarshaller() { }
}

Fix possible crash when upgrading from older app versions.

In versions of the app prior to 2.1.142, the list of Tabs was serialized
in a way that's not completely consistent with the way it's serialized
today. Specifically, the "domain" item of the "site" component can
sometimes be an empty string, which would manifest itself as a Uri with
an empty authority.

This leads to a dangerous condition where the tab list is deserialized
"successfully", but the Uri contains a ticking time bomb of null members,
which causes a confusing exception when the Uri is passed to Retrofit.

This patch adds logic to look for tab entries that match this description
after deserializing, and if found, fall back to clearing out the tab list
and starting fresh.

Bug: T152980
Change-Id: If09f6832e6a4f3e2b47a3806cb4e8da9cad8031e


package org.jboss.shamrock.deployment;

import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.shamrock.runtime.RegisterForReflection;

public class RegisterForReflectionProcessor implements ResourceProcessor {
    @Override
    public void process(ArchiveContext archiveContext, ProcessorContext processorContext) throws Exception {
        for (AnnotationInstance i : archiveContext.getCombinedIndex().getAnnotations(DotName.createSimple(RegisterForReflection.class.getName()))) {
            ClassInfo target = i.target().asClass();
            boolean methods = i.value("methods") == null || i.value("methods").asBoolean();
            boolean fields = i.value("fields") == null || i.value("fields").asBoolean();
            processorContext.addReflectiveClass(methods, fields, target.name().toString());
        }
    }

    @Override
    public int getPriority() {
        return 0;
    }
}

package org.jboss.shamrock.deployment;

import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.shamrock.runtime.RegisterForReflection;

public class RegisterForReflectionProcessor implements ResourceProcessor {
    @Override
    public void process(ArchiveContext archiveContext, ProcessorContext processorContext) throws Exception {
        for (AnnotationInstance i : archiveContext.getCombinedIndex().getAnnotations(DotName.createSimple(RegisterForReflection.class.getName()))) {
            ClassInfo target = i.target().asClass();
            boolean methods = i.value("methods") == null || i.value("methods").asBoolean();
            boolean fields = i.value("fields") == null || i.value("fields").asBoolean();
            processorContext.addReflectiveClass(methods, fields, target.name().toString());
        }

        //TODO: where should stuff like this go?
        //this will hold a heap of memory when it is initialized, and is rarely used (but it generally on the analysis path)
        processorContext.addRuntimeInitializedClasses("com.sun.org.apache.xml.internal.serializer.ToHTMLStream");
    }

    @Override
    public int getPriority() {
        return 0;
    }
}

Mark class with memory intensive static init method as init at runtime


package com.thoughtworks.xstream.core.util;

public final class FastStack {

    private Object[] stack;
    private int pointer;

    public FastStack(int initialCapacity) {
        stack = new Object[initialCapacity];
    }

    public Object push(Object value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
        return value;
    }

    public void popSilently() {
        pointer--;
    }

    public Object pop() {
        return stack[--pointer];
    }

    public Object peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public boolean hasStuff() {
        return pointer > 0;
    }

    public Object get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Object[] newStack = new Object[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }

    public String toString() {
        StringBuffer result = new StringBuffer("[");
        for (int i = 0; i < pointer; i++) {
            if (i > 0) {
                result.append(", ");
            }
            result.append(stack[i]);
        }
        result.append(']');
        return result.toString();
    }
}

package com.thoughtworks.xstream.core.util;

public final class FastStack {

    private Object[] stack;
    private int pointer;

    public FastStack(int initialCapacity) {
        stack = new Object[initialCapacity];
    }

    public Object push(Object value) {
        if (pointer + 1 >= stack.length) {
            resizeStack(stack.length * 2);
        }
        stack[pointer++] = value;
        return value;
    }

    public void popSilently() {
        stack[--pointer] = null;
    }

    public Object pop() {
        final Object result = stack[--pointer];
        stack[pointer] = null;
        return result;
    }

    public Object peek() {
        return pointer == 0 ? null : stack[pointer - 1];
    }

    public int size() {
        return pointer;
    }

    public boolean hasStuff() {
        return pointer > 0;
    }

    public Object get(int i) {
        return stack[i];
    }

    private void resizeStack(int newCapacity) {
        Object[] newStack = new Object[newCapacity];
        System.arraycopy(stack, 0, newStack, 0, Math.min(stack.length, newCapacity));
        stack = newStack;
    }

    public String toString() {
        StringBuffer result = new StringBuffer("[");
        for (int i = 0; i < pointer; i++) {
            if (i > 0) {
                result.append(", ");
            }
            result.append(stack[i]);
        }
        result.append(']');
        return result.toString();
    }
}

Drop unnecessary reference to popped elements to allow finalization through GC (XSTR-264).


package com.koenv.universalminecraftapi.users;

import com.koenv.universalminecraftapi.ErrorCodes;
import com.koenv.universalminecraftapi.UniversalMinecraftAPI;
import com.koenv.universalminecraftapi.http.model.APIException;
import com.koenv.universalminecraftapi.http.model.BaseHttpInvoker;
import com.koenv.universalminecraftapi.methods.APIMethod;
import com.koenv.universalminecraftapi.methods.APINamespace;
import com.koenv.universalminecraftapi.methods.Invoker;
import com.koenv.universalminecraftapi.users.model.User;

import java.util.Collection;

@APINamespace("users")
public class UserMethods {
    @APIMethod
    public static Collection<User> getUsers() {
        return UniversalMinecraftAPI.getInstance().getUserManager().getUsers();
    }

    @APIMethod(operatesOn = User.class)
    public static String getUsername(User user) {
        return user.getUsername();
    }

    @APIMethod
    public static String generateApiKey(Invoker invoker) {
        if (invoker instanceof BaseHttpInvoker) {
            BaseHttpInvoker httpInvoker = (BaseHttpInvoker) invoker;
            return UniversalMinecraftAPI.getInstance().getUserManager().getApiKeyManager().generate(httpInvoker.getUser());
        }
        throw new APIException("Invalid user", ErrorCodes.INVALID_CREDENTIALS);
    }
}

package com.koenv.universalminecraftapi.users;

import com.koenv.universalminecraftapi.ErrorCodes;
import com.koenv.universalminecraftapi.UniversalMinecraftAPI;
import com.koenv.universalminecraftapi.http.model.APIException;
import com.koenv.universalminecraftapi.http.model.BaseHttpInvoker;
import com.koenv.universalminecraftapi.methods.APIMethod;
import com.koenv.universalminecraftapi.methods.APINamespace;
import com.koenv.universalminecraftapi.methods.Invoker;
import com.koenv.universalminecraftapi.users.model.User;

import java.util.Collection;

@APINamespace("users")
public class UserMethods {
    @APIMethod
    public static Collection<User> getUsers() {
        return UniversalMinecraftAPI.getInstance().getUserManager().getUsers();
    }

    @APIMethod(operatesOn = User.class)
    public static String getUsername(User user) {
        return user.getUsername();
    }

    @APIMethod
    public static String generateApiKey(Invoker invoker) {
        if (invoker instanceof BaseHttpInvoker) {
            BaseHttpInvoker httpInvoker = (BaseHttpInvoker) invoker;
            return UniversalMinecraftAPI.getInstance().getUserManager().getApiKeyManager().generate(httpInvoker.getUser());
        }
        throw new APIException("Invalid user", ErrorCodes.INVALID_CREDENTIALS);
    }

    @APIMethod
    public static String getCurrentUser(Invoker invoker) {
        if (invoker instanceof BaseHttpInvoker) {
            BaseHttpInvoker httpInvoker = (BaseHttpInvoker) invoker;
            return httpInvoker.getUser().getUsername();
        }
        throw new APIException("Invalid user", ErrorCodes.INVALID_CREDENTIALS);
    }
}

Allow getting the current authenticated user


package com.rabenauge.gl;

import android.opengl.GLU;
import java.nio.FloatBuffer;
import javax.microedition.khronos.opengles.GL10;

/*
 * A class for various static helper methods.
 */
public class Helper {
    // Vertices and texture coordinates for rendering a bitmap in order LR, LL, UL, UR.
    private static final float w=1, h=1;
    private static final FloatBuffer v=FloatBuffer.allocate(8).put(w).put(h).put(0).put(h).put(0).put(0).put(w).put(0);

    public static void drawScreenSpaceTexture(Texture2D tex) {
        tex.makeCurrent();

        tex.gl.glMatrixMode(GL10.GL_PROJECTION);
        tex.gl.glLoadIdentity();
        GLU.gluOrtho2D(tex.gl, 0, w, h, 0);

        tex.gl.glVertexPointer(2, GL10.GL_FLOAT, 0, v);
        tex.gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, v);

        tex.gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, 4);
    }

    public static void toggleState(GL10 gl, int cap, boolean state) {
        if (state) {
            gl.glEnable(cap);
        }
        else {
            gl.glDisable(cap);
        }
    }
}

package com.rabenauge.gl;

import android.opengl.GLU;
import java.nio.FloatBuffer;
import javax.microedition.khronos.opengles.GL10;

/*
 * A class for various static helper methods.
 */
public class Helper {
    // Vertices and texture coordinates for rendering a bitmap in order LR, LL, UL, UR.
    private static final float w=1, h=1;
    private static final FloatBuffer v=FloatBuffer.allocate(8).put(w).put(h).put(0).put(h).put(0).put(0).put(w).put(0);

    public static void drawScreenSpaceQuad(GL10 gl) {
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        GLU.gluOrtho2D(gl, 0, w, h, 0);

        gl.glVertexPointer(2, GL10.GL_FLOAT, 0, v);
        gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, 4);
    }

    public static void drawScreenSpaceTexture(Texture2D tex) {
        tex.makeCurrent();
        tex.gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, v);

        drawScreenSpaceQuad(tex.gl);
    }

    public static void toggleState(GL10 gl, int cap, boolean state) {
        if (state) {
            gl.glEnable(cap);
        }
        else {
            gl.glDisable(cap);
        }
    }
}

Add a method to draw a screen space aligned (untextured) quad


package org.ow2.proactive.scheduler.common.task;

import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * This class is the super class of the every task that can be integrated in a job.

 * A task contains some properties that can be set but also :

 *
A selection script that can be used to select a specific execution node for this task.

 *
A preScript that will be launched before the real task (can be used to set environment vars).

 *
A postScript that will be launched just after the end of the real task.
 * (this can be used to transfer files that have been created by the task).

 *
A CleaningScript that will be launched by the resource manager to perform some cleaning. (deleting files or resources).

 *

 * You will also be able to add dependences (if necessary) to
 * this task. The dependences mechanism are best describe below.
 *
 * TODO PARAITA update javadoc
 *
 */
@XmlRootElement
public class TaskStatesPage {

    private int size;

    private List<TaskState> taskStates;

    public TaskStatesPage() {

    }

    public TaskStatesPage(List<TaskState> taskStates, int size) {
        this.taskStates = taskStates;
        this.size = size;
    }

    public int getSize() {
        return size;
    }

    public void setSize(final int size) {
        this.size = size;
    }

    public List<TaskState> getTaskStates() {
        return taskStates;
    }

    public void setTaskStates(List<TaskState> taskStates) {
        this.taskStates = taskStates;
    }

    @Override
    public String toString() {
        return "TaskStatePage{" + "size=" + size + ", taskStates='" + taskStates + '\'' + '}';
    }
}

package org.ow2.proactive.scheduler.common.task;

import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;

/**
 * This class holds a paginated list of TaskState
 * server-wise and the total number of tasks.
 *
 */
@XmlRootElement
public class TaskStatesPage {

    private int size;

    private List<TaskState> taskStates;

    public TaskStatesPage() {

    }

    public TaskStatesPage(List<TaskState> taskStates, int size) {
        this.taskStates = taskStates;
        this.size = size;
    }

    public int getSize() {
        return size;
    }

    public void setSize(final int size) {
        this.size = size;
    }

    public List<TaskState> getTaskStates() {
        return taskStates;
    }

    public void setTaskStates(List<TaskState> taskStates) {
        this.taskStates = taskStates;
    }

    @Override
    public String toString() {
        return "TaskStatePage{" + "size=" + size + ", taskStates='" + taskStates + '\'' + '}';
    }
}

Fix javadoc for the TaskStatePage

Fix javadoc for the TaskStatePage


package com.github.vedenin.thirdpartylib.htmlparser;

import com.github.vedenin.thirdpartylib.annotations.Atom;
import com.github.vedenin.thirdpartylib.annotations.BoilerPlate;
import com.github.vedenin.thirdpartylib.annotations.Contract;
import com.github.vedenin.thirdpartylib.annotations.Reference;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.jsoup.nodes.Element;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by vvedenin on 12/16/2016.
 */
@Atom
@Contract("Provide information about HTML pages")
@Reference({ElementAtom.class})
public class DocumentAtom {
    private final Document document;

    @Contract("Should returns elements according this CSS Query")
    public List<ElementAtom> select(String cssQuery) {
        Elements elements = document.select(cssQuery);
        List<ElementAtom> result = new ArrayList<>(elements.size());
        for(Element element: elements) {
            result.add(ElementAtom.getProxy(element));
        }
        return result;
    }

    @Contract("Should returns text from html without any tags")
    public String getText() {
        return document.text();
    }

    // -------------- Just boilerplate code for Atom -----------------
    @BoilerPlate
    private DocumentAtom(Document document) {
        this.document = document;
    }

    @BoilerPlate
    public static DocumentAtom getAtom(Document document) {
        return new DocumentAtom(document);
    }

}

package com.github.vedenin.thirdpartylib.htmlparser;

import com.github.vedenin.thirdpartylib.annotations.Atom;
import com.github.vedenin.thirdpartylib.annotations.BoilerPlate;
import com.github.vedenin.thirdpartylib.annotations.Contract;
import com.github.vedenin.thirdpartylib.annotations.Reference;
import org.jsoup.nodes.Document;
import java.util.ArrayList;
import java.util.List;

import static java.util.stream.Collectors.*;

/**
 * Created by vvedenin on 12/16/2016.
 */
@Atom
@Contract("Provide information about HTML pages")
@Reference({ElementAtom.class})
public class DocumentAtom {
    private final Document document;

    @Contract("Should returns elements according this CSS Query")
    public List<ElementAtom> select(String cssQuery) {
        List<ElementAtom> result = new ArrayList<>();
        result.addAll(document.select(cssQuery).stream().map(ElementAtom::getProxy).collect(toList()));
        return result;
    }

    @Contract("Should returns text from html without any tags")
    public String getText() {
        return document.text();
    }

    // -------------- Just boilerplate code for Atom -----------------
    @BoilerPlate
    private DocumentAtom(Document document) {
        this.document = document;
    }

    @BoilerPlate
    public static DocumentAtom getAtom(Document document) {
        return new DocumentAtom(document);
    }

}

Create atom-proxy for third party libs

Create atom-proxy for third party libs


/**
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 7;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

/**
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 8;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

Increment Java debugger minor version to 2.8 for a new release.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143450403


/*
 * This file is part of Bitsquare.
 *
 * Bitsquare is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
 */

package io.bitsquare.trade.protocol.availability.messages;

import io.bitsquare.app.Version;
import io.bitsquare.trade.protocol.availability.AvailabilityResult;

public final class OfferAvailabilityResponse extends OfferMessage {
    // That object is sent over the wire, so we need to take care of version compatibility.
    private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;

    public final AvailabilityResult availabilityResult;

    // TODO keep for backward compatibility. Can be removed once everyone is on v0.4.9
    public boolean isAvailable;

    public OfferAvailabilityResponse(String offerId, AvailabilityResult availabilityResult) {
        super(offerId);
        this.availabilityResult = availabilityResult;
    }

    @Override
    public String toString() {
        return "OfferAvailabilityResponse{" +
                "availabilityResult=" + availabilityResult +
                "} " + super.toString();
    }
}

/*
 * This file is part of Bitsquare.
 *
 * Bitsquare is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 *
 * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
 */

package io.bitsquare.trade.protocol.availability.messages;

import io.bitsquare.app.Version;
import io.bitsquare.trade.protocol.availability.AvailabilityResult;

public final class OfferAvailabilityResponse extends OfferMessage {
    // That object is sent over the wire, so we need to take care of version compatibility.
    private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;

    public final AvailabilityResult availabilityResult;

    // TODO keep for backward compatibility. Can be removed once everyone is on v0.4.9
    public boolean isAvailable;

    public OfferAvailabilityResponse(String offerId, AvailabilityResult availabilityResult) {
        super(offerId);
        this.availabilityResult = availabilityResult;
        isAvailable = availabilityResult == AvailabilityResult.AVAILABLE;
    }

    @Override
    public String toString() {
        return "OfferAvailabilityResponse{" +
                "availabilityResult=" + availabilityResult +
                "} " + super.toString();
    }
}

Set availabilityResult for backward compatibility


package hellowicket;

import org.apache.wicket.core.request.handler.PageProvider;
import org.apache.wicket.core.request.handler.RenderPageRequestHandler;
import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.IRequestMapper;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Url;
import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler;

import hellowicket.dbupdates.HelloDbUpdatesReference;
import hellowicket.fortune.FortunePage;
import hellowicket.plaintext.HelloTextReference;

/**
 * Custom request mapper optimized for the application needs
 */
public class RequestMapper implements IRequestMapper {

    private static final Url FORTUNES_URL = Url.parse("fortunes");

    @Override
    public IRequestHandler mapRequest(final Request request) {
        final String url = request.getUrl().toString();
        switch (url) {
            case "json":
                return new ResourceReferenceRequestHandler(new HelloJsonReference());
            case "db":
                return new ResourceReferenceRequestHandler(new HelloDbReference());
            case "updates":
                return new ResourceReferenceRequestHandler(new HelloDbUpdatesReference());
            case "plaintext":
                return new ResourceReferenceRequestHandler(new HelloTextReference());
            case "fortunes":
                return new RenderPageRequestHandler(new PageProvider(FortunePage.class));
            default:
        }
        return null;
    }

    @Override
    public int getCompatibilityScore(final Request request) {
        return 0;
    }

    @Override
    public Url mapHandler(final IRequestHandler requestHandler) {
        return FORTUNES_URL;
    }
}

package hellowicket;

import org.apache.wicket.core.request.handler.PageProvider;
import org.apache.wicket.core.request.handler.RenderPageRequestHandler;
import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.IRequestMapper;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Url;
import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler;

import hellowicket.dbupdates.HelloDbUpdatesReference;
import hellowicket.fortune.FortunePage;
import hellowicket.plaintext.HelloTextReference;

/**
 * Custom request mapper optimized for the application needs
 */
public class RequestMapper implements IRequestMapper {

    private static final Url FORTUNES_URL = Url.parse("fortunes");

    @Override
    public IRequestHandler mapRequest(final Request request) {
        final String url = request.getUrl().getPath();
        switch (url) {
            case "json":
                return new ResourceReferenceRequestHandler(new HelloJsonReference());
            case "db":
                return new ResourceReferenceRequestHandler(new HelloDbReference());
            case "updates":
                return new ResourceReferenceRequestHandler(new HelloDbUpdatesReference());
            case "plaintext":
                return new ResourceReferenceRequestHandler(new HelloTextReference());
            case "fortunes":
                return new RenderPageRequestHandler(new PageProvider(FortunePage.class));
            default:
        }
        return null;
    }

    @Override
    public int getCompatibilityScore(final Request request) {
        return 0;
    }

    @Override
    public Url mapHandler(final IRequestHandler requestHandler) {
        return FORTUNES_URL;
    }
}

Improve the url parsing - we need only the path to be able to decide


/*
 * Copyright (C) 2016 grandcentrix GmbH
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.grandcentrix.thirtyinch.distinctuntilchanged;

import net.grandcentrix.thirtyinch.TiView;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * When added to a {@code void} method with at least one parameter inside a {@link TiView}, the
 * method implementation will only be called when the parameters change. A
 * {@link DistinctComparator} class is used to detect changes. By default it uses
 * {@link EqualsComparator}.
 */
@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DistinctUntilChanged {

    Class<? extends DistinctComparator> comparator() default EqualsComparator.class;

    boolean logDropped() default false;

}

/*
 * Copyright (C) 2016 grandcentrix GmbH
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.grandcentrix.thirtyinch.distinctuntilchanged;

import net.grandcentrix.thirtyinch.TiView;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * When added to a {@code void} method with at least one parameter inside a {@link TiView}, the
 * method implementation will only be called when the parameters change. A
 * {@link DistinctComparator} class is used to detect changes. By default it uses
 * {@link HashComparator}.
 */
@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DistinctUntilChanged {

    Class<? extends DistinctComparator> comparator() default HashComparator.class;

    boolean logDropped() default false;

}

Revert Default implementation should using equals