package de.tudresden.slr.app;

import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {

	public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
		super(configurer);
	}

	public ActionBarAdvisor createActionBarAdvisor(
			IActionBarConfigurer configurer) {
		return new ApplicationActionBarAdvisor(configurer);
	}

	public void preWindowOpen() {
		IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
		configurer.setShowCoolBar(false);
		configurer.setShowStatusLine(false);
		configurer.setTitle("SLR Toolkit");
	}

	public void postWindowOpen() {
    	IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
    	configurer.getWindow().getShell().setMaximized(true);
	}
}

package de.tudresden.slr.app;

import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
	private IActionBarConfigurer actionBarConfigurer;

	public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
		super(configurer);
	}

	public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
		this.actionBarConfigurer = configurer;
    	return new ApplicationActionBarAdvisor(configurer);
	}

	public void preWindowOpen() {
		IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
		configurer.setShowCoolBar(false);
		configurer.setShowStatusLine(false);
		configurer.setTitle("SLR Toolkit");
	}

	public void postWindowOpen() {
		hideRunMenu();
    	IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
    	configurer.getWindow().getShell().setMaximized(true);
	}

	private void hideRunMenu() {
		IMenuManager menuManager = this.actionBarConfigurer.getMenuManager();
        IContributionItem[] menuItems =  menuManager.getItems();
        for (IContributionItem item : menuItems)
        {
        	if(item.getId().equalsIgnoreCase("org.eclipse.search.menu")){
        		item.setVisible(false);
        	}

        }
    }
}

Hide Search menu contributed by org.eclipse.search


package by.bsuir.mpp.computershop.controller.exception.wrapper;

import by.bsuir.mpp.computershop.controller.exception.ControllerException;
import by.bsuir.mpp.computershop.controller.exception.ResourceNotFoundException;
import by.bsuir.mpp.computershop.utils.WrappedFunctions.Function;
import by.bsuir.mpp.computershop.utils.WrappedFunctions.VoidFunction;
import by.bsuir.mpp.computershop.service.exception.EntityNotFoundException;
import by.bsuir.mpp.computershop.service.exception.ServiceException;
import org.apache.log4j.Logger;

public class ServiceCallWrapper {
    public static <T> T wrapServiceCall(Function<T> func, Logger logger) throws ControllerException {
        T result;
        try {
            result = func.call();
        } catch (EntityNotFoundException e) {
            logger.warn(e);
            throw new ResourceNotFoundException(e);
        } catch (ServiceException e) {
            logger.warn(e);
            throw new ControllerException(e);
        }
        return result;
    }

    public static void wrapServiceCall(VoidFunction func, Logger logger) throws ControllerException {
        wrapServiceCall(() -> func, logger);
    }
}

package by.bsuir.mpp.computershop.controller.exception.wrapper;

import by.bsuir.mpp.computershop.controller.exception.ControllerException;
import by.bsuir.mpp.computershop.controller.exception.ResourceNotFoundException;
import by.bsuir.mpp.computershop.service.exception.EntityNotFoundException;
import by.bsuir.mpp.computershop.service.exception.ServiceException;
import by.bsuir.mpp.computershop.utils.WrappedFunctions.Function;
import by.bsuir.mpp.computershop.utils.WrappedFunctions.VoidFunction;
import org.apache.log4j.Logger;

public class ServiceCallWrapper {
    public static <T> T wrapServiceCall(Function<T> func, Logger logger) throws ControllerException {
        T result;
        try {
            result = func.call();
        } catch (EntityNotFoundException e) {
            logger.warn(e);
            throw new ResourceNotFoundException(e);
        } catch (ServiceException e) {
            logger.warn(e);
            throw new ControllerException(e);
        }
        return result;
    }

    public static void wrapServiceCall(VoidFunction func, Logger logger) throws ControllerException {
        wrapServiceCall(() -> {
            func.call();
            return null;
        }, logger);
    }
}

Fix error with Service Calls Wrapper


package org.codehaus.xfire.transport.http;

import org.codehaus.xfire.addressing.AddressingInHandler;
import org.codehaus.xfire.addressing.AddressingOutHandler;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.ServiceRegistry;
import org.codehaus.xfire.test.AbstractServletTest;

import com.meterware.httpunit.HttpNotFoundException;

public class XFireConfigurableServletNewTest
    extends AbstractServletTest
{
    public void testServlet()
        throws Exception
    {
        try
        {
            newClient().getResponse("http://localhost/services/");
        }
        catch(HttpNotFoundException e) {}

        ServiceRegistry reg = getXFire().getServiceRegistry();

        assertTrue(reg.hasService("Echo"));
        Service echo = reg.getService("Echo");
        assertNotNull(echo.getName());
        assertNotSame("", echo.getName().getNamespaceURI());

        assertTrue(reg.hasService("Echo1"));
        Service echo1 = reg.getService("Echo1");
        assertNotNull(echo1.getBinding(SoapHttpTransport.SOAP12_HTTP_BINDING));

        assertEquals(2, echo1.getInHandlers().size());

        assertTrue(echo1.getInHandlers().get(1) instanceof AddressingInHandler);
        assertEquals(2, echo1.getOutHandlers().size());
        assertTrue(echo1.getOutHandlers().get(1) instanceof AddressingOutHandler);

        assertEquals(2, getXFire().getInHandlers().size());
    }

    protected String getConfiguration()
    {
        return "/org/codehaus/xfire/transport/http/configurable-web.xml";
    }

}

package org.codehaus.xfire.transport.http;

import org.codehaus.xfire.addressing.AddressingInHandler;
import org.codehaus.xfire.addressing.AddressingOutHandler;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.ServiceRegistry;
import org.codehaus.xfire.test.AbstractServletTest;

import com.meterware.httpunit.HttpNotFoundException;

public class XFireConfigurableServletNewTest
    extends AbstractServletTest
{
    public void testServlet()
        throws Exception
    {
        try
        {
            newClient().getResponse("http://localhost/services/");
        }
        catch(HttpNotFoundException e) {}

        ServiceRegistry reg = getXFire().getServiceRegistry();

        assertTrue(reg.hasService("Echo"));
        Service echo = reg.getService("Echo");
        assertNotNull(echo.getName());
        assertNotSame("", echo.getName().getNamespaceURI());

        assertTrue(reg.hasService("Echo1"));
        Service echo1 = reg.getService("Echo1");
        assertNotNull(echo1.getBinding(SoapHttpTransport.SOAP12_HTTP_BINDING));

        assertEquals(3, echo1.getInHandlers().size());
        assertTrue(echo1.getInHandlers().get(2) instanceof AddressingInHandler);
        assertEquals(2, echo1.getOutHandlers().size());
        assertTrue(echo1.getOutHandlers().get(1) instanceof AddressingOutHandler);

        assertEquals(2, getXFire().getInHandlers().size());
    }

    protected String getConfiguration()
    {
        return "/org/codehaus/xfire/transport/http/configurable-web.xml";
    }

}

Fix test.We have new default handler, so handlers list size must updated.


package de.desjardins.ol3.demo.client.utils;

import ol.Collection;
import ol.OLFactory;
import ol.control.Control;

/**
 *
 * @author Tino Desjardins
 *
 */
public final class DemoUtils {

    private DemoUtils() {
        throw new AssertionError();
    }

    /**
     * Creates some default controls.
     *
     * @param controls
     */
    public static void addDefaultControls(final Collection<Control> controls) {

        controls.push(OLFactory.createFullScreen());
        controls.push(OLFactory.createZoomSlider());
        controls.push(OLFactory.createMousePosition());
        controls.push(OLFactory.createZoomToExtent());

    }

}

package de.desjardins.ol3.demo.client.utils;

import ol.Collection;
import ol.Coordinate;
import ol.OLFactory;
import ol.OLUtil;
import ol.control.Control;
import ol.geom.Polygon;

/**
 *
 * @author Tino Desjardins
 *
 */
public final class DemoUtils {

    private DemoUtils() {
        throw new AssertionError();
    }

    /**
     * Creates some default controls.
     *
     * @param controls
     */
    public static void addDefaultControls(final Collection<Control> controls) {

        controls.push(OLFactory.createFullScreen());
        controls.push(OLFactory.createZoomSlider());
        controls.push(OLFactory.createMousePosition());
        controls.push(OLFactory.createZoomToExtent());

    }

    /**
     * Creates a test polygon geometry (triangle).
     *
     * @return test polygon geometry (EPSG:3857)
     */
    public static Polygon createTestPolygon() {

    	Coordinate[][] coordinates = new Coordinate[1][4];

    	Coordinate point1 = OLFactory.createCoordinate(13.36, 52.53);
    	Coordinate point2 = OLFactory.createCoordinate(13.36, 52.51);
    	Coordinate point3 = OLFactory.createCoordinate(13.37, 52.52);
    	Coordinate point4 = OLFactory.createCoordinate(13.36, 52.53);

    	coordinates[0][0] = point1;
    	coordinates[0][1] = point2;
    	coordinates[0][2] = point3;
    	coordinates[0][3] = point4;

    	Coordinate[][] tranformedCoordinates = new Coordinate[coordinates.length][coordinates[0].length];

    	tranformedCoordinates[0] = OLUtil.transform(coordinates[0], "EPSG:4326", "EPSG:3857");
    	return OLFactory.createPolygon(tranformedCoordinates);

    }

}

Add method to create a test polygon geometry


package org.gooru.nucleus.bootstrap;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.json.JsonObject;
import org.gooru.nucleus.global.constants.EndpointsConstants;
import org.gooru.nucleus.global.utils.Runner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by ashish on 7/11/15.
 * Dummy Verticle to demonstrate the deployment for the template project
 */
public class DummyVerticle extends AbstractVerticle {

  static final Logger LOG = LoggerFactory.getLogger(DummyVerticle.class);

  @Override
  public void start() throws Exception {

    LOG.info("Dummy verticle starting...");
    LOG.info("The main configuration is {}", config().getInteger("http.port"));

    EventBus eb = vertx.eventBus();

    eb.consumer(EndpointsConstants.DUMMY_ENDPOINT, message -> {

      LOG.info("Received message: {}" + message.body());

      final JsonObject result = new JsonObject().put("Organisation", "gooru.org").put("Product", "nucleus").put("purpose", "api")
                                                .put("mission", "Honor the human right to education");

      // Now send back reply
      message.reply(result);
    });

    LOG.info("Receiver ready!");
  }

}

package org.gooru.nucleus.bootstrap;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import io.vertx.core.json.JsonObject;
import org.gooru.nucleus.global.constants.EndpointsConstants;
import org.gooru.nucleus.global.utils.Runner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by ashish on 7/11/15.
 * Dummy Verticle to demonstrate the deployment for the template project
 */
public class DummyVerticle extends AbstractVerticle {

  static final Logger LOG = LoggerFactory.getLogger(DummyVerticle.class);

  @Override
  public void start() throws Exception {

    LOG.info("Dummy verticle starting...");

    EventBus eb = vertx.eventBus();

    eb.consumer(EndpointsConstants.DUMMY_ENDPOINT, message -> {

      LOG.info("Received message: {}", message.body());

      final JsonObject result = new JsonObject().put("Organisation", "gooru.org").put("Product", "nucleus").put("purpose", "api")
                                                .put("mission", "Honor the human right to education");

      // Now send back reply
      message.reply(result);
    });

    LOG.info("Receiver ready!");
  }

}

Remove the spurious message from the logging


package edu.northwestern.bioinformatics.studycalendar.domain;

/**
 * @author Rhett Sutphin
 */
public interface Named {
    String getName();
    void setName(String name);
}

package edu.northwestern.bioinformatics.studycalendar.domain;

/**
 * @author Rhett Sutphin
 * @see edu.northwestern.bioinformatics.studycalendar.utils.NamedComparator
 */
public interface Named {
    /**
     * Get the name for this instance, either set explicitly or computed.
     * @return
     */
    String getName();

    /**
     * Set the name.  This is an optional operation; if an implementor uses a computed
     * name, it should throw {@link UnsupportedOperationException}.
     * @param name
     */
    void setName(String name);
}

Add javadoc, particularly for the fact that the setName operation is optional


/*
 * Copyright 2018 EPAM Systems
 *
 * 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.epam.ta.reportportal.dao;

import com.epam.ta.reportportal.entity.attachment.Attachment;

import java.util.stream.Stream;

/**
 * @author Ivan Budayeu
 */
public interface AttachmentRepository extends ReportPortalRepository<Attachment, Long> {

	Stream<Attachment> findAllByProjectIdIsNull();

	Stream<Attachment> findAllByLaunchIdIsNull();

	Stream<Attachment> findAllByItemIdIsNull();

}

/*
 * Copyright 2018 EPAM Systems
 *
 * 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.epam.ta.reportportal.dao;

import com.epam.ta.reportportal.entity.attachment.Attachment;

import java.util.stream.Stream;

/**
 * @author Ivan Budayeu
 */
public interface AttachmentRepository extends ReportPortalRepository<Attachment, Long> {

	Stream<Attachment> findAllByProjectIdIsNull();

	Stream<Attachment> findAllByLaunchIdIsNull();

	Stream<Attachment> findAllByItemIdIsNull();

	void deleteAllByIdIsNull();

}

Delete all Jpa method impl


package com.github.kratorius.cuckoohash;

import junit.framework.TestCase;
import org.junit.Before;

import java.util.Map;

public class CuckooHashMapTest extends TestCase {
  private CuckooHashMap<Character, Boolean> mCB;

  @Before
  public void setUp() {
    mCB = new CuckooHashMap<>();
  }

  public void testContainsKey() {
    try {
      mCB.containsKey(null);
      fail("accepted null key");
    } catch (NullPointerException e) {
      // Expected.
    }

    mCB.put('A', true);
    mCB.put('B', true);
    mCB.put('C', true);

    assertTrue(mCB.containsKey('A'));
    assertTrue(mCB.containsKey('B'));
    assertTrue(mCB.containsKey('C'));
    assertFalse(mCB.containsKey('D'));
  }
}

package com.github.kratorius.cuckoohash;

import junit.framework.TestCase;
import org.junit.Before;

public class CuckooHashMapTest extends TestCase {
  private CuckooHashMap<Character, Boolean> mCB;

  @Before
  public void setUp() {
    mCB = new CuckooHashMap<>();
  }

  public void testPut() {
    assertTrue(mCB.isEmpty());
    mCB.put('A', true);
    mCB.put('B', false);
    assertFalse(mCB.isEmpty());

    assertEquals(true, (boolean) mCB.get('A'));
    assertEquals(false, (boolean) mCB.get('B'));
    assertNull(mCB.get('C'));
  }

  public void testGet() {
    assertTrue(mCB.isEmpty());
    assertNull(mCB.get('A'));

    mCB.put('A', true);
    assertEquals(true, (boolean) mCB.get('A'));
    assertFalse(mCB.isEmpty());
  }

  public void testRemove() {
    assertTrue(mCB.isEmpty());

    // Should never fail if the key didn't exist.
    assertNull(mCB.remove('A'));
    assertNull(mCB.remove('B'));
    assertNull(mCB.remove('C'));

    mCB.put('A', true);
    mCB.put('B', false);
    assertEquals(2, mCB.size());

    assertEquals(false, (boolean) mCB.remove('B'));
    assertEquals(1, mCB.size());
    assertNull(mCB.get('B'));

    assertEquals(true, (boolean) mCB.remove('A'));
    assertEquals(0, mCB.size());
    assertNull(mCB.get('A'));
  }

  public void testContainsKey() {
    try {
      mCB.containsKey(null);
      fail("accepted null key");
    } catch (NullPointerException e) {
      // Expected.
    }

    mCB.put('A', true);
    mCB.put('B', true);
    mCB.put('C', true);

    assertTrue(mCB.containsKey('A'));
    assertTrue(mCB.containsKey('B'));
    assertTrue(mCB.containsKey('C'));
    assertFalse(mCB.containsKey('D'));
  }
}

Add tests for put, get and remove


package com.ibm.mobilefirstplatform.clientsdk.android.app;

import android.app.Application;
import android.test.ApplicationTestCase;

import com.ibm.mobilefirst.clientsdk.android.push.api.IBMPush;
import com.ibm.mobilefirst.clientsdk.android.push.api.IBMPushException;
import com.ibm.mobilefirst.clientsdk.android.push.api.IBMPushResponseListener;

/**
 * Testing Fundamentals
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }

    public static void main(String[] args){
        IBMPush push = IBMPush.initializeService();

        push.register("sampleAlias", "sampleConsumerId", new IBMPushResponseListener<String>() {

            @Override
            public void onSuccess(String o) {
                System.out.println("Success response in testApp is: " + o);
            }

            @Override
            public void onFailure(IBMPushException e) {
                System.out.println("Failure response in testApp is: " + e.getMessage());

            }
        });
    }
}

package com.ibm.mobilefirstplatform.clientsdk.android.app;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
 * Testing Fundamentals
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }
}

Fix test java file references.


/*
 * Copyright 2017, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package io.spine.server.integration;

import com.google.common.base.Optional;
import io.spine.core.MessageInvalid;
import io.spine.server.bus.EnvelopeValidator;

/**
 * A validator of the incoming external messages to use in {@code IntegrationBus}.
 */
enum ExternalMessageValidator implements EnvelopeValidator<ExternalMessageEnvelope> {
    INSTANCE;

    @Override
    public Optional<MessageInvalid> validate(ExternalMessageEnvelope envelope) {
        return Optional.absent();
    }
}

/*
 * Copyright 2017, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package io.spine.server.integration;

import com.google.common.base.Optional;
import io.spine.core.MessageInvalid;
import io.spine.server.bus.EnvelopeValidator;

/**
 * A validator of the incoming external messages to use in {@code IntegrationBus}.
 *
 * @author Alex Tymchenko
 */
enum ExternalMessageValidator implements EnvelopeValidator<ExternalMessageEnvelope> {
    INSTANCE;

    @Override
    public Optional<MessageInvalid> validate(ExternalMessageEnvelope envelope) {
        return Optional.absent();
    }
}

Add a missing `@author` tag.


/*
 * Copyright 2015 John Scattergood
 *
 * 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 weatherAlarm.events;

import weatherAlarm.model.WeatherAlarm;

import java.time.Instant;

/**
 * @author John Scattergood 1/4/2015
 */
public class NotificationSentEvent implements IModuleEvent {
    private WeatherAlarm alarm;
    private Instant eventTime;

    public NotificationSentEvent(WeatherAlarm alarm, Instant eventTime) {
        this.alarm = alarm;
        this.eventTime = eventTime;
    }

    public WeatherAlarm getAlarm() {
        return alarm;
    }

    public Instant getEventTime() {
        return eventTime;
    }
}

/*
 * Copyright 2015 John Scattergood
 *
 * 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 weatherAlarm.events;

import weatherAlarm.model.WeatherAlarm;

import java.time.Instant;

/**
 * @author John Scattergood 1/4/2015
 */
public class NotificationSentEvent implements IModuleEvent {
    private WeatherAlarm alarm;
    private Instant eventTime;

    public NotificationSentEvent(WeatherAlarm alarm, Instant eventTime) {
        this.alarm = alarm;
        this.eventTime = eventTime;
    }

    public WeatherAlarm getAlarm() {
        return alarm;
    }

    public Instant getEventTime() {
        return eventTime;
    }

