Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package ee.jakarta.tck.ws.rs.api.client.entity;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.Variant;
import ee.jakarta.tck.ws.rs.common.JAXRSCommonClient;
import ee.jakarta.tck.ws.rs.common.util.JaxrsUtil;
import ee.jakarta.tck.ws.rs.lib.util.TestUtil;
/*
* @class.setup_props: webServerHost;
* webServerPort;
* ts_home;
*/
public class JAXRSClientIT extends JAXRSCommonClient {
private static final long serialVersionUID = 3872631127958907381L;
@BeforeEach
void logStartTest(TestInfo testInfo) {
TestUtil.logMsg("STARTING TEST : "+testInfo.getDisplayName());
}
@AfterEach
void logFinishTest(TestInfo testInfo) {
TestUtil.logMsg("FINISHED TEST : "+testInfo.getDisplayName());
}
/*
* @testName: entityMediaTypeTest
*
* @assertion_ids: JAXRS:JAVADOC:492; JAXRS:JAVADOC:504;
*
* @test_Strategy: Create an entity using a supplied content media type.
*
* Get entity media type.
*/
@Test
public void entityMediaTypeTest() throws Fault {
Entity entity;
MediaType[] mTypes = getMediaTypes(MediaType.class);
for (MediaType type : mTypes) {
entity = Entity.entity("entity", type);
assertEntity(entity, "entity");
assertMediaType(entity, type.toString());
}
}
/*
* @testName: entityMediaTypeGetEntityTest
*
* @assertion_ids: JAXRS:JAVADOC:492; JAXRS:JAVADOC:502;
*
* @test_Strategy: Create an entity using a supplied content media type.
*
* Get entity data.
*/
@Test
public void entityMediaTypeGetEntityTest() throws Fault {
Entity> entity;
Object[] entities = getEntities();
for (int i = 0; i != ENTITY_VALUES.length; i++) {
entity = Entity.entity(entities[i], MediaType.WILDCARD_TYPE);
assertEntity(entity, ENTITY_VALUES[i]);
}
}
/*
* @testName: entityMediaTypeAnnotationsTest
*
* @assertion_ids: JAXRS:JAVADOC:493; JAXRS:JAVADOC:504; JAXRS:JAVADOC:500;
*
* @test_Strategy: Create an entity using a supplied content media type.
*
* Get entity media type. Get the entity annotations.
*/
@Test
public void entityMediaTypeAnnotationsTest() throws Fault {
Entity entity;
MediaType[] mTypes = getMediaTypes(MediaType.class);
Annotation[] annotations = AnnotatedClass.class.getAnnotations();
for (MediaType type : mTypes) {
entity = Entity.entity("entity", type, annotations);
assertEntity(entity, "entity");
assertMediaType(entity, type.toString());
assertAnnotations(entity, annotations);
}
}
/*
* @testName: entityMediaTypeAnnotationsDifferentEntitiesTest
*
* @assertion_ids: JAXRS:JAVADOC:493; JAXRS:JAVADOC:504; JAXRS:JAVADOC:500;
*
* @test_Strategy: Create an entity using a supplied content media type.
*
* Get entity media type. Get the entity annotations.
*/
@Test
public void entityMediaTypeAnnotationsDifferentEntitiesTest() throws Fault {
Entity