rename org.baeldung package

This commit is contained in:
Loredana 2019-07-17 14:01:41 +03:00
parent baa3e69ff1
commit ec1807b828
25 changed files with 87 additions and 84 deletions

View File

@ -1,4 +1,4 @@
package org.baeldung.config;
package com.baeldung;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -7,8 +7,8 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
import org.springframework.context.annotation.ComponentScan;
@EnableAutoConfiguration
@ComponentScan("org.baeldung")
@SpringBootApplication
@ComponentScan("com.baeldung.cors")
public class Application extends SpringBootServletInitializer {
public static void main(final String[] args) {

View File

@ -1,6 +1,5 @@
package org.baeldung.config;
package com.baeldung.config;
import org.baeldung.config.converter.KryoHttpMessageConverter;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
@ -13,9 +12,12 @@ import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConve
import org.springframework.http.converter.xml.MarshallingHttpMessageConverter;
import org.springframework.oxm.xstream.XStreamMarshaller;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.baeldung.config.converter.KryoHttpMessageConverter;
import java.text.SimpleDateFormat;
import java.util.List;
@ -24,7 +26,7 @@ import java.util.List;
*/
@Configuration
@EnableWebMvc
@ComponentScan({ "org.baeldung.web" })
@ComponentScan({ "com.baeldung.web" })
public class WebConfig implements WebMvcConfigurer {
public WebConfig() {
@ -64,4 +66,10 @@ public class WebConfig implements WebMvcConfigurer {
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.APPLICATION_JSON);
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
}

View File

@ -1,13 +1,13 @@
package org.baeldung.config.converter;
package com.baeldung.config.converter;
import java.io.IOException;
import org.baeldung.web.dto.Foo;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
import org.springframework.http.converter.AbstractHttpMessageConverter;
import com.baeldung.web.dto.Foo;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;

View File

@ -6,4 +6,13 @@ public class Account {
public Account(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}

View File

@ -1,16 +0,0 @@
package com.baeldung.cors;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
}

View File

@ -1,4 +1,4 @@
package org.baeldung.web.controller;
package com.baeldung.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;

View File

@ -1,9 +1,8 @@
package org.baeldung.web.controller;
package com.baeldung.web.controller;
import java.util.Arrays;
import java.util.List;
import org.baeldung.web.dto.Bazz;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
@ -15,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baeldung.web.dto.Bazz;
import com.fasterxml.jackson.core.JsonProcessingException;
@RestController

View File

@ -1,11 +1,9 @@
package org.baeldung.web.controller;
package com.baeldung.web.controller;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import java.util.List;
import org.baeldung.web.dto.Foo;
import org.baeldung.web.dto.FooProtos;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
@ -16,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import com.baeldung.web.dto.Foo;
import com.baeldung.web.dto.FooProtos;
import com.google.common.collect.Lists;
@Controller

View File

@ -1,4 +1,4 @@
package org.baeldung.web.controller;
package com.baeldung.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.controller.status;
package com.baeldung.web.controller.status;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.controller.status;
package com.baeldung.web.controller.status;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.dto;
package com.baeldung.web.dto;
public class Bazz {

View File

@ -1,4 +1,4 @@
package org.baeldung.web.dto;
package com.baeldung.web.dto;
import com.thoughtworks.xstream.annotations.XStreamAlias;

View File

@ -1,7 +1,7 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: FooProtos.proto
package org.baeldung.web.dto;
package com.baeldung.web.dto;
public final class FooProtos {
private FooProtos() {
@ -115,11 +115,11 @@ public final class FooProtos {
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return org.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_descriptor;
return com.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() {
return org.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_fieldAccessorTable.ensureFieldAccessorsInitialized(org.baeldung.web.dto.FooProtos.Foo.class, org.baeldung.web.dto.FooProtos.Foo.Builder.class);
return com.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_fieldAccessorTable.ensureFieldAccessorsInitialized(com.baeldung.web.dto.FooProtos.Foo.class, com.baeldung.web.dto.FooProtos.Foo.Builder.class);
}
public static com.google.protobuf.Parser<Foo> PARSER = new com.google.protobuf.AbstractParser<Foo>() {
@ -255,43 +255,43 @@ public final class FooProtos {
return super.writeReplace();
}
public static org.baeldung.web.dto.FooProtos.Foo parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException {
public static com.baeldung.web.dto.FooProtos.Foo parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.baeldung.web.dto.FooProtos.Foo parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException {
public static com.baeldung.web.dto.FooProtos.Foo parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.baeldung.web.dto.FooProtos.Foo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
public static com.baeldung.web.dto.FooProtos.Foo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static org.baeldung.web.dto.FooProtos.Foo parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException {
public static com.baeldung.web.dto.FooProtos.Foo parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static org.baeldung.web.dto.FooProtos.Foo parseFrom(java.io.InputStream input) throws java.io.IOException {
public static com.baeldung.web.dto.FooProtos.Foo parseFrom(java.io.InputStream input) throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.baeldung.web.dto.FooProtos.Foo parseFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
public static com.baeldung.web.dto.FooProtos.Foo parseFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static org.baeldung.web.dto.FooProtos.Foo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException {
public static com.baeldung.web.dto.FooProtos.Foo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static org.baeldung.web.dto.FooProtos.Foo parseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
public static com.baeldung.web.dto.FooProtos.Foo parseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static org.baeldung.web.dto.FooProtos.Foo parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException {
public static com.baeldung.web.dto.FooProtos.Foo parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static org.baeldung.web.dto.FooProtos.Foo parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
public static com.baeldung.web.dto.FooProtos.Foo parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
@ -303,7 +303,7 @@ public final class FooProtos {
return newBuilder();
}
public static Builder newBuilder(org.baeldung.web.dto.FooProtos.Foo prototype) {
public static Builder newBuilder(com.baeldung.web.dto.FooProtos.Foo prototype) {
return newBuilder().mergeFrom(prototype);
}
@ -322,13 +322,13 @@ public final class FooProtos {
*/
public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:baeldung.Foo)
org.baeldung.web.dto.FooProtos.FooOrBuilder {
com.baeldung.web.dto.FooProtos.FooOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return org.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_descriptor;
return com.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() {
return org.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_fieldAccessorTable.ensureFieldAccessorsInitialized(org.baeldung.web.dto.FooProtos.Foo.class, org.baeldung.web.dto.FooProtos.Foo.Builder.class);
return com.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_fieldAccessorTable.ensureFieldAccessorsInitialized(com.baeldung.web.dto.FooProtos.Foo.class, com.baeldung.web.dto.FooProtos.Foo.Builder.class);
}
// Construct using org.baeldung.web.dto.FooProtos.Foo.newBuilder()
@ -364,23 +364,23 @@ public final class FooProtos {
}
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return org.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_descriptor;
return com.baeldung.web.dto.FooProtos.internal_static_baeldung_Foo_descriptor;
}
public org.baeldung.web.dto.FooProtos.Foo getDefaultInstanceForType() {
return org.baeldung.web.dto.FooProtos.Foo.getDefaultInstance();
public com.baeldung.web.dto.FooProtos.Foo getDefaultInstanceForType() {
return com.baeldung.web.dto.FooProtos.Foo.getDefaultInstance();
}
public org.baeldung.web.dto.FooProtos.Foo build() {
org.baeldung.web.dto.FooProtos.Foo result = buildPartial();
public com.baeldung.web.dto.FooProtos.Foo build() {
com.baeldung.web.dto.FooProtos.Foo result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public org.baeldung.web.dto.FooProtos.Foo buildPartial() {
org.baeldung.web.dto.FooProtos.Foo result = new org.baeldung.web.dto.FooProtos.Foo(this);
public com.baeldung.web.dto.FooProtos.Foo buildPartial() {
com.baeldung.web.dto.FooProtos.Foo result = new com.baeldung.web.dto.FooProtos.Foo(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
@ -397,16 +397,16 @@ public final class FooProtos {
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof org.baeldung.web.dto.FooProtos.Foo) {
return mergeFrom((org.baeldung.web.dto.FooProtos.Foo) other);
if (other instanceof com.baeldung.web.dto.FooProtos.Foo) {
return mergeFrom((com.baeldung.web.dto.FooProtos.Foo) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(org.baeldung.web.dto.FooProtos.Foo other) {
if (other == org.baeldung.web.dto.FooProtos.Foo.getDefaultInstance())
public Builder mergeFrom(com.baeldung.web.dto.FooProtos.Foo other) {
if (other == com.baeldung.web.dto.FooProtos.Foo.getDefaultInstance())
return this;
if (other.hasId()) {
setId(other.getId());
@ -433,11 +433,11 @@ public final class FooProtos {
}
public Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException {
org.baeldung.web.dto.FooProtos.Foo parsedMessage = null;
com.baeldung.web.dto.FooProtos.Foo parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (org.baeldung.web.dto.FooProtos.Foo) e.getUnfinishedMessage();
parsedMessage = (com.baeldung.web.dto.FooProtos.Foo) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {

View File

@ -1,4 +1,4 @@
package org.baeldung.web.util;
package com.baeldung.web.util;
import javax.servlet.http.HttpServletResponse;

View File

@ -2,9 +2,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:cors>

View File

@ -1,6 +1,5 @@
package org.baeldung;
package com.baeldung;
import org.baeldung.config.Application;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;

View File

@ -1,11 +1,11 @@
package org.baeldung.web.controller.mediatypes;
package com.baeldung.web.controller.mediatypes;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan({ "org.baeldung.web" })
@ComponentScan({ "com.baeldung.web" })
public class TestConfig {
}

View File

@ -1,9 +1,8 @@
package org.baeldung.web.controller.status;
package com.baeldung.web.controller.status;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.baeldung.config.WebConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -16,6 +15,8 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import com.baeldung.config.WebConfig;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = WebConfig.class)
@WebAppConfiguration

View File

@ -1,5 +1,5 @@
package org.baeldung.web.test;
package com.baeldung.web.test;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
@ -10,7 +10,6 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.baeldung.config.WebConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -23,6 +22,8 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import com.baeldung.config.WebConfig;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = WebConfig.class)

View File

@ -1,4 +1,4 @@
package org.baeldung.web.test;
package com.baeldung.web.test;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.test;
package com.baeldung.web.test;
import static org.apache.commons.codec.binary.Base64.encodeBase64;
import static org.hamcrest.CoreMatchers.equalTo;
@ -13,7 +13,6 @@ import java.net.URI;
import java.util.Arrays;
import java.util.Set;
import org.baeldung.web.dto.Foo;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.HttpEntity;
@ -31,6 +30,7 @@ import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RequestCallback;
import org.springframework.web.client.RestTemplate;
import com.baeldung.web.dto.Foo;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;

View File

@ -1,13 +1,10 @@
package org.baeldung.web.test;
package com.baeldung.web.test;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import java.util.Arrays;
import org.baeldung.config.converter.KryoHttpMessageConverter;
import org.baeldung.web.dto.Foo;
import org.baeldung.web.dto.FooProtos;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.http.HttpEntity;
@ -18,6 +15,10 @@ import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter;
import org.springframework.web.client.RestTemplate;
import com.baeldung.config.converter.KryoHttpMessageConverter;
import com.baeldung.web.dto.Foo;
import com.baeldung.web.dto.FooProtos;
/**
* Integration Test class. Tests methods hits the server's rest services.
*/

View File

@ -1,4 +1,4 @@
package org.baeldung.web.test;
package com.baeldung.web.test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

View File

@ -1,4 +1,4 @@
package org.baeldung.web.util;
package com.baeldung.web.util;
import java.util.List;