    @Override
    public String toString() {
        return "NotificationSentEvent[" +
                "alarm=" + alarm +
                ", eventTime=" + eventTime +
                ']';
    }
}

Use the FilterNoMatchEvent to reset the notification mechanism


package info.bitrich.xchangestream.bitfinex.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.knowm.xchange.bitfinex.v1.dto.marketdata.BitfinexTrade;

import java.math.BigDecimal;

/**
 * Created by Lukas Zaoralek on 7.11.17.
 */
@JsonFormat(shape = JsonFormat.Shape.ARRAY)
public class BitfinexWebSocketTrade {
    public long tradeId;
    public long timestamp;
    public BigDecimal amount;
    public BigDecimal price;

    public BitfinexWebSocketTrade() {
    }

    public BitfinexWebSocketTrade(long tradeId, long timestamp, BigDecimal amount, BigDecimal price) {
        this.tradeId = tradeId;
        this.timestamp = timestamp;
        this.amount = amount;
        this.price = price;
    }

    public long getTradeId() {
        return tradeId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public BitfinexTrade toBitfinexTrade() {
        String type;
        if (amount.compareTo(BigDecimal.ZERO) < 0) {
            type = "sell";
        } else {
            type = "buy";
        }

        return new BitfinexTrade(price, amount, timestamp / 1000, "bitfinex", tradeId, type);
    }
}

package info.bitrich.xchangestream.bitfinex.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.knowm.xchange.bitfinex.v1.dto.marketdata.BitfinexTrade;

import java.math.BigDecimal;

/**
 * Created by Lukas Zaoralek on 7.11.17.
 */
@JsonFormat(shape = JsonFormat.Shape.ARRAY)
public class BitfinexWebSocketTrade {
    public long tradeId;
    public long timestamp;
    public BigDecimal amount;
    public BigDecimal price;

    public BitfinexWebSocketTrade() {
    }

    public BitfinexWebSocketTrade(long tradeId, long timestamp, BigDecimal amount, BigDecimal price) {
        this.tradeId = tradeId;
        this.timestamp = timestamp;
        this.amount = amount;
        this.price = price;
    }

    public long getTradeId() {
        return tradeId;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public BitfinexTrade toBitfinexTrade() {
        String type;
        if (amount.compareTo(BigDecimal.ZERO) < 0) {
            type = "sell";
        } else {
            type = "buy";
        }
        return new BitfinexTrade(price, amount.abs(), timestamp / 1000, "bitfinex", tradeId, type);
    }
}

Fix trade signs on Bitfinex * Trades from all other exchanges are presented with positive amounts (with the trade type indicating direction). On Bitfinex, sells were arriving negative and buys positive.


package au.gov.ga.geodesy.support.mapper.dozer.populator;

import au.gov.ga.geodesy.support.utils.GMLGmlTools;
import au.gov.ga.geodesy.support.utils.GMLMiscTools;
import au.gov.xml.icsm.geodesyml.v_0_3.SiteIdentificationType;

/**
 * The translate simply copied the Countries (in Sopac Sitelog XML) across to the GeoesyML CountryCode elements.
 * This cleans those up by converting to the actual CountryCodes.
 *
 * @author brookes
 *
 */
public class SiteIdentificationTypePopulator extends GeodesyMLElementPopulator<SiteIdentificationType> {
    /**
     * Consider all required elements for this type and add any missing ones with default values.
     *
     * @param gnssReceiverType
     */
    void checkAllRequiredElementsPopulated(SiteIdentificationType sensorType) {
        checkElementPopulated(sensorType, "cdpNumber", GMLMiscTools.getEmptyString());
        checkElementPopulated(sensorType, "iersDOMESNumber", GMLMiscTools.getEmptyString());
    }
}

package au.gov.ga.geodesy.support.mapper.dozer.populator;

import au.gov.ga.geodesy.support.utils.GMLMiscTools;
import au.gov.xml.icsm.geodesyml.v_0_3.SiteIdentificationType;

/**
 * The translate simply copied the Countries (in Sopac Sitelog XML) across to the GeoesyML CountryCode elements.
 * This cleans those up by converting to the actual CountryCodes.
 *
 * @author brookes
 *
 */
public class SiteIdentificationTypePopulator extends GeodesyMLElementPopulator<SiteIdentificationType> {
    /**
     * Consider all required elements for this type and add any missing ones with default values.
     *
     * @param gnssReceiverType
     */
    void checkAllRequiredElementsPopulated(SiteIdentificationType sensorType) {
        checkElementPopulated(sensorType, "siteName", GMLMiscTools.getEmptyString());
        checkElementPopulated(sensorType, "cdpNumber", GMLMiscTools.getEmptyString());
        checkElementPopulated(sensorType, "iersDOMESNumber", GMLMiscTools.getEmptyString());
    }
}

Fix missing required elements in SiteIdentification


package fr.insee.pogues.config.auth.security;

import fr.insee.pogues.config.auth.UserProvider;
import fr.insee.pogues.config.auth.user.User;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
@ConditionalOnExpression("!'OIDC'.equals(@environment.getProperty('fr.insee.pogues.authentication'))")
public class DefaultSecurityContext extends WebSecurityConfigurerAdapter{

	@Override
	protected void configure(HttpSecurity http) throws Exception {
		http.csrf().disable();
		http.authorizeRequests().anyRequest().permitAll();
//		if (Config.REQUIRES_SSL) {
//			http.antMatcher("/**").requiresChannel().anyRequest().requiresSecure();
//		}
	}

	@Bean
	public UserProvider getUserProvider() {
		return auth->new User();
	}

}

package fr.insee.pogues.config.auth.security;

import fr.insee.pogues.config.auth.UserProvider;
import fr.insee.pogues.config.auth.user.User;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
@ConditionalOnExpression("!'OIDC'.equals('${fr.insee.pogues.authentication}')")
public class DefaultSecurityContext extends WebSecurityConfigurerAdapter{

	@Override
	protected void configure(HttpSecurity http) throws Exception {
		http.csrf().disable();
		http.authorizeRequests().anyRequest().permitAll();
//		if (Config.REQUIRES_SSL) {
//			http.antMatcher("/**").requiresChannel().anyRequest().requiresSecure();
//		}
	}

	@Bean
	public UserProvider getUserProvider() {
		return auth->new User();
	}

}

Use placeholder in SpEL for @ConditionaleOnExpression


package com.thecoffeine.auth.controllers;

import com.thecoffeine.auth.view.form.RegistrationForm;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * Security Controller.
 *
 * @version 1.0
 */
@Controller
public class SecurityController {

    /**
     * Display LogIn form.
     *
     * @param request   HTTP request.
     * @param model     View's model.
     *
     * @return View name.
     */
    @RequestMapping( value = "/login" )
    public String login( HttpServletRequest request, Model model ) {
        //- Set params for view -//
        model.addAttribute( "_csrf", request.getAttribute( "_csrf" ) );
        model.addAttribute( "error", request.getParameterMap().containsKey( "error" ) );

        return "login";
    }

    /**
     * Handle Sign Up.
     *
     * @param request HTTP request.
     *
     * @return View name.
     */
    @RequestMapping(method = RequestMethod.POST)
    public String signUp(
        @RequestBody
        RegistrationForm form,

        HttpServletRequest request
    ) {
        return "sign-up.success";
    }
}

package com.thecoffeine.auth.controllers;

import com.thecoffeine.auth.view.form.RegistrationForm;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * Security Controller.
 *
 * @version 1.0
 */
@Controller
public class SecurityController {

    /**
     * Display LogIn form.
     *
     * @param request   HTTP request.
     * @param model     View's model.
     *
     * @return View name.
     */
    @RequestMapping( value = "/login" )
    public String login( HttpServletRequest request, Model model ) {
        //- Set params for view -//
        model.addAttribute( "_csrf", request.getAttribute( "_csrf" ) );
        model.addAttribute( "error", request.getParameterMap().containsKey( "error" ) );

        return "login";
    }

    /**
     * Handle Sign Up.
     *
     * @param request HTTP request.
     *
     * @return View name.
     */
    @RequestMapping(value = "/signup", method = RequestMethod.POST)
    public String signUp(
        @RequestBody
        RegistrationForm form,

        HttpServletRequest request
    ) {
        return "sign-up.success";
    }
}

Add resource name for sign up.


/**
 * @author David Manouchehri
 *         Created on 6/17/15 at 6:56 PM.
 *         All content is under the MIT License unless otherwise specified.
 *         See LICENSE.txt for details.
 */

import java.util.Scanner;

public class ExpectedSalary {
    public static void main(String[] args) {
        Scanner userInput = new Scanner(System.in);

        final int baseBSc = 28000;
        final int expBSc = 6000;

        final int baseMSc = 35000;
        final int expMSc = 5000;

        final int basePhD = 45000;
        final int expPhD = 15000;

        String degrees[] = {"BSc", "MSc", "PhD"};

        /* Collect all the user input. */
        String userInputs = "";
        for(; userInput.hasNext();) {
            String input = userInput.next();
            if(input.equalsIgnoreCase("done"))
                break;
            userInputs += input;
        }

        Scanner scanner = new Scanner(userInputs);
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            System.out.println(line);
        }
        scanner.close();
    }
}

/**
 * @author David Manouchehri
 *         Created on 6/17/15 at 6:56 PM.
 *         All content is under the MIT License unless otherwise specified.
 *         See LICENSE.txt for details.
 */

import java.util.Scanner;

public class ExpectedSalary {
    public static void main(String[] args) {
        Scanner userInput = new Scanner(System.in);

        final int baseBSc = 28000;
        final int expBSc = 6000;

        final int baseMSc = 35000;
        final int expMSc = 5000;

        final int basePhD = 45000;
        final int expPhD = 15000;

        String degrees[] = {"BSc", "MSc", "PhD"};

        /* Collect all the user input. */
        String userInputs = "";
        for(; userInput.hasNext();) {
            String input = userInput.next();
            if(input.equalsIgnoreCase("done"))
                break;
            userInputs += input + "\n";
        }

        Scanner scanner = new Scanner(userInputs);
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            System.out.println(line);
        }
        scanner.close();
    }
}

