text:
package br.ita.bditac.test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.offset;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
import static org.springframework.restdocs.request.RequestDocumentation.pathParameters;
import static org.springframework.restdocs.request.RequestDocumentation.requestParameters;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.hal.Jackson2HalModule;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.restdocs.RestDocumentation;
import org.springframework.restdocs.payload.JsonFieldType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.client.ResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.util.UriComponentsBuilder;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.joda.JodaModule;

import br.ita.bditac.app.Application;
import br.ita.bditac.model.Alerta;
import br.ita.bditac.model.Crise;
import br.ita.bditac.ws.support.AlertaResource;
import br.ita.bditac.ws.support.AlertaResources;
import br.ita.bditac.ws.support.CriseResource;
import br.ita.bditac.ws.support.MessageResource;

/**
 *
 * = Testes unitários do serviço de Alertas para o BD-ITAC.
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@IntegrationTest("server.port:0")
@WebAppConfiguration
@ActiveProfiles("hateoas")
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MockAlertTests {

    private static final double DELTA = 1e-6;

    private static String _foto = null;

    @Configuration
    @EnableConfigurationProperties
    @ConfigurationProperties(prefix="info.build")
    class MockSettings {

    	private String version;

		public String getVersion() {
			return version;
		}

    }

    class ClientErrorHandler implements ResponseErrorHandler {

        public void handleError(ClientHttpResponse response) throws IOException {

        }

        public boolean hasError(ClientHttpResponse response) throws IOException {
            if ((response.getStatusCode().series() == HttpStatus.Series.CLIENT_ERROR) || (response.getStatusCode().series() == HttpStatus.Series.SERVER_ERROR)) {
                return true;
            }

            return false;
        }

    }

    RestTemplate getRestTemplate() {

        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
        mapper.registerModules(new Jackson2HalModule(), new JodaModule());

        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
        converter.setSupportedMediaTypes(Arrays.asList(MediaTypes.HAL_JSON));
        converter.setObjectMapper(mapper);

        RestTemplate restTemplate = new RestTemplate(Collections.<HttpMessageConverter<?>> singletonList(converter));
        restTemplate.setErrorHandler(new ClientErrorHandler());

        return restTemplate;

    }

    String getFoto() throws IOException {

    	if(_foto == null) {
	        byte[] binaryFile = Files.readAllBytes(Paths.get(Thread.currentThread().getContextClassLoader().getResource("foto.png").getPath()));
	        _foto = new String (binaryFile, StandardCharsets.UTF_8);
    	}

		return _foto;

    }

    @Value("${local.server.port}")
    private int port;

    @Autowired
    WebApplicationContext context;

    @Rule
    public RestDocumentation restDocumentation = new RestDocumentation("target/generated-docs");

    protected MockMvc mvc;

    protected String getBaseUrl() {
        return "http://localhost:" + port;
    }

    @Before
    public void setup() {
        mvc = MockMvcBuilders.webAppContextSetup(context).apply(documentationConfiguration(this.restDocumentation)).build();
    }

    @Test
    public void test000BootstrapsWebApp() {
        assertThat(mvc).isNotNull();
    }

    /**
     *
     * = TS02-US09
     *
     * == Asserção:
     *
     * Testa a inclusão de um crise de crise usando o seriço de Alertas.
     *
     * == Dados:
     *
     * Uma estrutura de dados contendo o crise.
     *
     * === Estrutura de dados
     *
     * [source,java]
     * --
     *  Crise criseRequest = new Crise(
     *          "Deslizamento na na favela do Paraiso",
     *          0,
     *          "Ze das Couves",
     *          "zedascouves@gmail.com",
     *          "(12) 99876-1234");
     * --
     *
     * == Execução:
     *
     * Uma chamada ao serviço de Alertas.
     *
     * ==Resultado esperado:
     *
     * Uma estrutura de dados com a mesma informação da estrutura enviada.
     *
     * === Estrutura de dados
     *
     * [source,java]
     * --
     *  Crise criseRequest = new Crise(
     *          "Deslizamento na na favela do Paraiso",
     *          0,
     *          "Ze das Couves",
     *          "zedascouves@gmail.com",
     *          "(12) 99876-1234",
     *          40.0,
     *          50.0
     *          foto);
     * --
     *
     */
    @Test
    public void test101PostCriseGerarAlerta() throws Exception {
        URI criseURI = new URI(getBaseUrl() + "/crise");

        Crise criseRequest = new Crise(
                "Deslizamento na na favela do Paraiso",
                1,
                "Ze das Couves",
                "zedascouves@gmail.com",
                "(12) 99876-1234",
                40.0,
                50.0,
                getFoto());

        ResponseEntity<MessageResource> criseResponseEntity =  getRestTemplate().postForEntity(criseURI, new HttpEntity<Crise>(criseRequest), MessageResource.class);

        assertThat(criseResponseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
    }

    /**
     *
     * = TS02-US09
     *
     * == Asserção:
     *
     * Testa a inclusão de um crise de crise usando o seriço de Alertas:
     *
     * == Dados:
     *
     * Identificação da crise na requisição.
     *
     * == Execução:
     *
     * Uma chamada ao serviço de Alertas.
     *
     * == Resultado esperado:
     *
     * O código de estado da chamada deve ser o código HTTP 404 (NOT FOUND).
     *
     */
    @Test
    public void test103GetCriseInexistente() throws Exception {
        String criseURL = getBaseUrl() + "/crise/{id}";

        Map<String, Integer> params = new HashMap<String, Integer>();
        params.put("id", 100);

        ResponseEntity<CriseResource> criseResponseEntity = getRestTemplate().getForEntity(criseURL, CriseResource.class, params);

        assertThat(criseResponseEntity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
    }

    /**
     *
     * = TS02-US09
     *
     * == Asserção:
     *
     * Testa a obtenção de um alerta de crise do seriço de Alertas:
     *
     * == Dados:
     *
     * Identificação do alerta na requisição.
     *
     * == Execução:
     *
     * Uma chamada ao serviço de Alertas.
     *
     * == Resultado esperado:
     *
     * Uma estrutura de dados com os dados do alerta.
     *
     * === Estrutura de dados
     *
     * [source,java]
     * --
     *  Alerta alertaRequest = new Alerta(
     *          "Alerta de deslizamento",
     *          "Perigo de deslizamento na altura do Km 20 da rodovia Tamoios, pista Sao Jose dos Campos/Litoral",
     *          5,
     *          5,
     *          0,
     *          40.0,
     *          50.0,
     *          1.0);
     * --
     *
     */
    @Test
    public void test105GetAlerta() throws URISyntaxException {
        String alertaUrl = getBaseUrl() + "/alerta";

        ResponseEntity<AlertaResource> alertaResponseEntity = getRestTemplate().getForEntity(alertaUrl, AlertaResource.class);

        assertThat(alertaResponseEntity.getStatusCode() == HttpStatus.OK);
    }

    /**
     *
     * = TS02-US09
     *
     * == Asserção:
     *
     * Testa a obtenção de alertas dentro de uma área identificada por um ponto geográfico e um raio no seriço de Alertas:
     *
     * == Dados:
     *
     * Identificação da área de pesquisa desejada.
     *
     * === Dados informados:
     *
     * [source,java]
     * --
     *  Map<String, Double> params = new HashMap<String, Double>();
     *  params.put("latitude", 40.0);
     *  params.put("longitude", 50.0);
     *  params.put("raio", 1D);
     * --
     *
     * == Execução:
     *
     * Uma chamada ao serviço de Alertas.
     *
     * == Resultado esperado:
     *
     * Uma lista de dados com os dados dos alertas na área informada.
     *
     * === Estrutura de dados
     *
     * [source,java]
     * --
     *  Alerta alertaRequest = new Alerta(
     *          "Alerta de deslizamento",
     *          "Perigo de deslizamento na altura do Km 20 da rodovia Tamoios, pista Sao Jose dos Campos/Litoral",
     *          5,
     *          5,
     *          0,
     *          40.0,
     *          50.0,
     *          1.0);
     * --
     *
     */
    @Test
    public void test107GetAlertasByCoords() throws Exception {
        DecimalFormat df=new DecimalFormat("#0.000000");
        SimpleDateFormat tf=new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
        df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.US));
        UriComponentsBuilder uriComponentsBuilder=UriComponentsBuilder.fromHttpUrl(getBaseUrl() + "/rest/avisos/nearbyWarnings").
            queryParam("timestamp", "'" + tf.format(0) + "'").
            queryParam("latitude", df.format(40)).
            queryParam("longitude", df.format(50)).
            queryParam("raio", df.format(1));

        ResponseEntity<AlertaResources> resources = getRestTemplate().getForEntity(uriComponentsBuilder.build().encode().toUri(), AlertaResources.class);

        assertThat(resources.getStatusCode()).isEqualTo(HttpStatus.OK);
    }

    /**
     *
     * = TS02-US09
     *
     * == Asserção:
     *
     * Testa a obtenção de alertas dentro de uma área identificada por um ponto geográfico e um raio no seriço de Alertas onde não há alertas:
     *
     * == Dados:
     *
     * Identificação da área de pesquisa desejada.
     *
     * === Dados informados:
     *
     * [source,java]
     * --
     *  Map<String, Double> params = new HashMap<String, Double>();
     *  params.put("latitude", 0.6D);
     *  params.put("longitude", 0.6D);
     *  params.put("raio", 1D);
     * --
     *
     * == Execução:
     *
     * Uma chamada ao serviço de Alertas.
     *
     * == Resultado esperado:
     *
     * Uma lista *vazia* de dados com os dados dos alertas na área informada.
     *
     */
    @Test
    public void test108GetAlertaByCoordsInexistente() throws Exception {
        DecimalFormat df=new DecimalFormat("#0.000000");
        SimpleDateFormat tf=new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");

        df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.US));
        UriComponentsBuilder uriComponentsBuilder=UriComponentsBuilder.fromHttpUrl(getBaseUrl() + "/rest/avisos/nearbyWarnings").
            queryParam("timestamp", "'" + tf.format(0) + "'").
            queryParam("latitude", df.format(0.6)).
            queryParam("longitude", df.format(0.6)).
            queryParam("raio", df.format(1));

        ResponseEntity<AlertaResources> resources = getRestTemplate().getForEntity(uriComponentsBuilder.build().encode().toUri(), AlertaResources.class);

        assertThat(resources.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
    }

    /**
     *
     * = TS02-US09
     *
     * == Asserção:
     *
     * Testa a inclusão de um crise de crise usando o seriço de Alertas.
     * Verificar se foi gerado um alerta com base nos dados da crise recém inserido.
     * Observar que em casos reais, existe uma demora significativa entre o cadastramento
     * da crise e a geração do alerta de crise.
     *
     * == Dados:
     *
     * Uma estrutura de dados contendo o crise.
     *
     * === Estrutura de dados
     *
     * [source,java]
     * --
     *  Crise criseRequest = new Crise(
     *          "Deslizamento na na favela do Paraiso",
     *          0,
     *          "Ze das Couves",
     *          "zedascouves@gmail.com",
     *          "(12) 99876-1234");
     * --
     *
     * == Execução:
     *
     * Uma chamada ao serviço de Alertas.
     *
     * ==Resultado esperado:
     *
     * Uma estrutura de dados com a mesma informação da estrutura enviada.
     *
     * === Estrutura de dados
     *
     * [source,java]
     * --
     *  Crise criseRequest = new Crise(
     *          "Deslizamento na na favela do Paraiso",
     *          0,
     *          "Ze das Couves",
     *          "zedascouves@gmail.com",
     *          "(12) 99876-1234",
     *          40.0,
     *          50.0,
     *          foto);
     * --
     *
     */
   @Test
   public void test111PostCriseGerarAlerta() throws Exception {
       URI criseURI = new URI(getBaseUrl() + "/crise");

       Crise criseRequest = new Crise(
               "Deslizamento na na favela do Paraiso",
               1,
               "Ze das Couves",
               "zedascouves@gmail.com",
               "(12) 99876-1234",
               40.0,
               50.0,
               getFoto());

       ResponseEntity<CriseResource> criseResponseEntity =  getRestTemplate().postForEntity(criseURI, new HttpEntity<Crise>(criseRequest), CriseResource.class);

       assertThat(criseResponseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);

       DecimalFormat df=new DecimalFormat("#0.000000");
       SimpleDateFormat tf=new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");

       df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.US));
       UriComponentsBuilder uriComponentsBuilder=UriComponentsBuilder.fromHttpUrl(getBaseUrl() + "/rest/avisos/nearbyWarnings").
           queryParam("timestamp", "'" + tf.format(0) + "'").
           queryParam("latitude", df.format(40)).
           queryParam("longitude", df.format(50)).
           queryParam("raio", df.format(1));

       ResponseEntity<AlertaResources> resources = getRestTemplate().getForEntity(uriComponentsBuilder.build().encode().toUri(), AlertaResources.class);

       assertThat(resources.getStatusCode()).isEqualTo(HttpStatus.OK);

       List<Alerta> alertas = resources.getBody().unwrap();

       assertThat(alertas.get(0).getOrigemLatitude()).isEqualTo(criseRequest.getLatitude(), offset(DELTA));
       assertThat(alertas.get(0).getOrigemLongitude()).isEqualTo(criseRequest.getLongitude(), offset(DELTA));
   }

    @Test
    public void test901PostCrise() throws Exception {
        Crise crise = new Crise(
            "Crise de teste",
            1,
            "João da Horta",
            "joao.horta@gmail.com",
            "(12) 95678-4321",
            40.0,
            50.0,
            getFoto());
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
        ObjectWriter writer = mapper.writer().withDefaultPrettyPrinter();
        String criseJson = writer.writeValueAsString(crise);

        this.mvc.perform(post(getBaseUrl() + "/crise")
            .contentType(MediaTypes.HAL_JSON_VALUE)
            .content(criseJson))
            .andExpect(status().isCreated())
            .andDo(document("crise/post",
            	preprocessResponse(prettyPrint()),
                responseFields(
                    //fieldWithPath("id").type(JsonFieldType.NUMBER).description("Identificação da mensagem"),
                    fieldWithPath("type").type(JsonFieldType.STRING).description("Tipo da mensagem (INFO, WARNING, ERROR)"),
                    fieldWithPath("status").type(JsonFieldType.STRING).description("Código de estado do sistema"),
                    fieldWithPath("description").type(JsonFieldType.STRING).description("Descrição da mensagem"),
                    fieldWithPath("info").type(JsonFieldType.STRING).description("Informações adicionais"))));
    }

    @Test
    public void test904GetAlerta() throws Exception {
        this.mvc.perform(get(getBaseUrl() + "/rest/avisos/{id}", 1))
	        .andExpect(status().isOk())
	        .andDo(document("alerta/id",
	            pathParameters(
	            	parameterWithName("id").description("Identificador do alerta no sistema"))));
	    this.mvc.perform(get(getBaseUrl() + "/rest/avisos/1")
	        .accept(MediaTypes.HAL_JSON_VALUE))
	        .andExpect(status().isOk())
	        .andDo(document("alerta/id",
	        	preprocessResponse(prettyPrint()),
	            responseFields(
	                fieldWithPath("id").type(JsonFieldType.NUMBER).description("Identificação do alerta no sistema"),
	                fieldWithPath("descricaoResumida").type(JsonFieldType.STRING).description("Breve descrição do alerta"),
	                fieldWithPath("descricaoCompleta").type(JsonFieldType.STRING).description("Descrição detalhada do alerta"),
	                fieldWithPath("categoriaAlerta").type(JsonFieldType.STRING).description("Indica o tipo de alerta"),
	                fieldWithPath("origemLatitude").type(JsonFieldType.NUMBER).description("Latitude do ponto de origem do alerta"),
	                fieldWithPath("origemLongitude").type(JsonFieldType.NUMBER).description("Longitude do ponto de origem do alerta"),
	                fieldWithPath("origemRaioKms").type(JsonFieldType.NUMBER).description("Área de abrangência do alerta em Kms"),
	    			fieldWithPath("_links.self.href").type(JsonFieldType.STRING).description("URI do link para o alerta"))));
    }

    @Test
    public void test907GetAlertaByCoords() throws Exception {
        DecimalFormat df=new DecimalFormat("#0.000000");
        SimpleDateFormat tf=new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
        df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.US));
        UriComponentsBuilder uriComponentsBuilder=UriComponentsBuilder.fromHttpUrl(getBaseUrl() + "/rest/avisos/nearbyWarnings").
            queryParam("timestamp", "'" + tf.format(0) + "'").
            queryParam("latitude", df.format(40)).
            queryParam("longitude", df.format(50)).
            queryParam("raio", df.format(1));

        this.mvc.perform(get(uriComponentsBuilder.build().encode().toUri()))
            .andExpect(status().isOk())
            .andDo(document("alerta/locationsCoords",
            	requestParameters(
                	parameterWithName("timestamp").description("Timestamp desde a última consulta"),
                    parameterWithName("latitude").description("Latitude do ponto de origem do alerta"),
                    parameterWithName("longitude").description("Longitude do ponto de origem do alerta"),
                    parameterWithName("raio").description("Área de abrangência do alerta em Kms"))));
        this.mvc.perform(get(uriComponentsBuilder.build().encode().toUri())
            .accept(MediaTypes.HAL_JSON_VALUE))
            .andExpect(status().isOk())
            .andDo(document("alerta/getCoords",
            	preprocessResponse(prettyPrint()),
                responseFields(
                    fieldWithPath("_embedded.alertaList[].id").type(JsonFieldType.NUMBER).description("Identificação do alerta no sistema"),
                    fieldWithPath("_embedded.alertaList[].descricaoResumida").type(JsonFieldType.STRING).description("Breve descrição do alerta"),
                    fieldWithPath("_embedded.alertaList[].descricaoCompleta").type(JsonFieldType.STRING).description("Descrição detalhada do alerta"),
                    fieldWithPath("_embedded.alertaList[].categoriaAlerta").type(JsonFieldType.STRING).description("Indica o tipo de alerta"),
                    fieldWithPath("_embedded.alertaList[].origemLatitude").type(JsonFieldType.NUMBER).description("Latitude do ponto de origem do alerta"),
                    fieldWithPath("_embedded.alertaList[].origemLongitude").type(JsonFieldType.NUMBER).description("Longitude do ponto de origem do alerta"),
                    fieldWithPath("_embedded.alertaList[].origemRaioKms").type(JsonFieldType.NUMBER).description("Área de abrangência do alerta em Kms"),
                    fieldWithPath("_embedded.alertaList[]._links.self.href").type(JsonFieldType.STRING).description("URI do link para o alerta"))));
    }

    @Test
    public void test910GetIndicadores() throws Exception {
    	this.mvc.perform(get(getBaseUrl() + "/indicadores/latitude/{latitude}/longitude/{longitude}/raio/{raio}", 40.0, 50.0, 1.0D))
    		.andExpect(status().isOk())
    		.andDo(document("indicadores",
                    pathParameters(
                            parameterWithName("latitude").description("Latitude do ponto de origem do alerta"),
                            parameterWithName("longitude").description("Longitude do ponto de origem do alerta"),
                            parameterWithName("raio").description("Área de abrangência do alerta em Kms"))));
        this.mvc.perform(get(getBaseUrl() + "indicadores/latitude/40.0/longitude/50.0/raio/1.0")
                .accept(MediaTypes.HAL_JSON_VALUE))
                .andExpect(status().isOk())
                .andDo(document("indicadores",
                	preprocessResponse(prettyPrint()),
                    responseFields(
                        fieldWithPath("_embedded.indicadorList[].id").type(JsonFieldType.STRING).description("Identificador do indicador"),
                        fieldWithPath("_embedded.indicadorList[].descricao").type(JsonFieldType.STRING).description("Descrição do indicador"),
                        fieldWithPath("_embedded.indicadorList[].valor").type(JsonFieldType.STRING).description("Valor do indicador"))));
    }

    @Test
    public void test920GetCategorias() throws Exception {
    	this.mvc.perform(get(getBaseUrl() + "/categorias"))
    		.andExpect(status().isOk())
    		.andDo(document("categorias",
                    pathParameters()));
        this.mvc.perform(get(getBaseUrl() + "categorias")
                .accept(MediaTypes.HAL_JSON_VALUE))
                .andExpect(status().isOk())
                .andDo(document("categorias",
                	preprocessResponse(prettyPrint()),
                    responseFields(
                        fieldWithPath("_embedded.categoriaList[].id").type(JsonFieldType.STRING).description("Identificador da categoria"),
                        fieldWithPath("_embedded.categoriaList[].descricao").type(JsonFieldType.STRING).description("Descrição da categoria"))));
    }

}


text:
<?php

namespace CodeTool\ArtifactDownloader\Config\Provider\Result\Factory;

use CodeTool\ArtifactDownloader\Config\ConfigInterface;
use CodeTool\ArtifactDownloader\Config\Provider\Result\ConfigProviderResult;
use CodeTool\ArtifactDownloader\Config\Provider\Result\ConfigProviderResultInterface;
use CodeTool\ArtifactDownloader\Error\ErrorInterface;

class ConfigProviderResultFactory implements ConfigProviderResultFactoryInterface
{
    /**
     * @param ConfigInterface|null $config
     * @param ErrorInterface|null  $error
     *
     * @return ConfigProviderResultInterface
     */
    public function create(ConfigInterface $config = null, ErrorInterface $error = null)
    {
        return new ConfigProviderResult($config, $error);
    }

    /**
     * @param ConfigInterface $config
     *
     * @return ConfigProviderResultInterface
     */
    public function createSuccess(ConfigInterface $config)
    {
        return $this->create($config, null);
    }

    /**
     * @param ErrorInterface $error
     *
     * @return ConfigProviderResultInterface
     */
    public function createError(ErrorInterface $error)
    {
        return $this->create(null, $error);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.intellij.tools;

import com.intellij.execution.process.ProcessListener;
import com.intellij.ide.macro.MacroManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import static com.intellij.openapi.actionSystem.CommonDataKeys.*;
import static com.intellij.openapi.actionSystem.PlatformCoreDataKeys.MODULE;
import static com.intellij.openapi.actionSystem.PlatformCoreDataKeys.PROJECT_FILE_DIRECTORY;

/**
 * @author Eugene Belyaev
 */
public class ToolAction extends AnAction implements DumbAware {
  private final String myActionId;

  public ToolAction(@NotNull Tool tool) {
    myActionId = tool.getActionId();
    getTemplatePresentation().setText(tool.getName(), false);
    getTemplatePresentation().setDescription(tool.getDescription());
  }

  @Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    runTool(myActionId, e.getDataContext(), e, 0L, null);
  }

  @Override
  public void update(@NotNull AnActionEvent e) {
    Tool tool = findTool(myActionId);
    if (tool != null) {
      e.getPresentation().setText(ToolRunProfile.expandMacrosInName(tool, e.getDataContext()), false);
    }
  }

  @Nullable
  private static Tool findTool(@NotNull String actionId) {
    for (Tool tool : ToolsProvider.getAllTools()) {
      if (actionId.equals(tool.getActionId())) {
        return tool;
      }
    }
    return null;
  }

  static void runTool(@NotNull String actionId, @NotNull DataContext context) {
    runTool(actionId, context, null, 0L, null);
  }

  static void runTool(@NotNull String actionId,
                      @NotNull DataContext context,
                      @Nullable AnActionEvent e,
                      long executionId,
                      @Nullable ProcessListener processListener) {
    MacroManager.getInstance().cacheMacrosPreview(context);
    Tool tool = findTool(actionId);
    if (tool != null) {
      tool.execute(e, getToolDataContext(context), executionId, processListener);
    }
    else {
      Tool.notifyCouldNotStart(processListener);
    }
  }

  @Nullable
  @Override
  public String getTemplateText() {
    return ToolsBundle.message("action.text.external.tool");
  }

  @NotNull
  public static DataContext getToolDataContext(@NotNull DataContext dataContext) {
    if (dataContext instanceof SimpleDataContext) return dataContext;

    SimpleDataContext.Builder builder = SimpleDataContext.builder()
      .addAll(dataContext, PROJECT, PROJECT_FILE_DIRECTORY, EDITOR, VIRTUAL_FILE, MODULE, PSI_FILE);
    VirtualFile virtualFile = dataContext.getData(VIRTUAL_FILE);
    if (virtualFile == null) {
      Project project = dataContext.getData(PROJECT);
      FileEditor editor = project == null ? null : FileEditorManager.getInstance(project).getSelectedEditor();
      VirtualFile editorFile = editor == null ? null : editor.getFile();
      builder.add(VIRTUAL_FILE, editorFile);
    }
    return builder.build();
  }
}


text:
SOURCES = array_initialization.c
# Functions to prove by WP
TARGETS= try_initialize_array

all: frama_project

# Create frama-c project
include ../build.mk


text:
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
import json
import os.path
import time
import azure.mgmt.resource

from azure.common.exceptions import (
    CloudError
)
from testutils.common_recordingtestcase import (
    RecordingTestCase,
    TestMode,
)
import tests.mgmt_settings_fake as fake_settings

should_log = os.getenv('SDK_TESTS_LOG', '0')
if should_log.lower() == 'true' or should_log == '1':
    import logging
    logger = logging.getLogger('msrest')
    logger.setLevel(logging.DEBUG)
    logger.addHandler(logging.StreamHandler())

class HttpStatusCode(object):
    OK = 200
    Created = 201
    Accepted = 202
    NoContent = 204
    NotFound = 404

class AzureMgmtTestCase(RecordingTestCase):

