diff --git a/pom.xml b/pom.xml
index ccebd6c69..1d1e8066a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,7 +134,7 @@
org.apache.commons
commons-compress
- 1.19
+ 1.18
commons-io
diff --git a/src/main/java/io/personium/core/PersoniumCoreException.java b/src/main/java/io/personium/core/PersoniumCoreException.java
index ffaf7a0ba..9431b8866 100644
--- a/src/main/java/io/personium/core/PersoniumCoreException.java
+++ b/src/main/java/io/personium/core/PersoniumCoreException.java
@@ -489,14 +489,6 @@ public static class Dav {
* When "F" is specified in the Overwrite header but the resource of the destination already exists.
*/
public static final PersoniumCoreException DESTINATION_ALREADY_EXISTS = create("PR412-DV-0002");
- /**
- * No Entity is matching.
- */
- public static final PersoniumCoreException NO_ENTITY_MATCH = create("PR412-DV-0003");
- /**
- * The Etag of the corresponding resource match.
- */
- public static final PersoniumCoreException ETAG_MATCH = create("PR412-DV-0004");
/**
* Range header specification error.
*/
diff --git a/src/main/java/io/personium/core/rs/box/DavFileResource.java b/src/main/java/io/personium/core/rs/box/DavFileResource.java
index bcb45a56c..025a34f63 100644
--- a/src/main/java/io/personium/core/rs/box/DavFileResource.java
+++ b/src/main/java/io/personium/core/rs/box/DavFileResource.java
@@ -75,11 +75,7 @@ public DavFileResource(final DavRsCmp parent, final DavCmp davCmp) {
@PUT
public Response put(@HeaderParam(HttpHeaders.CONTENT_TYPE) final String contentType,
@HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch,
- @HeaderParam(HttpHeaders.IF_NONE_MATCH) final String ifNoneMatch,
final InputStream inputStream) {
- if ("*".equals(ifNoneMatch)) {
- throw PersoniumCoreException.Dav.ETAG_MATCH;
- }
// Access Control
this.davRsCmp.checkAccessContext(BoxPrivilege.WRITE_CONTENT);
diff --git a/src/main/java/io/personium/core/rs/box/NullResource.java b/src/main/java/io/personium/core/rs/box/NullResource.java
index 8bd06bdbe..99bb08295 100644
--- a/src/main/java/io/personium/core/rs/box/NullResource.java
+++ b/src/main/java/io/personium/core/rs/box/NullResource.java
@@ -109,7 +109,6 @@ public final Response get() {
@PUT
public final Response put(
@HeaderParam(HttpHeaders.CONTENT_TYPE) final String contentType,
- @HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch,
final InputStream inputStream) {
//Access control
@@ -131,16 +130,6 @@ public final Response put(
throw PersoniumCoreException.Dav.HAS_NOT_PARENT.params(this.davRsCmp.getParent().getUrl());
}
- // If If-Match: * is specified, then should return 412
- // https://tools.ietf.org/html/rfc7232#section-3.1
- // If the field-value is "*", the condition is false
- // if the origin server does not have a current representation
- // for the target resource.
- // Interpretation: if any value is specified then should evaluated as false
- if (ifMatch != null) {
- throw PersoniumCoreException.Dav.NO_ENTITY_MATCH;
- }
-
Response response = this.davRsCmp.getDavCmp().putForCreate(contentType, inputStream).build();
// post event to EventBus
@@ -292,21 +281,12 @@ public Object nextPath(@PathParam("nextPath") final String nextPath,
* @return Jax-RS response object
*/
@DELETE
- public final Response delete(@HeaderParam(HttpHeaders.IF_MATCH) final String ifMatch) {
+ public final Response delete() {
//Access control
if (!this.isParentNull) {
this.davRsCmp.getParent().checkAccessContext(BoxPrivilege.UNBIND);
}
- // If If-Match: * is specified, then should return 412
- // https://tools.ietf.org/html/rfc7232#section-3.1
- // If the field-value is "*", the condition is false
- // if the origin server does not have a current representation
- // for the target resource.
- if (ifMatch != null) {
- throw PersoniumCoreException.Dav.NO_ENTITY_MATCH;
- }
-
throw PersoniumCoreException.Dav.RESOURCE_NOT_FOUND.params(this.davRsCmp.getUrl());
}
diff --git a/src/main/java/io/personium/core/utils/HttpClientFactory.java b/src/main/java/io/personium/core/utils/HttpClientFactory.java
index 869d09760..b2910098b 100644
--- a/src/main/java/io/personium/core/utils/HttpClientFactory.java
+++ b/src/main/java/io/personium/core/utils/HttpClientFactory.java
@@ -54,9 +54,6 @@ public class HttpClientFactory {
/** Connection timeout value.*/
private static final int TIMEOUT = 60000; // 20000;
- /** Addr local. */
- public static final String IP_ADDR_LOCAL = "127.0.0.1";
-
/** Constructor. */
private HttpClientFactory() {
}
@@ -103,7 +100,7 @@ private static CloseableHttpClient createAlwaysLocal(RequestConfig config) {
@Override
public InetAddress[] resolve(final String host) throws UnknownHostException {
// Always 127.0.0.1
- return new InetAddress[] { InetAddress.getByName(IP_ADDR_LOCAL) };
+ return new InetAddress[] { InetAddress.getByName("127.0.0.1") };
}
};
HttpClientConnectionManager cm = new BasicHttpClientConnectionManager(registry,
diff --git a/src/main/resources/personium-messages.properties b/src/main/resources/personium-messages.properties
index 6fa409483..dbf395489 100644
--- a/src/main/resources/personium-messages.properties
+++ b/src/main/resources/personium-messages.properties
@@ -100,7 +100,7 @@ io.personium.core.msg.PR400-DV-0002=XML content error.
io.personium.core.msg.PR400-DV-0003=Invalid depth header value:[{0}].
io.personium.core.msg.PR400-DV-0004=Role not found.
io.personium.core.msg.PR400-DV-0005=Box not found url:[{0}].
-io.personium.core.msg.PR400-DV-0006=XML validation error. Cause:[{0}].
+io.personium.core.msg.PR400-DV-0006=XML validate error. Cause:[{0}].
io.personium.core.msg.PR400-DV-0007=Cannot add any more child resources.
io.personium.core.msg.PR400-DV-0008=Hierarchy of the collection is too deep.
io.personium.core.msg.PR400-DV-0009=Request header {0} value is invalid [{1}].
@@ -135,9 +135,6 @@ io.personium.core.msg.PR409-DV-0002=File [{0}] already exists.
# PR412-DV
io.personium.core.msg.PR412-DV-0001=ETag does not match.
io.personium.core.msg.PR412-DV-0002=Overwrite header is "F" and the destination URL is already mapped to a resource.
-io.personium.core.msg.PR412-DV-0003=No entity matching.
-io.personium.core.msg.PR412-DV-0004=An entity matches with the given ETag.
-
# PR416-DV
io.personium.core.msg.PR416-DV-0001=Requested range not satisfiable.
diff --git a/src/test/java/io/personium/core/rs/box/DavCollectionResourceTest.java b/src/test/java/io/personium/core/rs/box/DavCollectionResourceTest.java
index 767cad2ee..6c26dae7c 100644
--- a/src/test/java/io/personium/core/rs/box/DavCollectionResourceTest.java
+++ b/src/test/java/io/personium/core/rs/box/DavCollectionResourceTest.java
@@ -27,7 +27,10 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
import io.personium.common.utils.CommonUtils;
import io.personium.core.PersoniumCoreException;
@@ -39,6 +42,8 @@
/**
* DavCollectionResource unit test classs.
*/
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ AccessContext.class })
@Category({ Unit.class })
public class DavCollectionResourceTest {
@@ -111,5 +116,4 @@ public void delete_Error_recursiveHeader_is_false_davCmp_not_empty() {
assertThat(e.getCode(), is(PersoniumCoreException.Dav.HAS_CHILDREN.getCode()));
}
}
-
}
diff --git a/src/test/java/io/personium/core/rs/box/DavFileResourceTest.java b/src/test/java/io/personium/core/rs/box/DavFileResourceTest.java
deleted file mode 100644
index 3f1e0ac52..000000000
--- a/src/test/java/io/personium/core/rs/box/DavFileResourceTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Personium
- * Copyright 2019 Personium Project
- * - FUJITSU LIMITED
- *
- * 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.personium.core.rs.box;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.google.common.base.Charsets;
-
-import io.personium.core.PersoniumCoreException;
-import io.personium.test.categories.Unit;
-
-/**
- * DavFileResource unit test class.
- */
-@Category({ Unit.class })
-public class DavFileResourceTest {
-
- /** Target class of unit test. */
- private DavFileResource davFileResource;
-
- /**
- * put with If-None-Match header value * should fail with 412.
- */
- @Test
- public void put_IfNoneMatchWildcard_ShouldFail() {
- // Prepare test target object
- davFileResource = new DavFileResource(null, null);
-
- // Run method
- try {
- InputStream is = new ByteArrayInputStream("{test:1}".getBytes(Charsets.UTF_8));
- davFileResource.put(org.apache.http.entity.ContentType.APPLICATION_JSON.toString(), null, "*", is);
- fail("Not throws exception.");
- } catch (PersoniumCoreException e) {
- // Confirm result
- PersoniumCoreException expected = PersoniumCoreException.Dav.ETAG_MATCH;
- assertEquals(expected.getCode(), e.getCode());
- }
- }
-}
diff --git a/src/test/java/io/personium/core/rs/box/NullResourceTest.java b/src/test/java/io/personium/core/rs/box/NullResourceTest.java
deleted file mode 100644
index f180b1f98..000000000
--- a/src/test/java/io/personium/core/rs/box/NullResourceTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Personium
- * Copyright 2017-2019 Personium Project
- * - FUJITSU LIMITED
- *
- * 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.personium.core.rs.box;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import io.personium.core.PersoniumCoreException;
-import io.personium.core.model.Cell;
-import io.personium.core.model.DavCmp;
-import io.personium.core.model.DavRsCmp;
-import io.personium.test.categories.Unit;
-
-/**
- * ODataSvcCollectionResource unit test classs.
- */
-@Category({ Unit.class })
-public class NullResourceTest {
-
- /** Target class of unit test. */
- private NullResource nullResource;
-
- @Before
- public void before() {
- // --------------------
- // Test method args
- // --------------------
- String url = "https://personium/cell/box";
- String name = "col";
- String cellUrl = "https://personium/cell/";
-
- // --------------------
- // Mock settings
- // --------------------
- DavRsCmp davRsCmp = mock(DavRsCmp.class);
- DavCmp davCmp = mock(DavCmp.class);
- Cell cell = mock(Cell.class);
- doReturn(null).when(davRsCmp).getAccessContext();
- doReturn(url).when(davRsCmp).getUrl();
- doReturn(cell).when(davRsCmp).getCell();
- doReturn(cellUrl).when(cell).getUrl();
- doReturn(name).when(davCmp).getName();
- nullResource = new NullResource(davRsCmp, davCmp, false);
-
- }
-
- /**
- *
- */
- @Test
- public void put_With_IfMatchWildCard_ShouldReturn_412() {
- try {
- nullResource.put("text/html", "*", null);
- fail();
- }catch (PersoniumCoreException e) {
- assertEquals(PersoniumCoreException.Dav.NO_ENTITY_MATCH.getCode(), e.getCode());
- }
- }
-
- /**
- * delete_ShouldReturn_404
- */
- @Test
- public void delete_ShouldReturn_404() {
- try {
- nullResource.delete(null);
- fail();
- }catch (PersoniumCoreException e) {
- assertEquals(PersoniumCoreException.Dav.RESOURCE_NOT_FOUND.getCode(), e.getCode());
- }
- }
- /**
- * delete_With_IfMatchWildCard_ShouldReturn_412
- */
- @Test
- public void delete_With_IfMatchWildCard_ShouldReturn_412() {
- try {
- nullResource.delete("*");
- fail();
- }catch (PersoniumCoreException e) {
- assertEquals(PersoniumCoreException.Dav.NO_ENTITY_MATCH.getCode(), e.getCode());
- }
- }
-}
diff --git a/src/test/java/io/personium/test/jersey/box/odatacol/UserDataDeleteTest.java b/src/test/java/io/personium/test/jersey/box/odatacol/UserDataDeleteTest.java
index e02cfbb56..8bbc76b09 100644
--- a/src/test/java/io/personium/test/jersey/box/odatacol/UserDataDeleteTest.java
+++ b/src/test/java/io/personium/test/jersey/box/odatacol/UserDataDeleteTest.java
@@ -1,7 +1,6 @@
/**
- * Personium
- * Copyright 2014-2019 Personium Project
- * - FUJITSU LIMITED
+ * personium.io
+ * Copyright 2014 FUJITSU LIMITED
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +54,7 @@ public class UserDataDeleteTest extends AbstractUserDataTest {
String userDataId = "userdata001";
/**
- * Constructor.
+ * コンストラクタ.
*/
public UserDataDeleteTest() {
super(new PersoniumCoreApplication());
@@ -116,7 +115,7 @@ public UserDataDeleteTest() {
// DELETEを実行
deleteUserData(cellName, boxName, "colhoge", entityTypeName,
- userDataId, AbstractCase.MASTER_TOKEN_NAME, HttpStatus.SC_PRECONDITION_FAILED);
+ userDataId, AbstractCase.MASTER_TOKEN_NAME, HttpStatus.SC_NOT_FOUND);
}
diff --git a/src/test/java/io/personium/test/jersey/box/odatacol/schema/assocend/AssociationEndDeleteTest.java b/src/test/java/io/personium/test/jersey/box/odatacol/schema/assocend/AssociationEndDeleteTest.java
index 272d747fc..1223b60ba 100644
--- a/src/test/java/io/personium/test/jersey/box/odatacol/schema/assocend/AssociationEndDeleteTest.java
+++ b/src/test/java/io/personium/test/jersey/box/odatacol/schema/assocend/AssociationEndDeleteTest.java
@@ -1,7 +1,6 @@
/**
- * Personium
- * Copyright 2014-2019 Personium Project
- * - FUJITSU LIMITED
+ * personium.io
+ * Copyright 2014 FUJITSU LIMITED
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +48,7 @@ public class AssociationEndDeleteTest extends AbstractCase {
private static final String ENTITY_TYPE_NAME = "Product";
/**
- * Constructor.
+ * コンストラクタ.
*/
public AssociationEndDeleteTest() {
super(new PersoniumCoreApplication());
@@ -148,7 +147,7 @@ public AssociationEndDeleteTest() {
.with("entityTypeName", ENTITY_TYPE_NAME)
.with("ifMatch", "*")
.returns()
- .statusCode(HttpStatus.SC_PRECONDITION_FAILED)
+ .statusCode(HttpStatus.SC_NOT_FOUND)
.debug();
// レスポンスヘッダーのチェック