/*******************************************************************************
 * Copyright (c) 1998, 2009 Oracle. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
 * which accompanies this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * Contributors:
 *     Oracle - initial API and implementation from Oracle TopLink
 ******************************************************************************/
package org.eclipse.persistence.internal.oxm.record.deferred;

import org.eclipse.persistence.oxm.record.UnmarshalRecord;
import org.xml.sax.SAXException;

/**
 *
Purpose: Class to represent the characters event
 *
Responsibilities:

 *
 Execute the characters event on the given unmarshalRecord with the specified arguments
 *

 */
public class CharactersEvent extends SAXEvent {
    private char[] characters;
    private int start;
    private int end;

    public CharactersEvent(char[] theCharacters, int theStart, int theEnd) {
        super();
        characters = theCharacters;
        start = theStart;
        end = theEnd;
    }

    public void processEvent(UnmarshalRecord unmarshalRecord) throws SAXException {
        unmarshalRecord.characters(characters, start, end);
    }
}

/*******************************************************************************
 * Copyright (c) 1998, 2009 Oracle. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
 * which accompanies this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * Contributors:
 *     Oracle - initial API and implementation from Oracle TopLink
 ******************************************************************************/
package org.eclipse.persistence.internal.oxm.record.deferred;

import org.eclipse.persistence.oxm.record.UnmarshalRecord;
import org.xml.sax.SAXException;

/**
 *
Purpose: Class to represent the characters event
 *
Responsibilities:

 *
 Execute the characters event on the given unmarshalRecord with the specified arguments
 *

 */
public class CharactersEvent extends SAXEvent {
    private char[] characters;
    private int start;
    private int end;

    public CharactersEvent(char[] theCharacters, int theStart, int theEnd) {
        super();
        //clone the character array. The one passed in from the original SAX event may change.
        characters = theCharacters.clone();
        start = theStart;
        end = theEnd;
    }

    public void processEvent(UnmarshalRecord unmarshalRecord) throws SAXException {
        unmarshalRecord.characters(characters, start, end);
    }
}

Fix for nightly build test failures
Reviewed by David McCann

Former-commit-id: 564cfc8b000c71aa47ce1164401719ca2f9edd39


package com.edulify.modules.geolocation;

import org.junit.Test;
import play.test.WithApplication;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.*;
import static play.test.Helpers.*;

/**
 * Created by sovaalexandr
 */
public class GeolocationServiceTest extends WithApplication {

  @Test
  public void testGetGeolocation() throws Exception {
    Map<String, Object> config = new HashMap<>(1);
    config.put("geolocation.provider", "com.edulify.modules.geolocation.providers.FreegeoipProvider");
    List<String> plugins = new ArrayList<>(1);
    plugins.add(GeolocationPlugin.class.getCanonicalName());
    running(fakeApplication(config, plugins), new Runnable() {
      @Override
      public void run() {
        String ipAddress = "192.30.252.129";
        Geolocation geolocation = GeolocationService.getGeolocation(ipAddress);
        assertEquals(ipAddress, geolocation.getIp());
      }
    });
  }
}

[improvement] Remove duplication of code at deprecated Sync service
Add new line to the end of file


/*
Copyright 2020 Google LLC

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

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.google.gpay.virtualqueue.backendservice.repository;

import java.util.Map;
import java.util.UUID;

import com.google.gpay.virtualqueue.backendservice.model.Shop;
import com.google.gpay.virtualqueue.backendservice.proto.CreateShopRequest;

public interface VirtualQueueRepository {

    public UUID createShop(CreateShopRequest createShopRequest);

    public Map<UUID, Shop> getAllShops();
}

/*
Copyright 2020 Google LLC

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

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package com.google.gpay.virtualqueue.backendservice.repository;

import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.google.gpay.virtualqueue.backendservice.model.Shop;
import com.google.gpay.virtualqueue.backendservice.model.Token;
import com.google.gpay.virtualqueue.backendservice.proto.CreateShopRequest;

public interface VirtualQueueRepository {

    public UUID createShop(CreateShopRequest createShopRequest);

    public Map<UUID, Shop> getAllShops();

    public List<Token> getTokensByShopId(UUID shopId);
}

Add function to Virtual Queue Repository interface


package org.spoofax.jsglr2.integrationtest.languages;

import java.io.IOException;
import java.util.stream.Stream;

import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.jsglr2.integrationtest.BaseTestWithParseTableFromTermWithJSGLR1;
import org.spoofax.terms.ParseError;

public class StrategoTest extends BaseTestWithParseTableFromTermWithJSGLR1 {

    public StrategoTest() throws Exception {
        setupParseTable("Stratego");
    }

    @TestFactory public Stream<DynamicTest> testAmbByExpectedAST() throws ParseError, IOException {
        String sampleProgram = getFileAsString("Stratego/ambiguity-issue.str");
        IStrategoTerm expectedAST = getFileAsAST("Stratego/ambiguity-issue.aterm");

        return testSuccessByAstString(sampleProgram, expectedAST.toString());
    }

    @TestFactory public Stream<DynamicTest> testIndentPadding() throws ParseError, IOException {
        String sampleProgram = getFileAsString("Stratego/test112.str");
        IStrategoTerm expectedAST = getFileAsAST("Stratego/test112.aterm");

        return testSuccessByAstString(sampleProgram, expectedAST.toString());
    }

}

package org.spoofax.jsglr2.integrationtest.languages;

import java.io.IOException;
import java.util.stream.Stream;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.jsglr2.integrationtest.BaseTestWithParseTableFromTermWithJSGLR1;
import org.spoofax.terms.ParseError;

public class StrategoTest extends BaseTestWithParseTableFromTermWithJSGLR1 {

    public StrategoTest() throws Exception {
        setupParseTable("Stratego");
    }

    @TestFactory public Stream<DynamicTest> testAmbByExpectedAST() throws ParseError, IOException {
        String sampleProgram = getFileAsString("Stratego/ambiguity-issue.str");
        IStrategoTerm expectedAST = getFileAsAST("Stratego/ambiguity-issue.aterm");

        return testSuccessByAstString(sampleProgram, expectedAST.toString());
    }

    @Disabled("The {indentpadding} attribute is not supported by JSGLR2 imploding due to concerns around incremental parsing")
    @TestFactory public Stream<DynamicTest> testIndentPadding() throws ParseError, IOException {
        String sampleProgram = getFileAsString("Stratego/test112.str");
        IStrategoTerm expectedAST = getFileAsAST("Stratego/test112.aterm");

        return testSuccessByAstString(sampleProgram, expectedAST.toString());
    }

}

Disable indentpadding test, note why

Disable indentpadding test, note why


package io.tetrapod.core.web;

import io.tetrapod.protocol.core.WebRoute;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class WebRoutes {

   private final Map<String,WebRoute> routes = new ConcurrentHashMap<>();

   public void setRoute(String path, int contractId, int structId) {
      // "/api/LoginRequest  contractId=2, structId=1244334
      WebRoute r = new WebRoute(path, structId, contractId);
      routes.put(path, r);
   }

   public WebRoute findRoute(String uri) {
      int ix = uri.indexOf('?');
      String path = ix < 0 ? uri : uri.substring(0, ix);
      WebRoute r = routes.get(path);
      if (r == null) {
         // allow /route/params instead of /route?params
         ix = uri.lastIndexOf('/');
         path = ix < 0 ? uri : uri.substring(0, ix);
         r = routes.get(path);
      }
      return r;
   }

}

package io.tetrapod.core.web;

import io.tetrapod.protocol.core.WebRoute;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class WebRoutes {

   private final Map<String, WebRoute> routes = new ConcurrentHashMap<>();

   public void setRoute(String path, int contractId, int structId) {
      // "/api/LoginRequest  contractId=2, structId=1244334
      WebRoute r = new WebRoute(path, structId, contractId);
      routes.put(path, r);
   }

   public WebRoute findRoute(String uri) {
      int ix = uri.indexOf('?');
      String path = ix < 0 ? uri : uri.substring(0, ix);

      WebRoute r = routes.get(path);
      if (r == null) {
         // special handling for @root paths
         for (WebRoute route : routes.values()) {
            if (path.startsWith(route.path)) {
               return route;
            }
         }
      }

      if (r == null) {
         // allow /route/params instead of /route?params
         ix = uri.lastIndexOf('/');
         path = ix < 0 ? uri : uri.substring(0, ix);
         r = routes.get(path);
      }
      return r;
   }

}

Add handling to @root WebRoute matching so we can send the whole subpath


package com.urlcrawler;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class LineParserImpl implements LineParser {

    private Pattern regPattern;
    private List<URL> links = new ArrayList<URL>();

    public List<URL> extractUrl(String line) {
        Matcher m = regPattern.matcher(line);
        while (m.find()) {
            try {
                System.out.println("Converting string to URL: " + m.group(1));
                URL url = new URL(m.group(1));
                links.add(url);
            } catch (MalformedURLException e) {
            }
        }
        return links;
    }

    public void setRegularExpression(String regex) {
        this.regPattern = Pattern.compile(regex);
    }

}

package com.urlcrawler;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class LineParserImpl implements LineParser {

    private Pattern regPattern;
    private List<URL> links = new ArrayList<URL>();

    public List<URL> extractUrl(String line) {
        links.clear();
        Matcher m = regPattern.matcher(line);
        while (m.find()) {
            try {
                System.out.println("Converting string to URL: " + m.group(1));
                URL url = new URL(m.group(1));
                links.add(url);
            } catch (MalformedURLException e) {
            }
        }
        return links;
    }

    public void setRegularExpression(String regex) {
        this.regPattern = Pattern.compile(regex);
    }

}

Clean links list for each new cycle.

Clean links list for each new cycle.


package fault;

import fault.concurrent.DefaultResilientPromise;
import fault.concurrent.ResilientFuture;
import fault.concurrent.ResilientPromise;
import fault.utils.ResilientPatternAction;

/**
 * Created by timbrooks on 6/4/15.
 */
public class LoadBalancer<T, C> implements Pattern {

    @Override
    public ResilientFuture<T> submitAction(ResilientPatternAction action, long millisTimeout) {
        return submitAction(action, new DefaultResilientPromise(), null, millisTimeout);
    }

    @Override
    public ResilientFuture<T> submitAction(ResilientPatternAction action, ResilientCallback callback,
                                           long millisTimeout) {
        return null;
    }

    @Override
    public ResilientFuture<T> submitAction(ResilientPatternAction action, ResilientPromise promise,
                                           long millisTimeout) {
        return null;
    }

    @Override
    public ResilientFuture<T> submitAction(ResilientPatternAction action, ResilientPromise promise,
                                           ResilientCallback callback, long millisTimeout) {
        return null;
    }

    @Override
    public ResilientPromise<T> performAction(ResilientPatternAction action) {
        return null;
    }
}

package fault;

import fault.concurrent.DefaultResilientPromise;
import fault.concurrent.ResilientFuture;
import fault.concurrent.ResilientPromise;
import fault.utils.ResilientPatternAction;

/**
 * Created by timbrooks on 6/4/15.
 */
public class LoadBalancer<C> implements Pattern<C> {

    @Override
    public <T> ResilientFuture<T> submitAction(ResilientPatternAction<T, C> action, long millisTimeout) {
        return submitAction(action, new DefaultResilientPromise<T>(), null, millisTimeout);
    }

    @Override
    public <T> ResilientFuture<T> submitAction(ResilientPatternAction<T, C> action, ResilientCallback<T> callback,
                                               long millisTimeout) {
        return submitAction(action, new DefaultResilientPromise<T>(), callback, millisTimeout);
    }

    @Override
    public <T> ResilientFuture<T> submitAction(ResilientPatternAction<T, C> action, ResilientPromise<T> promise,
                                               long millisTimeout) {
        return submitAction(action, promise, null, millisTimeout);
    }

    @Override
    public <T> ResilientFuture<T> submitAction(ResilientPatternAction<T, C> action, ResilientPromise<T> promise,
                                               ResilientCallback<T> callback, long millisTimeout) {
        return submitAction(action, promise, callback, millisTimeout);
    }

    @Override
    public <T> ResilientPromise<T> performAction(ResilientPatternAction<T, C> action) {
        return null;
    }
}

Fix type relationship. And have methods calls each other


package sketch.avengergear.com;

import android.app.Activity;
import android.os.Bundle;

public class sketchUI extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

package sketch.avengergear.com;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.app.Activity;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;

import org.spongycastle.jce.provider.BouncyCastleProvider;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Security;
import java.security.SecureRandom;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.util.Arrays;
import java.util.Map;

public class sketchUI extends Activity
{
    private static final String TAG = "SKETCH-UI";

    static {
        Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1);
    }

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        try {
            // Create the public and private keys
            KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "BC");

            SecureRandom random = new SecureRandom();
            generator.initialize(2048, random);
            KeyPair keyPair = generator.genKeyPair();

            byte[] pri = keyPair.getPrivate().getEncoded();
            byte[] pub = keyPair.getPublic().getEncoded();

            Log.v(TAG, keyPair.getPrivate().toString() );

        } catch (NoSuchProviderException e) {
            Log.e(TAG, "No provider exception", e);
        } catch (NoSuchAlgorithmException e) {
            Log.e(TAG, "No Algorithum exception", e);
        }

    }
}

Initialize BC Private and Public Key gen test


/*
 * Copyright 2011 CodeFlux, Inc <info@teamcodeflux.com>
 *
 * 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.teamcodeflux.android.adapter;

import android.content.Context;
import android.widget.SimpleAdapter;

import java.util.List;
import java.util.Map;

public abstract class AbstractSimpleAdapterBuilder<T> implements SimpleAdapterBuilder {
    private Context context;
    private List<T> data;

    public AbstractSimpleAdapterBuilder(final Context context, final List<T> data) {
        this.context = context;
        this.data = data;
    }

    @Override
    public SimpleAdapter build() {
        return new SimpleAdapter(context, data(data), resource(), from(), to());
    }

    protected abstract List<? extends Map<String, ?>> data(List<T> data);
    protected abstract int resource();
    protected abstract String[] from();
    protected abstract int[] to();
}

/*
 * Copyright 2011 CodeFlux, Inc <info@teamcodeflux.com>
 *
 * 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.teamcodeflux.android.adapter;

import android.content.Context;
import android.widget.SimpleAdapter;

import java.util.List;
import java.util.Map;

public abstract class AbstractSimpleAdapterBuilder<T> implements SimpleAdapterBuilder {
    protected Context context;
    protected List<T> data;

    public AbstractSimpleAdapterBuilder(final Context context, final List<T> data) {
        this.context = context;
        this.data = data;
    }

    @Override
    public SimpleAdapter build() {
        return new SimpleAdapter(context, data(data), resource(), from(), to());
    }

    protected abstract List<? extends Map<String, ?>> data(List<T> data);
    protected abstract int resource();
    protected abstract String[] from();
    protected abstract int[] to();
}

Change access modifier for builder attributes.

Made fields protected so it can be accessed by subclasses. This is for if a custom subclass of SimpleAdapter is needed.

Signed-off-by: Jhun Mag-atas <81e4780f037db3a872190957a49473577f0839d0@teamcodeflux.com>


package com.gentics.mesh.test.docker;

import static com.gentics.mesh.test.ClientHelper.call;
import static org.junit.Assert.assertEquals;

import org.junit.ClassRule;
import org.junit.Test;

import com.gentics.mesh.core.rest.user.UserListResponse;

import io.vertx.core.Vertx;

public class MeshDockerServerTest {

	@ClassRule
	public static MeshDockerServer server = new MeshDockerServer("gentics/mesh:0.10.0", "dummy", true, Vertx.vertx(), null, null);

	@Test
	public void testDockerImage() {
		UserListResponse response = call(() -> server.getMeshClient().findUsers());
		assertEquals(2, response.getData().size());
	}

}

package com.gentics.mesh.test.docker;

import static com.gentics.mesh.test.ClientHelper.call;
import static org.junit.Assert.assertEquals;

import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;

import com.gentics.mesh.core.rest.user.UserListResponse;

import io.vertx.core.Vertx;

@Ignore
public class MeshDockerServerTest {

	@ClassRule
	public static MeshDockerServer server = new MeshDockerServer("gentics/mesh:0.10.0", "dummy", true, Vertx.vertx(), null, null);

	@Test
	public void testDockerImage() {
		UserListResponse response = call(() -> server.getMeshClient().findUsers());
		assertEquals(2, response.getData().size());
	}

}

Disable test which is not yet working on CI


/*
 *  Copyright 2015 Eric F. Savage, code@efsavage.com
 *
 *   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.ajah.rest.api.model.relay.user;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

/**
 * @author Eric F. Savage, code@efsavage.com.
 */
@JsonInclude(Include.NON_NULL)
public class UserNameRelay {

	public String first;
	public String middle;
	public String last;
	public String suffix;
	public String display;
	public String firstName;
	public String middleName;
	public String lastName;
	public String displayName;

}

/*
 *  Copyright 2015 Eric F. Savage, code@efsavage.com
 *
 *   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.ajah.rest.api.model.relay.user;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

/**
 * @author Eric F. Savage,
 *         code@efsavage.com.
 */
@JsonInclude(Include.NON_NULL)
public class UserNameRelay {

	public String first;
	public String middle;
	public String last;
	public String suffix;
	public String display;
	@Deprecated
	public String firstName;
	@Deprecated
	public String middleName;
	@Deprecated
	public String lastName;
	@Deprecated
	public String displayName;

}

Mark redundant properties as deprecated

Mark redundant properties as deprecated


package info.u_team.u_team_test.entity.render;

import com.mojang.blaze3d.vertex.PoseStack;

import info.u_team.u_team_test.TestMod;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.ZombieRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.monster.Zombie;

public class TestLivingEntityRenderer extends ZombieRenderer {

	private static final ResourceLocation TEXTURE = new ResourceLocation(TestMod.MODID, "textures/entity/test_living/test_living.png");

	public TestLivingEntityRenderer(EntityRendererProvider.Context renderManager) {
		super(renderManager);
	}

	@Override
	protected void scale(Zombie zombie, PoseStack matrixStack, float partialTickTime) {
		matrixStack.scale(1.8F, 1.8F, 1.8F);
		super.scale(zombie, matrixStack, partialTickTime);
	}

	@Override
	public ResourceLocation getTextureLocation(Zombie entity) {
		return TEXTURE;
	}

}

package info.u_team.u_team_test.entity.render;

import com.mojang.blaze3d.vertex.PoseStack;

import info.u_team.u_team_test.TestMod;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.ZombieRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.monster.Zombie;

public class TestLivingEntityRenderer extends ZombieRenderer {

	private static final ResourceLocation TEXTURE = new ResourceLocation(TestMod.MODID, "textures/entity/test_living/test_living.png");

	public TestLivingEntityRenderer(EntityRendererProvider.Context renderManager) {
		super(renderManager);
	}

	@Override
	protected void scale(Zombie zombie, PoseStack poseStack, float partialTickTime) {
		poseStack.scale(1.8F, 1.8F, 1.8F);
		super.scale(zombie, poseStack, partialTickTime);
	}

	@Override
	public ResourceLocation getTextureLocation(Zombie entity) {
		return TEXTURE;
	}

}

Replace matrixStack in test living renderer


package org.wikipedia.onboarding;

import org.wikipedia.settings.Prefs;

public final class PrefsOnboardingStateMachine implements OnboardingStateMachine {
    private static final PrefsOnboardingStateMachine INSTANCE = new PrefsOnboardingStateMachine();

    private final boolean initialTocTutorialEnabled = Prefs.isTocTutorialEnabled();

    public static PrefsOnboardingStateMachine getInstance() {
        return INSTANCE;
    }

    @Override
    public boolean isTocTutorialEnabled() {
        return Prefs.isTocTutorialEnabled();
    }

    @Override
    public void setTocTutorial() {
        Prefs.setTocTutorialEnabled(false);
    }

    @Override
    public boolean isSelectTextTutorialEnabled() {
        return !initialTocTutorialEnabled && Prefs.isSelectTextTutorialEnabled();
    }

    @Override
    public void setSelectTextTutorial() {
        Prefs.setSelectTextTutorialEnabled(false);
    }

    @Override
    public boolean isShareTutorialEnabled() {
        return !initialTocTutorialEnabled
                && !isSelectTextTutorialEnabled()
                && Prefs.isShareTutorialEnabled();
    }

    @Override
    public void setShareTutorial() {
        Prefs.setShareTutorialEnabled(false);
    }

    private PrefsOnboardingStateMachine() { }
}

package org.wikipedia.onboarding;

import org.wikipedia.settings.Prefs;
import java.util.concurrent.TimeUnit;

public final class PrefsOnboardingStateMachine implements OnboardingStateMachine {
    private static final PrefsOnboardingStateMachine INSTANCE = new PrefsOnboardingStateMachine();
    private static final long MIN_MINUTES_PER_TUTORIAL = 1;

    private long millisSinceLastTutorial;

    public static PrefsOnboardingStateMachine getInstance() {
        return INSTANCE;
    }

    @Override
    public boolean isTocTutorialEnabled() {
        // don't care about time since last tutorial here, since the ToC tooltip
        // is always the first one shown.
        return Prefs.isTocTutorialEnabled();
    }

    @Override
    public void setTocTutorial() {
        Prefs.setTocTutorialEnabled(false);
        updateTimeSinceLastTutorial();
    }

    @Override
    public boolean isSelectTextTutorialEnabled() {
        return minutesSinceLastTutorial() >= MIN_MINUTES_PER_TUTORIAL
               && !Prefs.isTocTutorialEnabled() && Prefs.isSelectTextTutorialEnabled();
    }

    @Override
    public void setSelectTextTutorial() {
        Prefs.setSelectTextTutorialEnabled(false);
        updateTimeSinceLastTutorial();
    }

    @Override
    public boolean isShareTutorialEnabled() {
        // don't care about time since last tutorial here, since the share tooltip is
        // tied to the highlight action.
        return !Prefs.isTocTutorialEnabled()
                && !isSelectTextTutorialEnabled()
                && Prefs.isShareTutorialEnabled();
    }

    @Override
    public void setShareTutorial() {
        Prefs.setShareTutorialEnabled(false);
        updateTimeSinceLastTutorial();
    }

    private void updateTimeSinceLastTutorial() {
        millisSinceLastTutorial = System.currentTimeMillis();
    }

    private long minutesSinceLastTutorial() {
        return TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - millisSinceLastTutorial);
    }

    private PrefsOnboardingStateMachine() { }
}

Improve sequencing of ToC and Text-highlight tooltips.

Previously, if the ToC tutorial was shown to the user, then the Highlight
tutorial wouldn't be shown until the app is destroyed and relaunched,
which is not a predictable interval.

This patch guarantees that the Highlight tutorial is shown after the ToC
tutorial, with a minimum time interval of 1 minute between the two
tutorials (so that the user isn't inundated).

Change-Id: I621d179f47c0b606ab24facec06a654e70373c83


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

import org.junit.Test;

import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class InstanceLocalSettingsTest {
    @Test
    public void setAppNameTest() {
        InstanceLocalSettings.INSTANCE.setAppName("XXX");
        assertThat(InstanceLocalSettings.INSTANCE.getAppName(), is("XXX"));
    }

    @Test
    public void getAppNameUnsetTest() {
        assertThat(InstanceLocalSettings.INSTANCE.getAppName(), is(nullValue()));
    }
}

Add missing license header to test

Add missing license header to test


// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.zookeeper.cli;

import com.yahoo.vespa.zookeeper.client.ZkClientConfigBuilder;
import org.apache.zookeeper.ZooKeeperMain;

import java.io.IOException;

/**
 * @author bjorncs
 */
public class Main {
    public static void main(String[] args) throws IOException, InterruptedException {
        new ZkClientConfigBuilder()
                .toConfigProperties()
                .forEach(System::setProperty);
        ZooKeeperMain.main(args);
    }
}

// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.zookeeper.cli;

import com.yahoo.vespa.zookeeper.client.ZkClientConfigBuilder;
import org.apache.zookeeper.ZooKeeperMain;
import org.slf4j.impl.SimpleLogger;

import java.io.IOException;

/**
 * @author bjorncs
 */
public class Main {

    static {
        System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "WARN");
    }

    public static void main(String[] args) throws IOException, InterruptedException {
        new ZkClientConfigBuilder()
                .toConfigProperties()
                .forEach(System::setProperty);
        ZooKeeperMain.main(args);
    }
}

Set default log level to WARN, to avoid excessive INFO log from ZK


package org.fxmisc.richtext.demo.richtext;

import java.util.Optional;

import org.fxmisc.richtext.model.SegmentOps;

public class LinkedImageOps<S> implements SegmentOps<LinkedImage<S>, S> {

    private final EmptyLinkedImage<S> emptySeg = new EmptyLinkedImage<>();

    @Override
    public int length(LinkedImage<S> seg) {
        return seg == emptySeg ? 0 : 1;
    }

    @Override
    public char charAt(LinkedImage<S> seg, int index) {
        return seg == emptySeg ? '\0' : '\ufffc';
    }

    @Override
    public String getText(LinkedImage<S> seg) {
        return seg == emptySeg ? "" : "\ufffc";
    }

    @Override
    public LinkedImage<S> subSequence(LinkedImage<S> seg, int start, int end) {
        if (start < 0) {
            throw new IllegalArgumentException("Start cannot be negative. Start = " + start);
        }
        if (end > length(seg)) {
            throw new IllegalArgumentException("End cannot be greater than segment's length");
        }
        return start == 0 && end == 1
                ? seg
                : emptySeg;
    }

    @Override
    public LinkedImage<S> subSequence(LinkedImage<S> seg, int start) {
        if (start < 0) {
            throw new IllegalArgumentException("Start cannot be negative. Start = " + start);
        }
        return start == 0
                ? seg
                : emptySeg;
    }

    @Override
    public S getStyle(LinkedImage<S> seg) {
        return seg.getStyle();
    }

    @Override
    public LinkedImage<S> setStyle(LinkedImage<S> seg, S style) {
        return seg == emptySeg ? emptySeg : seg.setStyle(style);
    }

    @Override
    public Optional<LinkedImage<S>> join(LinkedImage<S> currentSeg, LinkedImage<S> nextSeg) {
        return Optional.empty();
    }

    @Override
    public LinkedImage<S> createEmpty() {
        return emptySeg;
    }
}

package org.fxmisc.richtext.demo.richtext;

import org.fxmisc.richtext.model.NodeSegmentOpsBase;

public class LinkedImageOps<S> extends NodeSegmentOpsBase<LinkedImage<S>, S> {

    public LinkedImageOps() {
        super(new EmptyLinkedImage<>());
    }

    @Override
    public S realGetStyle(LinkedImage<S> linkedImage) {
        return linkedImage.getStyle();
    }

    @Override
    public LinkedImage<S> realSetStyle(LinkedImage<S> linkedImage, S style) {
        return linkedImage.setStyle(style);
    }

}

Extend base class to reduce boilerplate code


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

import static org.junit.Assert.assertEquals;

public class TetrisTest
{
    @Test
    public void shouldReturnTwo()
    {
        //assertEquals(Tetris.returnTwo(), 2);
    }
}

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

import static org.junit.Assert.assertEquals;

public class TetrisTest
{

}

Add test for the main

Add test for the main


package io.quarkus.runtime.configuration;

import java.io.IOError;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Properties;

import org.eclipse.microprofile.config.spi.ConfigSource;

import io.smallrye.config.PropertiesConfigSource;

/**
 *
 */
public final class BuildTimeConfigFactory {

    public static final String BUILD_TIME_CONFIG_NAME = "META-INF/build-config.properties";

    private BuildTimeConfigFactory() {
    }

    public static ConfigSource getBuildTimeConfigSource() {
        Properties properties = new Properties();
        try (InputStream is = BuildTimeConfigFactory.class.getClassLoader().getResourceAsStream(BUILD_TIME_CONFIG_NAME)) {
            if (is != null)
                try (InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8)) {
                    properties.load(isr);
                }
            return new PropertiesConfigSource(properties, "Build time configuration");
        } catch (IOException e) {
            throw new IOError(e);
        }
    }
}

package io.quarkus.runtime.configuration;

import java.io.IOError;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.Properties;

import org.eclipse.microprofile.config.spi.ConfigSource;

import io.smallrye.config.PropertiesConfigSource;

/**
 *
 */
public final class BuildTimeConfigFactory {

    public static final String BUILD_TIME_CONFIG_NAME = "META-INF/build-config.properties";

    private BuildTimeConfigFactory() {
    }

    public static ConfigSource getBuildTimeConfigSource() {
        Properties properties = new Properties();
        final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        try {
            final Enumeration<URL> resources = classLoader.getResources(BUILD_TIME_CONFIG_NAME);
            if (resources.hasMoreElements()) {
                final URL url = resources.nextElement();
                try (InputStream is = url.openStream()) {
                    if (is != null)
                        try (InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8)) {
                            properties.load(isr);
                        }
                }
            }
            return new PropertiesConfigSource(properties, "Build time configuration");
        } catch (IOException e) {
            throw new IOError(e);
        }
    }
}

Load build config from correct class loader


package fr.insee.rmes.utils;

public class XmlUtils {

	public static String encodeXml(String s) {
		 return s.replaceAll("<([a-zA-Z]+)>", "<$1>") //xml open tag
				 .replaceAll("</([a-zA-Z]+)>", "</$1>") //xml close tag
				 .replaceAll("<([a-zA-Z]+)/>", "<$1/>") //br
				 .replaceAll("<([a-zA-Z]+) />", "<$1 />") //br with space
				 .replaceAll("", " />"); //a href open tag
	}

}

package fr.insee.rmes.utils;

public class XmlUtils {

	public static String encodeXml(String s) {
		 return s.replaceAll("<([a-zA-Z]+)>", "<$1>") //xml open tag
				 .replaceAll("<([a-zA-Z]+) style=("|')(.*?)("|')>", "<$1 style=\"$3\">") //open tag with style
				 .replaceAll("</([a-zA-Z]+)>", "</$1>") //xml close tag
				 .replaceAll("<([a-zA-Z]+)/>", "<$1/>") //br
				 .replaceAll("<([a-zA-Z]+) />", "<$1 />") //br with space
				 .replaceAll("<a href=("|')(.*?)("|')>", " ") //a href open tag
				 .replaceAll("<a title=("|')(.*?)("|') href=("|')(.*?)("|')>", " ") //a title href open tag
		 		.replaceAll("<a href=("|')(.*?)("|') title=("|')(.*?)("|')>", " "); //a href title open tag

	}

}

Add tag with style and improve linktag for xml encoder


// Copyright © 2011-2018, Esko Luontola <www.orfjackal.net>
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

package fi.jumi.actors.eventizers.dynamic;

import fi.jumi.actors.Promise;
import fi.jumi.actors.eventizers.Event;
import fi.jumi.actors.queue.MessageSender;

import javax.annotation.concurrent.ThreadSafe;
import java.lang.reflect.*;
import java.util.concurrent.Future;

@ThreadSafe
public class DynamicListenerToEvent<T> implements InvocationHandler {

    private final MessageSender<Event<T>> target;

    public DynamicListenerToEvent(MessageSender<Event<T>> target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (method.getDeclaringClass().equals(Object.class)) {
            return method.invoke(this, args);
        }
        if (Future.class.isAssignableFrom(method.getReturnType())) {
            Promise.Deferred<T> deferred = Promise.defer();
            target.send(new DynamicEvent<>(method, args, deferred));
            return deferred.promise();
        } else {
            target.send(new DynamicEvent<>(method, args));
            return null;
        }
    }
}

// Copyright © 2011-2018, Esko Luontola <www.orfjackal.net>
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

package fi.jumi.actors.eventizers.dynamic;

import fi.jumi.actors.Promise;
import fi.jumi.actors.eventizers.Event;
import fi.jumi.actors.queue.MessageSender;

import javax.annotation.concurrent.ThreadSafe;
import java.lang.reflect.*;

@ThreadSafe
public class DynamicListenerToEvent<T> implements InvocationHandler {

    private final MessageSender<Event<T>> target;

    public DynamicListenerToEvent(MessageSender<Event<T>> target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (method.getDeclaringClass().equals(Object.class)) {
            return method.invoke(this, args);
        }
        // This check will match the Promise class and all of its superclasses,
        // including the Future interface. Though it would be more obvious to
        // check whether the return type is an instance of Future, that could
        // blow up at runtime (for example if return type is FutureTask) because
        // this wrapper code will always return a Promise to the caller, even if
        // the callee returned some other Future implementation.
        if (method.getReturnType().isAssignableFrom(Promise.class)) {
            Promise.Deferred<T> deferred = Promise.defer();
            target.send(new DynamicEvent<>(method, args, deferred));
            return deferred.promise();
        } else {
            target.send(new DynamicEvent<>(method, args));
            return null;
        }
    }
}

Revert the type check and add a clarifying comment for its non-obviousness

Fixes #5


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

package com.facebook.presto.sql.planner.optimizations;

import java.util.function.Predicate;

public class Predicates
{
    private Predicates() {}

    public static Predicate isInstanceOfAny(Class... classes)
    {
        Predicate predicate = alwaysFalse();
        for (Class clazz : classes) {
            predicate = predicate.or(clazz::isInstance);
        }
        return predicate;
    }

    public static <T> Predicate<T> alwaysTrue()
    {
        return x -> true;
    }

    public static <T> Predicate<T> alwaysFalse()
    {
        return x -> false;
    }
}

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

package com.facebook.presto.sql.planner.optimizations;

import java.util.function.Predicate;

public class Predicates
{
    private Predicates() {}

    public static <T> Predicate<T> isInstanceOfAny(Class... classes)
    {
        Predicate predicate = alwaysFalse();
        for (Class clazz : classes) {
            predicate = predicate.or(clazz::isInstance);
        }
        return predicate;
    }

    public static <T> Predicate<T> alwaysTrue()
    {
        return x -> true;
    }

    public static <T> Predicate<T> alwaysFalse()
    {
        return x -> false;
    }
}

Fix use of raw generics

Fix use of raw generics


public class Constants {
    public static final int PLANETS_PER_PLAYER = 6;
    public static final int EXTRA_PLANETS = 4;

    public static final int DRAG = 3;
    public static final int MAX_SPEED = 30;
    public static final int MAX_ACCELERATION = 10;

    public static final short MAX_SHIP_HEALTH = 255;
    public static final short BASE_SHIP_HEALTH = 255;
    public static final short DOCKED_SHIP_REGENERATION = 0;

    public static final int WEAPON_COOLDOWN = 1;
    public static final int WEAPON_RADIUS = 5;
    public static final int WEAPON_DAMAGE = 128;
    public static final int EXPLOSION_RADIUS = 5;

    public static final int MAX_DOCKING_DISTANCE = 4;
    public static final int DOCK_TURNS = 5;
    public static final int PRODUCTION_PER_SHIP = 100;
    public static final int BASE_PRODUCTIVITY = 25;
    public static final int ADDITIONAL_PRODUCTIVITY = 25;
}

public class Constants {
    public static final int PLANETS_PER_PLAYER = 6;
    public static final int EXTRA_PLANETS = 4;

    public static final int DRAG = 3;
    public static final int MAX_SPEED = 30;
    public static final int MAX_ACCELERATION = 10;

    public static final short MAX_SHIP_HEALTH = 255;
    public static final short BASE_SHIP_HEALTH = 127;
    public static final short DOCKED_SHIP_REGENERATION = 32;

    public static final int WEAPON_COOLDOWN = 1;
    public static final int WEAPON_RADIUS = 5;
    public static final int WEAPON_DAMAGE = 64;

    public static final int MAX_DOCKING_DISTANCE = 4;
    public static final int DOCK_TURNS = 5;
    public static final int PRODUCTION_PER_SHIP = 100;
}

Update game constants in Java starter kit


/**
 * This program and the accompanying materials
 * are made available under the terms of the License
 * which accompanies this distribution in the file LICENSE.txt
 */
package com.archimatetool.editor.actions;

import java.awt.Desktop;
import java.awt.Desktop.Action;
import java.io.File;
import java.io.IOException;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.service.datalocation.Location;

/**
 * Open Archi Data folder
 *
 * @author Phillip Beauvoir
 */
public class OpenDataFolderHandler extends AbstractHandler {

    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        File folder = getInstanceLocation();
        if(folder != null) {
            try {
                Desktop.getDesktop().open(folder);
            }
            catch(IOException ex) {
                ex.printStackTrace();
            }
        }

        return null;
    }

    private File getInstanceLocation() {
        Location instanceLoc = Platform.getInstanceLocation();
        if(instanceLoc != null && instanceLoc.getURL() != null) {
            return new File(Platform.getInstanceLocation().getURL().getPath());
        }
        return null;
    }

    @Override
    public boolean isEnabled() {
        File folder = getInstanceLocation();
        return folder != null && folder.exists() && Desktop.getDesktop().isSupported(Action.OPEN);
    }
}

/**
 * This program and the accompanying materials
 * are made available under the terms of the License
 * which accompanies this distribution in the file LICENSE.txt
 */
package com.archimatetool.editor.actions;

import java.awt.Desktop;
import java.awt.Desktop.Action;
import java.io.File;
import java.io.IOException;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;

import com.archimatetool.editor.ArchiPlugin;

/**
 * Open Archi Data folder
 *
 * @author Phillip Beauvoir
 */
public class OpenDataFolderHandler extends AbstractHandler {

    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        File folder = ArchiPlugin.INSTANCE.getUserDataFolder();
        if(folder != null) {
            try {
                Desktop.getDesktop().open(folder);
            }
            catch(IOException ex) {
                ex.printStackTrace();
            }
        }

        return null;
    }

    @Override
    public boolean isEnabled() {
        File folder = ArchiPlugin.INSTANCE.getUserDataFolder();
        return folder != null && folder.exists() && Desktop.getDesktop().isSupported(Action.OPEN);
    }
}

Change location of Open Data Folder action to @user.home/Documents/Archi


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

package org.apache.camel.cdi.sample.metrics;

import com.codahale.metrics.Meter;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeExchangeException;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;

@ApplicationScoped
public class UnreliableService {

    @Inject
    private Meter attempt;

    public void unreliable(Exchange exchange) {
        attempt.mark();

        if (Math.random() < 0.5)
            throw new RuntimeExchangeException("Random failure", exchange);
    }
}

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

package org.apache.camel.cdi.sample.metrics;

import com.codahale.metrics.Meter;
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeExchangeException;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;

@ApplicationScoped
public class UnreliableService {

    @Inject
    private Meter attempt;

    //@Metered
    // TODO: to activate when global interceptors are supported in PAX CDI
    public void attempt(Exchange exchange) {
        attempt.mark();

        if (Math.random() < 0.5)
            throw new RuntimeExchangeException("Random failure", exchange);
    }
}

Add TODO when PAX CDI will support global interceptors


package de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.datatypes;

import de.uni_stuttgart.vis.vowl.owl2vowl.export.JsonGeneratorVisitor;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.BaseNode;

public abstract class BaseDatatype extends BaseNode {
	protected static int counterObjects = 1;

	protected BaseDatatype() {
	}

	protected abstract void setID();

	@Override
	public void accept(JsonGeneratorVisitor visitor) {
		super.accept(visitor);
		visitor.visit(this);
	}
}

package de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.datatypes;

import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Node_Types;
import de.uni_stuttgart.vis.vowl.owl2vowl.export.JsonGeneratorVisitor;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.BaseNode;

public abstract class BaseDatatype extends BaseNode {
	protected static int counterObjects = 1;

	protected BaseDatatype() {
		setType(Node_Types.TYPE_DATATYPE);
	}

	protected abstract void setID();

	@Override
	public void accept(JsonGeneratorVisitor visitor) {
		super.accept(visitor);
		visitor.visit(this);
	}
}

Set type for general datatype.

Set type for general datatype.


package com.codicesoftware.plugins.hudson.util;

import hudson.model.BooleanParameterValue;
import hudson.model.ParameterValue;
import hudson.model.StringParameterValue;
import org.junit.Test;

import java.util.LinkedList;
import java.util.List;

import static org.junit.Assert.assertEquals;

public class SelectorParametersResolverTest {

    @Test
    public void testResolver() {
        List<ParameterValue> parameters = new LinkedList<>();
        parameters.add(new StringParameterValue("PARAM", "VALUE"));
        parameters.add(new BooleanParameterValue("BOOL", true));

        assertEquals("sample VALUE text", SelectorParametersResolver.resolve("sample $PARAM text", parameters));
        assertEquals("sample VALUE text", SelectorParametersResolver.resolve("sample ${PARAM} text", parameters));
        assertEquals("sample PARAM text", SelectorParametersResolver.resolve("sample PARAM text", parameters));
        assertEquals("sample true text", SelectorParametersResolver.resolve("sample $BOOL text", parameters));
    }

}

package com.codicesoftware.plugins.hudson.util;

import hudson.model.BooleanParameterValue;
import hudson.model.ParameterValue;
import hudson.model.StringParameterValue;
import org.junit.Test;

import java.util.LinkedList;
import java.util.List;

import static org.junit.Assert.assertEquals;

public class SelectorParametersResolverTest {

    @Test
    public void testResolver() {
        List<ParameterValue> parameters = new LinkedList<>();
        parameters.add(new StringParameterValue("PARAM", "VALUE"));
        parameters.add(new BooleanParameterValue("BOOL", true));

        assertEquals("sample VALUE text", SelectorParametersResolver.resolve("sample $PARAM text", parameters));
        assertEquals("sample VALUE text", SelectorParametersResolver.resolve("sample ${PARAM} text", parameters));
        assertEquals("sample PARAM text", SelectorParametersResolver.resolve("sample PARAM text", parameters));
        assertEquals("sample true text", SelectorParametersResolver.resolve("sample $BOOL text", parameters));
    }

    @Test
    public void testLegacyParamsResolver() {
        List<ParameterValue> parameters = new LinkedList<>();
        parameters.add(new StringParameterValue("PARAM", "VALUE"));
        parameters.add(new BooleanParameterValue("BOOL", true));

        assertEquals("sample VALUE text", SelectorParametersResolver.resolve("sample %PARAM% text", parameters));
        assertEquals("sample PARAM text", SelectorParametersResolver.resolve("sample PARAM text", parameters));
        assertEquals("sample true text", SelectorParametersResolver.resolve("sample %BOOL% text", parameters));
    }

    @Test
    public void testMixedFormatsResolver() {
        List<ParameterValue> parameters = new LinkedList<>();
        parameters.add(new StringParameterValue("PARAM", "VALUE"));
        parameters.add(new BooleanParameterValue("BOOL", true));

        assertEquals("sample VALUE VALUE text", SelectorParametersResolver.resolve("sample %PARAM% $PARAM text", parameters));
        assertEquals("sample VALUE VALUE text", SelectorParametersResolver.resolve("sample ${PARAM} %PARAM% text", parameters));
        assertEquals("sample true true text", SelectorParametersResolver.resolve("sample $BOOL %BOOL% text", parameters));
    }
}

Cover the legacy-style parameter resolution with tests


/**
 * Copyright 2016 Palantir Technologies
 *
 * Licensed under the BSD-3 License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * 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.palantir.atlasdb.keyvalue.cassandra;

import java.util.Set;

import com.google.common.collect.ImmutableSet;
import com.palantir.atlasdb.AtlasDbConstants;
import com.palantir.atlasdb.keyvalue.api.TableReference;

class HiddenTables {
    private TableReference lockTable;
    private final Set<TableReference> hiddenTables;
    static final String LOCK_TABLE_PREFIX = "_locks";

    HiddenTables() {
        this.hiddenTables = ImmutableSet.of(
                AtlasDbConstants.TIMESTAMP_TABLE,
                AtlasDbConstants.METADATA_TABLE);
    }

    boolean isHidden(TableReference tableReference) {
        return hiddenTables.contains(tableReference) || (tableReference != null && tableReference.equals(lockTable));
    }

    TableReference getLockTable() {
        return lockTable;
    }

    void setLockTable(TableReference lockTable) {
        this.lockTable = lockTable;
    }
}

/**
 * Copyright 2016 Palantir Technologies
 *
 * Licensed under the BSD-3 License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://opensource.org/licenses/BSD-3-Clause
 *
 * 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.palantir.atlasdb.keyvalue.cassandra;

import java.util.Set;

import com.google.common.collect.ImmutableSet;
import com.palantir.atlasdb.AtlasDbConstants;
import com.palantir.atlasdb.keyvalue.api.TableReference;

class HiddenTables {
    private TableReference lockTable;
    private final Set<TableReference> hiddenTables;
    static final String LOCK_TABLE_PREFIX = "_locks_";

    HiddenTables() {
        this.hiddenTables = ImmutableSet.of(
                AtlasDbConstants.TIMESTAMP_TABLE,
                AtlasDbConstants.METADATA_TABLE);
    }

    boolean isHidden(TableReference tableReference) {
        return hiddenTables.contains(tableReference) || (tableReference != null && tableReference.equals(lockTable));
    }

    TableReference getLockTable() {
        return lockTable;
    }

    void setLockTable(TableReference lockTable) {
        this.lockTable = lockTable;
    }
}

Make locks tables begin with _locks_, not just _locks


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

/**
 * Enumeration for disabling tests conditionally based on the availability of
 * local browsers.
 *
 * @author Boni Garcia
 * @since 4.0.0
 */
public enum Browser {

    CHROME, EDGE, FIREFOX, OPERA, SAFARI;

}

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

/**
 * Enumeration for disabling tests conditionally based on the availability of
 * local browsers.
 *
 * @author Boni Garcia
 * @since 4.0.0
 */