    def setUp(self):
        self.working_folder = os.path.dirname(__file__)

        super(AzureMgmtTestCase, self).setUp()

        self.fake_settings = fake_settings
        if TestMode.is_playback(self.test_mode):
            self.settings = self.fake_settings
        else:
            import tests.mgmt_settings_real as real_settings
            self.settings = real_settings

        self.resource_client = self.create_mgmt_client(
            azure.mgmt.resource.ResourceManagementClient
        )

        # Every test uses a different resource group name calculated from its
        # qualified test name.
        #
        # When running all tests serially, this allows us to delete
        # the resource group in teardown without waiting for the delete to
        # complete. The next test in line will use a different resource group,
        # so it won't have any trouble creating its resource group even if the
        # previous test resource group hasn't finished deleting.
        #
        # When running tests individually, if you try to run the same test
        # multiple times in a row, it's possible that the delete in the previous
        # teardown hasn't completed yet (because we don't wait), and that
        # would make resource group creation fail.
        # To avoid that, we also delete the resource group in the
        # setup, and we wait for that delete to complete.
        self.group_name = self.get_resource_name(
            self.qualified_test_name.replace('.', '_')
        )
        self.region = 'westus'

        if not self.is_playback():
            self.delete_resource_group(wait_timeout=600)

    def tearDown(self):
        if not self.is_playback():
            self.delete_resource_group(wait_timeout=None)
        return super(AzureMgmtTestCase, self).tearDown()

    def create_basic_client(self, client_class, **kwargs):
        # Whatever the client, if credentials is None, fail
        with self.assertRaises(ValueError):
            client = client_class(
                credentials=None,
                **kwargs
            )
        # Whatever the client, if accept_language is not str, fail
        with self.assertRaises(TypeError):
            client = client_class(
                credentials=self.settings.get_credentials(),
                accept_language=42,
                **kwargs
            )

        # Real client creation
        client = client_class(
            credentials=self.settings.get_credentials(),
            **kwargs
        )
        if self.is_playback():
            client.config.long_running_operation_timeout = 0
        return client

    def create_mgmt_client(self, client_class, **kwargs):
        # Whatever the client, if subscription_id is None, fail
        with self.assertRaises(ValueError):
            self.create_basic_client(
                client_class,
                subscription_id=None,
                **kwargs
            )
        # Whatever the client, if subscription_id is not a string, fail
        with self.assertRaises(TypeError):
            self.create_basic_client(
                client_class,
                subscription_id=42,
                **kwargs
            )

        return self.create_basic_client(
            client_class,
            subscription_id=self.settings.SUBSCRIPTION_ID,
            **kwargs
        )

    def _scrub(self, val):
        val = super(AzureMgmtTestCase, self)._scrub(val)
        real_to_fake_dict = {
            self.settings.SUBSCRIPTION_ID: self.fake_settings.SUBSCRIPTION_ID,
            self.settings.AD_DOMAIN:  self.fake_settings.AD_DOMAIN
        }
        val = self._scrub_using_dict(val, real_to_fake_dict)
        return val

    def create_resource_group(self):
        self.group = self.resource_client.resource_groups.create_or_update(
            self.group_name,
            {
                'location': self.region
            }
        )

    def delete_resource_group(self, wait_timeout):
        """Delete an RG.

        :param wait_timeout: if None, means we don't block at all and let Azure deal with it.
        """
        try:
            if wait_timeout:
                azure_poller = self.resource_client.resource_groups.delete(self.group_name)
                azure_poller.wait(wait_timeout)
                if azure_poller.done():
                    return
                self.assertTrue(False, 'Timed out waiting for resource group to be deleted.')
            else:
                self.resource_client.resource_groups.delete(self.group_name, raw=True)
        except CloudError:
            pass


text:
<?php

class User_model extends CI_Model {

    function __construct() {
        parent::__construct();

        $this->load->library(array('encrypt'));
        $this->load->helper(array('cookie', 'url'));
    }

    function user_login($user_id = '', $password = '', $remember_me = '') {
        $query = $this->db->query("SELECT * FROM merchant where email = '" . $user_id . "'  and password = '" . $password . "'  LIMIT 1");
        if ($query->num_rows() > 0) {
            $row = $query->row();

            if ($remember_me == 'on') {
                $expires = ( 60 * 60 * 24 * 365) / 12;
            } else {
                $expires = ( 60 * 60 * 24);
            }

            $set_cm_account['id'] = $row->id;
            $set_cm_account['name'] = $row->name;
            $set_cm_account['webname'] = $row->webname;
            $set_cm_account['email'] = $row->email;
            $set_cm_account['description'] = $row->description;
            $set_cm_account['lineid'] = $row->lineid;
            $set_cm_account['image'] = $row->image;
            $set_cm_account['token'] = $row->token;
            $set_cm_account = $this->encrypt->encode(serialize($set_cm_account));
            set_cookie('useraccount', $set_cm_account, $expires);

            return true;
        } else {
            return false;
        }
    }

    function get_account_cookie() {
        $this->load->library(array('encrypt'));
        // get cookie
        $c_account = get_cookie('useraccount', true);
        if ($c_account != null) {
            $c_account = $this->encrypt->decode($c_account);
            $c_account = @unserialize($c_account);
            return $c_account;
        }
        return null;
    }

    function logout() {
        $this->load->helper(array('cookie'));
        delete_cookie('useraccount');
    }

    function is_login() {
        $cm_account = $this->get_account_cookie();
        if (!isset($cm_account['email']) || !isset($cm_account['id'])) {
            return false;
        } else
        if ($this->get_by_id($cm_account['id']) != false)
            return true;
        else
            return false;
    }

    function get_by_id($id) {
        $this->db->where('id', $id);
        return $this->db->get('merchant');
    }

}


text:
const lifts = require('../lifts');

lifts('beavercreek', 'html', {
  'Arrow Bahn': 'closed',
  'Bachelor Gulch Express': 'open',
  'Bibber Lift': 'open',
  'Birds of Prey Express': 'closed',
  'Centennial Express': 'open',
  'Cinch Express': 'open',
  'Elkhorn Lift': 'closed',
  'Grouse Mountain Express': 'closed',
  'Haymeadow Express Gondola': 'open',
  'Highlands Lift': 'closed',
  'Jitterbug Lift': 'closed',
  'Larkspur Express': 'closed',
  'Lower Beaver Creek Mountain Express': 'closed',
  'Magic Lift': 'open',
  'Red Buffalo Express': 'open',
  'RitzBahn Lift': 'closed',
  'Riverfront Express Gondola': 'open',
  'Rose Bowl Express': 'open',
  'Snowflake Lift': 'closed',
  'Strawberry Park Express': 'open',
  'Train Rider Lift': 'open',
  'Upper Beaver Creek Mountain Express': 'closed',
  'Wagon Train Lift': 'open'
});


text:
/**
 * Dice module; provdes functions for dice and skill commands.
 * @returns {Object} Public interface
 */
var Dice = (function() {

    // Message-constants
    var _MSG_ATTR_HINT   = "z.B. 11/13/12";
    var _MSG_ATTR_ERROR  = "Probe im falschen Format!";
    var _MSG_SKILL_SLIP  = "Patzer (automatisch misslungen)";
    var _MSG_SKILL_FAIL  = "Nach misslungenen Proben Malus kumulativ +1";
    var _MSG_SKILL_CRIT  = "Krit. Erfolg (bei Sammelprobe QS×2, Malus 0)";
    var _MSG_SKILL_FLOP  = "Erfolgsprobe misslungen";
    var _MSG_SKILL_SUCC  = "Erfolgsprobe bestanden";

    // Number-constants
    var _ROLLS_ATTR      = 3;
    var _ROLLS_SPECIAL   = 2;
    var _DICE_ATTR       = 20;
    var _VAL_SLIP        = 20;
    var _VAL_CRIT        = 1;
    var _QUAL_FACTOR     = 2;
    var _QUAL_DIVIDE     = 3;
    var _QUAL_MAX        = 6;
    var _QUAL_MIN        = 0;
    var _QUAL_SUCCESS    = 1;

    /**
     * Roll a number of dice.
     * @param {Number} m       Number of sides
     * @param {String} n       Number of rolls
     * @param {Object} options Command options
     */
    function roll(m, n, options) {

        // Initialize command arguments and options
            n       = Math.max(Util.toInt(n), 1);
        var mod     = Util.toInt(options.mod);
        var add     = n > 1 || mod;
        var results = [];
        var sum     = 0;

        // Make dice rolls
        _dice(n, m).forEach(function(res, i) {
            sum    += res;
            var str = Str.indent(res, m);
            results.push(Str.roll(str, res, _VAL_CRIT, m));
        });

        // Log results
        Log.spaced(Str.dice(n, m) + Str.mod(mod));
        Log.list(results);
        Log.spaced(add ? Str.sum(sum + mod, true) : "",
                   add ? 1 : 0, add ? 1 : 0);
    }

    /**
     * Make a skill check by dice rolls.
     * @param {String} attributes Skill attributes
     * @param {String} value      Skill value
     * @param {Object} options    Command options
     */
    function skill(attr, val, options) {

        // Initialize command arguments and options
        var attributes  = _attributes(attr);
        var value       = Math.max(Util.toInt(val), 0);
        var mod         = Util.toInt(options.mod);
        var prob        = options.wahrscheinlich || false;
        var repeat      = prob ? 0 : Math.max(Util.toInt(options.sammel), 1);
        var probability = Str.percent(_probability(attributes, value, mod));
        var repeated    = repeat > 1;
        var failed      = false;
        var slipped     = false;
        var critted     = false;
        var checks      = [];
        var malus       = 0;
        var sum         = 0;

        // Log error on invalid attributes
        if (attributes.length !== _ROLLS_ATTR) {
            Log.error(_MSG_ATTR_ERROR, 0, 1, 0);
            Log.hint(_MSG_ATTR_HINT, 0, 0, 1);

        // Continue with skill check
        } else {

            // Repeat skill checks
            for (var i = 0; i < repeat; i++) {

                // Calculate and set values
                var check   = _check(attributes, value, mod, malus);
                var results = check.results;
                var points  = check.points;
                var slip    = _special(results, _VAL_SLIP);
                var crit    = _special(results, _VAL_CRIT);
                var qual    = _quality(points, crit, slip, repeated);
                var fail    = qual < _QUAL_SUCCESS;
                    slipped = slipped ? true : slip;
                    critted = critted ? true : crit;
                    failed  = failed  ? true : fail;
                    sum     = slip    ? qual : sum + qual;
                    malus   = crit    ? 0    : fail ? malus + 1 : malus;

                // Add result
                checks.push(
                    Str.rolls(results, _VAL_CRIT, _DICE_ATTR) +
                    Str.points(points, _ROLLS_ATTR * _DICE_ATTR) +
                    Str.quality(qual, crit, slip, _QUAL_SUCCESS, _QUAL_MAX) +
                    Str.sum(sum, false, 0, _QUAL_MAX * repeat)
                );

                // Break on critical slip
                if (slip) { break; }
            }

            // Log title
            Log.spaced(
                Str.dice(Str.indent(_ROLLS_ATTR, checks.length), _DICE_ATTR) +
                Str.attr(attributes).magenta + Str.mod(mod) +
                Str.brackets(value).magenta + Str.times(repeat) + " " +
                (prob ? probability.cyan : probability.grey.dim)
            );

            // Abort if probability option is set
            if (prob) { return; }

            // Log results
            Log.list(checks);
            _alerts(checks.length, critted, failed, slipped);
        }
    }

    /**
     * Choose alerts for skill checks to log.
     * @param {Number}  repeat  Number of repeated checks
     * @param {Boolean} critted At least one critical success
     * @param {Boolean} failed  At least one failed check
     * @param {Boolean} slipped At least one slipped check
     */
    function _alerts(repeat, critted, failed, slipped) {

        // Initialize status and values
        var extra    = false;
        var message  = false;
        var repeated = repeat > 1;
        var error    = (!repeated &&  failed);
        var success  = (!repeated && !failed);

        // Choose messages
        if (!repeated && !failed) { message = _MSG_SKILL_SUCC.green; }
        if (!repeated &&  failed) { message = _MSG_SKILL_FLOP.red; }
        if ( repeated &&  failed) { message = _MSG_SKILL_FAIL.grey.dim; }
        if (critted)              { extra   = _MSG_SKILL_CRIT.green; }
        if (slipped)              { extra   = _MSG_SKILL_SLIP.red; }

        // Log messages
        if (!message && extra) { Log.empty(); }
        if (message)  { Log.shout(message, repeat, error, success, 1, 0); }
        if (extra)    { Log.shout(extra, repeat, slipped, critted, 0, 1); }
        if (!extra)   { Log.empty(); }
    }

    /**
     * Splitt attributes string to array of integers.
     * @param   {String}   attributes String of attributes
     * @returns {Number[]} Array of integers of attribute values
     */
    function _attributes(attributes) {
        var values = [];
        attributes.split("/").forEach(function(value) {
            values.push(Math.max(Util.toInt(value), 0));
        });
        return values;
    }

    /**
     * Make dice rolls.
     * @param   {Number}   n Integer of number of dice rolls
     * @param   {Number}   m Integer of number of dice sides
     * @returns {Number[]} Array of result integers
     */
    function _dice(n, m) {
        var results = [];
        for (var i = 0; i < n; i++) { results.push(Util.randomInt(1, m)); }
        return results;
    }

    /**
     * Make a skill check.
     * @param   {Number[]} attr  Integers of attribute values
     * @param   {Number}   value Integer of skill value
     * @param   {Number}   mod   Integer of mod
     * @param   {Number}   malus Integer of additional malus
     * @returns {Object}   Results of rolls and remaining skill points
     */
    function _check(attr, value, mod, malus) {
        var results = _dice(attr.length, _DICE_ATTR);
        var points  = _points(results, attr, value, mod, malus);
        return { results: results, points: points };
    }

    /**
     * Caluclate quality level of remaining skill points.
     * @param   {Number}  points  Remaining skill points
     * @param   {Boolean} crit    Critical success?
     * @param   {Boolean} slip    Critical slip?
     * @param   {Boolean} repeated Repeated check?
     * @returns {Number}  Caluclated quality level
     */
    function _quality(points, crit, slip, repeated) {
        var calc = Math.ceil(points / _QUAL_DIVIDE);
        var min  = crit ? _QUAL_SUCCESS : _QUAL_MIN;
        var mult = crit && repeated ? _QUAL_FACTOR : slip ? 0 : 1;
        var qual = points === 0 ? _QUAL_SUCCESS : calc;
        return Math.max(Math.min(qual * mult, _QUAL_MAX), min);
    }

    /**
     * Calculate probability of success of skill check.
     * @param   {Number[]} attr Attribute values
     * @param   {Number}   val  Skill value
     * @param   {Number}   mod  Mod value
     * @returns {Number}   Float number of probability
     */
    function _probability(attr, val, mod) {
        var s = 0;
        for (var x = 1; x <= _DICE_ATTR; x++) {
            for (var y = 1; y <= _DICE_ATTR; y++) {
                for (var z = 1; z <= _DICE_ATTR; z++) {
                    if (_special([x, y, z], _VAL_CRIT)) { s++; }
                    else if (!_special([x, y, z], _VAL_SLIP)) {
                        var p = _points([x, y, z], attr, val, mod, 0);
                        s += p >= 0 ? 1 : 0;
                    }
                }
            }
        }
        return Math.round(
            (1.0 /parseFloat(Math.pow(_DICE_ATTR, _ROLLS_ATTR)) * s) *
                100 * 100) / 100;
    }

    /**
     * Check for special result.
     * @param   {Number[]} res Result values
     * @param   {Number}   n   Special value
     * @returns {Boolean}  Is special result
     */
    function _special(res, n) {
        var count = 0;
        res.forEach(function(int) { count += int === n ? 1 : 0; });
        return count >= _ROLLS_SPECIAL;
    }

    /**
     * Calculate remaining points from skill check.
     * @param   {Number[]} res   Result values
     * @param   {Number[]} attr  Attribute values
     * @param   {Number}   val   Skill value
     * @param   {Number}   mod   Mod value
     * @param   {Number}   malus Addtional malus
     * @returns {Number}   Remaining points
     */
    function _points(res, attr, val, mod, malus) {
        var points = val + 0;
        res.forEach(function(result, i) {
            var goal = Math.max(0, attr[i] + mod - malus);
            points  -= Math.max(0, result - goal);
        });
        return points;
    }

    // Public interface
    return {
        roll  : roll,
        skill : skill
    };

})();


text:
DEV_DOCKER_FILES=-f docker-compose.yml -f docker-compose.override.yml

ifndef DOCKER_FILES
    DOCKER_FILES=$(DEV_DOCKER_FILES)
endif

DOCKER_COMPOSE=docker-compose $(DOCKER_FILES)
TEST_FLAGS=-e REGISTRY_SKIP_CELERY=True
END_TO_END_TEST_FLAGS=-e REGISTRY_SKIP_CELERY=False \
                         -e REGISTRY_LIMIT_LAYERS=3 \
                         -e REGISTRY_CHECK_PERIOD=2 \
                         -e REGISTRY_INDEX_CACHED_LAYERS_PERIOD=1 \
                         -e SELENIUM_HUB_URL=http://selenium-firefox:4444/wd/hub \
                         -e BROWSER_HYPERMAP_URL=http://nginx \
                         -e WAIT_FOR_CELERY_JOB_PERIOD=30
TEST_CSW_TRANSACTIONS_FLAGS=-e REGISTRY_SKIP_CELERY=True \
                         -e BROWSER_HYPERMAP_URL=http://nginx \
                         -e REGISTRY_HARVEST_SERVICES=False
pre-up:
	# Bring up the database and rabbitmq first
	$(DOCKER_COMPOSE) up -d postgres rabbitmq

wait:
	sleep 2

up:
	# Bring up the rest of the services
	$(DOCKER_COMPOSE) up -d --remove-orphans

build:
	$(DOCKER_COMPOSE) build django
	$(DOCKER_COMPOSE) build celery

sync: pre-up wait
	# set up the database tables
	$(DOCKER_COMPOSE) run django python manage.py migrate --noinput
	# load the default catalog and users (hypermap)
	$(DOCKER_COMPOSE) run django python manage.py loaddata \
	            hypermap/aggregator/fixtures/catalog_default.json \
	            hypermap/aggregator/fixtures/user.json

logs:
	$(DOCKER_COMPOSE) logs --follow

down:
	$(DOCKER_COMPOSE) down --remove-orphans

test-url-parse: DOCKER_FILES=$(DEV_DOCKER_FILES)
test-url-parse:
	$(DOCKER_COMPOSE) run $(TEST_FLAGS) django python manage.py test hypermap.aggregator.tests.test_url_parse --failfast

test-unit: DOCKER_FILES=$(DEV_DOCKER_FILES)
test-unit:
	$(DOCKER_COMPOSE) run $(TEST_FLAGS) django python manage.py test hypermap.aggregator --failfast

test-solr: DOCKER_FILES=-$(DEV_DOCKER_FILES) -f docker-compose.solr.yml
test-solr:
	# Run tests API <--> Solr backend
	$(DOCKER_COMPOSE) run $(TEST_FLAGS) django python manage.py test hypermap.search_api --failfast

test-elastic: DOCKER_FILES=$(DEV_DOCKER_FILES) -f docker-compose.elasticsearch.yml
test-elastic:
	# Run tests API <--> Elastic backend
	$(DOCKER_COMPOSE) run $(TEST_FLAGS) django python manage.py test hypermap.search_api --failfast

test-endtoend-selenium-firefox: DOCKER_FILES=$(DEV_DOCKER_FILES)
test-endtoend-selenium-firefox:
	# Run tests Selenium Firefox Browser <--> Nginx
	# Want to see whats happening? connect to VNC server localhost:5900 password: secret
	$(DOCKER_COMPOSE) run $(END_TO_END_TEST_FLAGS) django python manage.py test hypermap.tests.test_end_to_end_selenium_firefox --failfast

test-csw: DOCKER_FILES=$(DEV_DOCKER_FILES)
test-csw:
	# Run tests CSW requests <--> Nginx
	$(DOCKER_COMPOSE) run $(TEST_CSW_TRANSACTIONS_FLAGS) django python manage.py test hypermap.tests.test_csw --failfast

test-csw-transactions: DOCKER_FILES=$(DEV_DOCKER_FILES)
test-csw-transactions:
	# Run tests CSW requests <--> Nginx
	$(DOCKER_COMPOSE) run $(TEST_CSW_TRANSACTIONS_FLAGS) django python manage.py test hypermap.tests.test_csw_transactions --failfast

test: down start test-unit test-csw test-csw-transactions test-solr test-elastic

shell:
	$(DOCKER_COMPOSE) run django python manage.py shell_plus

# TODO: make it reset db ONLY with explicit indications. now: down/up db cleanup. future: down/up continue working on.
start: sync up

restart: down start

pull:
	$(DOCKER_COMPOSE) pull

reset: pull build restart

flake:
	flake8 hypermap --ignore=E121,E123,E126,E226,E24,E704,W503,W504

.PHONY: pre-up wait up build sync logs down test-unit test-search test-solr test-elastic test shell start restart pull reset flake


text:
<Org name="ExampleOrg" type="application/vnd.vmware.vcloud.org+xml"
	href="http://vcloud.example.com/api/v1.0/org/5" >
	<Link type="application/vnd.vmware.vcloud.catalog+xml" rel="down"
		href="http://vcloud.example.com/api/v1.0/catalog/32" name="Main Catalog" />
	<Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="down"
		href="http://vcloud.example.com/api/v1.0/catalog/32/controlAccess" />
	<Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="controlAccess"
		href="http://vcloud.example.com/api/v1.0/catalog/32/action/controlAccess" />
	<Link type="application/vnd.vmware.vcloud.catalog+xml" rel="down"
		href="http://vcloud.example.com/api/v1.0/catalog/37" name="Shared Catalog" />
	<Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="down"
		href="http://vcloud.example.com/api/v1.0/catalog/37/controlAccess" />
	<Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="controlAccess"
		href="http://vcloud.example.com/api/v1.0/catalog/37/action/controlAccess" />
	<Link type="application/vnd.vmware.vcloud.vdc+xml" rel="down"
		href="http://vcloud.example.com/api/v1.0/vdc/5" name="ExampleVdc01" />
	<Link type="application/vnd.vmware.vcloud.tasksList+xml" rel="down"
		href="http://vcloud.example.com/api/v1.0/tasksList/5" />
	<Link type="application/vnd.vmware.vcloud.network+xml" rel="down"
		href="http://vcloud.example.com/api/v1.0/network/14" name="TestNetwork" />
	<Link type="application/vnd.vmware.vcloud.network+xml" rel="down"
		href="http://vcloud.example.com/api/v1.0/network/54" name="ProductionNetwork" />
	<Description>Example Corp's Primary Organization.</Description>
</Org>


text:
package com.yahoo.platform.yui.compressor.org.mozilla.javascript;

/**
 * This class implements the JavaScript scanner.
 *
 * It is based on the C source files jsscan.c and jsscan.h
 * in the jsref package.
 *
 * @see com.yahoo.platform.yui.compressor.org.mozilla.javascript.Parser
 *
 * @author Mike McCabe
 * @author Brendan Eich
 */

public class Token
{

    // debug flags
    public static final boolean printTrees = false;
    static final boolean printICode = false;
    static final boolean printNames = printTrees || printICode;

    /**
     * Token types.  These values correspond to JSTokenType values in
     * jsscan.c.
     */

    public final static int
    // start enum
        ERROR          = -1, // well-known as the only code < EOF
        EOF            = 0,  // end of file token - (not EOF_CHAR)
        EOL            = 1,  // end of line

        // Interpreter reuses the following as bytecodes
        FIRST_BYTECODE_TOKEN    = 2,

        ENTERWITH      = 2,
        LEAVEWITH      = 3,
        RETURN         = 4,
        GOTO           = 5,
        IFEQ           = 6,
        IFNE           = 7,
        SETNAME        = 8,
        BITOR          = 9,
        BITXOR         = 10,
        BITAND         = 11,
        EQ             = 12,
        NE             = 13,
        LT             = 14,
        LE             = 15,
        GT             = 16,
        GE             = 17,
        LSH            = 18,
        RSH            = 19,
        URSH           = 20,
        ADD            = 21,
        SUB            = 22,
        MUL            = 23,
        DIV            = 24,
        MOD            = 25,
        NOT            = 26,
        BITNOT         = 27,
        POS            = 28,
        NEG            = 29,
        NEW            = 30,
        DELPROP        = 31,
        TYPEOF         = 32,
        GETPROP        = 33,
        GETPROPNOWARN  = 34,
        SETPROP        = 35,
        GETELEM        = 36,
        SETELEM        = 37,
        CALL           = 38,
        NAME           = 39,
        NUMBER         = 40,
        STRING         = 41,
        NULL           = 42,
        THIS           = 43,
        FALSE          = 44,
        TRUE           = 45,
        SHEQ           = 46,   // shallow equality (===)
        SHNE           = 47,   // shallow inequality (!==)
        REGEXP         = 48,
        BINDNAME       = 49,
        THROW          = 50,
        RETHROW        = 51, // rethrow caught exception: catch (e if ) use it
        IN             = 52,
        INSTANCEOF     = 53,
        LOCAL_LOAD     = 54,
        GETVAR         = 55,
        SETVAR         = 56,
        CATCH_SCOPE    = 57,
        ENUM_INIT_KEYS = 58,
        ENUM_INIT_VALUES = 59,
        ENUM_INIT_ARRAY= 60,
        ENUM_NEXT      = 61,
        ENUM_ID        = 62,
        THISFN         = 63,
        RETURN_RESULT  = 64, // to return previously stored return result
        ARRAYLIT       = 65, // array literal
        OBJECTLIT      = 66, // object literal
        GET_REF        = 67, // *reference
        SET_REF        = 68, // *reference    = something
        DEL_REF        = 69, // delete reference
        REF_CALL       = 70, // f(args)    = something or f(args)++
        REF_SPECIAL    = 71, // reference for special properties like __proto
        YIELD          = 72,  // JS 1.7 yield pseudo keyword

        // For XML support:
        DEFAULTNAMESPACE = 73, // default xml namespace =
        ESCXMLATTR     = 74,
        ESCXMLTEXT     = 75,
        REF_MEMBER     = 76, // Reference for x.@y, x..y etc.
        REF_NS_MEMBER  = 77, // Reference for x.ns::y, x..ns::y etc.
        REF_NAME       = 78, // Reference for @y, @[y] etc.
        REF_NS_NAME    = 79; // Reference for ns::y, @ns::y@[y] etc.

        // End of interpreter bytecodes
    public final static int
        LAST_BYTECODE_TOKEN    = REF_NS_NAME,

        TRY            = 80,
        SEMI           = 81,  // semicolon
        LB             = 82,  // left and right brackets
        RB             = 83,
        LC             = 84,  // left and right curlies (braces)
        RC             = 85,
        LP             = 86,  // left and right parentheses
        RP             = 87,
        COMMA          = 88,  // comma operator

        ASSIGN         = 89,  // simple assignment  (=)
        ASSIGN_BITOR   = 90,  // |=
        ASSIGN_BITXOR  = 91,  // ^=
        ASSIGN_BITAND  = 92,  // |=
        ASSIGN_LSH     = 93,  // <<=
        ASSIGN_RSH     = 94,  // >>=
        ASSIGN_URSH    = 95,  // >>>=
        ASSIGN_ADD     = 96,  // +=
        ASSIGN_SUB     = 97,  // -=
        ASSIGN_MUL     = 98,  // *=
        ASSIGN_DIV     = 99,  // /=
        ASSIGN_MOD     = 100;  // %=

    public final static int
        FIRST_ASSIGN   = ASSIGN,
        LAST_ASSIGN    = ASSIGN_MOD,

        HOOK           = 101, // conditional (?:)
        COLON          = 102,
        OR             = 103, // logical or (||)
        AND            = 104, // logical and (&&)
        INC            = 105, // increment/decrement (++ --)
        DEC            = 106,
        DOT            = 107, // member operator (.)
        FUNCTION       = 108, // function keyword
        EXPORT         = 109, // export keyword
        IMPORT         = 110, // import keyword
        IF             = 111, // if keyword
        ELSE           = 112, // else keyword
        SWITCH         = 113, // switch keyword
        CASE           = 114, // case keyword
        DEFAULT        = 115, // default keyword
        WHILE          = 116, // while keyword
        DO             = 117, // do keyword
        FOR            = 118, // for keyword
        BREAK          = 119, // break keyword
        CONTINUE       = 120, // continue keyword
        VAR            = 121, // var keyword
        WITH           = 122, // with keyword
        CATCH          = 123, // catch keyword
        FINALLY        = 124, // finally keyword
        VOID           = 125, // void keyword
        RESERVED       = 126, // reserved keywords

        EMPTY          = 127,

        /* types used for the parse tree - these never get returned
         * by the scanner.
         */

        BLOCK          = 128, // statement block
        LABEL          = 129, // label
        TARGET         = 130,
        LOOP           = 131,
        EXPR_VOID      = 132, // expression statement in functions
        EXPR_RESULT    = 133, // expression statement in scripts
        JSR            = 134,
        SCRIPT         = 135, // top-level node for entire script
        TYPEOFNAME     = 136, // for typeof(simple-name)
        USE_STACK      = 137,
        SETPROP_OP     = 138, // x.y op= something
        SETELEM_OP     = 139, // x[y] op= something
        LOCAL_BLOCK    = 140,
        SET_REF_OP     = 141, // *reference op= something

        // For XML support:
        DOTDOT         = 142,  // member operator (..)
        COLONCOLON     = 143,  // namespace::name
        XML            = 144,  // XML type
        DOTQUERY       = 145,  // .() -- e.g., x.emps.emp.(name == "terry")
        XMLATTR        = 146,  // @
        XMLEND         = 147,

        // Optimizer-only-tokens
        TO_OBJECT      = 148,
        TO_DOUBLE      = 149,

        GET            = 150,  // JS 1.5 get pseudo keyword
        SET            = 151,  // JS 1.5 set pseudo keyword
        LET            = 152,  // JS 1.7 let pseudo keyword
        CONST          = 153,
        SETCONST       = 154,
        SETCONSTVAR    = 155,
        ARRAYCOMP      = 156,  // array comprehension
        LETEXPR        = 157,
        WITHEXPR       = 158,
        DEBUGGER       = 159,

        CONDCOMMENT    = 160,  // JScript conditional comment
        KEEPCOMMENT    = 161,  // /*! ... */ comment

        LAST_TOKEN     = 162;

    public static String name(int token)
    {
        if (!printNames) {
            return String.valueOf(token);
        }
        switch (token) {
          case ERROR:           return "ERROR";
          case EOF:             return "EOF";
          case EOL:             return "EOL";
          case ENTERWITH:       return "ENTERWITH";
          case LEAVEWITH:       return "LEAVEWITH";
          case RETURN:          return "RETURN";
          case GOTO:            return "GOTO";
          case IFEQ:            return "IFEQ";
          case IFNE:            return "IFNE";
          case SETNAME:         return "SETNAME";
          case BITOR:           return "BITOR";
          case BITXOR:          return "BITXOR";
          case BITAND:          return "BITAND";
          case EQ:              return "EQ";
          case NE:              return "NE";
          case LT:              return "LT";
          case LE:              return "LE";
          case GT:              return "GT";
          case GE:              return "GE";
          case LSH:             return "LSH";
          case RSH:             return "RSH";
          case URSH:            return "URSH";
          case ADD:             return "ADD";
          case SUB:             return "SUB";
          case MUL:             return "MUL";
          case DIV:             return "DIV";
          case MOD:             return "MOD";
          case NOT:             return "NOT";
          case BITNOT:          return "BITNOT";
          case POS:             return "POS";
          case NEG:             return "NEG";
          case NEW:             return "NEW";
          case DELPROP:         return "DELPROP";
          case TYPEOF:          return "TYPEOF";
          case GETPROP:         return "GETPROP";
          case GETPROPNOWARN:   return "GETPROPNOWARN";
          case SETPROP:         return "SETPROP";
          case GETELEM:         return "GETELEM";
          case SETELEM:         return "SETELEM";
          case CALL:            return "CALL";
          case NAME:            return "NAME";
          case NUMBER:          return "NUMBER";
          case STRING:          return "STRING";
          case NULL:            return "NULL";
          case THIS:            return "THIS";
          case FALSE:           return "FALSE";
          case TRUE:            return "TRUE";
          case SHEQ:            return "SHEQ";
          case SHNE:            return "SHNE";
          case REGEXP:          return "OBJECT";
          case BINDNAME:        return "BINDNAME";
          case THROW:           return "THROW";
          case RETHROW:         return "RETHROW";
          case IN:              return "IN";
          case INSTANCEOF:      return "INSTANCEOF";
          case LOCAL_LOAD:      return "LOCAL_LOAD";
          case GETVAR:          return "GETVAR";
          case SETVAR:          return "SETVAR";
          case CATCH_SCOPE:     return "CATCH_SCOPE";
          case ENUM_INIT_KEYS:  return "ENUM_INIT_KEYS";
          case ENUM_INIT_VALUES:return "ENUM_INIT_VALUES";
          case ENUM_INIT_ARRAY: return "ENUM_INIT_ARRAY";
          case ENUM_NEXT:       return "ENUM_NEXT";
          case ENUM_ID:         return "ENUM_ID";
          case THISFN:          return "THISFN";
          case RETURN_RESULT:   return "RETURN_RESULT";
          case ARRAYLIT:        return "ARRAYLIT";
          case OBJECTLIT:       return "OBJECTLIT";
          case GET_REF:         return "GET_REF";
          case SET_REF:         return "SET_REF";
          case DEL_REF:         return "DEL_REF";
          case REF_CALL:        return "REF_CALL";
          case REF_SPECIAL:     return "REF_SPECIAL";
          case DEFAULTNAMESPACE:return "DEFAULTNAMESPACE";
          case ESCXMLTEXT:      return "ESCXMLTEXT";
          case ESCXMLATTR:      return "ESCXMLATTR";
          case REF_MEMBER:      return "REF_MEMBER";
          case REF_NS_MEMBER:   return "REF_NS_MEMBER";
          case REF_NAME:        return "REF_NAME";
          case REF_NS_NAME:     return "REF_NS_NAME";
          case TRY:             return "TRY";
          case SEMI:            return "SEMI";
          case LB:              return "LB";
          case RB:              return "RB";
          case LC:              return "LC";
          case RC:              return "RC";
          case LP:              return "LP";
          case RP:              return "RP";
          case COMMA:           return "COMMA";
          case ASSIGN:          return "ASSIGN";
          case ASSIGN_BITOR:    return "ASSIGN_BITOR";
          case ASSIGN_BITXOR:   return "ASSIGN_BITXOR";
          case ASSIGN_BITAND:   return "ASSIGN_BITAND";
          case ASSIGN_LSH:      return "ASSIGN_LSH";
          case ASSIGN_RSH:      return "ASSIGN_RSH";
          case ASSIGN_URSH:     return "ASSIGN_URSH";
          case ASSIGN_ADD:      return "ASSIGN_ADD";
          case ASSIGN_SUB:      return "ASSIGN_SUB";
          case ASSIGN_MUL:      return "ASSIGN_MUL";
          case ASSIGN_DIV:      return "ASSIGN_DIV";
          case ASSIGN_MOD:      return "ASSIGN_MOD";
          case HOOK:            return "HOOK";
          case COLON:           return "COLON";
          case OR:              return "OR";
          case AND:             return "AND";
          case INC:             return "INC";
          case DEC:             return "DEC";
          case DOT:             return "DOT";
          case FUNCTION:        return "FUNCTION";
          case EXPORT:          return "EXPORT";
          case IMPORT:          return "IMPORT";
          case IF:              return "IF";
          case ELSE:            return "ELSE";
          case SWITCH:          return "SWITCH";
          case CASE:            return "CASE";
          case DEFAULT:         return "DEFAULT";
          case WHILE:           return "WHILE";
          case DO:              return "DO";
          case FOR:             return "FOR";
          case BREAK:           return "BREAK";
          case CONTINUE:        return "CONTINUE";
          case VAR:             return "VAR";
          case WITH:            return "WITH";
          case CATCH:           return "CATCH";
          case FINALLY:         return "FINALLY";
          case VOID:            return "VOID";
          case RESERVED:        return "RESERVED";
          case EMPTY:           return "EMPTY";
          case BLOCK:           return "BLOCK";
          case LABEL:           return "LABEL";
          case TARGET:          return "TARGET";
          case LOOP:            return "LOOP";
          case EXPR_VOID:       return "EXPR_VOID";
          case EXPR_RESULT:     return "EXPR_RESULT";
          case JSR:             return "JSR";
          case SCRIPT:          return "SCRIPT";
          case TYPEOFNAME:      return "TYPEOFNAME";
          case USE_STACK:       return "USE_STACK";
          case SETPROP_OP:      return "SETPROP_OP";
          case SETELEM_OP:      return "SETELEM_OP";
          case LOCAL_BLOCK:     return "LOCAL_BLOCK";
          case SET_REF_OP:      return "SET_REF_OP";
          case DOTDOT:          return "DOTDOT";
          case COLONCOLON:      return "COLONCOLON";
          case XML:             return "XML";
          case DOTQUERY:        return "DOTQUERY";
          case XMLATTR:         return "XMLATTR";
          case XMLEND:          return "XMLEND";
          case TO_OBJECT:       return "TO_OBJECT";
          case TO_DOUBLE:       return "TO_DOUBLE";
          case GET:             return "GET";
          case SET:             return "SET";
          case LET:             return "LET";
          case YIELD:           return "YIELD";
          case CONST:           return "CONST";
          case SETCONST:        return "SETCONST";
          case ARRAYCOMP:       return "ARRAYCOMP";
          case WITHEXPR:        return "WITHEXPR";
          case LETEXPR:         return "LETEXPR";
          case DEBUGGER:        return "DEBUGGER";
        }

        // Token without name
        throw new IllegalStateException(String.valueOf(token));
    }
}


text:
package org.apache.pdfbox;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.pdfbox.cos.TestCOSFloat;
import org.apache.pdfbox.cos.TestCOSInteger;
import org.apache.pdfbox.cos.TestCOSString;
import org.apache.pdfbox.filter.TestFilters;
import org.apache.pdfbox.io.TestIOUtils;
import org.apache.pdfbox.io.TestRandomAccessBuffer;
import org.apache.pdfbox.filter.ccitt.TestCCITTFaxG31DDecodeInputStream;
import org.apache.pdfbox.filter.ccitt.TestPackedBitArray;
import org.apache.pdfbox.multipdf.TestLayerUtility;
import org.apache.pdfbox.pdmodel.TestFDF;
import org.apache.pdfbox.pdmodel.TestPDDocument;
import org.apache.pdfbox.pdmodel.TestPDDocumentInformation;
import org.apache.pdfbox.pdmodel.common.TestPDNameTreeNode;
import org.apache.pdfbox.pdmodel.common.TestPDNumberTreeNode;
import org.apache.pdfbox.pdmodel.TestPDPageContentStream;
import org.apache.pdfbox.pdmodel.graphics.optionalcontent.TestOptionalContentGroups;
import org.apache.pdfbox.pdmodel.interactive.form.TestFields;
import org.apache.pdfbox.util.TestDateUtil;
import org.apache.pdfbox.util.TestMatrix;

/**
 * This is a holder for all test cases in the pdfbox system.
 * It's part of the ant build and isn't used by the maven build.
 *
 * @author Ben Litchfield
 *
 */
public class TestAll extends TestCase
{

