/*
 * Copyright 2017 MovingBlocks
 *
 * 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 org.terasology.rendering;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class FontUnderlineTest {

    private static final char START_UNDERLINE = 0xF001;
    private static final char END_UNDERLINE = 0xF002;

    @Test
    public void testStartUnderline() {
        assertTrue(FontUnderline.isValid(START_UNDERLINE));
    }

    @Test
    public void testEndUnderline() {
        assertTrue(FontUnderline.isValid(END_UNDERLINE));
    }

    @Test
    public void testInvalidUnderline() {
        char invalidUnderline = 0xF003;
        assertFalse(FontUnderline.isValid(invalidUnderline));
    }

    @Test
    public void testMarkUnderlined() {
        String testString = "string";
        assertTrue(FontUnderline.markUnderlined(testString).equals(START_UNDERLINE + testString + END_UNDERLINE));
    }
}

/*
 * Copyright 2017 MovingBlocks
 *
 * 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 org.terasology.rendering;

import org.junit.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class FontUnderlineTest {

    private static final char START_UNDERLINE = 0xF001;
    private static final char END_UNDERLINE = 0xF002;

    @Test
    public void testStartUnderline() {
        assertTrue(FontUnderline.isValid(START_UNDERLINE));
    }

    @Test
    public void testEndUnderline() {
        assertTrue(FontUnderline.isValid(END_UNDERLINE));
    }

    @Test
    public void testInvalidUnderline() {
        char invalidUnderline = 0xF003;
        assertFalse(FontUnderline.isValid(invalidUnderline));
    }

    @Test
    public void testMarkUnderlined() {
        String testString = "string";
        assertTrue(FontUnderline.markUnderlined(testString).equals(START_UNDERLINE + testString + END_UNDERLINE));
    }
}

Reformat tests to remove tabs


package com.github.sormuras.bach.internal;

import java.lang.module.ModuleFinder;
import java.util.List;
import java.util.Set;

/** Module-related utilities. */
public class Modules {

  public static ModuleLayer layer(ModuleFinder finder) {
    var boot = ModuleLayer.boot();
    var configuration = boot.configuration().resolveAndBind(ModuleFinder.of(), finder, Set.of());
    var parent = Modules.class.getClassLoader();
    var controller = ModuleLayer.defineModulesWithOneLoader(configuration, List.of(boot), parent);
    return controller.layer();
  }

  /** Hide default constructor. */
  private Modules() {}
}

package com.github.sormuras.bach.internal;

import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleDescriptor.Requires;
import java.lang.module.ModuleFinder;
import java.lang.module.ModuleReference;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/** Module-related utilities. */
public class Modules {

  public static Set<String> declared(ModuleFinder finder) {
    return declared(finder.findAll().stream().map(ModuleReference::descriptor));
  }

  public static Set<String> declared(Stream<ModuleDescriptor> descriptors) {
    return descriptors.map(ModuleDescriptor::name).collect(Collectors.toCollection(TreeSet::new));
  }

  public static Set<String> required(ModuleFinder finder) {
    return required(finder.findAll().stream().map(ModuleReference::descriptor));
  }

  public static Set<String> required(Stream<ModuleDescriptor> descriptors) {
    return descriptors
        .map(ModuleDescriptor::requires)
        .flatMap(Set::stream)
        .filter(requires -> !requires.modifiers().contains(Requires.Modifier.MANDATED))
        .filter(requires -> !requires.modifiers().contains(Requires.Modifier.SYNTHETIC))
        .map(Requires::name)
        .collect(Collectors.toCollection(TreeSet::new));
  }

  public static ModuleLayer layer(ModuleFinder finder) {
    var boot = ModuleLayer.boot();
    var configuration = boot.configuration().resolveAndBind(ModuleFinder.of(), finder, Set.of());
    var parent = Modules.class.getClassLoader();
    var controller = ModuleLayer.defineModulesWithOneLoader(configuration, List.of(boot), parent);
    return controller.layer();
  }

  /** Hide default constructor. */
  private Modules() {}
}

Extend module-related utilities with declared and required methods


/*
 * 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.sis.internal.book;

/**
 * Localized resources, for internal usage only.
 *
 * @author  Martin Desruisseaux (Geomatys)
 * @since   0.7
 * @version 0.7
 */
public final class Resources_fr extends Resources {
    @Override
    protected Object[][] getContents() {
        final Object[][] resources = super.getContents();
        resources[0][1] = "Chapitre suivant";
        resources[1][1] = "Chapitre précédent";
        resources[2][1] = "Dans ce chapitre:";
        return resources;
    }
}

/*
 * 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.sis.internal.book;

/**
 * Localized resources, for internal usage only.
 *
 * @author  Martin Desruisseaux (Geomatys)
 * @since   0.7
 * @version 0.7
 */
public final class Resources_fr extends Resources {
    @Override
    protected Object[][] getContents() {
        final Object[][] resources = super.getContents();
        resources[0][1] = "Chapitre précédent";
        resources[1][1] = "Chapitre suivant";
        resources[2][1] = "Dans ce chapitre:";
        return resources;
    }
}

Fix wrong French resources for the developer guide.


/*
 * 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 io.prestosql.tests.hive;

import com.google.inject.Inject;
import com.google.inject.name.Named;
import io.prestosql.tempto.ProductTest;

import static com.google.common.base.Preconditions.checkState;

public class HiveProductTest
        extends ProductTest
{
    @Inject
    @Named("databases.hive.major_version")
    private int hiveVersionMajor;

    protected int getHiveVersionMajor()
    {
        checkState(hiveVersionMajor > 0, "hiveVersionMajor not set");
        return hiveVersionMajor;
    }
}

/*
 * 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 io.prestosql.tests.hive;

import com.google.inject.Inject;
import com.google.inject.name.Named;
import io.prestosql.tempto.ProductTest;

import java.sql.SQLException;

import static com.google.common.base.Preconditions.checkState;
import static io.prestosql.tests.utils.QueryExecutors.onHive;

public class HiveProductTest
        extends ProductTest
{
    @Inject
    @Named("databases.hive.major_version")
    private int hiveVersionMajor;
    private boolean hiveVersionMajorVerified;

    protected int getHiveVersionMajor()
    {
        checkState(hiveVersionMajor > 0, "hiveVersionMajor not set");
        if (!hiveVersionMajorVerified) {
            int detected = detectHiveVersionMajor();
            checkState(hiveVersionMajor == detected, "Hive version major expected: %s, but was detected as: %s", hiveVersionMajor, detected);
            hiveVersionMajorVerified = true;
        }
        return hiveVersionMajor;
    }

    private static int detectHiveVersionMajor()
    {
        try {
            return onHive().getConnection().getMetaData().getDatabaseMajorVersion();
        }
        catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}

Verify Hive version major in product tests


/*
 * Copyright 2002-2015 the original author or authors.
 *
 * 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 org.springframework.http.client;

import org.junit.Test;

import org.springframework.http.HttpMethod;

/**
 * @author Luciano Leggieri
 */
public class OkHttpClientHttpRequestFactoryTests extends AbstractHttpRequestFactoryTestCase {

	@Override
	protected ClientHttpRequestFactory createRequestFactory() {
		return new OkHttpClientHttpRequestFactory();
	}

	@Override
	@Test
	public void httpMethods() throws Exception {
		assertHttpMethod("patch", HttpMethod.PATCH);
	}

}

/*
 * Copyright 2002-2015 the original author or authors.
 *
 * 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 org.springframework.http.client;

import org.junit.Test;

import org.springframework.http.HttpMethod;

/**
 * @author Luciano Leggieri
 */
public class OkHttpClientHttpRequestFactoryTests extends AbstractHttpRequestFactoryTestCase {

	@Override
	protected ClientHttpRequestFactory createRequestFactory() {
		return new OkHttpClientHttpRequestFactory();
	}

	@Override
	@Test
	public void httpMethods() throws Exception {
		super.httpMethods();
		assertHttpMethod("patch", HttpMethod.PATCH);
	}

}

Add missing super in test


package com.rarchives.ripme.tst.ripper.rippers;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import com.rarchives.ripme.ripper.rippers.ErotivRipper;
import org.junit.jupiter.api.Test;

public class ErotivRipperTest extends RippersTest {
	@Test
	public void testGetGID() throws IOException {
		URL url = new URL("https://erotiv.io/e/1568314255");
		ErotivRipper ripper = new ErotivRipper(url);
		assertEquals("1568314255", ripper.getGID(url));
	}

	public void testRip() throws IOException {
		URL url = new URL("https://erotiv.io/e/1568314255");
		ErotivRipper ripper = new ErotivRipper(url);
		testRipper(ripper);
	}
	@Test
	public void testGetURLsFromPage() throws IOException {
		URL url = new URL("https://erotiv.io/e/1568314255");
		ErotivRipper ripper = new ErotivRipper(url);
		assert (1 == ripper.getURLsFromPage(ripper.getFirstPage()).size());
	}
}

package com.rarchives.ripme.tst.ripper.rippers;

import java.io.IOException;
import java.net.URL;

import com.rarchives.ripme.ripper.rippers.ErotivRipper;
import org.junit.jupiter.api.Test;

public class ErotivRipperTest extends RippersTest {
    @Test
    public void testGetGID() throws IOException {
        URL url = new URL("https://erotiv.io/e/1568314255");
        ErotivRipper ripper = new ErotivRipper(url);
        assert("1568314255".equals(ripper.getGID(url)));
    }

    public void testRip() throws IOException {
        URL url = new URL("https://erotiv.io/e/1568314255");
        ErotivRipper ripper = new ErotivRipper(url);
        testRipper(ripper);
    }

    @Test
    public void testGetURLsFromPage() throws IOException {
        URL url = new URL("https://erotiv.io/e/1568314255");
        ErotivRipper ripper = new ErotivRipper(url);
        assert(1 == ripper.getURLsFromPage(ripper.getFirstPage()).size());
    }
}

Fix indentation, remove unused import, avoid deprecated method


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.navalplanner.business.resources.entities;

import java.util.List;

/**
 *
 * @author Diego Pino Garcia<dpino@igalia.com>
 */
public enum ResourceEnum {

    RESOURCE(Resource.class),
    WORKER(Worker.class);

    Class clase;

    private ResourceEnum(Class clase) {
        this.clase = clase;
    }

    public Class asClass() {
        return clase;
    }

    public static ResourceEnum getDefault() {
        return RESOURCE;
    }

    public boolean isAssignableFrom(Class clase) {
        return asClass().equals(clase);
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.navalplanner.business.resources.entities;

import java.util.List;

/**
 *
 * @author Diego Pino Garcia<dpino@igalia.com>
 */
public enum ResourceEnum {

    RESOURCE(Resource.class),
    WORKER(Worker.class);

    Class clase;

    private ResourceEnum(Class clase) {
        this.clase = clase;
    }

    public Class asClass() {
        return clase;
    }

    public static ResourceEnum getDefault() {
        return RESOURCE;
    }

    public boolean isAssignableFrom(Class clase) {
        return asClass().isAssignableFrom(clase);
    }
}

Fix bug to let add a CriterionSatisfaction to Resource super class or subclass.


package com.jetbrains.python.documentation.doctest;

import com.intellij.lang.InjectableLanguage;
import com.intellij.lang.Language;
import com.jetbrains.python.PythonLanguage;

/**
 * User : ktisha
 */
public class PyDocstringLanguageDialect extends Language implements InjectableLanguage {
  public static PyDocstringLanguageDialect getInstance() {
    return (PyDocstringLanguageDialect)PyDocstringFileType.INSTANCE.getLanguage();
  }

  protected PyDocstringLanguageDialect() {
    super(PythonLanguage.getInstance(), "PyDocstring");
  }
}

package com.jetbrains.python.documentation.doctest;

import com.intellij.codeInsight.intention.impl.QuickEditAction;
import com.intellij.lang.InjectableLanguage;
import com.intellij.lang.Language;
import com.jetbrains.python.PythonLanguage;

/**
 * User : ktisha
 */
public class PyDocstringLanguageDialect extends Language implements InjectableLanguage {
  public static PyDocstringLanguageDialect getInstance() {
    return (PyDocstringLanguageDialect)PyDocstringFileType.INSTANCE.getLanguage();
  }

  protected PyDocstringLanguageDialect() {
    super(PythonLanguage.getInstance(), "PyDocstring");
    putUserData(QuickEditAction.EDIT_ACTION_AVAILABLE, false);
  }
}

Edit injection language fragment action is not available for Python Docstring language


package org.tinylog.impl.format.pattern.placeholders;

import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Locale;

import org.tinylog.core.Framework;
import org.tinylog.core.internal.InternalLogger;

/**
 * Builder for creating an instance of {@link DatePlaceholder}.
 */
public class DatePlaceholderBuilder implements PlaceholderBuilder {

	private static final String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss";

	/** */
	public DatePlaceholderBuilder() {
	}

	@Override
	public String getName() {
		return "date";
	}

	@Override
	public Placeholder create(Framework framework, String value) {
		String pattern = value == null ? DEFAULT_PATTERN : value;
		Locale locale = framework.getConfiguration().getLocale();
		ZoneId zone = framework.getConfiguration().getZone();

		try {
			DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern, locale);
			return new DatePlaceholder(formatter.withZone(zone), value != null);
		} catch (IllegalArgumentException ex) {
			InternalLogger.error(ex, "Invalid date time pattern: \"{}\"", pattern);
			DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DEFAULT_PATTERN, locale);
			return new DatePlaceholder(formatter.withZone(zone), false);
		}
	}

}

package org.tinylog.impl.format.pattern.placeholders;

import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Locale;

import org.tinylog.core.Framework;
import org.tinylog.core.internal.InternalLogger;

/**
 * Builder for creating an instance of {@link DatePlaceholder}.
 */
public class DatePlaceholderBuilder implements PlaceholderBuilder {

	private static final String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss";

	/** */
	public DatePlaceholderBuilder() {
	}

	@Override
	public String getName() {
		return "date";
	}

	@Override
	public Placeholder create(Framework framework, String value) {
		String pattern = value == null ? DEFAULT_PATTERN : value;
		Locale locale = framework.getConfiguration().getLocale();
		ZoneId zone = framework.getConfiguration().getZone();

		try {
			DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern, locale);
			return new DatePlaceholder(formatter.withZone(zone), value != null);
		} catch (IllegalArgumentException ex) {
			InternalLogger.error(ex, "Invalid date-time pattern: \"{}\"", pattern);
			DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DEFAULT_PATTERN, locale);
			return new DatePlaceholder(formatter.withZone(zone), false);
		}
	}

}

Add hyphen to date-time pattern


package org.luxons.sevenwonders.config;

import java.security.Principal;

import org.luxons.sevenwonders.validation.DestinationAccessValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
import org.springframework.messaging.support.ChannelInterceptorAdapter;
import org.springframework.stereotype.Component;

@Component
public class TopicSubscriptionInterceptor extends ChannelInterceptorAdapter {

    private final DestinationAccessValidator destinationAccessValidator;

    @Autowired
    public TopicSubscriptionInterceptor(DestinationAccessValidator destinationAccessValidator) {
        this.destinationAccessValidator = destinationAccessValidator;
    }

    @Override
    public Message<?> preSend(Message<?> message, MessageChannel channel) {
        StompHeaderAccessor headerAccessor = StompHeaderAccessor.wrap(message);
        if (StompCommand.SUBSCRIBE.equals(headerAccessor.getCommand())) {
            Principal userPrincipal = headerAccessor.getUser();
            if (!destinationAccessValidator.hasAccess(userPrincipal.getName(), headerAccessor.getDestination())) {
                throw new ForbiddenSubscriptionException();
            }
        }
        return message;
    }

    private static class ForbiddenSubscriptionException extends RuntimeException {
    }
}

package org.luxons.sevenwonders.config;

import org.luxons.sevenwonders.errors.ApiMisuseException;
import org.luxons.sevenwonders.validation.DestinationAccessValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
import org.springframework.messaging.support.ChannelInterceptorAdapter;
import org.springframework.stereotype.Component;

@Component
public class TopicSubscriptionInterceptor extends ChannelInterceptorAdapter {

    private final DestinationAccessValidator destinationAccessValidator;

    @Autowired
    public TopicSubscriptionInterceptor(DestinationAccessValidator destinationAccessValidator) {
        this.destinationAccessValidator = destinationAccessValidator;
    }

    @Override
    public Message<?> preSend(Message<?> message, MessageChannel channel) {
        StompHeaderAccessor headerAccessor = StompHeaderAccessor.wrap(message);
        if (StompCommand.SUBSCRIBE.equals(headerAccessor.getCommand())) {
            String username = headerAccessor.getUser().getName();
            String destination = headerAccessor.getDestination();
            if (!destinationAccessValidator.hasAccess(username, destination)) {
                throw new ForbiddenSubscriptionException(username, destination);
            }
        }
        return message;
    }

    private static class ForbiddenSubscriptionException extends ApiMisuseException {

        ForbiddenSubscriptionException(String username, String destination) {
            super(String.format("Player '%s' is not allowed to access %s", username, destination));
        }
    }
}

Improve forbidden subscription exception message


package com.geektime.rnonesignalandroid;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

/**
 * Created by Avishay on 1/31/16.
 */
public class ReactNativeOneSignalPackage implements ReactPackage {

    RNOneSignal mRNPushNotification;

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();
        mRNPushNotification = new RNOneSignal(reactContext);

        modules.add(mRNPushNotification);
        return modules;
    }

    @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return new ArrayList<>();
    }
}

package com.geektime.rnonesignalandroid;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

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

/**
 * Created by Avishay on 1/31/16.
 */
public class ReactNativeOneSignalPackage implements ReactPackage {

    RNOneSignal mRNPushNotification;

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();
        mRNPushNotification = new RNOneSignal(reactContext);

        modules.add(mRNPushNotification);
        return modules;
    }

    // Deprecated RN 0.47
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return new ArrayList<>();
    }
}

Remove depreciated createJSModules @ovveride marker


package org.hibernate.ogm.test.simpleentity;

import org.hibernate.Session;

/**
 * @author Emmanuel Bernard
 */
public class BootstrapTest extends OgmTestCase {

	public void testBootstrap() throws Exception {
		final Session session = openSession();
		session.close();
	}

	@Override
	protected Class<?>[] getAnnotatedClasses() {
		return new Class<?>[] {
				Hypothesis.class
		};
	}
}

package org.hibernate.ogm.test.simpleentity;

import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 * @author Emmanuel Bernard
 */
public class BootstrapTest extends OgmTestCase {

	public void testBootstrap() throws Exception {
		final Session session = openSession();
		Hypothesis hyp = new Hypothesis();
		hyp.setId( "1234567890" );
		hyp.setDescription( "P != NP" );
		final Transaction transaction = session.beginTransaction();
		session.persist( hyp );
		session.flush();
		session.clear();
		final Hypothesis loadedHyp = (Hypothesis) session.get( Hypothesis.class, hyp.getId() );
		assertEquals( hyp.getDescription(), loadedHyp.getDescription() );
		transaction.rollback();
		session.close();
	}

	@Override
	protected Class<?>[] getAnnotatedClasses() {
		return new Class<?>[] {
				Hypothesis.class
		};
	}
}

Improve test to add insertion and subsequent read


package io.quarkus.it.mailer;

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

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

public class FakeMailerTestResource implements QuarkusTestResourceLifecycleManager {

    public GenericContainer<?> server = new GenericContainer<>("reachfive/fake-smtp-server:latest")
            .withExposedPorts(1080, 1025)
            .waitingFor(Wait.forHttp("/api/emails"));

    @Override
    public Map<String, String> start() {
        server.start();
        HashMap<String, String> properties = new HashMap<>();
        properties.put("quarkus.mailer.port", Integer.toString(server.getMappedPort(1025)));
        properties.put("quarkus.mailer.host", server.getContainerIpAddress());
        properties.put("fake.mailer", server.getContainerIpAddress() + ":" + server.getMappedPort(1080));
        //        properties.put("quarkus.mailer.port", Integer.toString(32787));
        //        properties.put("quarkus.mailer.host", "localhost");
        //        properties.put("fake.mailer", "localhost" + ":" + 32786);
        return properties;
    }

    @Override
    public void stop() {
        server.close();
    }
}

package io.quarkus.it.mailer;

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

import org.testcontainers.containers.FixedHostPortGenericContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;

public class FakeMailerTestResource implements QuarkusTestResourceLifecycleManager {

    public GenericContainer<?> server = new FixedHostPortGenericContainer<>("reachfive/fake-smtp-server:latest")
            .withFixedExposedPort(9155, 1080)
            .withFixedExposedPort(9156, 1025)
            .waitingFor(Wait.forHttp("/api/emails"));

    @Override
    public Map<String, String> start() {
        server.start();
        HashMap<String, String> properties = new HashMap<>();
        properties.put("quarkus.mailer.port", Integer.toString(server.getMappedPort(1025)));
        properties.put("quarkus.mailer.host", server.getContainerIpAddress());
        properties.put("fake.mailer", server.getContainerIpAddress() + ":" + server.getMappedPort(1080));
        //        properties.put("quarkus.mailer.port", Integer.toString(32787));
        //        properties.put("quarkus.mailer.host", "localhost");
        //        properties.put("fake.mailer", "localhost" + ":" + 32786);
        return properties;
    }

    @Override
    public void stop() {
        server.close();
    }
}

Use fixed port for mailer test


package org.adaptlab.chpir.android.participanttracker.validators;

/**
 * Created by mn127 on 3/3/15.
 */
public class CaregiverIdValidator extends ParticipantIdValidator {

    @Override
    public boolean validate(String value) {
        if (value.length() > 0) {
            return value.charAt(0) == 'E' && super.validate(value);
        }

        return false;
    }
}

package org.adaptlab.chpir.android.participanttracker.validators;

public class CaregiverIdValidator extends ParticipantIdValidator {

    @Override
    public boolean validate(String value) {
        if (value.length() > 0) {
            return value.charAt(0) == 'E' && super.validate(value);
        }

        return false;
    }
}

Clean up comments for caregiver id validator


/*
 * Copyright 2017 The Bazel Authors. 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.idea.blaze.terminal;

import com.google.idea.blaze.base.model.primitives.WorkspaceRoot;
import com.intellij.openapi.project.Project;
import javax.annotation.Nullable;
import org.jetbrains.plugins.terminal.LocalTerminalCustomizer;

/** Set the default terminal path to the workspace root. */
public class DefaultTerminalLocationCustomizer extends LocalTerminalCustomizer {

  @Override
  @Nullable
  protected String getDefaultFolder(Project project) {
    WorkspaceRoot root = WorkspaceRoot.fromProjectSafe(project);
    return root != null ? root.toString() : null;
  }
}

/*
 * Copyright 2017 The Bazel Authors. 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.idea.blaze.terminal;

import com.google.idea.blaze.base.model.primitives.WorkspaceRoot;
import com.intellij.openapi.project.Project;
import java.util.Map;
import javax.annotation.Nullable;
import org.jetbrains.plugins.terminal.LocalTerminalCustomizer;

/** Set the default terminal path to the workspace root. */
public class DefaultTerminalLocationCustomizer extends LocalTerminalCustomizer {

  @Override
  @Nullable
  protected String getDefaultFolder(Project project) {
    return getWorkspaceRootPath(project);
  }

  @Override
  public String[] customizeCommandAndEnvironment(
      Project project, String[] command, Map<String, String> envs) {
    String workspaceRootPath = getWorkspaceRootPath(project);
    if (workspaceRootPath != null) {
      envs.put("PWD", workspaceRootPath);
    }
    return super.customizeCommandAndEnvironment(project, command, envs);
  }

  @Nullable
  private static String getWorkspaceRootPath(Project project) {
    WorkspaceRoot root = WorkspaceRoot.fromProjectSafe(project);
    return root != null ? root.toString() : null;
  }
}

Set PWD env var when customizing Terminal plugin working directory.


package org.lagonette.app.room.statement;

public abstract class MapPartnerStatement
        extends Statement {

    // TODO Why only 87 partners returned ??
    public static final String SQL =
            "SELECT partner.id, " +
                "partner.latitude, " +
                "partner.longitude, " +
                "partner.is_exchange_office, " +
                "partner.main_category_id, " +
                "main_category.icon " +
            "FROM partner " +
            "JOIN partner_metadata " +
                "ON partner.id = partner_metadata.partner_id " +
            "JOIN category AS main_category " +
                "ON partner.main_category_id = main_category.id " +
            "JOIN category_metadata AS main_category_metadata " +
                "ON main_category.id = main_category_metadata.category_id " +
            "LEFT JOIN partner_side_category " +
                "ON partner.id = partner_side_category.partner_id " +
            "LEFT JOIN category AS side_category " +
                "ON partner_side_category.category_id = side_category.id " +
            "LEFT JOIN category_metadata AS side_category_metadata " +
                "ON side_category.id = side_category_metadata.category_id " +
            "WHERE partner.name LIKE :search " +
                "AND partner.is_localizable <> 0 " +
            "GROUP BY partner.id " +
            "HAVING partner_metadata.is_visible > 0 " +
                "AND SUM (side_category_metadata.is_visible) > 0";

}

package org.lagonette.app.room.statement;

public abstract class MapPartnerStatement
        extends Statement {

    // TODO Why only 87 partners returned ??
    public static final String SQL =
            "SELECT partner.id, " +
                "partner.latitude, " +
                "partner.longitude, " +
                "partner.is_exchange_office, " +
                "partner.main_category_id, " +
                "main_category.icon " +
            "FROM partner " +
            "JOIN partner_metadata " +
                "ON partner.id = partner_metadata.partner_id " +
            "JOIN category AS main_category " +
                "ON partner.main_category_id = main_category.id " +
            "JOIN category_metadata AS main_category_metadata " +
                "ON main_category.id = main_category_metadata.category_id " +
            "LEFT JOIN partner_side_category " +
                "ON partner.id = partner_side_category.partner_id " +
            "LEFT JOIN category AS side_category " +
                "ON partner_side_category.category_id = side_category.id " +
            "LEFT JOIN category_metadata AS side_category_metadata " +
                "ON side_category.id = side_category_metadata.category_id " +
            "WHERE partner.name LIKE :search " +
                "AND partner.is_localizable <> 0 " +
            "GROUP BY partner.id " +
            "HAVING partner_metadata.is_visible + TOTAL (side_category_metadata.is_visible) > 0";

}

Fix map partner SQL request


package org.gbif.checklistbank.ws.resources;

import java.security.Permission;

import org.gbif.ws.app.Application;
import org.junit.Test;

import static org.junit.Assert.fail;

public class WsAppTest {

  /**
   * Test the startup of the webapp.
   * We expect a SecurityException raised as the Application stops because of missing configs.
   * But no NoSuchMethodError thrown by incompatible jackson we see with a wrong version introduced by solr
   */
  @Test(expected = SecurityException.class)
  public void testWsStartup() {
    // throw exception if Application exits
    System.setSecurityManager(new NoExitSecurityManager());
    Application.main(new String[]{});
  }

  private static class NoExitSecurityManager extends SecurityManager {
    @Override
    public void checkPermission(Permission perm) {
      // allow anything.
    }
    @Override
    public void checkPermission(Permission perm, Object context) {
      // allow anything.
    }

    @Override
    public void checkExit(int status) {
      super.checkExit(status);
      throw new SecurityException("Exit status " + status + " called");
    }
  }
}

package org.gbif.checklistbank.ws.resources;

import java.security.Permission;

import org.gbif.ws.app.Application;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.fail;

public class WsAppTest {
  private SecurityManager sm;

  @Before
  public void init(){
    sm = System.getSecurityManager();
    System.setSecurityManager(new NoExitSecurityManager());
  }

  @After
  public void shutdown(){
    System.setSecurityManager(sm);
  }

  /**
   * Test the startup of the webapp.
   * We expect a ExitException raised as the Application stops because of missing configs.
   * But no NoSuchMethodError thrown by incompatible jackson we see with a wrong version introduced by solr
   */
  @Test(expected = ExitException.class)
  public void testWsStartup() {
    Application.main(new String[]{});
  }

  public static class ExitException extends RuntimeException {
    public ExitException(int status) {
      super("Exit status " + status + " called");
    }
  }

  private static class NoExitSecurityManager extends SecurityManager {
    @Override
    public void checkPermission(Permission perm) {
      // allow anything.
    }
    @Override
    public void checkPermission(Permission perm, Object context) {
      // allow anything.
    }

    @Override
    public void checkExit(int status) {
      super.checkExit(status);
      throw new ExitException(status);
    }
  }
}

Remove custom security manager after test finishes