Add a new line for each line of user input.


package com.thoughtworks.xstream.core;

import com.thoughtworks.acceptance.AbstractAcceptanceTest;
import com.thoughtworks.xstream.XStream;

public class TreeMarshallerTest extends AbstractAcceptanceTest {

    class Thing {
        Thing thing;
    }

    protected void setUp() throws Exception {
        super.setUp();
        xstream.setMode(XStream.NO_REFERENCES);
    }

    public void testThrowsExceptionWhenDetectingCircularReferences() {
        Thing a = new Thing();
        Thing b = new Thing();
        a.thing = b;
        b.thing = a;

        try {
            xstream.toXML(a);
            fail("expected exception");
        } catch (TreeMarshaller.CircularReferenceException expected) {
            // good
        }
    }
}

package com.thoughtworks.xstream.core;

import com.thoughtworks.acceptance.AbstractAcceptanceTest;
import com.thoughtworks.xstream.XStream;

public class TreeMarshallerTest extends AbstractAcceptanceTest {

    static class Thing {
        Thing thing;
    }

    protected void setUp() throws Exception {
        super.setUp();
        xstream.setMode(XStream.NO_REFERENCES);
    }

    public void testThrowsExceptionWhenDetectingCircularReferences() {
        Thing a = new Thing();
        Thing b = new Thing();
        a.thing = b;
        b.thing = a;

        try {
            xstream.toXML(a);
            fail("expected exception");
        } catch (TreeMarshaller.CircularReferenceException expected) {
            // good
        }
    }
}

Fix unit test for JDK 1.3.


package com.facebook.react.fabric;

public interface FabricBinding {

  void installFabric(Object jsContext, FabricUIManagerModule fabricModule);

}

package com.facebook.react.fabric;

import com.facebook.react.bridge.JavaScriptContextHolder;

public interface FabricBinding {

  void installFabric(JavaScriptContextHolder jsContext, FabricUIManagerModule fabricModule);

}

Extend installFabric method to access UIFabricModule from C++


package io.refectoring.cache.embedded;

import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import io.refectoring.cache.embedded.rest.Car;
import org.springframework.stereotype.Component;

@Component
public class HazelcastNode {

    public static final String CARS = "cars";
    private final HazelcastInstance hzInstance = Hazelcast.newHazelcastInstance(createConfig());

    public String put(String number, Car car){
        IMap<Object, Object> map = hzInstance.getMap(CARS);
        return (String) map.put(number, car);
    }

    public Car get(String key){
        IMap<Object, Object> map = hzInstance.getMap(CARS);
        return (Car) map.get(key);
    }

    public Config createConfig() {
        Config config = new Config();
        MapConfig mapConfig = new MapConfig(CARS);
        mapConfig.setTimeToLiveSeconds(20);
        mapConfig.setMaxIdleSeconds(360);
        config.addMapConfig(mapConfig);
        return config;
    }
}

package io.refectoring.cache.embedded;

import com.hazelcast.config.*;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import io.refectoring.cache.embedded.rest.Car;
import org.springframework.stereotype.Component;

@Component
public class HazelcastNode {

    public static final String CARS = "cars";
    private final HazelcastInstance hzInstance = Hazelcast.newHazelcastInstance(createConfig());

    public String put(String number, Car car){
        IMap<Object, Object> map = hzInstance.getMap(CARS);
        return (String) map.putIfAbsent(number, car);
    }

    public Car get(String key){
        IMap<Object, Object> map = hzInstance.getMap(CARS);
        return (Car) map.get(key);
    }

    public Config createConfig() {
        Config config = new Config();
        config.addMapConfig(mapConfig());
        return config;
    }

    private MapConfig mapConfig() {
        MapConfig mapConfig = new MapConfig(CARS);
        mapConfig.setEvictionConfig(evictionConfig());
        mapConfig.setTimeToLiveSeconds(20);
        mapConfig.setMaxIdleSeconds(360);
        return mapConfig;
    }

    private EvictionConfig evictionConfig() {
        EvictionConfig evictionConfig = new EvictionConfig();
        evictionConfig.setEvictionPolicy(EvictionPolicy.LFU);
        evictionConfig.setSize(2000);
        return evictionConfig;
    }
}

Add eviction configuration for the Map.


package org.xcolab.client.activities.enums;

import java.util.Arrays;

public enum ActivityCategory {

    MEMBER(ContestActivityType.values()),
    DISCUSSION(DiscussionActivityType.values()),
    PROPOSAL(ProposalActivityType.values()),
    CONTEST(ContestActivityType.values());

    private final ActivityType[] activityTypes;

    ActivityCategory(ActivityType[] activityTypes) {
        this.activityTypes = activityTypes;
    }

    public ActivityType getActivityType(String activityType) {
        return Arrays.stream(activityTypes)
                .filter(s -> s.name().equalsIgnoreCase(activityType))
                .findAny()
                .orElseThrow(() -> new IllegalArgumentException(
                        "No enum constant " + name() + "." + activityType));
    }
}

package org.xcolab.client.activities.enums;

import java.util.Arrays;

public enum ActivityCategory {

    MEMBER(MemberActivityType.values()),
    DISCUSSION(DiscussionActivityType.values()),
    PROPOSAL(ProposalActivityType.values()),
    CONTEST(ContestActivityType.values());

    private final ActivityType[] activityTypes;

    ActivityCategory(ActivityType[] activityTypes) {
        this.activityTypes = activityTypes;
    }

    public ActivityType getActivityType(String activityType) {
        return Arrays.stream(activityTypes)
                .filter(s -> s.name().equalsIgnoreCase(activityType))
                .findAny()
                .orElseThrow(() -> new IllegalArgumentException(
                        "No enum constant " + name() + "." + activityType));
    }
}

Fix class for member activities


/*
 * Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.oomph.setup.internal.installer;

import org.eclipse.oomph.ui.AbstractOomphUIPlugin;

import org.eclipse.emf.common.ui.EclipseUIPlugin;
import org.eclipse.emf.common.util.ResourceLocator;

import org.osgi.framework.BundleContext;

/**
 * @author Eike Stepper
 */
public final class SetupInstallerPlugin extends AbstractOomphUIPlugin
{
  public static final SetupInstallerPlugin INSTANCE = new SetupInstallerPlugin();

  private static Implementation plugin;

  public SetupInstallerPlugin()
  {
    super(new ResourceLocator[] {});
  }

  @Override
  public ResourceLocator getPluginResourceLocator()
  {
    return plugin;
  }

  /**
   * @author Eike Stepper
   */
  public static class Implementation extends EclipseUIPlugin
  {
    public Implementation()
    {
      plugin = this;
    }

    @Override
    public void start(BundleContext context) throws Exception
    {
      super.start(context);
    }
  }
}

/*
 * Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.oomph.setup.internal.installer;

import org.eclipse.oomph.setup.ui.SetupUIPlugin;
import org.eclipse.oomph.ui.AbstractOomphUIPlugin;

import org.eclipse.emf.common.ui.EclipseUIPlugin;
import org.eclipse.emf.common.util.ResourceLocator;

import org.osgi.framework.BundleContext;

/**
 * @author Eike Stepper
 */
public final class SetupInstallerPlugin extends AbstractOomphUIPlugin
{
  public static final SetupInstallerPlugin INSTANCE = new SetupInstallerPlugin();

  private static Implementation plugin;

  public SetupInstallerPlugin()
  {
    super(new ResourceLocator[] { SetupUIPlugin.INSTANCE });
  }

  @Override
  public ResourceLocator getPluginResourceLocator()
  {
    return plugin;
  }

  /**
   * @author Eike Stepper
   */
  public static class Implementation extends EclipseUIPlugin
  {
    public Implementation()
    {
      plugin = this;
    }

    @Override
    public void start(BundleContext context) throws Exception
    {
      super.start(context);
    }
  }
}

Fix resource delegation in installer (icons were missing)


/*****************************************************************************
 * Copyright (c) PicoContainer Organization. All rights reserved.            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *                                                                           *
 * Original code by Joerg Schaible                                           *
 *****************************************************************************/

package org.picocontainer.gems.adapters;

import org.picocontainer.defaults.ObjectReference;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

/**
 * An {@link org.picocontainer.defaults.ObjectReference} based on a {@link ThreadLocal}.
 *
 * @author Jörg Schaible
 */
public class ThreadLocalReference extends ThreadLocal implements ObjectReference, Serializable {

    private static final long serialVersionUID = 1L;

    private void writeObject(final ObjectOutputStream out) {
        if(out != null); // eliminate warning because of unused parameter
    }

    private void readObject(final ObjectInputStream in) {
        if(in != null); // eliminate warning because of unused parameter
    }
}

/*****************************************************************************
 * Copyright (c) PicoContainer Organization. All rights reserved.            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *                                                                           *
 * Original code by Joerg Schaible                                           *
 *****************************************************************************/

package org.picocontainer.gems.adapters;

import java.io.Serializable;

import org.picocontainer.defaults.ObjectReference;

/**
 * An {@link org.picocontainer.defaults.ObjectReference} based on a {@link ThreadLocal}.
 *
 * @author Jörg Schaible
 */
public class ThreadLocalReference extends ThreadLocal implements ObjectReference, Serializable {

    private static final long serialVersionUID = 1L;

    private static class Marker implements Serializable {
        private static final long serialVersionUID = 1L;
        private static final Marker INSTANCE = new Marker();

        private Object readResolve() {
            return new ThreadLocalReference();
        }
    }

    private Object writeReplace() {
        return Marker.INSTANCE;
    }
}

