Skip to content

Commit 1e2177e

Browse files
committed
Use intellij java google style to fix import ordering
1 parent 14cb64c commit 1e2177e

3 files changed

Lines changed: 65 additions & 16 deletions

File tree

ingestion/src/main/java/feast/ingestion/deserializer/FeatureRowDeserializer.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
* Copyright 2018 The Feast Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
118
package feast.ingestion.deserializer;
219

320
import com.google.protobuf.InvalidProtocolBufferException;

ingestion/src/main/java/feast/ingestion/deserializer/FeatureRowKeyDeserializer.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
* Copyright 2018 The Feast Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
118
package feast.ingestion.deserializer;
219

320
import com.google.protobuf.InvalidProtocolBufferException;

ingestion/src/test/java/feast/ingestion/deserializer/KafkaFeatureRowDeserializerTest.java

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1+
/*
2+
* Copyright 2018 The Feast Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
118
package feast.ingestion.deserializer;
219

320
import com.google.protobuf.MessageLite;
421
import feast.types.FeatureRowProto.FeatureRow;
522
import java.util.Map;
6-
import java.util.UUID;
723
import java.util.concurrent.BlockingQueue;
824
import java.util.concurrent.ExecutionException;
925
import java.util.concurrent.LinkedBlockingQueue;
@@ -13,9 +29,11 @@
1329
import org.apache.kafka.common.serialization.ByteArraySerializer;
1430
import org.apache.kafka.common.serialization.Deserializer;
1531
import org.junit.Assert;
32+
import org.junit.ClassRule;
1633
import org.junit.Test;
1734
import org.junit.runner.RunWith;
1835
import org.springframework.beans.factory.annotation.Autowired;
36+
import org.springframework.boot.test.context.SpringBootTest;
1937
import org.springframework.context.annotation.Bean;
2038
import org.springframework.context.annotation.Configuration;
2139
import org.springframework.kafka.core.ConsumerFactory;
@@ -28,31 +46,29 @@
2846
import org.springframework.kafka.listener.MessageListener;
2947
import org.springframework.kafka.listener.MessageListenerContainer;
3048
import org.springframework.kafka.support.SendResult;
31-
import org.springframework.kafka.test.EmbeddedKafkaBroker;
32-
import org.springframework.kafka.test.context.EmbeddedKafka;
49+
import org.springframework.kafka.test.rule.EmbeddedKafkaRule;
3350
import org.springframework.kafka.test.utils.ContainerTestUtils;
3451
import org.springframework.kafka.test.utils.KafkaTestUtils;
52+
import org.springframework.test.annotation.DirtiesContext;
3553
import org.springframework.test.context.junit4.SpringRunner;
3654
import org.springframework.util.concurrent.ListenableFuture;
3755

3856
@RunWith(SpringRunner.class)
39-
@EmbeddedKafka(controlledShutdown = true)
57+
@SpringBootTest
58+
@DirtiesContext
4059
public class KafkaFeatureRowDeserializerTest {
4160

42-
@Autowired private EmbeddedKafkaBroker embeddedKafka;
61+
private static final String topic = "TEST_TOPIC";
62+
63+
@ClassRule public static EmbeddedKafkaRule embeddedKafka = new EmbeddedKafkaRule(1, true, topic);
4364
@Autowired private KafkaTemplate<byte[], byte[]> template;
4465

4566
private <MessageType extends MessageLite> void deserialize(MessageType input) {
46-
// generate a random UUID to create a unique topic and consumer group id for each test
47-
String uuid = UUID.randomUUID().toString();
48-
String topic = "topic-" + uuid;
49-
50-
embeddedKafka.addTopics(topic);
5167

5268
Deserializer deserializer = new FeatureRowDeserializer();
5369

5470
Map<String, Object> consumerProps =
55-
KafkaTestUtils.consumerProps(uuid, Boolean.FALSE.toString(), embeddedKafka);
71+
KafkaTestUtils.consumerProps("testGroup", "false", embeddedKafka.getEmbeddedKafka());
5672
ConsumerFactory<FeatureRow, FeatureRow> consumerFactory =
5773
new DefaultKafkaConsumerFactory<>(consumerProps, deserializer, deserializer);
5874

@@ -63,7 +79,8 @@ private <MessageType extends MessageLite> void deserialize(MessageType input) {
6379
MessageListenerContainer container =
6480
new KafkaMessageListenerContainer<>(consumerFactory, containerProps);
6581
container.start();
66-
ContainerTestUtils.waitForAssignment(container, embeddedKafka.getPartitionsPerTopic());
82+
ContainerTestUtils.waitForAssignment(
83+
container, embeddedKafka.getEmbeddedKafka().getPartitionsPerTopic());
6784

6885
byte[] data = input.toByteArray();
6986
ProducerRecord<byte[], byte[]> producerRecord = new ProducerRecord<>(topic, data, data);
@@ -99,12 +116,10 @@ public void deserializeFeatureRowProto() {
99116

100117
@Configuration
101118
static class ContextConfiguration {
102-
103-
@Autowired private EmbeddedKafkaBroker embeddedKafka;
104-
105119
@Bean
106120
ProducerFactory<byte[], byte[]> producerFactory() {
107-
Map<String, Object> producerProps = KafkaTestUtils.producerProps(embeddedKafka);
121+
Map<String, Object> producerProps =
122+
KafkaTestUtils.producerProps(embeddedKafka.getEmbeddedKafka());
108123

109124
return new DefaultKafkaProducerFactory<>(
110125
producerProps, new ByteArraySerializer(), new ByteArraySerializer());

0 commit comments

Comments
 (0)