/*
 * Copyright 2016 Erik Wramner.
 *
 * 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 name.wramner.jmstools.messages;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;

/**
 * A message provider can create JMS messages enriched with a checksum property that can be checked on the other side.
 *
 * @author Erik Wramner
 */
public interface MessageProvider {
    static final String UNIQUE_MESSAGE_ID_PROPERTY_NAME = "Unique-Message-Id";
    static final String CHECKSUM_PROPERTY_NAME = "Payload-Checksum-MD5";
    static final String LENGTH_PROPERTY_NAME = "Payload-Length";

    /**
     * Create message with checksum and length properties.
     *
     * @param session The JMS session.
     * @return message.
     * @throws JMSException on JMS errors.
     */
    Message createMessageWithPayloadAndChecksumProperty(Session session) throws JMSException;
}

/*
 * Copyright 2016 Erik Wramner.
 *
 * 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 name.wramner.jmstools.messages;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;

/**
 * A message provider can create JMS messages enriched with a checksum property that can be checked on the other side.
 * <p>
 * Note that according to the JMS standard property names must follow the same rules as Java identifiers.
 *
 * @author Erik Wramner
 */
public interface MessageProvider {
    static final String UNIQUE_MESSAGE_ID_PROPERTY_NAME = "EWJMSToolsUniqueMessageId";
    static final String CHECKSUM_PROPERTY_NAME = "EWJMSToolsPayloadChecksumMD5";
    static final String LENGTH_PROPERTY_NAME = "EWJMSToolsPayloadLength";

    /**
     * Create message with checksum and length properties.
     *
     * @param session The JMS session.
     * @return message.
     * @throws JMSException on JMS errors.
     */
    Message createMessageWithPayloadAndChecksumProperty(Session session) throws JMSException;
}

Rename property names to follow JMS standard for identifiers.


package devopsdistilled.operp.client.abstracts;

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

import devopsdistilled.operp.server.data.entity.Entiti;
import devopsdistilled.operp.server.data.service.EntityService;

public interface EntityModel<E extends Entiti, ES extends EntityService<E, ID>, EO extends EntityObserver, ID extends Serializable>
		extends Model<EO> {

	public List<E> getEntities();

	void setEntities(List<E> entities);

	public ES getService();

}

package devopsdistilled.operp.client.abstracts;

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

import devopsdistilled.operp.server.data.entity.Entiti;
import devopsdistilled.operp.server.data.service.EntityService;

public interface EntityModel<E extends Entiti, ES extends EntityService<E, ID>, EO extends EntityObserver, ID extends Serializable>
		extends Model<EO> {

	public List<E> getEntities();

	void setEntities(List<E> entities);

	public ES getService();

	public E saveAndUpdateModel(E entity);

}

Add saveAndUpdateModel() method to save entity and update the model


package io.georocket.index.xml;

import io.georocket.index.generic.BoundingBoxIndexerFactory;

/**
 * Create instances of {@link BoundingBoxIndexer}
 * @author Michel Kraemer
 */
public class XMLBoundingBoxIndexerFactory extends BoundingBoxIndexerFactory implements XMLIndexerFactory {
  @Override
  public XMLIndexer createIndexer() {
    return new BoundingBoxIndexer();
  }
}

package io.georocket.index.xml;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import io.georocket.index.generic.BoundingBoxIndexerFactory;

/**
 * Create instances of {@link BoundingBoxIndexer}
 * @author Michel Kraemer
 */
public class XMLBoundingBoxIndexerFactory extends BoundingBoxIndexerFactory
    implements XMLIndexerFactory {
  private static final String PROPERTIES_FILENAME =
    "io.georocket.index.xml.XMLBoundingBoxIndexerFactory.properties";
  private static final String BOUNDINGBOXINDEXER_CLASSNAME =
    "io.georocket.index.xml.BoundingBoxIndexer";
  private static Class<? extends BoundingBoxIndexer> configuredClass;

  static {
    loadConfig();
  }

  @SuppressWarnings("unchecked")
  private static void loadConfig() {
    try (InputStream is = XMLBoundingBoxIndexerFactory.class.getClassLoader()
        .getResourceAsStream(PROPERTIES_FILENAME)) {
      if (is != null) {
        Properties p = new Properties();
        p.load(is);
        String cls = p.getProperty(BOUNDINGBOXINDEXER_CLASSNAME);
        if (cls != null) {
          try {
            configuredClass = (Class<? extends BoundingBoxIndexer>)Class.forName(cls);
          } catch (ClassNotFoundException e) {
            throw new RuntimeException("Could not find custom "
              + "BoundingBoxIndexer class: " + cls, e);
          }
        }
      }
    } catch (IOException e) {
      // ignore
    }
  }

  @Override
  public XMLIndexer createIndexer() {
    if (configuredClass == null) {
      return new BoundingBoxIndexer();
    }
    try {
      return configuredClass.newInstance();
    } catch (ReflectiveOperationException e) {
      throw new RuntimeException("Could not create custom "
        + "BoundingBoxIndexer", e);
    }
  }
}

Add possibility to override the default BoundingBoxIndexer


/*
 * Copyright 2011 Splunk, 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.
 */

import com.splunk.Entity;

import org.openide.nodes.Children;

class EntityNode extends ExplorerNode {
    EntityNode(Entity entity) {
        super(entity);
        String name = entity.getName();
        setName(name);
        setDisplayName(name);
    }

    protected PropertyList getMetadata() {
        return new PropertyList() {{
            add(String.class, "getTitle");
        }};
    }
}

/*
 * Copyright 2011 Splunk, 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.
 */

import com.splunk.Entity;

import org.openide.nodes.Children;

class EntityNode extends ExplorerNode {
    EntityNode(Entity entity) {
        super(entity);
        setDisplayName(entity.getName());
    }

    protected PropertyList getMetadata() {
        return new PropertyList() {{
            add(String.class, "getPath");
            add(String.class, "getTitle");
        }};
    }
}

Add path property to base entity node.


package io.github.web.rest.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FilmsRestController {

    @Autowired
    private FilmsService filmsService;

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public Film getTeams(
            @RequestParam(value = "t", required = false) String title) {

        System.out.println("Incoming request for film " + title);
        Film out = filmsService.getFilmByTitle(title);
        System.out.println("Response: " + out);

        return out;
    }

}

package io.github.web.rest.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class FilmsRestController {

    @Autowired
    private FilmsService filmsService;

    @CrossOrigin
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public Film getTeams(
            @RequestParam(value = "t", required = false) String title) {

        System.out.println("Incoming request for film " + title);
        Film out = filmsService.getFilmByTitle(title);
        System.out.println("Response: " + out);

        return out;
    }

}

Enable CrossOrigin in REST service for films


/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.client.cli.fs.command;

import alluxio.client.cli.fs.AbstractFileSystemShellTest;

import org.junit.Assert;
import org.junit.Test;

/**
 * Tests for leader command.
 */
public final class LeaderCommandIntegrationTest extends AbstractFileSystemShellTest {

  @Test
  public void leader() {
    mFsShell.run("leader");
    String expected =
        mLocalAlluxioCluster.getLocalAlluxioMaster().getAddress().getHostName() + "\n";
    Assert.assertEquals(expected, mOutput.toString());
  }

  @Test
  public void leaderAddressNotAvailable() throws Exception {
    mLocalAlluxioCluster.stopMasters();
    mFsShell.run("leader");
    String expected = "The leader is not currently serving requests.\n";
    Assert.assertEquals(expected, mErrOutput.toString());
  }
}

/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.client.cli.fs.command;

import alluxio.client.cli.fs.AbstractFileSystemShellTest;

import org.junit.Assert;
import org.junit.Test;

/**
 * Tests for leader command.
 */
public final class LeaderCommandIntegrationTest extends AbstractFileSystemShellTest {

  @Test
  public void leader() {
    mFsShell.run("leader");
    String expected =
        mLocalAlluxioCluster.getLocalAlluxioMaster().getAddress().getHostName() + "\n";
    Assert.assertEquals(expected, mOutput.toString());
  }

  @Test
  public void leaderAddressNotAvailable() throws Exception {
    mLocalAlluxioCluster.stopMasters();
    mFsShell.run("leader");
    String expected = "The leader is not currently serving requests.";
    Assert.assertTrue(mErrOutput.toString().contains(expected));
  }
}

Validate only last line for leader command test


package com.ea.orbit.metrics.jvm;

import com.codahale.metrics.Gauge;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricSet;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by jefft on 9/21/2015.
 */
public class ThreadCPUUsageSet implements MetricSet
{

    private final ThreadMXBean threads;

    public ThreadCPUUsageSet()
    {
        this(ManagementFactory.getThreadMXBean());
    }

    public ThreadCPUUsageSet(ThreadMXBean threads)
    {
        this.threads = threads;
    }

    @Override
    public Map<String, Metric> getMetrics()
    {
        final Map<String, Metric> gauges = new HashMap<String, Metric>();

        ThreadInfo[] threadInfos = threads.getThreadInfo(threads.getAllThreadIds());
        for (final ThreadInfo info : threadInfos)
        {
            gauges.put("Thread." + info.getThreadName(), new Gauge<Long>()
            {
                @Override
                public Long getValue()
                {
                    return threads.getThreadCpuTime(info.getThreadId());
                }
            });
        }
        return gauges;
    }
}

package com.ea.orbit.metrics.jvm;

import com.codahale.metrics.Gauge;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricSet;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by jefft on 9/21/2015.
 */
public class ThreadCPUUsageSet implements MetricSet
{

    private final ThreadMXBean threads;

    public ThreadCPUUsageSet()
    {
        this(ManagementFactory.getThreadMXBean());
    }