Fix serialization issue with XStream 1.2.x.


package com.ulisesbocchio.jasyptspringboot.wrapper;

import com.ulisesbocchio.jasyptspringboot.EncryptablePropertyResolver;
import com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource;

import org.jasypt.encryption.StringEncryptor;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.util.Assert;

import java.util.Map;

/**
 * @author Ulises Bocchio
 */
public class EncryptableMapPropertySourceWrapper extends MapPropertySource implements EncryptablePropertySource<Map<String, Object>> {
    EncryptablePropertyResolver resolver;
    private MapPropertySource delegate;

    public EncryptableMapPropertySourceWrapper(MapPropertySource delegate, EncryptablePropertyResolver resolver) {
        super(delegate.getName(), delegate.getSource());
        Assert.notNull(delegate, "PropertySource delegate cannot be null");
        Assert.notNull(resolver, "EncryptablePropertyResolver cannot be null");
        this.resolver = resolver;
        this.delegate = delegate;
    }

    @Override
    public Object getProperty(String name) {
        return getProperty(resolver, delegate, name);
    }

    @Override
    public PropertySource<Map<String, Object>> getDelegate() {
        return delegate;
    }
}

package com.ulisesbocchio.jasyptspringboot.wrapper;

import com.ulisesbocchio.jasyptspringboot.EncryptablePropertyResolver;
import com.ulisesbocchio.jasyptspringboot.EncryptablePropertySource;

import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.util.Assert;

import java.util.Map;

/**
 * @author Ulises Bocchio
 */
public class EncryptableMapPropertySourceWrapper extends MapPropertySource implements EncryptablePropertySource<Map<String, Object>> {
    EncryptablePropertyResolver resolver;
    private MapPropertySource delegate;

    public EncryptableMapPropertySourceWrapper(MapPropertySource delegate, EncryptablePropertyResolver resolver) {
        super(delegate.getName(), delegate.getSource());
        Assert.notNull(delegate, "PropertySource delegate cannot be null");
        Assert.notNull(resolver, "EncryptablePropertyResolver cannot be null");
        this.resolver = resolver;
        this.delegate = delegate;
    }

    @Override
    public Object getProperty(String name) {
        return getProperty(resolver, delegate, name);
    }

    @Override
    public PropertySource<Map<String, Object>> getDelegate() {
        return delegate;
    }

    @Override
    public boolean containsProperty(String name) {
       return delegate.containsProperty(name);
    }

    @Override
    public String[] getPropertyNames() {
       return delegate.getPropertyNames();
    }
}

Fix containsProperty and getPropertyNames on MapPropertySources


/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2019 Vladimir
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.devproserv.courses.model;

/**
 * Deals with lecturers.
 *
 * @since 0.5.0
 */
public final class NestLecturers implements Nest {
    @Override
    public Responsible makeUser() {
        return null;
    }
}

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2019 Vladimir
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.devproserv.courses.model;

/**
 * Deals with lecturers.
 *
 * @since 0.5.0
 */
public final class NestLecturers implements Nest {
    @Override
    public Responsible makeUser() {
        return new Lecturer(new User(-1, "no login", "no pass"), "no degree");
    }
}

Fix null in lecturer account


package fr.free.nrw.commons.auth;

import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.webkit.WebView;

import fr.free.nrw.commons.R;

public class SignupActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d("SignupActivity", "Signup Activity started");

        WebView webView = new WebView(this);
        setContentView(webView);
        //myWebView.loadUrl("https://commons.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page");

        //Mobile page, looks better than the above
        webView.loadUrl("https://commons.m.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes");

        //After Create Account button is pressed within WebView, it brings user to https://commons.wikimedia.org/wiki/Main_Page. So can we just override that URL?
        //Do we NEED to enable JS? Validation seems to work fine here
    }

}

package fr.free.nrw.commons.auth;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import fr.free.nrw.commons.R;

public class SignupActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d("SignupActivity", "Signup Activity started");

        WebView webView = new WebView(this);
        setContentView(webView);

        webView.setWebViewClient(new MyWebViewClient());
        //myWebView.loadUrl("https://commons.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page");
        //Mobile page, looks better than the above
        webView.loadUrl("https://commons.m.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes");

        //After Create Account button is pressed within WebView, it brings user to https://commons.m.wikimedia.org/w/index.php?title=Main_Page&welcome=yes. So can we just override that URL?
        //Do we NEED to enable JS? Validation seems to work fine here
    }

    private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (Uri.parse(url).getHost().equals("www.example.com")) {
                // This is my web site, so do not override; let my WebView load the page
                return false;
            }
            // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            startActivity(intent);
            return true;
        }
    }
}

Change URLs and add MyWebViewClient


package de.mvitz.jprops.core.impl.provider;

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

import org.junit.Test;

public class SystemPropertyProviderTest {

    @Test
    public void nonPrefixProviderShouldUseGivenKey() throws Exception {
        System.setProperty("abc", "foo");
        try {
            assertThat(new SystemPropertyProvider().get("abc")).isEqualTo("foo");
        } finally {
            System.clearProperty("abc");
        }
    }

    @Test
    public void prefixProviderShouldUseGivenPrefixAndKey() throws Exception {
        System.setProperty("abc", "foo");
        try {
            assertThat(new SystemPropertyProvider("ab").get("c")).isEqualTo("foo");
        } finally {
            System.clearProperty("abc");
        }
    }

}

package de.mvitz.jprops.core.impl.provider;

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

import org.junit.Test;

public class SystemPropertyProviderTest {

    @Test
    public void nonPrefixProviderShouldUseGivenKey() throws Exception {
        System.setProperty("abc", "foo");
        try {
            assertThat(new SystemPropertyProvider().get("abc")).isEqualTo("foo");
        } finally {
            System.clearProperty("abc");
        }
    }

    @Test
    public void prefixProviderShouldUseGivenPrefixAndKey() throws Exception {
        System.setProperty("abc", "foo");
        try {
            assertThat(new SystemPropertyProvider("ab").get("c")).isEqualTo("foo");
        } finally {
            System.clearProperty("abc");
        }
    }

    @Test
    public void providerShouldReturnNullWhenNoPropertyIsFound() throws Exception {
        assertThat(new SystemPropertyProvider().get("abc")).isNull();
    }

}

Add junit test for SystemPropertyProvider.


package com.hubspot.singularity.executor.shells;

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

import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class SingularityExecutorShellCommandDescriptor {

  @JsonProperty
  @NotNull
  private String name;

  @JsonProperty
  @NotNull
  // Options are : {PID}
  private List<String> command;

  @JsonProperty
  @NotNull
  private List<SingularityExecutorShellCommandOptionDescriptor> options = Collections.emptyList();

  @JsonProperty
  private boolean skipCommandPrefix = false;

  public List<SingularityExecutorShellCommandOptionDescriptor> getOptions() {
    return options;
  }

  public void setOptions(List<SingularityExecutorShellCommandOptionDescriptor> options) {
    this.options = options;
  }

  public void setName(String name) {
    this.name = name;
  }

  public void setCommand(List<String> command) {
    this.command = command;
  }

  public String getName() {
    return name;
  }

  public List<String> getCommand() {
    return command;
  }

  public boolean isSkipCommandPrefix() {
    return skipCommandPrefix;
  }

  public void setSkipCommandPrefix(boolean skipCommandPrefix) {
    this.skipCommandPrefix = skipCommandPrefix;
  }
}

package com.hubspot.singularity.executor.shells;

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

import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class SingularityExecutorShellCommandDescriptor {

  @JsonProperty
  @NotNull
  private String name;

  @JsonProperty
  @NotNull
  // Options are : {PID}
  private List<String> command;

  @JsonProperty
  @NotNull
  private List<SingularityExecutorShellCommandOptionDescriptor> options = Collections.emptyList();

  @JsonProperty
  private boolean skipCommandPrefix = false;

  @JsonProperty
  private boolean skipCommandPrefixDockerOnly = false;

  public List<SingularityExecutorShellCommandOptionDescriptor> getOptions() {
    return options;
  }

  public void setOptions(List<SingularityExecutorShellCommandOptionDescriptor> options) {
    this.options = options;
  }

  public void setName(String name) {
    this.name = name;
  }

  public void setCommand(List<String> command) {
    this.command = command;
  }

  public String getName() {
    return name;
  }

  public List<String> getCommand() {
    return command;
  }

  public boolean isSkipCommandPrefix() {
    return skipCommandPrefix;
  }

  public void setSkipCommandPrefix(boolean skipCommandPrefix) {
    this.skipCommandPrefix = skipCommandPrefix;
  }

  public boolean isSkipCommandPrefixDockerOnly() {
    return skipCommandPrefixDockerOnly;
  }

  public void setSkipCommandPrefixDockerOnly(boolean skipCommandPrefixDockerOnly) {
    this.skipCommandPrefixDockerOnly = skipCommandPrefixDockerOnly;
  }
}

Add config for skipping the shell command prefix for Docker tasks only.


package rogue.creature;

import java.util.Collection;
import jade.fov.RayCaster;
import jade.fov.ViewField;
import jade.ui.Camera;
import jade.ui.Terminal;
import jade.util.datatype.ColoredChar;
import jade.util.datatype.Coordinate;
import jade.util.datatype.Direction;

public class Player extends Creature implements Camera
{
    private Terminal term;
    private ViewField fov;

    public Player(Terminal term)
    {
        super(ColoredChar.create('@'));
        this.term = term;
        fov = new RayCaster();
    }