    /**
     * Constructor.
     *
     * @param name The name of the test to run.
     */
    public TestAll( String name )
    {
        super( name );
    }

    /**
     * The main method to run tests.
     *
     * @param args The command line arguments.
     */
    public static void main( String[] args )
    {
        String[] arg = {TestAll.class.getName() };
        junit.textui.TestRunner.main( arg );
    }

    /**
     * This will get the suite of test that this class holds.
     *
     * @return All of the tests that this class holds.
     */
    public static Test suite()
    {
        TestSuite suite = new TestSuite();
        suite.addTest( TestDateUtil.suite() );
        suite.addTest( TestMatrix.suite() );
        suite.addTestSuite( TestFilters.class );
        suite.addTest( TestFDF.suite() );
        suite.addTest( TestFields.suite() );
        suite.addTest( TestCOSString.suite() );
        suite.addTest( TestCOSInteger.suite() );
        suite.addTest( TestCOSFloat.suite() );
        suite.addTestSuite( TestPDDocument.class );
        suite.addTestSuite( TestPDDocumentInformation.class );
        suite.addTestSuite( TestOptionalContentGroups.class );
        suite.addTestSuite( TestLayerUtility.class );
        suite.addTest( org.apache.pdfbox.pdmodel.common.function.TestFunctions.suite() );

        suite.addTestSuite( TestIOUtils.class );
        suite.addTestSuite( TestRandomAccessBuffer.class );
        suite.addTestSuite( TestPackedBitArray.class );
        suite.addTestSuite( TestCCITTFaxG31DDecodeInputStream.class );

        suite.addTestSuite(TestPDPageContentStream.class);

        suite.addTestSuite(TestPDNameTreeNode.class);
        suite.addTestSuite(TestPDNumberTreeNode.class);

        return suite;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE xliff PUBLIC "-//XLIFF//DTD XLIFF//EN" "http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" >
<xliff version="1.0">
  <file original="global" source-language="en" datatype="plaintext">
    <header/>
    <body>
      <!-- admin -->
      <trans-unit>
        <source>Enable Super Cache?</source>
        <target>Activer le Super-Cache?</target>
      </trans-unit>
      <trans-unit>
        <source>With layout?</source>
        <target>Avec layout ?</target>
      </trans-unit>
      <trans-unit>
        <source>Lifetime</source>
        <target>Durée de vie</target>
      </trans-unit>
      <trans-unit>
        <source>Enable Comments</source>
        <target>Activer les commentaires</target>
      </trans-unit>
      <trans-unit>
        <source>Default Status</source>
        <target>Statut par défaut</target>
      </trans-unit>
      <trans-unit>
        <source>Clearing Cache</source>
        <target>Vidange du cache</target>
      </trans-unit>
      <trans-unit>
        <source>Starting cache clearing process...</source>
        <target>Début du processus de vidange du cache...</target>
      </trans-unit>
      <trans-unit>
        <source>Clearing %s cache...</source>
        <target>Vidange du cache "%s"...</target>
      </trans-unit>
      <trans-unit>
        <source>Cache clearing process is finished.</source>
        <target>La vidange du cache est terminée.</target>
      </trans-unit>
      <trans-unit>
        <source>Editing </source>
        <target>Edition </target>
      </trans-unit>
      <trans-unit>
        <source>Editing Site "%s"</source>
        <target>Edition du site "%s"</target>
      </trans-unit>
      <trans-unit>
        <source>Editing Content Type "%s"</source>
        <target>Edition du type de contenu "%s"</target>
      </trans-unit>
      <trans-unit>
        <source>Sympal / Preview</source>
        <target>Sympal / Prévisualisation</target>
      </trans-unit>
      <trans-unit>
        <source>Sympal / Themes</source>
        <target>Sympal / Thèmes</target>
      </trans-unit>
      <trans-unit>
        <source>This action will change the default theme to "%s" for the "%s" site.</source>
        <target>Cette action changera le thème par défaut vers "%s" pour le site "%s".</target>
      </trans-unit>
      <trans-unit>
        <source>This action will change the global default theme to "%s"</source>
        <target>Cette action changera le thème global par défaut vers "%s"</target>
      </trans-unit>
      <trans-unit>
        <source>Theme successfully changed!</source>
        <target>Le thème a été changé avec succès !</target>
      </trans-unit>
      <trans-unit>
        <source>Editing Slot "%s"</source>
        <target>Edition du slot "%s"</target>
      </trans-unit>
      <trans-unit>
        <source>Showing all %count% total results.</source>
        <target>Les %count% résultats sont affichés.</target>
      </trans-unit>
      <!-- sympal_redirects -->
      <trans-unit>
        <source>Create New Redirect</source>
        <target>Nouvelle redirection</target>
      </trans-unit>
      <trans-unit>
        <source>Manage a list of URLs to redirect in case of URL changing or old URLs that you
would like to point to something new. This is useful for maintaining search
engine optimization.</source>
        <target>Gérez une liste d'URLs de redirection en cas de changement d'URL ou d'ancienne URL que vous souhaitez faire pointer vers un nouvel emplacement. C'est utile dans un but d'optimisation pour les moteurs de recherche (SEO)</target>
      </trans-unit>
      <trans-unit>
        <source>New Sympal redirects</source>
        <target>Nouvelles redirections Sympal</target>
      </trans-unit>
      <trans-unit>
        <source>The source path to redirect. Example: /some_page</source>
        <target>Le chemin source à rediriger. Exemple : /une_page</target>
      </trans-unit>
      <trans-unit>
        <source>The destination to redirect to: Example: /new_url, @some_route or http://www.someurl.com</source>
        <target>Destination de la redirection. Exemple : /nouvelle_url ou http://www.uneadresse.com</target>
      </trans-unit>
      <trans-unit>
        <source>The content record to redirect to instead of a manual entered destination above.</source>
        <target>Le contenu vers lequel rediriger au lieu d'entrer une destination à la main</target>
      </trans-unit>
      <trans-unit>
        <source>Edit Sympal redirects</source>
        <target>Éditer les redirections Sympal</target>
      </trans-unit>

      <!-- sympal_admin -->
      <trans-unit>
        <source>Sympal Server Check</source>
        <target>Vérification du serveur</target>
      </trans-unit>
      <trans-unit>
        <source>Sympal Admin / Check Server</source>
        <target>Sympal Admin / Vérification du serveur</target>
      </trans-unit>
      <!-- templates -->
      <trans-unit>
        <source>Powered by %1% %2%</source>
        <target>Réalisé avec %1% %2%</target>
      </trans-unit>
      <!-- sympal_themes -->
      <trans-unit>
        <source>Preview the available themes in this Sympal project. Click a
theme name below to see what it looks like!</source>
        <target>Prévisualiser les thèmes disponibles pour ce projet Sympal. Cliquez sur le nom d'un thème ci-dessous pour voir à quoi il ressemble !</target>
      </trans-unit>
      <trans-unit>
        <source>Sympal Admin / Themes</source>
        <target>Sympal administration / Thèmes</target>
      </trans-unit>
      <trans-unit>
        <source>Default theme</source>
        <target>Thème par défaut</target>
      </trans-unit>
      <trans-unit>
        <source>Themes</source>
        <target>Thèmes</target>
      </trans-unit>
      <trans-unit>
        <source>Default</source>
        <target>Standard</target>
      </trans-unit>
      <trans-unit>
        <source>Wordpress default</source>
        <target>Wordpress standard</target>
      </trans-unit>
      <trans-unit>
        <source>Make Global Default</source>
        <target>Thème global par défaut</target>
      </trans-unit>
      <trans-unit>
        <source>Previewing "%1%" Theme</source>
        <target>Prévisualisation du thème "%1%"</target>
      </trans-unit>
      <trans-unit>
        <source>You are previewing the %1% theme. Go back to the %2%.</source>
        <target>Vous prévisualisez le thème %1%. Revenir à la %2%.</target>
      </trans-unit>
      <trans-unit>
        <source>list of themes</source>
        <target>liste des thèmes</target>
      </trans-unit>
      <trans-unit>
        <source>Make %1% Default</source>
        <target>Thème par défaut pour %1%</target>
      </trans-unit>
      <trans-unit>
        <source>Remove %1% Default</source>
        <target>Enlever ce thème pour %1%</target>
      </trans-unit>
      <!-- sympal_dashboard -->
      <trans-unit>
        <source>Sympal Dashboard</source>
        <target>Tableau de bord Sympal</target>
      </trans-unit>
      <trans-unit>
        <source>Hello %name%! Welcome to your Sympal Dashboard.</source>
        <target>Bonjour %name% ! Bienvenue sur votre tableau de bord Sympal.</target>
      </trans-unit>
      <trans-unit>
        <source>Rows per page</source>
        <target>Lignes par page</target>
      </trans-unit>
      <trans-unit>
        <source>Default rendering module</source>
        <target>Module de rendu par défaut</target>
      </trans-unit>
      <trans-unit>
        <source>Default rendering action</source>
        <target>Action de rendu par défaut</target>
      </trans-unit>
      <trans-unit>
        <source>Breadcrumbs separator</source>
        <target>Séparateur de menus (breadcrumbs)</target>
      </trans-unit>
      <trans-unit>
        <source>Default from email address</source>
        <target>Adresse email de provenance par défaut</target>
      </trans-unit>
      <trans-unit>
        <source>Enable markdown editor</source>
        <target>Éditeur "Markdown"</target>
      </trans-unit>
      <trans-unit>
        <source>Sympal Admin / Settings</source>
        <target>Administration Sympal / Paramètres</target>
      </trans-unit>

      <trans-unit>
        <source>Elastic textareas</source>
        <target>Champs textes élastiques</target>
      </trans-unit>
      <trans-unit>
        <source>Check for upgrades on dashboard</source>
        <target>Vérifiez les mises à jour sur le tableau de bord</target>
      </trans-unit>
      <trans-unit>
        <source>Username or API Key</source>
        <target>Nom d'utilisateur ou clé d'API</target>
      </trans-unit>

      <trans-unit>
        <source>Manage the configuration of your Sympal project from the
  easy to use web form below. The different functionalities added by Sympal
  plugins may add settings here for you to control.</source>
        <target>Gérez la configuration de votre projet Sympal à partir du forumaire ci-dessous. Les différentes fonctionnalités ajoutées par les plugins Sympal peuvent ajouter des paramètres dans ce formulaire pour que vous puissiez les contrôler.</target>
      </trans-unit>
      <trans-unit>
        <source>Here is a list of indicators for your installation:</source>
        <target>Voici une liste d'indicateur pour votre installation :</target>
      </trans-unit>
      <trans-unit>
        <source>Users: %s</source>
        <target>Utilisateurs : %s</target>
      </trans-unit>
      <trans-unit>
        <source>Sites: %s</source>
        <target>Sites : %s</target>
      </trans-unit>
      <trans-unit>
        <source>Content Types: %s</source>
        <target>Types de contenu : %s</target>
      </trans-unit>
      <trans-unit>
        <source>Published: %s Content %s</source>
        <target>Publié : %s -> %s</target>
      </trans-unit>
      <trans-unit>
        <source>Un-Published: %s Content %s</source>
        <target>Non-publié : %s -> %s</target>
      </trans-unit>

      <!-- admin menu -->
      <trans-unit>
        <source>Add to menu</source>
        <target>Ajouter au menu</target>
      </trans-unit>
      <trans-unit>
        <source>Signout</source>
        <target>Déconnexion</target>
      </trans-unit>
      <trans-unit>
        <source>Dashboard</source>
        <target>Tableau de bord</target>
      </trans-unit>
      <trans-unit>
        <source>Go to %s</source>
        <target>Aller sur %s</target>
      </trans-unit>
      <trans-unit>
        <source>My Dashboard</source>
        <target>Mon tableau de bord</target>
      </trans-unit>
      <trans-unit>
        <source>Content List</source>
        <target>Liste de contenu</target>
      </trans-unit>
      <trans-unit>
        <source>Assets</source>
        <target>Médias</target>
      </trans-unit>
      <trans-unit>
        <source>404 Redirects</source>
        <target>Redirections 404</target>
      </trans-unit>
      <trans-unit>
        <source>Edit Site</source>
        <target>Éditer le site</target>
      </trans-unit>
      <trans-unit>
        <source>Menus</source>
        <target>Menus</target>
      </trans-unit>
      <trans-unit>
        <source>Users</source>
        <target>Utilisateurs</target>
      </trans-unit>
      <trans-unit>
        <source>Groups</source>
        <target>Groupes</target>
      </trans-unit>
      <trans-unit>
        <source>Permissions</source>
        <target>Permissions</target>
      </trans-unit>
      <trans-unit>
        <source>Global Setup</source>
        <target>Configuration globale</target>
      </trans-unit>
      <trans-unit>
        <source>Content Types</source>
        <target>Types de contenu</target>
      </trans-unit>
      <trans-unit>
        <source>Themes</source>
        <target>Thèmes</target>
      </trans-unit>
      <trans-unit>
        <source>Sites</source>
        <target>Sites</target>
      </trans-unit>
      <trans-unit>
        <source>System Settings</source>
        <target>Paramètres système</target>
      </trans-unit>
      <trans-unit>
        <source>Plugin Manager</source>
        <target>Gestionnaire de plugin</target>
      </trans-unit>
      <trans-unit>
        <source>Clear Cache</source>
        <target>Vider le cache</target>
      </trans-unit>
      <trans-unit>
        <source>Setup</source>
        <target>Configuration</target>
      </trans-unit>
      <trans-unit>
        <source>Quit</source>
        <target>Quitter</target>
      </trans-unit>
      <trans-unit>
        <source>Switch to %s</source>
        <target>Passer en %s</target>
      </trans-unit>
      <trans-unit>
        <source>Go to %s</source>
        <target>Aller à </target>
      </trans-unit>
      <trans-unit>
        <source>Site Content</source>
        <target>Contenu du site</target>
      </trans-unit>

      <!-- admin filters -->
      <trans-unit>
        <source>Search</source>
        <target>Recherche</target>
      </trans-unit>
      <trans-unit>
        <source>Enter keywords to search by. Wildcards (*) are supported.</source>
        <target>Veuillez saisir les mots-clés à recherche. Le caractère générique (*) est supporté.</target>
      </trans-unit>
      <trans-unit>
        <source>Yes</source>
        <target>Oui</target>
      </trans-unit>
      <trans-unit>
        <source>No</source>
        <target>Non</target>
      </trans-unit>
      <trans-unit>
        <source>All</source>
        <target>~</target>
      </trans-unit>
      <trans-unit>
        <source>You must at least select one item.</source>
        <target>Vous devez au moins sélectionner une ligne.</target>
      </trans-unit>
      <!-- sympal_sites -->
      <trans-unit>
        <source>Sympal sites List</source>
        <target>Liste des sites Sympal</target>
      </trans-unit>
      <trans-unit>
        <source>Browse, create, edit and delete your Sympal sites below! Manage your sites and switch between the current site and your other sites easily!</source>
        <target>Parcourez, créez, éditez et supprimez vos sites Sympal ci-dessous. Gérez vos sites et passez d'un site à l'autre facilement !</target>
      </trans-unit>
      <trans-unit>
        <source>Description</source>
        <target>Description</target>
      </trans-unit>
      <trans-unit>
        <source>Switch site</source>
        <target>Changer de site</target>
      </trans-unit>
      <trans-unit>
        <source>New Sympal sites</source>
        <target>Nouveaux sites Sympal</target>
      </trans-unit>
      <trans-unit>
        <source>Site Information</source>
        <target>Information sur le site</target>
      </trans-unit>
      <trans-unit>
        <source>Slug</source>
        <target>Identifiant textuel (slug)</target>
      </trans-unit>
      <trans-unit>
        <source>The text slug identifier that represents this site.</source>
        <target>L'identifiant textuel (slug) représentant ce site.</target>
      </trans-unit>

      <trans-unit>
        <source></source>
        <target></target>
      </trans-unit>
    </body>
  </file>
</xliff>