    public ThreadCPUUsageSet(ThreadMXBean threads)
    {
        this.threads = threads;
    }

    @Override
    public Map<String, Metric> getMetrics()
    {
        final Map<String, Metric> gauges = new HashMap<String, Metric>();

        ThreadInfo[] threadInfos = threads.getThreadInfo(threads.getAllThreadIds());
        for (final ThreadInfo info : threadInfos)
        {
            gauges.put("Thread." + info.getThreadName() + ".cputime", new Gauge<Long>()
            {
                @Override
                public Long getValue()
                {
                    return threads.getThreadCpuTime(info.getThreadId());
                }
            });
        }
        return gauges;
    }
}

Fix Thread CPU time metric name.


package fr.liglab.adele.cream.it.entity.test;

import fr.liglab.adele.cream.testing.helpers.ContextBaseTest;

import java.util.Arrays;
import java.util.List;

/**
 * Created by aygalinc on 26/08/16.
 */
public abstract class EntityBaseCommonConfig extends ContextBaseTest {

    @Override
    protected List<String> getExtraExports() {
        return Arrays.asList(
                "fr.liglab.adele.cream.it.entity.synchronisation"
                //By convention services package are exported by the base test
        );
    }

    @Override
    public boolean deployTestBundle() {
        return true;
    }
}

package fr.liglab.adele.cream.it.entity.test;

import fr.liglab.adele.cream.testing.helpers.ContextBaseTest;

import java.util.Arrays;
import java.util.List;

/**
 * Created by aygalinc on 26/08/16.
 */
public abstract class EntityBaseCommonConfig extends ContextBaseTest {

    @Override
    protected List<String> getExtraExports() {
        if ("Linux".equalsIgnoreCase(System.getProperty("os.name"))){
            return Arrays.asList(
                    "fr.liglab.adele.cream.it.entity.synchronisation"
                    //By convention services package are exported by the base test
            );
        } else {
            return Arrays.asList(
                    "fr.liglab.adele.cream.it.entity.synchronisation",
                    "fr.liglab.adele.cream.it.entity.services"
                    //By convention services package are exported by the base test but FAILED on windows....
            );
        }

    }

    @Override
    public boolean deployTestBundle() {
        return true;
    }
}

Add extra export package due to windows


package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.PlannedActivity;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Rhett Sutphin
 */
@Transactional (readOnly=true)
public class PlannedActivityDao extends StudyCalendarMutableDomainObjectDao<PlannedActivity> {
    @Override
    public Class<PlannedActivity> domainClass() {
        return PlannedActivity.class;
    }

    @Transactional(readOnly=false)
    public void delete(PlannedActivity event) {
        getHibernateTemplate().delete(event);
    }

    public List<PlannedActivity> getPlannedActivitiesForAcivity(Integer activityId) {

        return (List<PlannedActivity>) getHibernateTemplate().find("select pa from PlannedActivity as pa where pa.activity.id=?",activityId);
    }

}

package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.PlannedActivity;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Rhett Sutphin
 */
@Transactional (readOnly=true)
public class PlannedActivityDao extends StudyCalendarMutableDomainObjectDao<PlannedActivity> {
    @Override
    public Class<PlannedActivity> domainClass() {
        return PlannedActivity.class;
    }

    /**
    * Deletes a planned activity
    *
    * @param  event the planned activity to delete
    */
    @Transactional(readOnly=false)
    public void delete(PlannedActivity event) {
        getHibernateTemplate().delete(event);
    }

    /**
    * Finds all planned activities for a activity id
    *
    * @param  activityId the activity id to search with
    * @return      a list of planned activities with the activity id passed in
    */
    public List<PlannedActivity> getPlannedActivitiesForAcivity(Integer activityId) {
        return (List<PlannedActivity>) getHibernateTemplate().find("select pa from PlannedActivity as pa where pa.activity.id=?",activityId);
    }
}

Add javadoc to planned activity dao.


package org.wikipedia.activity;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import org.wikipedia.activity.CallbackFragment.Callback;

public final class FragmentUtil {
    @Nullable public static Callback getCallback(@NonNull Fragment fragment) {
        return getCallback(fragment, Callback.class);
    }

    @Nullable public static <T extends Callback> T getCallback(@NonNull Fragment fragment,
                                                               @NonNull Class<T> callback) {
        if (callback.isInstance(fragment.getTargetFragment())) {
            //noinspection unchecked
            return (T) fragment.getTargetFragment();
        } else if (callback.isInstance(fragment.getActivity())) {
            //noinspection unchecked
            return (T) fragment.getActivity();
        } else {
            return null;
        }
    }

    private FragmentUtil() { }
}

package org.wikipedia.activity;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import org.wikipedia.activity.CallbackFragment.Callback;

public final class FragmentUtil {
    @Nullable public static Callback getCallback(@NonNull Fragment fragment) {
        return getCallback(fragment, Callback.class);
    }

    @Nullable public static <T extends Callback> T getCallback(@NonNull Fragment fragment,
                                                               @NonNull Class<T> callback) {
        if (callback.isInstance(fragment.getTargetFragment())) {
            //noinspection unchecked
            return (T) fragment.getTargetFragment();
        }
        if (callback.isInstance(fragment.getParentFragment())) {
            //noinspection unchecked
            return (T) fragment.getParentFragment();
        }
        if (callback.isInstance(fragment.getActivity())) {
            //noinspection unchecked
            return (T) fragment.getActivity();
        }
        return null;
    }

    private FragmentUtil() { }
}

Check hosting Fragment for callback


package me.wener.bbvm.vm;

import me.wener.bbvm.asm.ParseException;
import org.junit.Test;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
 * @author wener
 * @since 15/12/18
 */
public class BasmSpecTest {
    @Test
    public void in() throws IOException, ParseException {
        BasmTester test = new BasmTester();
        Files.walk(Paths.get("../bbvm-test/case/in"))
                .filter(p -> !p.toFile().isDirectory())
                .filter(p -> p.toFile().getName().endsWith(".basm"))
                .forEach(p -> test.init(p.toFile()).run());
    }
}

package me.wener.bbvm.vm;

import me.wener.bbvm.asm.ParseException;
import org.junit.Test;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
 * @author wener
 * @since 15/12/18
 */
public class BasmSpecTest {
    @Test
    public void in() throws IOException, ParseException {
        doTest("../bbvm-test/case/in");
    }

    @Test
    public void out() throws IOException, ParseException {
        doTest("../bbvm-test/case/out");
    }

    @Test
    public void file() throws IOException, ParseException {
        doTest("../bbvm-test/case/file");
    }

    @Test
    public void graph() throws IOException, ParseException {
        doTest("../bbvm-test/case/graph");
    }

    @Test
    public void basic() throws IOException, ParseException {
        doTest("../bbvm-test/case/basic");
    }

    private void doTest(String first) throws IOException {
        BasmTester test = new BasmTester();
        Files.walk(Paths.get(first))
                .filter(p -> !p.toFile().isDirectory())
                .filter(p -> p.toFile().getName().endsWith(".basm"))
                .forEach(p -> test.init(p.toFile()).run());
    }
}

Add file basic graph basm test.


package com.redhat.ceylon.compiler.java.runtime.metamodel;

import ceylon.language.meta.declaration.CallableConstructorDeclaration;

import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Ignore;
import com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor;

@Ceylon(major = 8)
@com.redhat.ceylon.compiler.java.metadata.Class
public class FreeClassWithConstructors
        extends FreeClass
        implements ceylon.language.meta.declaration.ClassWithConstructorsDeclaration {

    @Ignore
    public final static TypeDescriptor $TypeDescriptor$ = TypeDescriptor.klass(FreeClassWithConstructors.class);

    public FreeClassWithConstructors(com.redhat.ceylon.model.typechecker.model.Class declaration) {
        super(declaration);
    }

    @Override
    @Ignore
    public ceylon.language.meta.declaration.ClassWithConstructorsDeclaration$impl
    $ceylon$language$meta$declaration$ClassWithConstructorsDeclaration$impl() {
        return new ceylon.language.meta.declaration.ClassWithConstructorsDeclaration$impl(this);
    }

    @Ignore
    @Override
    public TypeDescriptor $getType$() {
        return $TypeDescriptor$;
    }

    @Override
    public CallableConstructorDeclaration getDefaultConstructor() {
        return (CallableConstructorDeclaration)getConstructorDeclaration("");
    }

}

package com.redhat.ceylon.compiler.java.runtime.metamodel;

import ceylon.language.meta.declaration.CallableConstructorDeclaration;

import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Ignore;
import com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor;

@Ceylon(major = 8)
@com.redhat.ceylon.compiler.java.metadata.Class
public class FreeClassWithConstructors
        extends FreeClass
        implements ceylon.language.meta.declaration.ClassWithConstructorsDeclaration {

    @Ignore
    public final static TypeDescriptor $TypeDescriptor$ = TypeDescriptor.klass(FreeClassWithConstructors.class);

    public FreeClassWithConstructors(com.redhat.ceylon.model.typechecker.model.Class declaration) {
        super(declaration);
    }

    //@Override
    @Ignore
    public ceylon.language.meta.declaration.ClassWithConstructorsDeclaration$impl
    $ceylon$language$meta$declaration$ClassWithConstructorsDeclaration$impl() {
        return null;//new ceylon.language.meta.declaration.ClassWithConstructorsDeclaration$impl(this);
    }

    @Ignore
    @Override
    public TypeDescriptor $getType$() {
        return $TypeDescriptor$;
    }

    @Override
    public CallableConstructorDeclaration getDefaultConstructor() {
        return (CallableConstructorDeclaration)getConstructorDeclaration("");
    }

}

Remove expression which breaks javac.


package com.graywolf336.trailingperspective.workers;