public enum Browser {

    CHROME, EDGE, FIREFOX, CHROMIUM, SAFARI, OPERA;

}

Include Chromium in the browser enum for conditional disabling


/**
 * 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.
 */

/**
 * Commons CLI 1.3
 *
 * @version $Id$
 */
package org.apache.commons.cli;

/**
 * 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.
 */

/**
 * Apache Commons CLI provides a simple API for presenting, processing and validating a command line interface.
 *
 * @version $Id$
 */
package org.apache.commons.cli;

Remove hard coded version from package JavaDoc

git-svn-id: 0504523afcbcb96d4685eab89810948fa7b5e19d@1786656 13f79535-47bb-0310-9956-ffa450edef68


package de.fau.osr.core.vcs.base;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Created by Rajab Kaoneka on 18.05.2015.
 */
public class CommitTest {

    @Test
    public void CommitConstructor_idField_Test(){
        Commit commitToTest = new Commit("new_id", null, null, null);
        assertEquals("commit id should be equal the initialization id", "new_id", commitToTest.id);
    }
}

package de.fau.osr.core.vcs.base;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Created by Rajab Kaoneka on 18.05.2015.
 */
public class CommitTest {

    @Test
    public void CommitConstructor_idField_Test(){
        Commit commitToTest = new Commit("new_id", null, null, null);
        assertEquals("commit id should be equal the initialization id", "new_id", commitToTest.id);
    }

    @Test
    public void CommitConstructor_messageField_Test(){
        Commit commitToTest = new Commit(null, "msg ok", null, null);
        assertEquals("message should be equal the initialization message", "msg ok", commitToTest.message);
    }
}

Test for Commit, testing message initialization


package GUI;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

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

public class App extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    public void start(Stage stageIn) throws UnsupportedEncodingException, FileNotFoundException {
        stage = stageIn;
        stage.setTitle("Programming Life");
        loadScene("/FXML/Menu.fxml");
    }

    private static Stage stage;
    private static AnchorPane pane;

    public static FXMLLoader loadScene(String path) {

        try {
            // Load the anchor pane
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(App.class.getResource(path));
            pane = loader.load();

            // Set the pane onto the scene
            Scene scene = new Scene(pane);
            stage.setScene(scene);
            stage.setResizable(true);
            stage.show();
            System.out.println(path + " loaded on the stage");
            return loader;
        } catch (IOException e) {
            e.printStackTrace();
            System.out
                    .println("Something went wrong while loading the fxml file");
        }
        return null;
    }

}

package GUI;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

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

public class App extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    public void start(Stage stageIn) throws UnsupportedEncodingException, FileNotFoundException {
        stage = stageIn;
        stage.setTitle("Programming Life");
        loadScene("/FXML/Menu.fxml");
    }

    private static Stage stage;
    private static AnchorPane pane;

    public static FXMLLoader loadScene(String path) {

        try {
            // Load the anchor pane
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(App.class.getResource(path));
            pane = loader.load();

            // Set the pane onto the scene
            Scene scene = new Scene(pane);
            stage.setScene(scene);
            stage.setResizable(true);
            stage.setMaximized(true);
            stage.show();
            System.out.println(path + " loaded on the stage");
            return loader;
        } catch (IOException e) {
            e.printStackTrace();
            System.out
                    .println("Something went wrong while loading the fxml file");
        }
        return null;
    }

}

Set stage to maximized screen

Set stage to maximized screen


/**
 * Copyright (c) 2016-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

package com.facebook.redexlinemap;

import static org.fest.assertions.api.Assertions.*;

import java.util.Arrays;
import java.util.List;
import org.junit.Test;

public class DisabledLineMapTest {

  @NoInline
  private void wrapsThrow() throws Exception {
    throw new Exception("foo");
  }

  private void inlinedThrower() throws Exception {
    wrapsThrow();
  }

  @Test
  public void testStackTraceWithoutLineMap() {
    try {
      inlinedThrower();
    } catch (Exception e) {
      List<StackTraceElement> trace = Arrays.asList(e.getStackTrace());
      assertThat(TraceUtil.traceToString(trace, 2)).isEqualTo(Arrays.asList(
       "com.facebook.redexlinemap.DisabledLineMapTest.wrapsThrow(DisabledLineMapTest.java:22)",
       "com.facebook.redexlinemap.DisabledLineMapTest.testStackTraceWithoutLineMap(DisabledLineMapTest.java:26)"));
    }
  }
}

/**
 * Copyright (c) 2016-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

package com.facebook.redexlinemap;

import static org.fest.assertions.api.Assertions.*;

import java.util.Arrays;
import java.util.List;
import org.junit.Test;

public class DisabledLineMapTest {

  @NoInline
  private void wrapsThrow() throws Exception {
    throw new Exception("foo");
  }

  private void inlinedThrower() throws Exception {
    wrapsThrow();
  }

  @Test
  public void testStackTraceWithoutLineMap() {
    try {
      inlinedThrower();
    } catch (Exception e) {
      List<StackTraceElement> trace = Arrays.asList(e.getStackTrace());
      assertThat(TraceUtil.traceToString(trace, 3)).isEqualTo(Arrays.asList(
       "com.facebook.redexlinemap.DisabledLineMapTest.wrapsThrow(DisabledLineMapTest.java:22)",
       "com.facebook.redexlinemap.DisabledLineMapTest.testStackTraceWithoutLineMap(DisabledLineMapTest.java:26)",
       "java.lang.reflect.Method.invokeNative(Native Method)"));
    }
  }
}

Revert D6139620: [redex] Fix line_map tests

Summary:
This reverts commit 120d0731995f10ef4969d06cd9109c0585107ac2

bypass-lint

Differential Revision: D6139620

fbshipit-source-id: 59ed38a5e980f7684ad413d8d77bf89a0f180070


package com.hartwig.healthchecks.nesbit.extractor;

import com.hartwig.healthchecks.nesbit.model.VCFType;

import org.jetbrains.annotations.NotNull;

final class VCFExtractorFunctions {

    private static final int ALT_INDEX = 4;
    private static final int REF_INDEX = 3;
    private static final String MULTIPLE_ALTS_IDENTIFIER = ",";

    private VCFExtractorFunctions() {
    }

    @NotNull
    static VCFType getVCFType(@NotNull final String[] values) {
        final String refValue = values[REF_INDEX];
        final String altValue = values[ALT_INDEX];

        final String[] allAlts = altValue.split(MULTIPLE_ALTS_IDENTIFIER);

        return allAlts[0].length() != refValue.length() ? VCFType.INDELS : VCFType.SNP;

        //        VCFType type = VCFType.SNP;
        //
        //        for (String alt : allAlts) {
        //            if (refValue.length() != alt.length()) {
        //                type = VCFType.INDELS;
        //            }
        //        }
        //        return type;
    }
}

package com.hartwig.healthchecks.nesbit.extractor;

import com.hartwig.healthchecks.nesbit.model.VCFType;

import org.jetbrains.annotations.NotNull;

final class VCFExtractorFunctions {

    private static final int ALT_INDEX = 4;
    private static final int REF_INDEX = 3;
    private static final String MULTIPLE_ALTS_IDENTIFIER = ",";

    private VCFExtractorFunctions() {
    }

    @NotNull
    static VCFType getVCFType(@NotNull final String[] values) {
        final String refValue = values[REF_INDEX];
        final String altValue = values[ALT_INDEX];

        final String[] allAlts = altValue.split(MULTIPLE_ALTS_IDENTIFIER);

        VCFType type = VCFType.SNP;

        for (String alt : allAlts) {
            if (refValue.length() != alt.length()) {
                type = VCFType.INDELS;
            }
        }
        return type;
    }
}

Revert to original solution for vcf type determination


package org.jetbrains.plugins.scala.refactoring.introduceVariable;

import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.Sdk;
import junit.framework.Test;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.plugins.scala.base.ScalaLibraryLoader;
import org.jetbrains.plugins.scala.util.TestUtils;
import scala.Option$;

/**
 * @author Alexander Podkhalyuzin
 */
public class IntroduceVariableTest extends AbstractIntroduceVariableTestBase {
  @NonNls
  private static final String DATA_PATH = "/introduceVariable/data";

  public IntroduceVariableTest() {
    super(TestUtils.getTestDataPath() + DATA_PATH);
  }

  public static Test suite() {
    return new IntroduceVariableTest();
  }

  @Override
  protected void setUp(Project project) {
    super.setUp(project);
    Module[] modules = ModuleManager.getInstance(project).getModules();
    Sdk sdk = JavaSdk.getInstance().createJdk("java sdk", TestUtils.getMockJdk(), false);
    ScalaLibraryLoader loader = new ScalaLibraryLoader(project, modules[0], null, false, false, Option$.MODULE$.apply(sdk));
    loader.loadLibrary(TestUtils.DEFAULT_SCALA_SDK_VERSION);
  }
}

package org.jetbrains.plugins.scala.refactoring.introduceVariable;

import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess;
import junit.framework.Test;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.plugins.scala.base.ScalaLibraryLoader;
import org.jetbrains.plugins.scala.util.TestUtils;
import scala.Option$;

/**
 * @author Alexander Podkhalyuzin
 */
public class IntroduceVariableTest extends AbstractIntroduceVariableTestBase {
  @NonNls
  private static final String DATA_PATH = "/introduceVariable/data";

  public IntroduceVariableTest() {
    super(TestUtils.getTestDataPath() + DATA_PATH);
  }

  public static Test suite() {
    return new IntroduceVariableTest();
  }

  @Override
  protected void setUp(Project project) {
    super.setUp(project);
    Module[] modules = ModuleManager.getInstance(project).getModules();
    String mockJdk = TestUtils.getMockJdk();
    VfsRootAccess.allowRootAccess(mockJdk);
    Sdk sdk = JavaSdk.getInstance().createJdk("java sdk", mockJdk, false);
    ScalaLibraryLoader loader = new ScalaLibraryLoader(project, modules[0], null, false, false, Option$.MODULE$.apply(sdk));
    loader.loadLibrary(TestUtils.DEFAULT_SCALA_SDK_VERSION);
  }
}

Allow root access for mock jdk in introduce variable test


// SPDX-License-Identifier: MIT

package mealplaner.io.xml.model.v3;

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

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class RecipeXml {
  public final int numberOfPortions;
  @XmlElementWrapper(name = "meals")
  @XmlElement(name = "meal")
  public final List<QuantitativeIngredientXml> quantitativeIngredients;

  public RecipeXml() {
    this(1, new ArrayList<>());
  }

  public RecipeXml(Integer numberOfPortions, List<QuantitativeIngredientXml> quantitativeIngredients) {
    this.numberOfPortions = numberOfPortions;
    this.quantitativeIngredients = quantitativeIngredients;
  }
}

// SPDX-License-Identifier: MIT

package mealplaner.io.xml.model.v3;

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

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class RecipeXml {
  public final int numberOfPortions;
  @XmlElementWrapper(name = "ingredients")
  @XmlElement(name = "ingredient")
  public final List<QuantitativeIngredientXml> quantitativeIngredients;

  public RecipeXml() {
    this(1, new ArrayList<>());
  }

  public RecipeXml(Integer numberOfPortions, List<QuantitativeIngredientXml> quantitativeIngredients) {
    this.numberOfPortions = numberOfPortions;
    this.quantitativeIngredients = quantitativeIngredients;
  }
}

Fix xml tags for ingredients

Fix xml tags for ingredients


public class ShipMarket extends Market {
	List<Ship> ships;
	public void dissassembleShip() {

	}
	public void buyShip(Ship selectedShip) {

	}
}

public class ShipMarket extends Market {
	List<Ship> ships;
	public void disassembleShip() {

	}
	public void buyShip(Ship selectedShip) {

	}
}

Fix typo in method name

Fix typo in method name


package net.simpvp.Portals;

import java.util.ArrayList;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;

/**
 * Checks all broken obsidian blocks, checking that they were not part of
 * a portal that now will have to be deactivated. If they were, deactivate
 * said portal(s).
 */
public class BlockBreak implements Listener {

	@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled=true)
	public void onBlockBreak(BlockBreakEvent event) {
		if (event.getBlock().getType() != Material.OBSIDIAN)
			return;

		Block block = event.getBlock();
		ArrayList<PortalLocation> portals = SQLite.obsidian_checker(block);

		for (PortalLocation portal : portals) {
			if (PortalCheck.is_valid_portal(portal.block, block) == false) {
				Portals.instance.getLogger().info("Query returned positive. "
						+ "Disabling this portal at "
						+ portal.block.getWorld().getName() + " "
						+ portal.block.getX() + " "
						+ portal.block.getY() + " "
						+ portal.block.getZ());
				SQLite.delete_portal_pair(portal.id);
			}
		}
	}
}

package net.simpvp.Portals;

import java.util.ArrayList;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;

/**
 * Checks all broken obsidian blocks, checking that they were not part of
 * a portal that now will have to be deactivated. If they were, deactivate
 * said portal(s).
 */
public class BlockBreak implements Listener {

	@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled=true)
	public void onBlockBreak(BlockBreakEvent event) {
		if (event.getBlock().getType() != Material.OBSIDIAN)
			return;

		Block block = event.getBlock();
		ArrayList<PortalLocation> portals = SQLite.obsidian_checker(block);

		for (PortalLocation portal : portals) {
			if (PortalCheck.is_valid_portal(portal.block, block) == false) {
				Portals.instance.getLogger().info("Query returned positive by " + event.getPlayer().getName()
						+ ". Disabling this portal at "
						+ portal.block.getWorld().getName() + " "
						+ portal.block.getX() + " "
						+ portal.block.getY() + " "
						+ portal.block.getZ());
				SQLite.delete_portal_pair(portal.id);
			}
		}
	}
}

Add player name to log about portal disabling


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

package org.apache.tapestry5.integration.app1.pages;

import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.ioc.annotations.Inject;

public class ActionViaLinkDemo
{
    @Persist(PersistenceConstants.FLASH)
    private String message;

    @Inject
    private ComponentResources resources;

    Object[]
    onPassivate()
    {
        return new Object[] { };
    }

    public String getMessage()
    {
        return message;
    }

    void onUpdateMessage(String message)
    {
        getActionURL();

        this.message = message;
    }

    public String getActionURL()
    {
        Link link = resources.createEventLink("UpdateMessage", false, "from getActionURL()");

        return link.toURI();
    }
}

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

package org.apache.tapestry5.integration.app1.pages;

import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.ioc.annotations.Inject;

public class ActionViaLinkDemo
{
    @Persist(PersistenceConstants.FLASH)
    private String message;

    @Inject
    private ComponentResources resources;

    Object[]
    onPassivate()
    {
        return new Object[]{};
    }

    public String getMessage()
    {
        return message;
    }

    void onUpdateMessage(String message)
    {
        this.message = message;
    }

    public String getActionURL()
    {
        Link link = resources.createEventLink("UpdateMessage", "from getActionURL()");

        return link.toURI();
    }
}

Make a correction to how the event link is created


package org.javamoney.moneybook.chapter.three;

import org.javamoney.moneta.Money;
import org.javamoney.moneta.function.MonetaryOperators;

import javax.money.CurrencyUnit;
import javax.money.Monetary;
import javax.money.MonetaryAmount;
import java.util.Locale;

/**
 * Created by otaviojava on 27/05/15.
 */
public class MonetaryOperatorsExample {

    public static void main(String[] args) {
        CurrencyUnit currency = Monetary.getCurrency("BRL");
        CurrencyUnit dollar = Monetary.getCurrency(Locale.US);

        MonetaryAmount money = Money.of(120.231, currency);

        MonetaryAmount majorPartResult = money.with(MonetaryOperators.majorPart());//BRL 120
        MonetaryAmount minorPartResult = money.with(MonetaryOperators.minorPart());//BRL 0.231
        MonetaryAmount percentResult = money.with(MonetaryOperators.percent(20));//BRL 24.0462
        MonetaryAmount permilResult = money.with(MonetaryOperators.permil(100));//BRL 12.0231
        MonetaryAmount roundingResult = money.with(MonetaryOperators.rounding());//BRL 120.23
        MonetaryAmount resultExchange = money.with(MonetaryOperators.exchange(dollar));//USD 120.231
    }
}

package org.javamoney.moneybook.chapter.three;

import java.util.Locale;

import javax.money.CurrencyUnit;
import javax.money.Monetary;
import javax.money.MonetaryAmount;

import org.javamoney.moneta.Money;
import org.javamoney.moneta.convert.ConversionOperators;
import org.javamoney.moneta.function.MonetaryOperators;

/**
 * Created by otaviojava on 27/05/15.
 */
public class MonetaryOperatorsExample {

    public static void main(String[] args) {
        CurrencyUnit currency = Monetary.getCurrency("BRL");
        CurrencyUnit dollar = Monetary.getCurrency(Locale.US);

        MonetaryAmount money = Money.of(120.231, currency);

        MonetaryAmount majorPartResult = money.with(MonetaryOperators.majorPart());//BRL 120
        MonetaryAmount minorPartResult = money.with(MonetaryOperators.minorPart());//BRL 0.231
        MonetaryAmount percentResult = money.with(MonetaryOperators.percent(20));//BRL 24.0462
        MonetaryAmount permilResult = money.with(MonetaryOperators.permil(100));//BRL 12.0231
        MonetaryAmount roundingResult = money.with(MonetaryOperators.rounding());//BRL 120.23
        MonetaryAmount resultExchange = money.with(ConversionOperators.exchange(dollar));//USD 120.231
    }
}

Update the Operator with the new Classe ConversionOperatos


