diff --git a/batch/file-ingest/pom.xml b/batch/file-ingest/pom.xml index 004c77b..7fef086 100644 --- a/batch/file-ingest/pom.xml +++ b/batch/file-ingest/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.springframework + io.spring.cloud.ingest ingest 1.0.0 @@ -14,7 +14,6 @@ 1.8 3.7.0 1.2.2.RELEASE - 2.0.0.M7 checkstyle.xml 2.17 diff --git a/batch/file-ingest/src/main/java/io/spring/cloud/ingest/Application.java b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/Application.java new file mode 100644 index 0000000..8e53a22 --- /dev/null +++ b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/Application.java @@ -0,0 +1,34 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.spring.cloud.ingest; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.task.configuration.EnableTask; + +/** + * Main entry point for the ingest sample application. + * + * @author Chris Schaefer + */ +@EnableTask +@SpringBootApplication +public class Application { + public static void main(String[] args) throws Exception { + SpringApplication.run(Application.class, args); + } +} diff --git a/batch/file-ingest/src/main/java/org/springframework/ingest/config/BatchConfiguration.java b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/config/BatchConfiguration.java similarity index 78% rename from batch/file-ingest/src/main/java/org/springframework/ingest/config/BatchConfiguration.java rename to batch/file-ingest/src/main/java/io/spring/cloud/ingest/config/BatchConfiguration.java index 5e03ec0..7f74421 100644 --- a/batch/file-ingest/src/main/java/org/springframework/ingest/config/BatchConfiguration.java +++ b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/config/BatchConfiguration.java @@ -1,5 +1,24 @@ -package org.springframework.ingest.config; +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.spring.cloud.ingest.config; + +import io.spring.cloud.ingest.domain.Person; +import io.spring.cloud.ingest.mapper.fieldset.PersonFieldSetMapper; +import io.spring.cloud.ingest.processor.PersonItemProcessor; import javax.sql.DataSource; import org.springframework.batch.core.Job; @@ -21,10 +40,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ResourceLoader; -import org.springframework.ingest.domain.Person; -import org.springframework.ingest.mapper.fieldset.PersonFieldSetMapper; -import org.springframework.ingest.processor.PersonItemProcessor; - /** * Class used to configure the batch job related beans. * diff --git a/batch/file-ingest/src/main/java/io/spring/cloud/ingest/domain/Person.java b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/domain/Person.java new file mode 100644 index 0000000..be94838 --- /dev/null +++ b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/domain/Person.java @@ -0,0 +1,45 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.spring.cloud.ingest.domain; + +/** + * Domain object representing data about a Person. + * + * @author Chris Schaefer + */ +public class Person { + private final String firstName; + private final String lastName; + + public Person(final String firstName, final String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + @Override + public String toString() { + return "First name: " + firstName + " , last name: " + lastName; + } +} diff --git a/batch/file-ingest/src/main/java/io/spring/cloud/ingest/mapper/fieldset/PersonFieldSetMapper.java b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/mapper/fieldset/PersonFieldSetMapper.java new file mode 100644 index 0000000..f5abbd6 --- /dev/null +++ b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/mapper/fieldset/PersonFieldSetMapper.java @@ -0,0 +1,37 @@ +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.spring.cloud.ingest.mapper.fieldset; + +import io.spring.cloud.ingest.domain.Person; + +import org.springframework.batch.item.file.mapping.FieldSetMapper; +import org.springframework.batch.item.file.transform.FieldSet; + +/** + * Maps the provided FieldSet into a Person object. + * + * @author Chris Schaefer + */ +public class PersonFieldSetMapper implements FieldSetMapper { + @Override + public Person mapFieldSet(FieldSet fieldSet) { + String firstName = fieldSet.readString(0); + String lastName = fieldSet.readString(1); + + return new Person(firstName, lastName); + } +} diff --git a/batch/file-ingest/src/main/java/org/springframework/ingest/processor/PersonItemProcessor.java b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/processor/PersonItemProcessor.java similarity index 51% rename from batch/file-ingest/src/main/java/org/springframework/ingest/processor/PersonItemProcessor.java rename to batch/file-ingest/src/main/java/io/spring/cloud/ingest/processor/PersonItemProcessor.java index 6d2802c..dd77287 100644 --- a/batch/file-ingest/src/main/java/org/springframework/ingest/processor/PersonItemProcessor.java +++ b/batch/file-ingest/src/main/java/io/spring/cloud/ingest/processor/PersonItemProcessor.java @@ -1,10 +1,26 @@ -package org.springframework.ingest.processor; +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.spring.cloud.ingest.processor; + +import io.spring.cloud.ingest.domain.Person; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.item.ItemProcessor; -import org.springframework.ingest.domain.Person; /** * Processes the providing record, transforming the data into diff --git a/batch/file-ingest/src/main/java/org/springframework/ingest/Application.java b/batch/file-ingest/src/main/java/org/springframework/ingest/Application.java deleted file mode 100644 index 1cbaf9d..0000000 --- a/batch/file-ingest/src/main/java/org/springframework/ingest/Application.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.springframework.ingest; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.task.configuration.EnableTask; - -/** - * Main entry point for the ingest sample application. - * - * @author Chris Schaefer - */ -@EnableTask -@SpringBootApplication -public class Application { - public static void main(String[] args) throws Exception { - SpringApplication.run(Application.class, args); - } -} diff --git a/batch/file-ingest/src/main/java/org/springframework/ingest/domain/Person.java b/batch/file-ingest/src/main/java/org/springframework/ingest/domain/Person.java deleted file mode 100644 index edf03d9..0000000 --- a/batch/file-ingest/src/main/java/org/springframework/ingest/domain/Person.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.springframework.ingest.domain; - -/** - * Domain object representing data about a Person. - * - * @author Chris Schaefer - */ -public class Person { - private final String firstName; - private final String lastName; - - public Person(final String firstName, final String lastName) { - this.firstName = firstName; - this.lastName = lastName; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - @Override - public String toString() { - return "First name: " + firstName + " , last name: " + lastName; - } -} diff --git a/batch/file-ingest/src/main/java/org/springframework/ingest/mapper/fieldset/PersonFieldSetMapper.java b/batch/file-ingest/src/main/java/org/springframework/ingest/mapper/fieldset/PersonFieldSetMapper.java deleted file mode 100644 index 4b3f6cf..0000000 --- a/batch/file-ingest/src/main/java/org/springframework/ingest/mapper/fieldset/PersonFieldSetMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.springframework.ingest.mapper.fieldset; - -import org.springframework.batch.item.file.mapping.FieldSetMapper; -import org.springframework.batch.item.file.transform.FieldSet; - -import org.springframework.ingest.domain.Person; - -/** - * Maps the provided FieldSet into a Person object. - * - * @author Chris Schaefer - */ -public class PersonFieldSetMapper implements FieldSetMapper { - @Override - public Person mapFieldSet(FieldSet fieldSet) { - String firstName = fieldSet.readString(0); - String lastName = fieldSet.readString(1); - - return new Person(firstName, lastName); - } -} diff --git a/batch/file-ingest/src/test/java/org/springframework/ingest/config/BatchConfigurationTests.java b/batch/file-ingest/src/test/java/io/spring/cloud/ingest/config/BatchConfigurationTests.java similarity index 86% rename from batch/file-ingest/src/test/java/org/springframework/ingest/config/BatchConfigurationTests.java rename to batch/file-ingest/src/test/java/io/spring/cloud/ingest/config/BatchConfigurationTests.java index 1577977..47e0d7c 100644 --- a/batch/file-ingest/src/test/java/org/springframework/ingest/config/BatchConfigurationTests.java +++ b/batch/file-ingest/src/test/java/io/spring/cloud/ingest/config/BatchConfigurationTests.java @@ -1,4 +1,20 @@ -package org.springframework.ingest.config; +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.spring.cloud.ingest.config; import org.junit.After; import org.junit.Before; diff --git a/batch/file-ingest/src/test/java/org/springframework/ingest/mapper/fieldset/PersonFieldSetMapperTests.java b/batch/file-ingest/src/test/java/io/spring/cloud/ingest/mapper/fieldset/PersonFieldSetMapperTests.java similarity index 62% rename from batch/file-ingest/src/test/java/org/springframework/ingest/mapper/fieldset/PersonFieldSetMapperTests.java rename to batch/file-ingest/src/test/java/io/spring/cloud/ingest/mapper/fieldset/PersonFieldSetMapperTests.java index 4256de3..5bd20cb 100644 --- a/batch/file-ingest/src/test/java/org/springframework/ingest/mapper/fieldset/PersonFieldSetMapperTests.java +++ b/batch/file-ingest/src/test/java/io/spring/cloud/ingest/mapper/fieldset/PersonFieldSetMapperTests.java @@ -1,4 +1,20 @@ -package org.springframework.ingest.mapper.fieldset; +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.spring.cloud.ingest.mapper.fieldset; import org.junit.Test; @@ -6,7 +22,7 @@ import org.springframework.batch.item.file.mapping.FieldSetMapper; import org.springframework.batch.item.file.transform.DefaultFieldSet; import org.springframework.batch.item.file.transform.FieldSet; -import org.springframework.ingest.domain.Person; +import io.spring.cloud.ingest.domain.Person; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertEquals; diff --git a/batch/file-ingest/src/test/java/org/springframework/ingest/processor/PersonItemProcessorTests.java b/batch/file-ingest/src/test/java/io/spring/cloud/ingest/processor/PersonItemProcessorTests.java similarity index 62% rename from batch/file-ingest/src/test/java/org/springframework/ingest/processor/PersonItemProcessorTests.java rename to batch/file-ingest/src/test/java/io/spring/cloud/ingest/processor/PersonItemProcessorTests.java index 1477f58..e05e318 100644 --- a/batch/file-ingest/src/test/java/org/springframework/ingest/processor/PersonItemProcessorTests.java +++ b/batch/file-ingest/src/test/java/io/spring/cloud/ingest/processor/PersonItemProcessorTests.java @@ -1,9 +1,25 @@ -package org.springframework.ingest.processor; +/* + * Copyright 2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.spring.cloud.ingest.processor; + +import io.spring.cloud.ingest.domain.Person; import org.junit.Test; import org.springframework.batch.item.ItemProcessor; -import org.springframework.ingest.domain.Person; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertEquals;