Skip to content

Commit

Permalink
Merge pull request #3660 from ingef/release for 2025KW05
Browse files Browse the repository at this point in the history
Merge Release
  • Loading branch information
thoniTUB authored Feb 20, 2025
2 parents 321559a + ff12393 commit 6cccdd6
Show file tree
Hide file tree
Showing 20 changed files with 105 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
jobs:
test:
runs-on: ubuntu-latest
env:
# Set electron language to german so request use "accept-language: de" header
ELECTRON_EXTRA_LAUNCH_ARGS: --lang=de
timeout-minutes: 10
steps:
- name: Cache local Maven repository
Expand Down
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>4.2.2</version>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package com.bakdata.conquery.io.jetty;

import com.bakdata.conquery.models.error.ConqueryError;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;

import com.bakdata.conquery.models.error.ConqueryError;
import com.bakdata.conquery.models.error.SimpleErrorInfo;

public class ConqueryErrorExceptionMapper implements ExceptionMapper<ConqueryError> {
@Override
public Response toResponse(ConqueryError exception) {
return Response.status(Response.Status.BAD_REQUEST.getStatusCode())
.type(MediaType.APPLICATION_JSON_TYPE)
.entity(exception)
.build();
SimpleErrorInfo plain = exception.asPlain();

return Response.status(Response.Status.BAD_REQUEST.getStatusCode())
.type(MediaType.APPLICATION_JSON_TYPE)
.entity(plain)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.net.InetAddress;
import java.net.InetSocketAddress;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;

Expand All @@ -16,7 +15,11 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.dropwizard.core.Configuration;
import io.dropwizard.util.DataSize;
import io.dropwizard.util.DataSizeUnit;
import io.dropwizard.util.Duration;
import io.dropwizard.validation.MaxDataSize;
import io.dropwizard.validation.MinDataSize;
import io.dropwizard.validation.PortRange;
import lombok.Getter;
import lombok.Setter;
Expand Down Expand Up @@ -49,18 +52,18 @@ public class ClusterConfig extends Configuration {
* <p/>
* May only touch this for testing purposes.
*/
@Max(Integer.MAX_VALUE - 4)
@Min(64) // not practical
private int maxIoBufferSizeBytes = Integer.MAX_VALUE - 4;
@MaxDataSize(value = Integer.MAX_VALUE - 4, unit = DataSizeUnit.BYTES)
@MinDataSize(value = 64, unit = DataSizeUnit.BYTES)
private DataSize maxIoBufferSize = DataSize.bytes(Integer.MAX_VALUE - 4);

/**
* Defines the starting buffer allocation size. Larger can reduce reallocations, but can cause a greater memory demand.
* <p/>
* May only touch this for testing purposes.
*/
@Max(Integer.MAX_VALUE - 4)
@Min(64) // Mina's default
private int initialIoBufferSizeBytes = 8192; // 8kb
@MaxDataSize(value = Integer.MAX_VALUE - 4, unit = DataSizeUnit.BYTES)
@MinDataSize(value = 64, unit = DataSizeUnit.BYTES)
private DataSize initialIoBufferSize = DataSize.bytes(8192); // 8kb

/**
* @see com.bakdata.conquery.models.messages.namespaces.specific.CollectColumnValuesJob
Expand Down Expand Up @@ -90,8 +93,8 @@ public NioSocketConnector getClusterConnector(ObjectMapper om, IoHandler ioHandl
final NioSocketConnector connector = new NioSocketConnector();

JacksonProtocolEncoder encoder = new JacksonProtocolEncoder(om.writerFor(NetworkMessage.class));
encoder.setMaxObjectSize(maxIoBufferSizeBytes);
encoder.setInitialBufferCapacityBytes(initialIoBufferSizeBytes);
encoder.setMaxObjectSize(Math.toIntExact(maxIoBufferSize.toBytes()));
encoder.setInitialBufferCapacityBytes(Math.toIntExact(initialIoBufferSize.toBytes()));

ProtocolCodecFilter codecFilter = new ProtocolCodecFilter(
encoder,
Expand All @@ -115,8 +118,8 @@ public NioSocketAcceptor getClusterAcceptor(ObjectMapper om, IoHandler ioHandler


JacksonProtocolEncoder encoder = new JacksonProtocolEncoder(om.writerFor(NetworkMessage.class));
encoder.setMaxObjectSize(maxIoBufferSizeBytes);
encoder.setInitialBufferCapacityBytes(initialIoBufferSizeBytes);
encoder.setMaxObjectSize(Math.toIntExact(maxIoBufferSize.toBytes()));
encoder.setInitialBufferCapacityBytes(Math.toIntExact(initialIoBufferSize.toBytes()));

ProtocolCodecFilter codecFilter = new ProtocolCodecFilter(
encoder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ public record TimeStratifiedSelects(@NotNull String label, String description, @
@JsonIgnore
public boolean isSelectsUnique() {
return timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).flatMap(Collection::stream).map(InfoCardSelect::select).distinct().count()
== timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).flatMap(Collection::stream).count();
== timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).mapToLong(Collection::size).sum();
}

@ValidationMethod(message = "Labels must be unique.")
@JsonIgnore
public boolean isLabelsUnique() {
return timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).flatMap(Collection::stream).map(InfoCardSelect::label).distinct().count()
== timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).flatMap(Collection::stream).count();
== timeStratifiedSelects.stream().map(TimeStratifiedSelects::selects).mapToLong(Collection::size).sum();
}

@JsonIgnore
Expand Down Expand Up @@ -178,7 +178,7 @@ public String resolveSelectLabel(SelectResultInfo info) {
public List<Select> getSelects() {
return getInfoCardSelects().stream()
.map(InfoCardSelect::select)
.map(SelectId::<Select>resolve)
.map(SelectId::resolve)
.collect(Collectors.toList());
}

Expand All @@ -200,10 +200,10 @@ public ConceptId resolveSearchConcept() {


return searchFilters.stream()
.map(FilterId::<Filter<?>>resolve)
.map(FilterId::resolve)
.map(filter -> filter.getConnector().getConcept())
.distinct()
.map(Concept::getId)
.collect(MoreCollectors.onlyElement());
.collect(MoreCollectors.toOptional()).orElse(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

import java.util.Set;
import java.util.UUID;
import jakarta.validation.constraints.NotNull;

import c10n.C10N;
import com.bakdata.conquery.io.cps.CPSBase;
import com.bakdata.conquery.io.cps.CPSType;
import com.bakdata.conquery.models.forms.util.Alignment;
import com.bakdata.conquery.models.forms.util.Resolution;
import com.bakdata.conquery.models.i18n.I18n;
import com.bakdata.conquery.models.identifiable.ids.Id;
import com.bakdata.conquery.models.query.entity.Entity;
import com.bakdata.conquery.util.VariableDefaultValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand Down Expand Up @@ -79,7 +80,7 @@ public final String getCode() {
@JsonIgnore
@ToString.Include
public final String getMessage() {
return getMessageTemplate(C10N.get(ErrorMessages.class));
return getMessageTemplate(C10N.get(ErrorMessages.class, I18n.LOCALE.get()));
}

@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class MinaStackTest {
public static void beforeAll() throws IOException {

CLUSTER_CONFIG.setPort(0);
CLUSTER_CONFIG.setMaxIoBufferSizeBytes(toIntExact(DataSize.mebibytes(10).toBytes()));
CLUSTER_CONFIG.setMaxIoBufferSize(DataSize.mebibytes(10));

// This enables the Chunking filter, which triggers for messages > 1 MebiByte
CLUSTER_CONFIG.getMina().setSendBufferSize(toIntExact(DataSize.mebibytes(1).toBytes()));
Expand Down
34 changes: 29 additions & 5 deletions cypress/e2e/frontend/test_1_runQuery.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Run query", () => {
visitWithToken(USER_TOKEN_WITH_PERMISSIONS);
});

it("Can execute query and see it in the queries tab", () => {
it("Can execute query, see it in the queries tab and delete it", () => {
cy.get('[data-test-id="right-pane-container"] >div:visible').as("queryEditor");

// Drag concept to editor
Expand Down Expand Up @@ -40,18 +40,16 @@ describe("Run query", () => {
cy.get("@queryEditor").find('[data-test-id="query-runner-button"]').click();

cy.get("@queryEditor").contains("Ergebnisse");
});

it("Can see the executed query in the queries tab", () => {
// Lookup executed query in the previous queries tab
cy.get('[data-test-id="left-pane"]').contains("Anfragen").click();

cy.get('[data-test-id="left-pane-container"]').as("leftPaneContainer");

cy.get("@leftPaneContainer").contains("Ergebnisse");
cy.get("@leftPaneContainer").contains("Concept1");
});

it("Can delete the query", () => {
// Delete the Query
cy.get('[data-test-id="left-pane"]').contains("Anfragen").click();

cy.get('[data-test-id="left-pane-container"]').as("leftPaneContainer");
Expand All @@ -60,7 +58,33 @@ describe("Run query", () => {

cy.get('@executionList').find('[data-test-id="project-item-delete-button"]').click();
cy.get('@executionList').contains('Anfrage jetzt löschen').click();

cy.get('@leftPaneContainer').contains('Keine Anfragen / Formulare gefunden')
});

it("Check user error message", () => {
cy.get('[data-test-id="right-pane-container"] >div:visible').as("queryEditor");

// Drag concept to editor
cy.contains("MultiConnector").trigger("dragstart").trigger("dragleave");
cy.get("@queryEditor")
.trigger("dragenter")
.trigger("dragover")
.trigger("drop")
.trigger("dragend");

// Switch to secondary id mode
cy.get("@queryEditor").contains("Secondary Id").click()

// Exclude only concept from secondary id to create an invalid query
cy.get("@queryEditor").find('[data-test-id="secondary-id-toggle"]').click()

// Start query
cy.get("@queryEditor").find('[data-test-id="query-runner-button"]').click();

// Check for specific user error message
cy.get('[data-test-id="query-runner"]').contains("Die ausgewählte Analyseebenen konnte in keinem der ausgewählten Konzepten gefunden werden.")
})
});

describe("Reference list", () => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
on('before:browser:launch', (browser = {}, launchOptions) => {
if (browser.family === 'chromium') {
launchOptions.args.push('--lang=de_DE');
}
return launchOptions;
});

}
5 changes: 5 additions & 0 deletions cypress/support/test_data/sid.secondaryId.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"description": "SecondaryId for Dicing",
"label": "Secondary Id",
"name": "sid"
}
4 changes: 2 additions & 2 deletions cypress/support/test_data/table1.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
id,STRING
1,abc
id,sid,STRING
1,a,abc
6 changes: 6 additions & 0 deletions cypress/support/test_data/table1.import.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"inputType": "STRING",
"operation": "COPY"
},
{
"inputColumn": "sid",
"name": "sid",
"inputType": "STRING",
"operation": "COPY"
},
{
"inputColumn": "STRING",
"name": "STRING",
Expand Down
5 changes: 5 additions & 0 deletions cypress/support/test_data/table1.table.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"name": "id",
"type": "STRING"
},
{
"name": "sid",
"type": "STRING",
"secondaryId": "sid"
},
{
"name": "STRING",
"type": "STRING"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const DeleteProjectItemButton = ({ item }: { item: ProjectItemT }) => {
<IconButton
icon={faTimes}
bare
title="delete"
data-test-id="project-item-delete-button"
/>
</WithTooltip>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/js/previous-queries/list/ProjectItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ const ProjectItem = forwardRef<
<IconButton
icon={isShared ? faUser : faUserRegular}
bare
title="share"
data-test-id="share"
onClick={onIndicateShare}
/>
</WithTooltip>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/js/query-runner/QueryRunner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const QueryRunner = ({
);

return (
<Root>
<Root data-test-id="query-runner">
<Left>
<WithTooltip text={buttonTooltip}>
<QueryRunnerButton
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/js/query-runner/QueryRunnerInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ interface PropsT {
const useMessage = (queryRunner: QueryRunnerStateT) => {
const { t } = useTranslation();

if (queryRunner.startQuery.error) {
const error = queryRunner.startQuery.error;
if (error) {
// Maybe use type guard here
if (typeof error === "string" && error.trim().length > 0)
return { type: "error", value: error };
return { type: "error", value: t("queryRunner.startError") };
} else if (queryRunner.stopQuery.error) {
return { type: "error", value: t("queryRunner.stopError") };
Expand Down
1 change: 1 addition & 0 deletions frontend/src/js/standard-query-editor/QueryNodeActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const QueryNodeActions = (props: Props) => {
<RelativeContainer>
<StyledIconButton
icon={faMicroscope}
data-test-id="secondary-id-toggle"
onClick={(e) => {
e.stopPropagation();
props.onToggleSecondaryIdExclude(props.andIdx, props.orIdx);
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.required}</source>
<target>${java.required}</target>
<release>${java.required}</release>
<parameters>true</parameters>
</configuration>
</plugin>
Expand Down
5 changes: 4 additions & 1 deletion scripts/load_e2e_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ echo "Creating mappings"
curl --fail -X POST "$admin_api/datasets/dataset1/internToExtern" -H "$h_ct" -H "$h_auth" -d "@./cypress/support/test_data/mapping.mapping.json"
sleep 3

# TODO secondary ID
echo "Creating secondary ids"
curl --fail -X POST "$admin_api/datasets/dataset1/secondaryId" -H "$h_ct" -H "$h_auth" -d "@./cypress/support/test_data/sid.secondaryId.json"
sleep 1

echo "Creating tables"
for table_json in `ls ./cypress/support/test_data/*.table.json`
do
Expand Down

0 comments on commit 6cccdd6

Please sign in to comment.