/*
 * Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except
 * in compliance with the License. A copy of the License is located at
 *
 * http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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.amazonaws.services.dynamodbv2.mapper.encryption;

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.datamodeling.AttributeEncryptor;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperConfig;

public class TestDynamoDBMapperFactory {
    public static DynamoDBMapper createDynamoDBMapper(AmazonDynamoDB dynamo) {
        return new DynamoDBMapper(dynamo,
                DynamoDBMapperConfig.DEFAULT,
                new AttributeEncryptor(new TestEncryptionMaterialsProvider()));
    }

    public static DynamoDBMapper createDynamoDBMapper(AmazonDynamoDB dynamo, DynamoDBMapperConfig config) {
        return new DynamoDBMapper(dynamo,
                config,
                new AttributeEncryptor(new TestEncryptionMaterialsProvider()));
    }
}

/*
 * Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except
 * in compliance with the License. A copy of the License is located at
 *
 * http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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.amazonaws.services.dynamodbv2.mapper.encryption;

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.datamodeling.AttributeEncryptor;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperConfig;

public class TestDynamoDBMapperFactory {
    public static DynamoDBMapper createDynamoDBMapper(AmazonDynamoDB dynamo) {
        return new DynamoDBMapper(dynamo,
                DynamoDBMapperConfig.builder().withSaveBehavior(DynamoDBMapperConfig.SaveBehavior.PUT).build(),
                new AttributeEncryptor(new TestEncryptionMaterialsProvider()));
    }

    public static DynamoDBMapper createDynamoDBMapper(AmazonDynamoDB dynamo, DynamoDBMapperConfig config) {
        return new DynamoDBMapper(dynamo,
                config,
                new AttributeEncryptor(new TestEncryptionMaterialsProvider()));
    }
}

Modify DynamoDBMapperFactory to return PUT configured mappers

The default behavior now throws a DynamoDBMappingException on DEFAULT
SaveBehavior. Update the integration tests to run against PUT instead.


/**
 * Copyright (c) 2018, RTE (http://www.rte-france.com)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package eu.itesla_project.case_projector;

import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import com.powsybl.commons.config.InMemoryPlatformConfig;
import com.powsybl.commons.config.PlatformConfig;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.nio.file.FileSystem;

public class CaseProjectorPostProcessorTest {

    private FileSystem fileSystem;
    private PlatformConfig platformConfig;

    private PlatformConfig createEmptyPlatformConfig() {
        fileSystem = Jimfs.newFileSystem(Configuration.unix());
        platformConfig = new InMemoryPlatformConfig(fileSystem);
        return platformConfig;
    }

    @Before
    public void setUp() throws Exception {
        fileSystem = Jimfs.newFileSystem(Configuration.unix());
        platformConfig = createEmptyPlatformConfig();
    }

    @After
    public void tearDown() throws Exception {
        fileSystem.close();
    }

    @Test
    public void testInstCaseProjectorPostProcessor() throws Exception {
        //when there is no case-projector section, in the configuration, this constructor should not throw any exception
        CaseProjectorPostProcessor postProcessor = new CaseProjectorPostProcessor();
    }
}

Add end of line character

Add end of line character


package com.ssu.schedule.model;

public class Day {
    private String start = "01.09.2016";
    private String end = "01.07.2017";
    private int weekday;

    private int week = 0;

    public void setWeekday(int weekday) {
        this.weekday = weekday;
    }

    public void setWeek(int week) {
        this.week = week;
    }

    public int getWeekday() {
        return weekday;
    }

    public int getWeek() {
        return week;
    }

    public String getStart() {
        return start;
    }

    public void setStart(String start) {
        this.start = start;
    }

    public String getEnd() {
        return end;
    }

    public void setEnd(String end) {
        this.end = end;
    }
}

package com.ssu.schedule.model;

public class Day {
    private String start = "01.09.2017";
    private String end = "01.07.2018";
    private int weekday;

    private int week = 0;

    public void setWeekday(int weekday) {
        this.weekday = weekday;
    }

    public void setWeek(int week) {
        this.week = week;
    }

    public int getWeekday() {
        return weekday;
    }

    public int getWeek() {
        return week;
    }

    public String getStart() {
        return start;
    }

    public void setStart(String start) {
        this.start = start;
    }

    public String getEnd() {
        return end;
    }

    public void setEnd(String end) {
        this.end = end;
    }
}

Update date for new study year

fix(date): Update date for new study year


package org.spoofax.jsglr2.imploder;

import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.jsglr2.parseforest.hybrid.HybridParseForest;

public class NullParseForestStrategoImploder implements IImploder<HybridParseForest, IStrategoTerm> {

    @Override public ImplodeResult<IStrategoTerm> implode(String input, String filename, HybridParseForest forest) {
        return null;
    }

}

package org.spoofax.jsglr2.imploder;

import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.jsglr2.parseforest.IParseForest;

public class NullParseForestStrategoImploder implements IImploder<IParseForest, IStrategoTerm> {

    @Override public ImplodeResult<IStrategoTerm> implode(String input, String filename, IParseForest forest) {
        return null;
    }

}

Fix incorrect specialized type parameter


package org.inaetics.dronessimulator.drone.droneinit;

import org.apache.felix.dm.DependencyActivatorBase;
import org.apache.felix.dm.DependencyManager;
import org.inaetics.dronessimulator.discovery.api.Discoverer;
import org.osgi.framework.BundleContext;

public class Activator extends DependencyActivatorBase {
    @Override
    public void init(BundleContext bundleContext, DependencyManager dependencyManager) throws Exception {
        dependencyManager.add(createComponent()
                .setInterface(DroneInit.class.getName(), null)
                .setImplementation(DroneInit.class)
                .add(createServiceDependency()
                        .setService(Discoverer.class)
                        .setRequired(true)
                )
                .setCallbacks("init", "start", "stop", "destroy")
        );
    }
}

package org.inaetics.dronessimulator.drone.droneinit;

import org.apache.felix.dm.DependencyActivatorBase;
import org.apache.felix.dm.DependencyManager;
import org.inaetics.dronessimulator.discovery.api.Discoverer;
import org.inaetics.dronessimulator.pubsub.api.subscriber.Subscriber;
import org.osgi.framework.BundleContext;

public class Activator extends DependencyActivatorBase {
    @Override
    public void init(BundleContext bundleContext, DependencyManager dependencyManager) throws Exception {
        dependencyManager.add(createComponent()
                .setInterface(DroneInit.class.getName(), null)
                .setImplementation(DroneInit.class)
                .add(createServiceDependency()
                        .setService(Subscriber.class)
                        .setRequired(true)
                )
                .add(createServiceDependency()
                        .setService(Discoverer.class)
                        .setRequired(true)
                )
                .setCallbacks("init", "start", "stop", "destroy")
        );
    }
}

Add Subscriber dependency to droninit

Add Subscriber dependency to droninit


package org.apache.cordova.appsettings;

import java.util.Locale;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class AppSettings extends CordovaPlugin {

    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    	JSONObject options = new JSONObject();
        if (action.equals("get")) {
        	try{
                for(int i=0;i<args.length();i++){
        	        String key=args.getString(i);
                    String keyvalue = cordova.getActivity().getIntent().getStringExtra(key.toLowerCase(Locale.getDefault()));
                    if (keyvalue != null) {
                        options.put(key, keyvalue);
                    }
                }
                callbackContext.success(options);
        	} catch (Exception ex) {
            	callbackContext.error(0);
            }
            return true;
        }
        return false;
    }
}

package org.apache.cordova.appsettings;

import java.util.Locale;

import android.app.Activity;

import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class AppSettings extends CordovaPlugin {
    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
        JSONObject options = new JSONObject();
        if (action.equals("get")) {

            try{
                for(int i=0;i<args.length();i++){
                    String key=args.getString(i);
                    PackageManager pm = cordova.getActivity().getApplication().getPackageManager();
                    String packageName = cordova.getActivity().getApplication().getPackageName();
                    ApplicationInfo appInfo = pm.getApplicationInfo(packageName, pm.GET_META_DATA);
                    String keyvalue = appInfo.metaData.getString(key);
                    if (keyvalue != null) {
                        options.put(key, keyvalue);
                    }
                }
                callbackContext.success(options);
            } catch (Exception ex) {
                callbackContext.error(0);
            }
            return true;
        }
        return false;
    }
}

Update src to read top level metatags for android


package io.quarkus.vault.runtime.config;

import java.util.Arrays;

import org.eclipse.microprofile.config.spi.ConfigSource;
import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
import org.jboss.logging.Logger;

public class VaultConfigSourceProvider implements ConfigSourceProvider {

    private static final Logger log = Logger.getLogger(VaultConfigSourceProvider.class);

    private VaultBootstrapConfig vaultBootstrapConfig;

    public VaultConfigSourceProvider(VaultBootstrapConfig vaultBootstrapConfig) {
        this.vaultBootstrapConfig = vaultBootstrapConfig;
    }

    @Override
    public Iterable<ConfigSource> getConfigSources(ClassLoader forClassLoader) {
        return Arrays.asList(new VaultConfigSource(150, vaultBootstrapConfig));
    }
}

package io.quarkus.vault.runtime.config;

import java.util.Arrays;

import org.eclipse.microprofile.config.spi.ConfigSource;
import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
import org.jboss.logging.Logger;

public class VaultConfigSourceProvider implements ConfigSourceProvider {

    private static final Logger log = Logger.getLogger(VaultConfigSourceProvider.class);

    private VaultBootstrapConfig vaultBootstrapConfig;

    public VaultConfigSourceProvider(VaultBootstrapConfig vaultBootstrapConfig) {
        this.vaultBootstrapConfig = vaultBootstrapConfig;
    }

    @Override
    public Iterable<ConfigSource> getConfigSources(ClassLoader forClassLoader) {
        // 270 is higher than the file system or jar ordinals, but lower than env vars
        return Arrays.asList(new VaultConfigSource(270, vaultBootstrapConfig));
    }
}

Change ordinal from 150 to 270 in Vault config source