import org.bukkit.ChatColor;

import com.graywolf336.trailingperspective.TrailingPerspectiveMain;
import com.graywolf336.trailingperspective.enums.Settings;
import com.graywolf336.trailingperspective.interfaces.ITrailer;
import com.graywolf336.trailingperspective.interfaces.ITrailerWorker;

public class HomeSendingWorker implements ITrailerWorker {
    private TrailingPerspectiveMain pl;

    public HomeSendingWorker(TrailingPerspectiveMain plugin) {
        this.pl = plugin;
        this.pl.getLogger().info("HomeSendingWorker started.");
    }

    public void run() {
        if(Settings.HOME_LOCATION.asLocation() == null) return;

        for(ITrailer trailer : this.pl.getTrailerManager().getTrailers()) {
            if(trailer.isOnline() && !trailer.isCurrentlyTrailingSomeone() && !trailer.wasSentHome()) {
                trailer.getPlayer().teleport(Settings.HOME_LOCATION.asLocation());
                trailer.setWhetherTheyHaveBeenSentHome(true);

                trailer.getPlayer().sendMessage(ChatColor.AQUA + "You've been sent home as there is no one to trail currently.");
            }
        }
    }
}

package com.graywolf336.trailingperspective.workers;

import org.bukkit.ChatColor;

import com.graywolf336.trailingperspective.TrailingPerspectiveMain;
import com.graywolf336.trailingperspective.enums.Settings;
import com.graywolf336.trailingperspective.interfaces.ITrailer;
import com.graywolf336.trailingperspective.interfaces.ITrailerWorker;

public class HomeSendingWorker implements ITrailerWorker {
    private TrailingPerspectiveMain pl;

    public HomeSendingWorker(TrailingPerspectiveMain plugin) {
        this.pl = plugin;
        this.pl.getLogger().info("HomeSendingWorker started.");
    }

    public void run() {
        if(Settings.HOME_LOCATION.asLocation() == null) return;

        for(ITrailer trailer : this.pl.getTrailerManager().getTrailers()) {
            if(trailer.isOnline() && !trailer.isCurrentlyTrailingSomeone() && !trailer.wasSentHome() && this.pl.getServer().getOnlinePlayers().size() <= this.pl.getTrailerManager().getTrailers().size()) {
                trailer.getPlayer().teleport(Settings.HOME_LOCATION.asLocation());
                trailer.setWhetherTheyHaveBeenSentHome(true);

                trailer.getPlayer().sendMessage(ChatColor.AQUA + "You've been sent home as there is no one to trail currently.");
            }
        }
    }
}

Fix the home sending worker being too generic on how it sends people home


package de.plushnikov.intellij.plugin.inspection;

import com.intellij.codeInspection.InspectionProfileEntry;

public class BuilderInspectionTest extends LombokInspectionTest {

  @Override
  protected String getTestDataPath() {
    return TEST_DATA_INSPECTION_DIRECTORY + "/builder";
  }

  @Override
  protected InspectionProfileEntry getInspection() {
    return new LombokInspection();
  }

  public void testBuilderInvalidIdentifier() throws Exception {
    doTest();
  }

  public void testBuilderRightType() throws Exception {
    doTest();
  }

  public void testBuilderInvalidUse() throws Exception {
    doTest();
  }

  public void testBuilderObtainVia() throws Exception {
    doTest();
  }

  public void testBuilderDefaultsWarnings() throws Exception {
    //TODO implement test after adding support for Builder.Default
    doTest();
  }

  public void testBuilderDefaultValue() throws Exception {
    doTest();
  }
}

package de.plushnikov.intellij.plugin.inspection;

import com.intellij.codeInspection.InspectionProfileEntry;

public class BuilderInspectionTest extends LombokInspectionTest {

  @Override
  protected String getTestDataPath() {
    return TEST_DATA_INSPECTION_DIRECTORY + "/builder";
  }

  @Override
  protected InspectionProfileEntry getInspection() {
    return new LombokInspection();
  }

  public void testBuilderInvalidIdentifier() throws Exception {
    doTest();
  }

  public void testBuilderRightType() throws Exception {
    doTest();
  }

  public void testBuilderInvalidUse() throws Exception {
    doTest();
  }

  public void testBuilderObtainVia() throws Exception {
    doTest();
  }

  public void testBuilderDefaultsWarnings() throws Exception {
    doTest();
  }

  public void testBuilderDefaultValue() throws Exception {
    doTest();
  }
}

Remove todo because it is implemented now


package com.hubspot.dropwizard.guice;

import com.google.common.base.Optional;
import com.google.inject.AbstractModule;
import com.google.inject.Provider;
import com.google.inject.Provides;
import com.yammer.dropwizard.config.Configuration;
import com.yammer.dropwizard.config.Environment;

public class DropwizardEnvironmentModule<T extends Configuration> extends AbstractModule {
	private T configuration;
	private Environment environment;
	private Class<? super T> configurationClass;

	public DropwizardEnvironmentModule(Class<T> configurationClass) {
		this.configurationClass = configurationClass;
	}

	@Override
	protected void configure() {
		Provider<T> provider = new CustomConfigurationProvider();
		bind(configurationClass).toProvider(provider);
		if (configurationClass != Configuration.class) {
			bind(Configuration.class).toProvider(provider);
		}
	}

	public void setEnvironmentData(T configuration, Environment environment) {
		this.configuration = configuration;
		this.environment = environment;
	}

	@Provides
	public Environment providesEnvironment() {
		return environment;
	}

	private class CustomConfigurationProvider implements Provider<T> {
		@Override
		public T get() {
			return configuration;
		}
	}
}

package com.hubspot.dropwizard.guice;

import com.google.common.base.Optional;
import com.google.inject.AbstractModule;
import com.google.inject.CreationException;
import com.google.inject.Provider;
import com.google.inject.Provides;
import com.google.inject.spi.Message;
import com.yammer.dropwizard.config.Configuration;
import com.yammer.dropwizard.config.Environment;

import java.util.Arrays;

public class DropwizardEnvironmentModule<T extends Configuration> extends AbstractModule {
	private T configuration;
	private Environment environment;
	private Class<? super T> configurationClass;

	public DropwizardEnvironmentModule(Class<T> configurationClass) {
		this.configurationClass = configurationClass;
	}

	@Override
	protected void configure() {
		Provider<T> provider = new CustomConfigurationProvider();
		bind(configurationClass).toProvider(provider);
		if (configurationClass != Configuration.class) {
			bind(Configuration.class).toProvider(provider);
		}
	}

	public void setEnvironmentData(T configuration, Environment environment) {
		this.configuration = configuration;
		this.environment = environment;
	}

	@Provides
	public Environment providesEnvironment() {
		if (environment == null) {
			throw new CreationException(Arrays.asList(new Message("The dropwizard environment has not yet been set. This is likely caused by trying to access the dropwizard environment during the bootstrap phase.")));
		}
		return environment;
	}

	private class CustomConfigurationProvider implements Provider<T> {
		@Override
		public T get() {
			if (configuration == null) {
				throw new CreationException(Arrays.asList(new Message("The dropwizard configuration has not yet been set. This is likely caused by trying to access the dropwizard environment during the bootstrap phase.")));
			}
			return configuration;
		}
	}
}

Throw exceptions if accessing configuration/environment during bootstrap phase.


package net.floodlightcontroller.prediction;

import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;

import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;

public class TopologyGraphResource extends ServerResource {
	@Get("json")
    public String retrieve() throws FileNotFoundException, UnsupportedEncodingException {
		INetTopologyService pihr = (INetTopologyService)getContext().getAttributes().get(INetTopologyService.class.getCanonicalName());
        return pihr.getTopologyGraph("json");
    }

	@Post
	public String store(String in) {
		INetTopologyService pihr = (INetTopologyService)getContext().getAttributes().get(INetTopologyService.class.getCanonicalName());
        return pihr.getTopologyGraph(in);
	}

}

package net.floodlightcontroller.prediction;

import org.json.JSONObject;
import org.restlet.resource.Get;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;

import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;

public class TopologyGraphResource extends ServerResource {
	@Get("json")
    public String retrieve() throws FileNotFoundException, UnsupportedEncodingException {
		INetTopologyService pihr = (INetTopologyService)getContext().getAttributes().get(INetTopologyService.class.getCanonicalName());
        return pihr.getTopologyGraph("json");
    }

	@Post
	public String store(String in) {
		INetTopologyService service = (INetTopologyService)getContext().getAttributes().get(INetTopologyService.class.getCanonicalName());
		try {
			JSONObject jp = new JSONObject(in);
			String type = jp.getString("type");
			return service.getTopologyGraph(type);
		}
		catch(Exception e){
			System.out.println(e.getMessage());
			return "{ \"status\" : \"err\" }\n";
		}
	}

}

Create the POST route handler


package com.novoda.downloadmanager.lib;

public interface DownloadClientReadyChecker {
    Ready READY = new Ready();

    /**
     * Warning: This method is executed on a background thread
     */
    boolean isAllowedToDownload();

    /**
     * Ready specifies that it is always ready to download
     */
    class Ready implements DownloadClientReadyChecker {

        @Override
        public boolean isAllowedToDownload() {
            return true;
        }
    }
}

package com.novoda.downloadmanager.lib;

public interface DownloadClientReadyChecker {
    Ready READY = new Ready();

    /**
     * This method is executed on a background thread
     */
    boolean isAllowedToDownload();

    /**
     * Ready specifies that it is always ready to download
     */
    class Ready implements DownloadClientReadyChecker {

        @Override
        public boolean isAllowedToDownload() {
            return true;
        }
    }
}

Remove "warning' sentence from the Javadoc


package net.mcft.copy.betterstorage.addon.armourersworkshop;

import net.minecraft.entity.Entity;
import riskyken.armourersWorkshop.api.client.render.IEquipmentRenderHandler;
import riskyken.armourersWorkshop.api.client.render.IEquipmentRenderManager;
import riskyken.armourersWorkshop.api.common.equipment.EnumEquipmentPart;
import riskyken.armourersWorkshop.api.common.equipment.EnumEquipmentType;
import riskyken.armourersWorkshop.api.common.equipment.IEquipmentDataHandler;
import riskyken.armourersWorkshop.api.common.equipment.IEquipmentDataManager;

public class AWDataManager implements IEquipmentDataManager, IEquipmentRenderManager {

	@Override
	public void onLoad(IEquipmentDataHandler dataHandler) {
		AWAddon.dataHandler = dataHandler;
	}

	@Override
	public void onLoad(IEquipmentRenderHandler renderHandler) {
		AWAddon.renderHandler = renderHandler;
	}

	@Override
	public void onRenderEquipment(Entity entity, EnumEquipmentType armourType) {

	}

	@Override
	public void onRenderEquipmentPart(Entity entity, EnumEquipmentPart armourPart) {

	}
}

package net.mcft.copy.betterstorage.addon.armourersworkshop;

import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import riskyken.armourersWorkshop.api.client.render.IEquipmentRenderHandler;
import riskyken.armourersWorkshop.api.client.render.IEquipmentRenderManager;
import riskyken.armourersWorkshop.api.common.equipment.EnumEquipmentPart;
import riskyken.armourersWorkshop.api.common.equipment.EnumEquipmentType;
import riskyken.armourersWorkshop.api.common.equipment.IEquipmentDataHandler;
import riskyken.armourersWorkshop.api.common.equipment.IEquipmentDataManager;

import com.mojang.authlib.GameProfile;

public class AWDataManager implements IEquipmentDataManager, IEquipmentRenderManager {

	@Override
	public void onLoad(IEquipmentDataHandler dataHandler) {
		AWAddon.dataHandler = dataHandler;
	}

	@Override
	public void onLoad(IEquipmentRenderHandler renderHandler) {
		AWAddon.renderHandler = renderHandler;
	}

	@Override
	public void onRenderEquipment(Entity entity, EnumEquipmentType armourType) {  }

	@Override
	public void onRenderEquipmentPart(Entity entity, EnumEquipmentPart armourPart) {  }

	@Override
	public void onRenderMannequin(TileEntity TileEntity, GameProfile gameProfile) {  }

}

Update to new Armourer's Workshop API


package it.playfellas.superapp.logic.master;

import it.playfellas.superapp.events.EventFactory;
import it.playfellas.superapp.events.game.StartGameEvent;
import it.playfellas.superapp.logic.Config1;
import it.playfellas.superapp.network.TenBus;

/**
 * Created by affo on 31/07/15.
 */
public class Master1Controller extends MasterController {
    private Config1 conf;

    public Master1Controller(Config1 conf){
        super(conf);
        this.conf = conf;
    }

    @Override
    void onBeginStage() {

    }

    @Override
    void onEndStage() {

    }

    @Override
    void onAnswer(boolean rw) {
        if (getScore() % conf.getRuleChange() == 0) {
            TenBus.get().post(EventFactory.gameChange());
        }
    }

    @Override
    StartGameEvent getNewGameEvent() {
        return EventFactory.startGame1(conf);
    }
}

package it.playfellas.superapp.logic.master;

import it.playfellas.superapp.events.EventFactory;
import it.playfellas.superapp.events.game.StartGameEvent;
import it.playfellas.superapp.logic.Config1;
import it.playfellas.superapp.network.TenBus;

/**
 * Created by affo on 31/07/15.
 */
public class Master1Controller extends MasterController {
    private Config1 conf;

    public Master1Controller(Config1 conf){
        super(conf);
        this.conf = conf;
    }

    @Override
    void onBeginStage() {

    }

    @Override
    void onEndStage() {

    }

    @Override
    void onAnswer(boolean rw) {
        int score = getScore();
        if (score != 0 && score % conf.getRuleChange() == 0) {
            TenBus.get().post(EventFactory.gameChange());
        }
    }

    @Override
    StartGameEvent getNewGameEvent() {
        return EventFactory.startGame1(conf);
    }
}

Fix bug that led to togglegame at each error


import java.sql.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;

import com.heroku.sdk.jdbc.DatabaseUrl;

public class FG
{
	public String Id;
	public String Name;
	public Double AnnualVolume;
	public Double LaunchVolume;
	public Double MOQ1;
	public Double MOQ2;
	public Double MOQ3;
	public Double UnitPackSize;

	public String npdId;
	public NPD npd;

	public FG(ResultSet rs)
	{
		try {
			Id = rs.getString("SFID");
			Name = rs.getString("Name");
			AnnualVolume = rs.getDouble("Annual_Volume_Summary__c");
			LaunchVolume =  rs.getDouble("Launch__c");
			MOQ1 = rs.getDouble("Finished_Goods_MOQ_Max__c");
			MOQ2 = rs.getDouble("Finished_Goods_MOQ_Min__c");
			MOQ3 = rs.getDouble("Finished_Goods_MOQ_Option_3__c");
			UnitPackSize = rs.getDouble("Unit_Pack_Size__c");

			npdId = rs.getString("NPD__c");
		}
		catch (SQLException e) {}
	}

	public void linkNPD(NPD newNPD)
	{
		if(npdId == newNPD.Id)
		{
			npd = newNPD;
		}
	}
}

import java.sql.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;

import com.heroku.sdk.jdbc.DatabaseUrl;

public class FG
{
	public String Id;
	public String Name;
	public Double AnnualVolume;
	public Double LaunchVolume;
	public Double MOQ1;
	public Double MOQ2;
	public Double MOQ3;
	public Double UnitPackSize;

	public String npdId;
	public NPD npd;

	public FG(ResultSet rs)
	{
		try {
			Id = rs.getString("SFID");
			Name = rs.getString("Name");
			AnnualVolume = rs.getDouble("Annual_Volume_Summary__c");
			LaunchVolume =  rs.getDouble("Launch__c");
			MOQ1 = rs.getDouble("Finished_Goods_MOQ_Max__c");
			MOQ2 = rs.getDouble("Finished_Goods_MOQ_Min__c");
			//MOQ3 = rs.getDouble("Finished_Goods_MOQ_Option_3__c");
			UnitPackSize = rs.getDouble("Unit_Pack_Size__c");

			npdId = rs.getString("NPD__c");
		}
		catch (SQLException e) {}
	}

	public void linkNPD(NPD newNPD)
	{
		if(npdId == newNPD.Id)
		{
			npd = newNPD;
		}
	}
}

Test Query WHERE IN v0.2


package org.springframework.security.oauth2.common.util;

import java.io.*;

public class SerializationUtils {

	public static byte[] serialize(Object state) {
		ObjectOutputStream oos = null;
		try {
			ByteArrayOutputStream bos = new ByteArrayOutputStream(512);
			oos = new ObjectOutputStream(bos);
			oos.writeObject(state);
			oos.flush();
			return bos.toByteArray();
		}
		catch (IOException e) {
			throw new IllegalArgumentException(e);
		}
		finally {
			if (oos != null) {
				try {
					oos.close();
				}
				catch (IOException e) {
					// eat it
				}
			}
		}
	}

	public static <T> T deserialize(byte[] byteArray) {
		ObjectInputStream oip = null;
		try {
			oip = new ObjectInputStream(new ByteArrayInputStream(byteArray));
			@SuppressWarnings("unchecked")
			T result = (T) oip.readObject();
			return result;
		}
		catch (IOException e) {
			throw new IllegalArgumentException(e);
		}
		catch (ClassNotFoundException e) {
			throw new IllegalArgumentException(e);
		}
		finally {
			if (oip != null) {
				try {
					oip.close();
				}
				catch (IOException e) {
					// eat it
				}
			}
		}
	}

}

package org.springframework.security.oauth2.common.util;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import org.springframework.core.ConfigurableObjectInputStream;

public class SerializationUtils {

	public static byte[] serialize(Object state) {
		ObjectOutputStream oos = null;
		try {
			ByteArrayOutputStream bos = new ByteArrayOutputStream(512);
			oos = new ObjectOutputStream(bos);
			oos.writeObject(state);
			oos.flush();
			return bos.toByteArray();
		}
		catch (IOException e) {
			throw new IllegalArgumentException(e);
		}
		finally {
			if (oos != null) {
				try {
					oos.close();
				}
				catch (IOException e) {
					// eat it
				}
			}
		}
	}

	public static <T> T deserialize(byte[] byteArray) {
		ObjectInputStream oip = null;
		try {
			oip = new ConfigurableObjectInputStream(new ByteArrayInputStream(byteArray),
					Thread.currentThread().getContextClassLoader());
			@SuppressWarnings("unchecked")
			T result = (T) oip.readObject();
			return result;
		}
		catch (IOException e) {
			throw new IllegalArgumentException(e);
		}
		catch (ClassNotFoundException e) {
			throw new IllegalArgumentException(e);
		}
		finally {
			if (oip != null) {
				try {
					oip.close();
				}
				catch (IOException e) {
					// eat it
				}
			}
		}
	}

}

Use thread context class loader to load classes during deserialization


package pl.edu.icm.yadda.analysis.classification.features;

import java.util.Collection;
import java.util.Set;

/**
 * Feature vector builder (GoF factory pattern). The builder calculates
 * feature vectors for objects using a list of single feature calculators.
 *
 * @author Dominika Tkaczyk (dtkaczyk@icm.edu.pl)
 *
 * @param <S> Type of objects for whom features' values can be calculated.
 * @param <T> Type of additional context objects that can be used
 * for calculation.
 */
public interface FeatureVectorBuilder<S, T> {

    /**
     * Sets feature calculators used for building feature vectors.
     *
     * @param featureCalculators A collection of feature calculators.
     */
    void setFeatureCalculators(Collection<FeatureCalculator<S, T>> featureCalculators);

    /**
     * Returns calculated feature vector.
     *
     * @param object An object, whose feature vector is to be calculated.
     * @param context Context object
     * @return Calculated feature vector.
     */
    FeatureVector getFeatureVector(S object, T context);

    /**
     * Returns the names of features that are part of calculated feature vector.
     *
     * @return The set of feature names.
     */
    Set<String> getFeatureNames();

}

package pl.edu.icm.yadda.analysis.classification.features;

import java.util.Collection;
import java.util.Set;

/**
 * Feature vector builder (GoF factory pattern). The builder calculates
 * feature vectors for objects using a list of single feature calculators.
 *
 * @author Dominika Tkaczyk (dtkaczyk@icm.edu.pl)
 *
 * @param <X> Type of objects for whom features' values can be calculated.
 * @param <Y> Type of additional context objects that can be used
 * for calculation.
 */
public interface FeatureVectorBuilder<X, Y> {

    /**
     * Sets feature calculators used for building feature vectors.
     *
     * @param featureCalculators A collection of feature calculators.
     */
    void setFeatureCalculators(Collection<FeatureCalculator<X, Y>> featureCalculators);

    /**
     * Returns calculated feature vector.
     *
     * @param object An object, whose feature vector is to be calculated.
     * @param context Context object
     * @return Calculated feature vector.
     */
    FeatureVector getFeatureVector(X object, Y context);

    /**
     * Returns the names of features that are part of calculated feature vector.
     *
     * @return The set of feature names.
     */
    Set<String> getFeatureNames();

}

Change generic types' names to be less ambiguous (leave S,T for label class and feature vector class respectively)


/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.xcodeml.transformation;

import java.util.Map;

/**
 * Transformer interface
 *
 * Transformer stores all the transformation to be applied by a translator.
 *
 * @author clementval
 */

public interface Transformer {

  /**
   * Add a transformation in a transformation group stored in the transformer.
   * @param t The transformation to be added.
   */
  void addTransformation(Transformation t);

  /**
   * Get all transformation groups stored in this transformer.
   * @return A list of all transformation groups.
   */
  Map<Class, TransformationGroup> getGroups();

  /**
   * Get the next transformation counter value.
   * @return Transformation counter value.
   */
  int getNextTransformationCounter();
}

/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.xcodeml.transformation;

import java.util.Map;

/**
 * Transformer interface
 *
 * Transformer stores all the transformation to be applied by a translator.
 *
 * @author clementval
 */

public interface Transformer {

  /**
   * Add a transformation in a transformation group stored in the transformer.
   * @param t The transformation to be added.
   */
  void addTransformation(Transformation t);

  /**
   * Get all transformation groups stored in this transformer.
   * @return A list of all transformation groups.
   */
  Map<Class, TransformationGroup> getGroups();

  /**
   * Get the next transformation counter value.
   * @return Transformation counter value.
   */
  int getNextTransformationCounter();

  /**
   * Get the internal module cache.
   * @return Module cache.
   */
  ModuleCache getModCache();
}

Add getter for module cache


/*
 * 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.facebook.presto.hive;

import org.apache.hadoop.conf.Configuration;

import javax.inject.Inject;

import java.net.URI;

import static com.google.common.base.Preconditions.checkNotNull;

public class HiveHdfsConfiguration
        implements HdfsConfiguration
{
    @SuppressWarnings("ThreadLocalNotStaticFinal")
    private final ThreadLocal<Configuration> hadoopConfiguration = new ThreadLocal<Configuration>()
    {
        @Override
        protected Configuration initialValue()
        {
            Configuration config = new Configuration();
            updater.updateConfiguration(config);
            return config;
        }
    };

    private final HdfsConfigurationUpdater updater;

    @Inject
    public HiveHdfsConfiguration(HdfsConfigurationUpdater updater)
    {
        this.updater = checkNotNull(updater, "updater is null");
    }

    @Override
    public Configuration getConfiguration(URI uri)
    {
        // use the same configuration for everything
        return hadoopConfiguration.get();
    }
}

/*
 * 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.facebook.presto.hive;

import org.apache.hadoop.conf.Configuration;

import javax.inject.Inject;

import java.net.URI;
import java.util.Map;

import static com.google.common.base.Preconditions.checkNotNull;

public class HiveHdfsConfiguration
        implements HdfsConfiguration
{
    private static final Configuration DEFAULT_CONFIGURATION = new Configuration();

    @SuppressWarnings("ThreadLocalNotStaticFinal")
    private final ThreadLocal<Configuration> hadoopConfiguration = new ThreadLocal<Configuration>()
    {
        @Override
        protected Configuration initialValue()
        {
            Configuration config = new Configuration(false);
            for (Map.Entry<String, String> entry : DEFAULT_CONFIGURATION) {
                config.set(entry.getKey(), entry.getValue());
            }
            updater.updateConfiguration(config);
            return config;
        }
    };

    private final HdfsConfigurationUpdater updater;

    @Inject
    public HiveHdfsConfiguration(HdfsConfigurationUpdater updater)
    {
        this.updater = checkNotNull(updater, "updater is null");
    }

    @Override
    public Configuration getConfiguration(URI uri)
    {
        // use the same configuration for everything
        return hadoopConfiguration.get();
    }
}

Reduce allocation of hadoop configuration objects


package com.malpo.sliver.sample.ui.sample;

import com.malpo.sliver.sample.models.Message;

import java.util.concurrent.Callable;

import javax.inject.Inject;

import rx.Observable;
import timber.log.Timber;

class SampleInteractor implements SampleContract.Interactor {

    private String log;

    public SampleInteractor(String log) {
        this.log = log;
    }

    @Override
    public Observable<Message> sendMessageToApi(Message message) {
		Timber.d(log);
        Timber.d("Sending message!");
        return Observable.fromCallable(mockApiCall(message));
    }

    private Callable<Message> mockApiCall(Message message) {
        Timber.d("Inside callable!");
        return () -> new Message("New Message", "Woah, sick message bro");
    }
}

Fix more spacing from merge conflict


// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.configserver;

import com.yahoo.container.jdisc.HttpResponse;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Optional;

/**
 * @author valerijf
 */
public class ProxyResponse extends HttpResponse {

    private final String content;
    private final String contentType;

    public ProxyResponse(String content, String contentType, int status) {
        super(status);
        this.content = content;
        this.contentType = contentType;
    }

    @Override
    public void render(OutputStream outputStream) throws IOException {
        outputStream.write(content.getBytes(StandardCharsets.UTF_8));
    }

    @Override
    public String getContentType() {
        return Optional.ofNullable(contentType).orElseGet(super::getContentType);
    }
}

// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.configserver;

import com.yahoo.container.jdisc.HttpResponse;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Optional;

/**
 * @author valerijf
 */
public class ProxyResponse extends HttpResponse {

    private final byte[] content;
    private final String contentType;

    public ProxyResponse(byte[] content, String contentType, int status) {
        super(status);
        this.content = content;
        this.contentType = contentType;
    }

    @Override
    public void render(OutputStream outputStream) throws IOException {
        outputStream.write(content);
    }

    @Override
    public String getContentType() {
        return Optional.ofNullable(contentType).orElseGet(super::getContentType);
    }
}

Use byte array for proxy response


package com.grayben.riskExtractor.headingMarker.elector;

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

import static org.junit.Assert.*;

/**
 * Created by beng on 28/11/2015.
 */
@Ignore
public class ElectedTextListTest {

    @Before
    public void setUp() throws Exception {

    }

    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void testGetNominees() throws Exception {

    }

    @Test
    public void testGetElectees() throws Exception {

    }
}

package com.grayben.riskExtractor.headingMarker.elector;

import com.grayben.riskExtractor.headingMarker.TextCandidate;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;

import java.util.List;

import static org.junit.Assert.*;

/**
 * Created by beng on 28/11/2015.
 */
public class ElectedTextListTest {

    ElectedTextList electedTextList;

    @Mock
    protected List<String> stringListMock;

    @Mock
    protected List<TextCandidate> nomineesMock;

    @Mock
    protected List<TextCandidate> electeesMock;

    @Before
    public void setUp() throws Exception {
        electedTextList = new ElectedTextList(stringListMock, nomineesMock, electeesMock);
    }

    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void test_GetNominees_ReturnsNonNull_Always() throws Exception {
        //setup data

        //setup expectations

        //exercise
        List<TextCandidate> nominees = electedTextList.getNominees();
        //verify
        assertNotNull(nominees);
    }

    @Test
    public void test_GetNominees_ReturnsConstructedNominees_OnlyWhenNoOverwrite() throws Exception {
        //setup data
        List<TextCandidate> newNomineesMock = (List<TextCandidate>) Mockito.mock(List.class);

        //setup expectations

        //exercise
        List<TextCandidate> nomineesReturned = electedTextList.getNominees();
        electedTextList.setNominees(newNomineesMock);
        List<TextCandidate> newNomineesReturned = electedTextList.getNominees();

        //verify
        assertEquals(nomineesMock, nomineesReturned);
        assertEquals(newNomineesMock, newNomineesReturned);
        assertNotEquals(nomineesMock, newNomineesReturned);
    }

    @Test
    public void test_GetElectees_ReturnsNonNull() throws Exception {
        //setup data

        //setup expectations

        //exercise

        //verify
    }
}

Add some tests to ElectedTextList class