    @Override
    public void act()
    {
        try
        {
            char key;
            key = term.getKey();
            switch(key)
            {
                case 'q':
                    expire();
                    break;
                default:
                    Direction dir = Direction.keyToDir(key);
                    if(dir != null)
                        move(dir);
                    break;
            }
        }
        catch(InterruptedException e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public Collection<Coordinate> getViewField()
    {
        return fov.getViewField(world(), pos(), 5);
    }
}

package rogue.creature;

import java.util.Collection;
import jade.fov.RayCaster;
import jade.fov.ViewField;
import jade.ui.Camera;
import jade.ui.Terminal;
import jade.util.datatype.ColoredChar;
import jade.util.datatype.Coordinate;
import jade.util.datatype.Direction;

public class Player extends Creature implements Camera
{
    private Terminal term;
    private ViewField fov;

    public Player(Terminal term)
    {
        super(ColoredChar.create('@'));
        this.term = term;
        fov = new RayCaster();
    }

    @Override
    public void act()
    {
        try
        {
            char key;
            key = term.getKey();
            switch(key)
            {
                case 'q':
                    expire();
                    break;
		case 'l':
		    System.out.println("Geschaeftsprozessmodelle");
		    // Do not break; here, otherwise we can't move left!
                default:
                    Direction dir = Direction.keyToDir(key);
                    if(dir != null)
                        move(dir);
                    break;
            }
        }
        catch(InterruptedException e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public Collection<Coordinate> getViewField()
    {
        return fov.getViewField(world(), pos(), 5);
    }
}

Print "Geschaeftsprozessmodelle" when 'l' has been pressed


package in.srain.cube.views.ptr;

import android.content.Context;
import android.util.AttributeSet;

/**
 * PtrFrameLayout which use {@link PtrClassicFrameLayout} as header view.
 */
public class PtrClassicFrameLayout extends PtrFrameLayout {

    private PtrClassicDefaultHeader mPtrClassicHeader;

    public PtrClassicFrameLayout(Context context) {
        super(context);
        initViews();
    }

    public PtrClassicFrameLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        initViews();
    }

    public PtrClassicFrameLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        initViews();
    }

    private void initViews() {
        mPtrClassicHeader = new PtrClassicDefaultHeader(getContext());
        setHeaderView(mPtrClassicHeader);
        addPtrUIHandler(mPtrClassicHeader);
    }

    public PtrClassicDefaultHeader getHeader() {
        return mPtrClassicHeader;
    }

    /**
     * Specify the last update time by this key string
     *
     * @param key
     */
    public void setLastUpdateTimeKey(String key) {
        if (mPtrClassicHeader != null) {
            mPtrClassicHeader.setLastUpdateTimeKey(key);
        }
    }

    /**
     * Using an object to specify the last update time.
     *
     * @param object
     */
    public void setLastUpdateTimeRelateObject(Object object) {
        if (mPtrClassicHeader != null) {
            mPtrClassicHeader.setLastUpdateTimeRelateObject(object);
        }
    }
}

package in.srain.cube.views.ptr;

import android.content.Context;
import android.util.AttributeSet;

/**
 * PtrFrameLayout which use {@link PtrClassicDefaultHeader} as header view.
 */
public class PtrClassicFrameLayout extends PtrFrameLayout {

    private PtrClassicDefaultHeader mPtrClassicHeader;

    public PtrClassicFrameLayout(Context context) {
        super(context);
        initViews();
    }

    public PtrClassicFrameLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        initViews();
    }

    public PtrClassicFrameLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        initViews();
    }

    private void initViews() {
        mPtrClassicHeader = new PtrClassicDefaultHeader(getContext());
        setHeaderView(mPtrClassicHeader);
        addPtrUIHandler(mPtrClassicHeader);
    }

    public PtrClassicDefaultHeader getHeader() {
        return mPtrClassicHeader;
    }

    /**
     * Specify the last update time by this key string
     *
     * @param key
     */
    public void setLastUpdateTimeKey(String key) {
        if (mPtrClassicHeader != null) {
            mPtrClassicHeader.setLastUpdateTimeKey(key);
        }
    }

    /**
     * Using an object to specify the last update time.
     *
     * @param object
     */
    public void setLastUpdateTimeRelateObject(Object object) {
        if (mPtrClassicHeader != null) {
            mPtrClassicHeader.setLastUpdateTimeRelateObject(object);
        }
    }
}

Add comment to core libs, modify some comment error.


package guitests;

import org.junit.Test;

import seedu.task.commons.core.Messages;
import seedu.task.testutil.TestTask;

import static org.junit.Assert.assertTrue;

public class FindCommandTest extends TaskManagerGuiTest {

    @Test
    public void find_nonEmptyList() {
        assertFindResult("find Mark"); //no results
        assertFindResult("find Meier", td.laundry, td.daniel); //multiple results

        //find after deleting one result
        commandBox.runCommand("delete 1");
        assertFindResult("find Meier",td.daniel);
    }

    @Test
    public void find_emptyList(){
        commandBox.runCommand("clear");
        assertFindResult("find Jean"); //no results
    }

    @Test
    public void find_invalidCommand_fail() {
        commandBox.runCommand("findgeorge");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertFindResult(String command, TestTask... expectedHits ) {
        commandBox.runCommand(command);
        assertListSize(expectedHits.length);
        assertResultMessage(expectedHits.length + " tasks listed!");
        assertTrue(taskListPanel.isListMatching(expectedHits));
    }
}

package guitests;

import org.junit.Test;

import seedu.task.commons.core.Messages;
import seedu.task.testutil.TestTask;

import static org.junit.Assert.assertTrue;

public class FindCommandTest extends TaskManagerGuiTest {

    @Test
    public void find_nonEmptyList() {
        assertFindResult("find Mark"); //no results
        assertFindResult("find Meier", td.daniel, td.laundry); //multiple results

        //find after deleting one result
        commandBox.runCommand("delete 1");
        assertFindResult("find Meier", td.laundry);
    }

    @Test
    public void find_emptyList(){
        commandBox.runCommand("clear");
        assertFindResult("find Jean"); //no results
    }

    @Test
    public void find_invalidCommand_fail() {
        commandBox.runCommand("findgeorge");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertFindResult(String command, TestTask... expectedHits ) {
        commandBox.runCommand(command);
        assertListSize(expectedHits.length);
        assertResultMessage(expectedHits.length + " tasks listed!");
        assertTrue(taskListPanel.isListMatching(expectedHits));
    }
}

Fix ordering in find test


/*
 * Copyright (c) 2002-2003 by OpenSymphony
 * All rights reserved.
 */
package com.opensymphony.workflow.soap;

import org.codehaus.xfire.transport.http.XFireServletController;

/**
 * @author Hani Suleiman
 *         Date: Nov 10, 2005
 *         Time: 1:51:55 PM
 */
public class XFireSOAPWorkflow extends BasicSOAPWorkflow {
    //~ Methods ////////////////////////////////////////////////////////////////

    protected String getRemoteUser() {
        String user = XFireServletController.getRequest().getRemoteUser();

        return (user == null) ? "guest" : user;
    }
}

/*
 * Copyright (c) 2002-2003 by OpenSymphony
 * All rights reserved.
 */
package com.opensymphony.workflow.soap;

import org.codehaus.xfire.transport.http.XFireServletController;

/**
 * @author Hani Suleiman
 *         Date: Nov 10, 2005
 *         Time: 1:51:55 PM
 */
public class XFireSOAPWorkflow extends BasicSOAPWorkflow {
    //~ Methods ////////////////////////////////////////////////////////////////

    protected String getRemoteUser() {
        String user = XFireServletController.getRequest().getRemoteUser();

        return (user == null) ? "test" : user;
    }
}

Use user 'test' if no remote user found, to get the example working better out of the box


package org.spoofax.jsglr2.incremental.lookaheadstack;

import org.metaborg.parsetable.query.IActionQuery;
import org.spoofax.jsglr2.incremental.parseforest.IncrementalParseForest;

// TODO the name LookaheadStack is a bit misleading. Rename to something like MixedInputStream?
public interface ILookaheadStack extends IActionQuery, Cloneable {
    void leftBreakdown();

    void popLookahead();

    IncrementalParseForest get();
}

package org.spoofax.jsglr2.incremental.lookaheadstack;

import org.metaborg.parsetable.query.IActionQuery;
import org.spoofax.jsglr2.incremental.parseforest.IncrementalParseForest;

// TODO the name LookaheadStack is a bit misleading. Rename to something like MixedInputStream?
public interface ILookaheadStack extends IActionQuery, Cloneable {
    void leftBreakdown();

    void popLookahead();

    IncrementalParseForest get();

    // TODO add support for recovery. Resetting should push the characters between new and old position on the stack.
    // This is an optimization because the parse nodes in the the part of the input being recovered need to be broken
    // down anyway.
    // void resetPosition(int position);
}

Add TODO for recovery optimization


package org.jivesoftware.fastpath;

/**
 * Fastpath / Workgroup related code is available in smack-legacy.jar. Sadly, only part of the IQ providers and packet
 * extensions is loaded by default by Smack (see SMACK-729 in the issue tracker).
 *

 * To work around this issue, this class initializes the remaining classes. This class should no longer be needed when
 * the original problem in Smack is fixed.
 *
 * @author Guus der Kinderen, guus.der.kinderen@gmail.com
 * @see Issue SMACK-729
 */

import org.jivesoftware.smack.initializer.UrlInitializer;

public class WorkgroupInitializer extends UrlInitializer
{
    public WorkgroupInitializer()
    {
    }

    @Override
    protected String getProvidersUri() {
        return "classpath:org.jivesoftware.smack.legacy/workgroup.providers";
    }
}

package org.jivesoftware.fastpath;

/**
 * Fastpath / Workgroup related code is available in smack-legacy.jar. Sadly, only part of the IQ providers and packet
 * extensions is loaded by default by Smack (see SMACK-729 in the issue tracker).
 *

 * To work around this issue, this class initializes the remaining classes. This class should no longer be needed when
 * the original problem in Smack is fixed.
 *
 * @author Guus der Kinderen, guus.der.kinderen@gmail.com
 * @see Issue SMACK-729
 */

import org.jivesoftware.smack.initializer.UrlInitializer;

public class WorkgroupInitializer extends UrlInitializer
{
    public WorkgroupInitializer()
    {
    }

    @Override
    protected String getProvidersUri() {
        return "classpath:org.jivesoftware.smack.legacy/legacy.providers";
    }
}

Fix classpath after update to Smack to 4.4


package com.sdsmdg.kd.trianglify.utilities;

/**
 *
Thread Local Random

 * Description : Generates Random numbers that are local to a thread thus reducing instructions
 *                  needed to generate a random number.
 *
 * @author suyash
 * @since 2/5/17.
 */

public class ThreadLocalRandom {
    long seed = 0x5DEECE66DL;

    public ThreadLocalRandom(){

    }

    /**
     * Generates a psuedoRandom integer that have computational costs of several instructions less
     * then that of java.util.random.nextInt().
     * @param mod limit for generation of pseudo random number
     * @return Random number between 0 and mod (exclusive)
     */
    public int nextInt(int mod) {
        seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
        return (int)(seed%mod);
    }

}

package com.sdsmdg.kd.trianglify.utilities;

/**
 *
Thread Local Random

 * Description : Generates Random numbers that are local to a thread thus reducing instructions
 *                  needed to generate a random number.
 *
 * @author suyash
 * @since 2/5/17.
 */

public class ThreadLocalRandom {
    long seed = 0x5DEECE66DL;

    public ThreadLocalRandom(){

    }

    /**
     * Generates a psuedoRandom integer that has computational costs of several instructions less
     * than that of java.util.random.nextInt().
     * @param mod limit for generation of pseudo random number
     * @return Random number between 0 and mod (exclusive)
     */
    public int nextInt(int mod) {
        seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
        return (int)(seed%mod);
    }

}

Fix typos in doc comments


package com.elmakers.mine.bukkit.action.builtin;

import java.util.Collection;

import org.bukkit.configuration.ConfigurationSection;

import com.elmakers.mine.bukkit.action.CheckAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.Spell;

public class CheckTriggerAction extends CheckAction {
    private String trigger;

    @Override
    public void prepare(CastContext context, ConfigurationSection parameters)
    {
        super.prepare(context, parameters);
        trigger = parameters.getString("trigger", "");
    }

    @Override
    protected boolean isAllowed(CastContext context) {
        Long lastTrigger = context.getMage().getLastTrigger(trigger);
        return (lastTrigger != null && lastTrigger > context.getStartTime());
    }

    @Override
    public void getParameterNames(Spell spell, Collection<String> parameters) {
        super.getParameterNames(spell, parameters);
        parameters.add("trigger");
    }
}

package com.elmakers.mine.bukkit.action.builtin;

import java.util.Collection;

import org.bukkit.configuration.ConfigurationSection;

import com.elmakers.mine.bukkit.action.CheckAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.Spell;

public class CheckTriggerAction extends CheckAction {
    private boolean sinceStartOfCast;
    private long startTime;
    private String trigger;

    @Override
    public void prepare(CastContext context, ConfigurationSection parameters)
    {
        super.prepare(context, parameters);
        trigger = parameters.getString("trigger", "");
        sinceStartOfCast = parameters.getBoolean("since_start_of_cast", false);
    }

    @Override
    public void reset(CastContext context) {
        startTime = System.currentTimeMillis();
    }

    @Override
    protected boolean isAllowed(CastContext context) {
        Long lastTrigger = context.getMage().getLastTrigger(trigger);
        long startTime = sinceStartOfCast ? context.getStartTime() : this.startTime;
        return (lastTrigger != null && lastTrigger > startTime);
    }

    @Override
    public void getParameterNames(Spell spell, Collection<String> parameters) {
        super.getParameterNames(spell, parameters);
        parameters.add("trigger");
    }
}

Change CheckTrigger action to be retriggerable


package io.vertx.it.plugin;

import java.util.concurrent.TimeUnit;

public class TimeUtils {

  public static void sleep(long millis) {
    sleep(millis, TimeUnit.MILLISECONDS);
  }

  private static void sleep(long amount, TimeUnit unit) {
    try {
      Thread.sleep(unit.toMillis(amount) * getTimeFactor());
    } catch (InterruptedException e) {
      // Ignore it.
    }
  }

  private static int getTimeFactor() {
    return Integer.getInteger("time.factor", 1);
  }

}

package io.vertx.it.plugin;

import java.util.concurrent.TimeUnit;

public class TimeUtils {

  public static void sleep(long millis) {
    sleep(millis, TimeUnit.MILLISECONDS);
  }

  private static void sleep(long amount, TimeUnit unit) {
    try {
      Thread.sleep(unit.toMillis(amount) * getTimeFactor());
    } catch (InterruptedException e) {
      // Ignore it.
    }
  }

  public static int getTimeFactor() {
    return Integer.getInteger("time.factor", 1);
  }

}

Make the getTimeFactor method public, as it will be use elsewhere.


package model;

import com.google.gson.JsonObject;
import okhttp3.OkHttpClient;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import util.MockInterceptor;
import util.Networking;

import java.io.IOException;

import static org.junit.Assert.assertTrue;
import static util.MockConstants.*;

public class TestImageTransform {

    /**
     * Set a custom httpClient for our testing.
     * This custom client has an added interceptor to create mock responses.
     */
    @BeforeClass
    public static void setup() {
        OkHttpClient client = new OkHttpClient.Builder()
                .addInterceptor(new MockInterceptor())
                .build();
        Networking.setCustomClient(client);
    }

    @Test
    public void testDebug() throws IOException {
        ImageTransform transform = new ImageTransform(FILE_LINK);
        transform = transform.resize(100, 100, null, null);
        JsonObject debugResponse = transform.debug();
        String message = "Debug response was null";
        assertTrue(message, debugResponse != null);
    }

    /**
     * Clear changes to {@link Networking Networking} class since it's a shared resource.
     */
    @AfterClass
    public static void teardown() {
        Networking.removeCustomClient();
    }
}

package model;

import com.google.gson.JsonObject;
import okhttp3.OkHttpClient;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import util.MockInterceptor;
import util.Networking;

import java.io.IOException;

import static org.junit.Assert.assertTrue;
import static util.MockConstants.*;

public class TestImageTransform {
    private static final String SOURCE = "https://example.com/image.jpg";

    /**
     * Set a custom httpClient for our testing.
     * This custom client has an added interceptor to create mock responses.
     */
    @BeforeClass
    public static void setup() {
        OkHttpClient client = new OkHttpClient.Builder()
                .addInterceptor(new MockInterceptor())
                .build();
        Networking.setCustomClient(client);
    }

    @Test
    public void testDebug() throws IOException {
        ImageTransform transform = new ImageTransform(FILE_LINK);
        transform = transform.resize(100, 100, null, null);
        JsonObject debugResponse = transform.debug();
        String message = "Debug response was null";
        assertTrue(message, debugResponse != null);
    }

    @Test
    public void testDebugExternal() throws IOException {
        ImageTransform transform = new ImageTransform(CLIENT, SOURCE);
        transform = transform.resize(100, 100, null, null);
        JsonObject debugResponse = transform.debug();
        String message = "External debug response was null";
        assertTrue(message, debugResponse != null);
    }

    /**
     * Clear changes to {@link Networking Networking} class since it's a shared resource.
     */
    @AfterClass
    public static void teardown() {
        Networking.removeCustomClient();
    }
}

Add test for external image transform debug


package com.ternaryop.utils;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class DialogUtils {

    public static void showErrorDialog(Context context, Exception e) {
        showErrorDialog(context, "Error", e);
    }

    public static void showErrorDialog(Context context, String title, Exception e) {
        showSimpleMessageDialog(context, title, e.getLocalizedMessage());
    }

    public static void showErrorDialog(Context context, int resId, Exception e) {
        showSimpleMessageDialog(context, context.getString(resId), e.getLocalizedMessage());
    }

    public static void showSimpleMessageDialog(Context context, int resId, String message) {
        showSimpleMessageDialog(context, context.getString(resId), message);
    }

    public static void showSimpleMessageDialog(Context context, String title, String message) {
        new AlertDialog.Builder(context)
        .setCancelable(false) // This blocks the 'BACK' button
        .setTitle(title)
        .setMessage(message)
        .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                dialog.dismiss();
            }
        })
        .show();
    }
}

package com.ternaryop.utils;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class DialogUtils {

    public static void showErrorDialog(Context context, Throwable t) {
        showErrorDialog(context, "Error", t);
    }

    public static void showErrorDialog(Context context, String title, Throwable t) {
        showSimpleMessageDialog(context, title, t.getLocalizedMessage());
    }

    public static void showErrorDialog(Context context, int resId, Throwable t) {
        showSimpleMessageDialog(context, context.getString(resId), t.getLocalizedMessage());
    }

    public static void showSimpleMessageDialog(Context context, int resId, String message) {
        showSimpleMessageDialog(context, context.getString(resId), message);
    }

    public static void showSimpleMessageDialog(Context context, String title, String message) {
        new AlertDialog.Builder(context)
        .setCancelable(false) // This blocks the 'BACK' button
        .setTitle(title)
        .setMessage(message)
        .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                dialog.dismiss();
            }
        })
        .show();
    }
}

Use Throwable instead of Exception


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

BREAK BUILD

/**
 * Interface implemented by components that can be named, such as via configuration, and wish to have that name
 * set once it has been configured.
 *
 * @author Les Hazlewood
 * @since 0.9
 */
public interface Nameable {

    /**
     * Sets the (preferably application unique) name for this component.
     * @param name the preferably application unique name for this component.
     */
    void setName(String name);
}

