Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Release #3660

Merged
merged 22 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8d8ca04
Use dw DataSize for validation
thoniTUB Dec 17, 2024
86f90f1
use dw provided validators
thoniTUB Dec 17, 2024
16258fc
Merge branch 'develop' into fix/review-mina-stack
thoniTUB Jan 8, 2025
4754f71
use plain object for exception mapping
thoniTUB Jan 9, 2025
5c7b2cf
check if startQuery error is a string/message and use it instead
thoniTUB Jan 13, 2025
13774e7
prettier
thoniTUB Jan 13, 2025
8e057e9
remove unnecessary comment
thoniTUB Jan 13, 2025
968aac7
Merge branch 'develop' into fix/conquery-execption-mapper
thoniTUB Jan 14, 2025
1efaa8b
Respect request locale for error and start test browser (chromium) wi…
thoniTUB Jan 14, 2025
83fcb9f
set language for electron in cypress action
thoniTUB Jan 14, 2025
746799f
Merge branch 'develop' into fix/review-mina-stack
thoniTUB Jan 16, 2025
4b8d866
combine query execution test case as they are not independent
thoniTUB Jan 24, 2025
e06a22f
prevent nasty NoSuchElementExceptionMapper if no preview config was s…
thoniTUB Jan 24, 2025
9b3f3b3
Merge pull request #3655 from ingef/fix/e2e-combine-dependent-items
thoniTUB Jan 27, 2025
d631690
Merge pull request #3657 from ingef/reintegrate-main
awildturtok Jan 28, 2025
f617bb6
Bump com.auth0:java-jwt from 4.2.2 to 4.5.0
dependabot[bot] Jan 30, 2025
4e8c834
Merge pull request #3659 from ingef/dependabot/maven/com.auth0-java-j…
thoniTUB Feb 3, 2025
9834008
Merge branch 'develop' into fix/review-mina-stack
thoniTUB Feb 3, 2025
b0db47d
Merge pull request #3642 from ingef/fix/review-mina-stack
thoniTUB Feb 3, 2025
b7fc835
Merge branch 'develop' into fix/conquery-execption-mapper
thoniTUB Feb 3, 2025
b3b417c
Merge pull request #3647 from ingef/fix/conquery-execption-mapper
thoniTUB Feb 3, 2025
ff12393
Merge remote-tracking branch 'origin/master' into release
thoniTUB Feb 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading