Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ protected Map<String, Collection<Object>> createCondition(final PropertyContext<
.collect(toList());
final Map<String, Collection<Object>> condition = values.size() == 1 ? values.iterator().next()
: new UiSchema.ConditionBuilder().withOperator("or").withValues(values).build();
final UiSchema.ConditionValuesBuilder rootBuilder;
if (!shouldBe) { // no need to add the wrapper if we test true (default)
return new UiSchema.ConditionBuilder()
.withOperator("==")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,6 @@ void enumAsRestrictedList() throws Exception {
@Test
void optionsOrder() throws Exception {
final ConfigTypeNode node = load("optionsorder.json", ConfigTypeNode.class);
final SimplePropertyDefinition root = node
.getProperties()
.stream()
.filter(it -> it.getPath().equals("configuration"))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("bad config"));
final Ui payload = service.convert("FileIO", "en", node, null).toCompletableFuture().get();
final List<String> actualOrder = payload
.getUiSchema()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ private void assertForm1(final Map<String, JsonSchema> properties) {

public static class Form1 {

@SuppressWarnings("java:S1068")
private String name;

@SuppressWarnings("java:S1068")
private int age;
}

public static class Form2 {

@SuppressWarnings("java:S1068")
private String name;

@SuppressWarnings("java:S1068")
private Form1 form1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -675,14 +675,12 @@ void pipelineDateTimeFields() throws Exception {
final Date date = new Date(new java.text.SimpleDateFormat("yyyy-MM-dd").parse("2018-12-6").getTime());
final Date datetime = new Date();
final Date time = new Date(1000 * 60 * 60 * 15 + 1000 * 60 * 20 + 39000); // 15:20:39
final Instant timestamp = java.sql.Timestamp.valueOf("2021-04-19 13:37:07.752345").toInstant();
builder.withDateTime("t_date", date);
builder.withDateTime("t_datetime", datetime);
builder.withDateTime("t_time", time);
final Record rec = builder.build();
final Pipeline pipeline = Pipeline.create();
final PCollection<Record> input = pipeline.apply(Create.of(asList(rec)).withCoder(SchemaRegistryCoder.of())); //
final PCollection<Record> output = input.apply(new RecordToRecord());
pipeline.apply(Create.of(asList(rec)).withCoder(SchemaRegistryCoder.of())).apply(new RecordToRecord());
assertEquals(org.apache.beam.sdk.PipelineResult.State.DONE, pipeline.run().waitUntilFinish());
}

Expand Down Expand Up @@ -721,9 +719,7 @@ void pipelineDecimalFieldsWithAvroRecord() throws Exception {
// should not use ReflectData for any GenericRecord implements
// ReflectData.get().addLogicalTypeConversion(new Conversions.DecimalConversion());

final PCollection<Record> input =
pipeline.apply(Create.of(asList(rec1, rec2)).withCoder(SchemaRegistryCoder.of())); //
final PCollection<Record> output = input.apply(new RecordToRecord());
pipeline.apply(Create.of(asList(rec1, rec2)).withCoder(SchemaRegistryCoder.of())).apply(new RecordToRecord());
assertEquals(org.apache.beam.sdk.PipelineResult.State.DONE, pipeline.run().waitUntilFinish());
}

Expand Down Expand Up @@ -751,9 +747,7 @@ void pipelineTimestampFieldsWithAvroRecord() throws Exception {

final Pipeline pipeline = Pipeline.create();

final PCollection<Record> input =
pipeline.apply(Create.of(asList(rec1, rec2)).withCoder(SchemaRegistryCoder.of())); //
final PCollection<Record> output = input.apply(new RecordToRecord());
pipeline.apply(Create.of(asList(rec1, rec2)).withCoder(SchemaRegistryCoder.of())).apply(new RecordToRecord());
assertEquals(org.apache.beam.sdk.PipelineResult.State.DONE, pipeline.run().waitUntilFinish());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static class WorkAroundCoder extends Coder<JsonObject> {

private static final long serialVersionUID = 1L;

@SuppressWarnings("java:S1068")
private transient PCollection<JsonObject> collection;

private Coder<JsonObject> delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ void providedSchemaGetSchema() {
.build())
.build();
assertEquals(schema, new RecordImpl.BuilderImpl(schema).withString("name", "ok").build().getSchema());

Schema.EntriesOrder e = Schema.EntriesOrder.of(new RecordImpl.BuilderImpl().getCurrentEntries()
.stream()
.map(Schema.Entry::getName)
.collect(Collectors.toList()));
}

@Test
Expand Down Expand Up @@ -437,11 +432,9 @@ void timestampExceedMillisecond() {
assertEquals(time.toInstant(), record.getInstant("time"));

int nano = time.toInstant().getNano();
long natime = time.toInstant().toEpochMilli();/// 1000 * 1000_000_000 +nano;
long ntime = time.toInstant().getEpochSecond();

Instant back1 = Instant.ofEpochSecond(ntime, nano);
Instant back2 = Instant.ofEpochSecond(natime, nano);
assertEquals(time.toInstant(), back1);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ void emptyRecord() {
final Schema emptySchema = new BuilderImpl() //
.withType(Type.RECORD) //
.build();
List<Entry> ordered = emptySchema.getEntriesOrdered();
RecordBuilderFactory factory = new RecordBuilderFactoryImpl("test");
Record record = factory.newRecordBuilder(emptySchema).build();
Assertions.assertNotNull(record);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public void run() {
}

static {
ComponentManager manager = SingletonHolder.buildNewComponentManager();
ComponentManager manager = SingletonHolder.buildNewComponentManager(); // NOSONAR
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public class StreamingLongParamBuilder {

private final ParameterMeta root;

private final String componentClassName;

private final String name;

private final String layoutType;
Expand All @@ -42,7 +40,6 @@ public class StreamingLongParamBuilder {
public StreamingLongParamBuilder(final ParameterMeta root, final String componentClassName,
final String parameterName, final LocalConfiguration configuration) {
this.root = root;
this.componentClassName = componentClassName;
this.name = parameterName;
this.configuration = configuration;
this.layoutType = findLayoutType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
Expand Down Expand Up @@ -97,7 +96,6 @@ public String map(final String key) {
}
} else {
try {
final FileReader reader = new FileReader(clazz);
outputStream.putNextEntry(new JarEntry('/' + clazz.getName()));
outputStream.write(Files.readAllBytes(clazz.getAbsoluteFile().toPath()));
outputStream.closeEntry();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@
import java.util.function.Consumer;
import java.util.function.Supplier;

import javax.json.JsonBuilderFactory;
import javax.json.JsonObject;
import javax.json.bind.Jsonb;
import javax.json.bind.spi.JsonbProvider;
import javax.json.spi.JsonProvider;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -61,10 +59,6 @@
@Slf4j
class CheckpointInputTest {

private final JsonProvider jsonp = JsonProvider.provider();

private final JsonBuilderFactory jsonFactory = jsonp.createBuilderFactory(emptyMap());

private final Jsonb jsonb = JsonbProvider.provider().create().build();

private final PluginGenerator pluginGenerator = new PluginGenerator();
Expand Down Expand Up @@ -207,9 +201,8 @@ void studioLifecycle(@TempDir final Path temporaryFolder) {
final Input input = chainedMapper.create(); // ChainedInput
input.start();
//
Object rawData;
int counted = 0;
while ((rawData = input.next()) != null) {
while (input.next() != null) {
// data conversion of rawData to rowStruct and operate on rowStruct...
if (input.isCheckpointReady()) {
System.err.println(input.getCheckpoint());
Expand Down Expand Up @@ -241,10 +234,8 @@ void studioLifecycleWithResume(@TempDir final Path temporaryFolder) {
//
final Input input = chainedMapper.create(); // ChainedInput
input.start((s) -> log.info("[studioLifecycleWithResume] state: {}.", s));
Object rawData;
int counted = 0;
// RowStruct rowStruct = new RowStruct(); // @Data static class RowStruct {Integer data;}
while ((rawData = input.next()) != null) {
while (input.next() != null) {
// data conversion of rawData to rowStruct ...
// operate on rowStruct...
counted++;
Expand Down Expand Up @@ -295,9 +286,8 @@ void resumeableInputManualUsage(@TempDir final Path temporaryFolder) throws Exce
//
final Input input = getInput(mgr, "resumeable-input", 1, configuration);
input.start();
Record record;
int counted = 0;
while ((record = (Record) input.next()) != null) {
while (input.next() != null) {
Comment thread
undx marked this conversation as resolved.
counted++;
if (input.isCheckpointReady()) {
assertNotNull(input.getCheckpoint());
Expand Down Expand Up @@ -326,9 +316,8 @@ void resumeableInputManualUsageNoCheckpoint(@TempDir final Path temporaryFolder)
//
final Input input = getInput(mgr, "resumeable-input", 1, configuration);
input.start();
Record record;
int counted = 0;
while ((record = (Record) input.next()) != null) {
while (input.next() != null) {
Comment thread
undx marked this conversation as resolved.
counted++;
assertFalse(input.isCheckpointReady());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.talend.sdk.component.runtime.input.Mapper;
import org.talend.sdk.component.runtime.manager.ComponentManager;
import org.talend.sdk.component.runtime.manager.asm.PluginGenerator;

Expand All @@ -43,8 +42,7 @@ void wrongCL(@TempDir final File temporaryFolder) {
try (final ComponentManager manager = new ComponentManager(deps, "META-INF/test/dependencies", null)) {
manager.addPlugin(plugin.getAbsolutePath());
try {
final Mapper mapper =
manager.findMapper("db", "input", 1, emptyMap()).orElseThrow(IllegalStateException::new);
manager.findMapper("db", "input", 1, emptyMap()).orElseThrow(IllegalStateException::new);
} catch (MissingResourceException e) {
fail("Bundle should have been loaded.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public Path discover() {

};

private final PathHandler handler = new PathHandlerImpl();

private final PathHandler handlerNoExistCheck = new PathHandlerImpl() {

@Override
Expand Down Expand Up @@ -270,7 +268,6 @@ void discoverFromRepositoryPropertyAndSettingsKo() {
@Test
void discoverFromEnvironment() throws IOException {
Files.createDirectories(repository.resolve("repository"));
final String vm2 = System.getenv("M2_HOME");
final Path m2 = resolver.discover();
assertNotNull(m2);
assertEquals(repository.resolve("repository"), m2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.talend.sdk.component.runtime.manager.service.http;

import static org.junit.jupiter.api.Assertions.*;

import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -95,7 +93,6 @@ public <T> T buildNew(Class<? extends T> realClass) {
.getDeclaredMethod("complexe", String.class, String.class, String.class, String.class,
Integer.class, Map.class));
{
final Type responseType = complexe.getResponseType();
final HttpRequestCreator creator = complexe.getRequestCreator();
Assertions.assertNotNull(creator);
Map<String, String> queryParams = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@Emitter(family = "db", name = "input")
public class DataInput implements Serializable {

@SuppressWarnings("java:S1068")
private final I18nService i18n;

private static final Map<String, List<Object>> data = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static class MapperWithCheckpointWorker implements Serializable {

private int current = 0;

@SuppressWarnings("java:S1068")
private boolean newBookmark = false;

public MapperWithCheckpointWorker(final RecordBuilderFactory recordBuilderFactory, int partition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
@Slf4j
public class ResumeableInput implements Serializable {

@SuppressWarnings("java:S1068")
private final Jsonb jsonb;

private final RecordBuilderFactory factory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ ComponentDetailList getDetail(
// @Unused, only for sample
class SampleErrorForBulk {

@SuppressWarnings("java:S1068")
private ErrorPayload error1;

@SuppressWarnings("java:S1068")
private ErrorPayload error2;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public class BulkReadResourceImpl implements BulkReadResource {
"{\"code\":\"UNAUTHORIZED\",\"description\":\"Forbidden endpoint in bulk mode.\"}"))
.readObject());

@SuppressWarnings("java:S1068")
private final BulkResponses.Result forbiddenResponse =
Comment thread
undx marked this conversation as resolved.
new BulkResponses.Result(Response.Status.FORBIDDEN.getStatusCode(), emptyMap(),
Json.createReader(new StringReader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,14 @@ public Response getIconIndex(final String theme) {

@Override
public Map<String, String> migrate(final String id, final int version, final Map<String, String> config) {
Comment thread
undx marked this conversation as resolved.
final Map<String, String> configuration = config.entrySet().stream().map(e -> {
config.entrySet().forEach(e -> {
if (e.getValue().startsWith(BASE64_PREFIX)) {
final String value = new String(Base64
.getUrlDecoder()
.decode(e.getValue().substring(BASE64_PREFIX.length()).getBytes(StandardCharsets.UTF_8)));
e.setValue(value);
}
return e;
}).collect(toMap(Entry::getKey, Entry::getValue));
});
if (virtualComponents.isExtensionEntity(id)) {
return config;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.Date;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.StreamSupport;

import javax.annotation.PostConstruct;
Expand All @@ -37,8 +36,6 @@
@ApplicationScoped
public class EnvironmentResourceImpl implements EnvironmentResource {

private final AtomicReference<Environment> environment = new AtomicReference<>();

@Inject
@ConfigProperty(name = "git.build.version")
private String version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,6 @@ void migrateUnexpectedWithNPE() {

@Test
void migrateWithEncrypted() {
final JsonBuilderFactory factory = JsonProvider.provider().createBuilderFactory(emptyMap());
final JsonObject json = factory
.createObjectBuilder()
.add("configuration.url", "vault:v1:hcccVPODe9oZpcr/sKam8GUrbacji8VkuDRGfuDt7bg7VA==")
.add("configuration.username", "username0")
.add("configuration.password", "vault:v1:hcccVPODe9oZpcr/sKam8GUrbacji8VkuDRGfuDt7bg7VA==")
.build();
final Map<String, String> config = base
.path("/configurationtype/migrate/amRiYy1jb21wb25lbnQjamRiYyNkYXRhc2V0I2pkYmM/-2")
.request(APPLICATION_JSON_TYPE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
@FixedSchema(value = "jdbc_discover_schema", flows = { "reject" })
public class JdbcOutput implements Serializable {

@SuppressWarnings("java:S1068")
private final ConfigWrapper dataset;

public JdbcOutput(@Option("configuration") final ConfigWrapper dataset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public class ApiDemoEndpoints {

public static final String VALUE_ACCESS_CONTROL_ALLOW_METHODS = "GET, POST, DELETE, PUT, PATCH, OPTIONS";

@SuppressWarnings("java:S1068")
private final byte[] ENVIRONMENT;

private final Object ACTION_INDEX;
Expand All @@ -100,6 +101,7 @@ public class ApiDemoEndpoints {

private final Object COMPONENT_DEPENDENCIES;

@SuppressWarnings("java:S1068")
Comment thread
undx marked this conversation as resolved.
private final Object COMPONENT_DEPENDENCY;

private final Object COMPONENT_ICON;
Expand Down
Loading
Loading