/*
 * 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.jsecurity.util;

/**
 * Interface implemented by components that can be named, such as via configuration, and wish to have that name
 * set once it has been configured.
 *
 * @author Les Hazlewood
 * @since 0.9
 */
public interface Nameable {

    /**
     * Sets the (preferably application unique) name for this component.
     * @param name the preferably application unique name for this component.
     */
    void setName(String name);
}

Fix the build to test Hudson


package reborncore.mixin.implementations.asmInjector;

import org.apache.logging.log4j.LogManager;
import reborncore.mixin.MixinManager;
import reborncore.mixin.implementations.prebaker.MixinPrebaker;

/**
 * Used by asm injector to load mixins into a jar at build time
 */
public class ASMInjectorSetupClass {

	public static void main(){
		MixinManager.logger = LogManager.getLogger();
		MixinManager.logger.info("Loading mixin manager");
		MixinManager.logger.info("Using dummy remapper");
		MixinManager.mixinRemaper = new MixinPrebaker.DummyRemapper();
		MixinManager.load();
	}

}

package reborncore.mixin.implementations.asmInjector;

import javassist.LoaderClassPath;
import org.apache.logging.log4j.LogManager;
import reborncore.mixin.MixinManager;
import reborncore.mixin.implementations.prebaker.MixinPrebaker;
import reborncore.mixin.transformer.MixinTransformer;

/**
 * Used by asm injector to load mixins into a jar at build time
 */
public class ASMInjectorSetupClass {

	public static void main(){
		MixinManager.logger = LogManager.getLogger();
		MixinManager.logger.info("Loading mixin manager");
		MixinManager.logger.info("Using dummy remapper");
		MixinManager.mixinRemaper = new MixinPrebaker.DummyRemapper();
		MixinTransformer.cp.appendClassPath(new LoaderClassPath(ASMInjectorSetupClass.class.getClassLoader()));
		MixinManager.load();
	}

}

Add class path to asm injector


package com.example;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Contact {
  public Integer id;
  public String email;
  public String firstName;
  public String lastName;
  public String middleName;
  public String dateOfBirth;
  public Integer sex;

  public Contact() {
    this.id = null;
    this.email = null;
    this.firstName = null;
    this.lastName = null;
    this.middleName = null;
    this.dateOfBirth = null;
    this.sex = null;
  }

  public Contact(
    Integer id,
    String email,
    String firstName,
    String lastName,
    String middleName,
    String dateOfBirth,
    Integer sex
  ) {
    this.id = id;
    this.email = email;
    this.firstName = firstName;
    this.lastName = lastName;
    this.middleName = middleName;
    this.dateOfBirth = dateOfBirth;
    this.sex = sex;
  }
}

package com.example;

import java.util.ArrayList;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Contact {
  public Integer id;
  public String email;
  public String firstName;
  public String lastName;
  public String middleName;
  public String dateOfBirth;
  public Integer sex;
  public ArrayList<Profile> profiles;

  public Contact() {
    this.id = null;
    this.email = null;
    this.firstName = null;
    this.lastName = null;
    this.middleName = null;
    this.dateOfBirth = null;
    this.sex = null;
    this.profiles = null;
  }

  public Contact(
    Integer id,
    String email,
    String firstName,
    String lastName,
    String middleName,
    String dateOfBirth,
    Integer sex
  ) {
    this.id = id;
    this.email = email;
    this.firstName = firstName;
    this.lastName = lastName;
    this.middleName = middleName;
    this.dateOfBirth = dateOfBirth;
    this.sex = sex;
    this.profiles = null;
  }
}

Make profiles list null by default


package com.example.helloworld.resources;

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

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/json")
@Produces(MediaType.APPLICATION_JSON)
public class JsonResource
{
  private final Map<String, String> MESSAGE = new HashMap<String, String>();

  public JsonResource()
  {
    MESSAGE.put("message", "Hello, world!");
  }

  @GET
  public Map<String, String> sayHello()
  {
    return MESSAGE;
  }
}

package com.example.helloworld.resources;

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

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/json")
@Produces(MediaType.APPLICATION_JSON)
public class JsonResource
{
  // Response message class (copied from 'servlet' test)
  public final static class HelloMessage {
    public final String message;

    public HelloMessage(String m) { message = m; }
  }

  public JsonResource() { }

  @GET
  public HelloMessage sayHello()
  {
    return new HelloMessage("Hello, World!");
  }
}

Improve DropWizard test to use JSON generation similar to Servlet test -- more efficient that way


package de.markusfisch.android.shadereditor.app;

import de.markusfisch.android.shadereditor.database.DataSource;
import de.markusfisch.android.shadereditor.preference.Preferences;

import android.app.Application;

public class ShaderEditorApplication extends Application
{
	public static final Preferences preferences = new Preferences();
	public static final DataSource dataSource = new DataSource();

	@Override
	public void onCreate()
	{
		super.onCreate();

		preferences.init( this );
		dataSource.openAsync( this );
	}
}

package de.markusfisch.android.shadereditor.app;

import de.markusfisch.android.shadereditor.database.DataSource;
import de.markusfisch.android.shadereditor.preference.Preferences;
import de.markusfisch.android.shadereditor.BuildConfig;

import android.app.Application;
import android.os.StrictMode;

public class ShaderEditorApplication extends Application
{
	public static final Preferences preferences = new Preferences();
	public static final DataSource dataSource = new DataSource();

	@Override
	public void onCreate()
	{
		super.onCreate();

		preferences.init( this );
		dataSource.openAsync( this );

		if( BuildConfig.DEBUG )
		{
			StrictMode.setThreadPolicy(
				new StrictMode.ThreadPolicy.Builder()
					.detectAll()
					.penaltyLog()
					.build() );

			StrictMode.setVmPolicy(
				new StrictMode.VmPolicy.Builder()
					.detectLeakedSqlLiteObjects()
					.detectLeakedClosableObjects()
					.penaltyLog()
					.penaltyDeath()
					.build() );
		}
	}
}

Use strict mode in debug build


package datasources;

import org.junit.*;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import java.util.ArrayList;
import java.util.Collection;

import datasources.MockDataProvider;
import models.Person;

public class MockDataProviderTest {

	private MockDataProvider mdp;
	private ArrayList<Person> persons;
	private Person bart;

	@Before
	public void setUp() throws Exception {
		mdp = new MockDataProvider();
		persons = mdp.getPersons();
		bart = new Person(101,"Bart","Simpsons",1987,"Springfield","USA");
	}

	@Test
	public void constructorInvokePopulateCollection() {
		assertFalse(persons.isEmpty());
	}

	@Test
	public void getPersonsReturnCollectionType() {
		Collection<Object> dataCollection = new ArrayList<>();
		assertThat(dataCollection, instanceOf(persons.getClass()));
	}

	@Test
	public void getPersonsReturnCollectionItemType() {
		assertThat(bart, instanceOf(persons.get(0).getClass()));
	}

	@Test
	public void getPersonsReturnCollectionSize() {
		assertEquals(3, persons.size());
	}

	@Test(timeout=1000) // milliseconds, i.e. 1000=1sec
	public void getPersonsInInfiniteLoop() {
		assertNotNull(mdp.getPersons());
	}

}

package datasources;

import org.junit.*;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import java.util.ArrayList;
import java.util.Collection;

import datasources.MockDataProvider;
import models.Person;

public class MockDataProviderTest {

	private MockDataProvider mdp;
	private ArrayList<Person> persons;
	private Person bart;

	@Before
	public void setUp() throws Exception {
		mdp = new MockDataProvider();
		persons = mdp.getPersons();
		bart = new Person(101,"Bart","Simpsons",1987,"Springfield","USA");
	}

	@Test
	public void constructorInvokePopulateCollection() {
		assertFalse(persons.isEmpty());
	}

	@Test
	public void getPersonsReturnCollectionType() {
		Collection<Object> expectedDataCollection = new ArrayList<>();
		assertThat(expectedDataCollection, instanceOf(persons.getClass()));
	}

	@Test
	public void getPersonsReturnCollectionItemType() {
		Person expectedType = bart;
		assertThat(bart, instanceOf(persons.get(0).getClass()));
	}

	@Test
	public void getPersonsReturnCollectionSize() {
		int expectedSize = 3;
		assertEquals(expectedSize, persons.size());
	}

	@Test(timeout=1000) // milliseconds, i.e. 1000=1sec
	public void getPersonsInInfiniteLoop() {
		assertNotNull(mdp.getPersons());
	}

}

Add variables to express intent while asserting


package io.quarkus.oidc.runtime;

import io.quarkus.oidc.OidcTenantConfig;

class TenantConfigContext {

    /**
     * OIDC Provider
     */
    final OidcProvider provider;

    /**
     * Tenant configuration
     */
    final OidcTenantConfig oidcConfig;

    final boolean ready;

    public TenantConfigContext(OidcProvider client, OidcTenantConfig config) {
        this(client, config, true);
    }

    public TenantConfigContext(OidcProvider client, OidcTenantConfig config, boolean ready) {
        this.provider = client;
        this.oidcConfig = config;
        this.ready = ready;
    }
}

package io.quarkus.oidc.runtime;

import io.quarkus.oidc.OidcTenantConfig;

public class TenantConfigContext {

    /**
     * OIDC Provider
     */
    final OidcProvider provider;

    /**
     * Tenant configuration
     */
    final OidcTenantConfig oidcConfig;

    final boolean ready;

    public TenantConfigContext(OidcProvider client, OidcTenantConfig config) {
        this(client, config, true);
    }

    public TenantConfigContext(OidcProvider client, OidcTenantConfig config, boolean ready) {
        this.provider = client;
        this.oidcConfig = config;
        this.ready = ready;
    }

    public OidcTenantConfig getOidcTenantConfig() {
        return oidcConfig;
    }
}

Make it easier to access the static OidcTenantConfig from custom tenant resolvers