src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
EdmEntityTypeImplProv extends EdmStructuralTypeImplProv implements EdmEntityType { @Override public List<EdmProperty> getKeyProperties() throws EdmException { if (edmKeyProperties == null) { if (edmBaseType != null) { return ((EdmEntityType) edmBaseType).getKeyProperties(); } if (keyProperties == null) { keyProperties ... | @Test public void getKeyProperties() throws Exception { List<EdmProperty> keyProperties = edmEntityType.getKeyProperties(); assertNotNull(keyProperties); assertEquals("Id", keyProperties.get(0).getName()); }
@Test public void getKeyPropertiesWithBaseType() throws Exception { List<EdmProperty> keyProperties = edmEntityT... |
EdmEntityTypeImplProv extends EdmStructuralTypeImplProv implements EdmEntityType { @Override public List<String> getKeyPropertyNames() throws EdmException { if (edmKeyPropertyNames == null) { if (edmBaseType != null) { return ((EdmEntityType) edmBaseType).getKeyPropertyNames(); } edmKeyPropertyNames = new ArrayList<Str... | @Test public void getKeyPropertiesNames() throws Exception { List<String> keyProperties = edmEntityType.getKeyPropertyNames(); assertNotNull(keyProperties); assertTrue(keyProperties.contains("Id")); List<String> properties = edmEntityType.getPropertyNames(); assertNotNull(properties); assertTrue(properties.contains("Id... |
EdmEntityTypeImplProv extends EdmStructuralTypeImplProv implements EdmEntityType { @Override public List<String> getNavigationPropertyNames() throws EdmException { if (edmNavigationPropertyNames == null) { edmNavigationPropertyNames = new ArrayList<String>(); if (edmBaseType != null) { edmNavigationPropertyNames.addAll... | @Test public void getNavProperties() throws Exception { List<String> navProperties = edmEntityType.getNavigationPropertyNames(); assertNotNull(navProperties); assertTrue(navProperties.contains("fooBarNav")); }
@Test public void getNavPropertiesWithBaseType() throws Exception { List<String> navProperties = edmEntityType... |
EdmEntityTypeImplProv extends EdmStructuralTypeImplProv implements EdmEntityType { @Override public EdmAnnotations getAnnotations() throws EdmException { return new EdmAnnotationsImplProv(entityType.getAnnotationAttributes(), entityType.getAnnotationElements()); } EdmEntityTypeImplProv(final EdmImplProv edm, final Enti... | @Test public void getAnnotations() throws Exception { EdmAnnotatable annotatable = edmEntityType; EdmAnnotations annotations = annotatable.getAnnotations(); assertNull(annotations.getAnnotationAttributes()); assertNull(annotations.getAnnotationElements()); } |
EdmNavigationPropertyImplProv extends EdmTypedImplProv implements EdmNavigationProperty, EdmAnnotatable { @Override public EdmAnnotations getAnnotations() throws EdmException { return new EdmAnnotationsImplProv(navigationProperty.getAnnotationAttributes(), navigationProperty.getAnnotationElements()); } EdmNavigationPro... | @Test public void getAnnotations() throws Exception { EdmAnnotatable annotatable = navPropertyProvider; EdmAnnotations annotations = annotatable.getAnnotations(); assertNull(annotations.getAnnotationAttributes()); assertNull(annotations.getAnnotationElements()); } |
EdmAssociationSetImplProv extends EdmNamedImplProv implements EdmAssociationSet, EdmAnnotatable { @Override public EdmAssociationSetEnd getEnd(final String role) throws EdmException { AssociationSetEnd end; if (associationSet.getEnd1().getRole().equals(role)) { end = associationSet.getEnd1(); } else if (associationSet.... | @Test public void testAssociationSet() throws Exception { EdmAssociationSet associationSet = edmAssociationSet; assertEquals("associationSetName", associationSet.getName()); assertEquals("end1Role", associationSet.getEnd("end1Role").getRole()); assertEquals(null, associationSet.getEnd("endWrongRole")); }
@Test(expected... |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public boolean isMappingModelExists() { return mappingModelExists; } JPAEdmMappingModelService(final ODataJPAContext ctx); @Override void loadMappingModel(); @Override boolean isMappingModelExists(); @Override JPAEdmMappingModel getJPAEdmMappingM... | @Test public void testIsMappingModelExists() { assertTrue(objJPAEdmMappingModelServiceTest.isMappingModelExists()); } |
Team { public boolean isScrumTeam() { return isScrumTeam; } Team(final int id, final String name); String getId(); String getName(); void setName(final String name); boolean isScrumTeam(); void setScrumTeam(final boolean isScrumTeam); List<Employee> getEmployees(); @Override int hashCode(); @Override boolean equals(fin... | @Test public void testIsScrumTeam() { Team team1 = new Team(1, null); team1.setScrumTeam(true); assertTrue(team1.isScrumTeam()); } |
EdmAssociationSetImplProv extends EdmNamedImplProv implements EdmAssociationSet, EdmAnnotatable { @Override public EdmAssociation getAssociation() throws EdmException { EdmAssociation association = edm.getAssociation(associationSet.getAssociation().getNamespace(), associationSet.getAssociation().getName()); if (associa... | @Test public void testAssociationExists() throws Exception { EdmAssociationSet associationSet = edmAssociationSet; assertNotNull(associationSet.getAssociation()); } |
EdmAssociationSetImplProv extends EdmNamedImplProv implements EdmAssociationSet, EdmAnnotatable { @Override public EdmEntityContainer getEntityContainer() throws EdmException { return edmEntityContainer; } EdmAssociationSetImplProv(final EdmImplProv edm, final AssociationSet associationSet, final EdmEntityContainer edm... | @Test public void testEntityContainer() throws Exception { EdmAssociationSet associationSet = edmAssociationSet; assertNotNull(associationSet.getEntityContainer()); } |
EdmAssociationSetImplProv extends EdmNamedImplProv implements EdmAssociationSet, EdmAnnotatable { @Override public EdmAnnotations getAnnotations() throws EdmException { return new EdmAnnotationsImplProv(associationSet.getAnnotationAttributes(), associationSet.getAnnotationElements()); } EdmAssociationSetImplProv(final ... | @Test public void getAnnotations() throws Exception { EdmAnnotatable annotatable = (EdmAnnotatable) edmAssociationSet; EdmAnnotations annotations = annotatable.getAnnotations(); assertNull(annotations.getAnnotationAttributes()); assertNull(annotations.getAnnotationElements()); } |
EdmFunctionImportImplProv extends EdmNamedImplProv implements EdmFunctionImport, EdmAnnotatable { @Override public String getHttpMethod() throws EdmException { return functionImport.getHttpMethod(); } EdmFunctionImportImplProv(final EdmImplProv edm, final FunctionImport functionImport, final EdmEntityContainer edmEntit... | @Test public void functionImport() throws Exception { assertEquals("foo", edmFunctionImport.getName()); assertEquals(HttpMethods.GET, edmFunctionImport.getHttpMethod()); } |
EdmFunctionImportImplProv extends EdmNamedImplProv implements EdmFunctionImport, EdmAnnotatable { @Override public EdmEntityContainer getEntityContainer() throws EdmException { return edmEntityContainer; } EdmFunctionImportImplProv(final EdmImplProv edm, final FunctionImport functionImport, final EdmEntityContainer edm... | @Test public void containerName() throws Exception { assertEquals(edmEntityContainer, edmFunctionImport.getEntityContainer()); } |
EdmFunctionImportImplProv extends EdmNamedImplProv implements EdmFunctionImport, EdmAnnotatable { @Override public EdmTyped getReturnType() throws EdmException { final ReturnType returnType = functionImport.getReturnType(); return new EdmTypedImplProv(edm, functionImport.getName(), returnType.getTypeName(), returnType.... | @Test public void returnType() throws Exception { EdmTyped returnType = edmFunctionImport.getReturnType(); assertNotNull(returnType); assertEquals(EdmSimpleTypeKind.String.getFullQualifiedName().getName(), returnType.getType().getName()); assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity()); } |
EdmFunctionImportImplProv extends EdmNamedImplProv implements EdmFunctionImport, EdmAnnotatable { @Override public EdmEntitySet getEntitySet() throws EdmException { return edmEntityContainer.getEntitySet(functionImport.getEntitySet()); } EdmFunctionImportImplProv(final EdmImplProv edm, final FunctionImport functionImpo... | @Test public void entitySet() throws Exception { EdmEntitySet entitySet = edmFunctionImport.getEntitySet(); assertNotNull(entitySet); assertEquals("fooEntitySet", entitySet.getName()); assertEquals(edmEntityContainer.getEntitySet("fooEntitySet"), entitySet); } |
EdmFunctionImportImplProv extends EdmNamedImplProv implements EdmFunctionImport, EdmAnnotatable { @Override public EdmAnnotations getAnnotations() throws EdmException { return new EdmAnnotationsImplProv(functionImport.getAnnotationAttributes(), functionImport.getAnnotationElements()); } EdmFunctionImportImplProv(final ... | @Test public void getAnnotations() throws Exception { EdmAnnotatable annotatable = edmFunctionImport; EdmAnnotations annotations = annotatable.getAnnotations(); assertNull(annotations.getAnnotationAttributes()); assertNull(annotations.getAnnotationElements()); } |
EdmAssociationImplProv extends EdmNamedImplProv implements EdmAssociation, EdmAnnotatable { @Override public EdmAnnotations getAnnotations() throws EdmException { return new EdmAnnotationsImplProv(association.getAnnotationAttributes(), association.getAnnotationElements()); } EdmAssociationImplProv(final EdmImplProv edm... | @Test public void getAnnotations() throws Exception { EdmAnnotatable annotatable = associationProv; EdmAnnotations annotations = annotatable.getAnnotations(); assertNull(annotations.getAnnotationAttributes()); assertNull(annotations.getAnnotationElements()); } |
EdmEntityContainerImplProv implements EdmEntityContainer, EdmAnnotatable { @Override public String getName() throws EdmException { return entityContainer.getName(); } EdmEntityContainerImplProv(final EdmImplProv edm, final EntityContainerInfo entityContainer); @Override String getName(); @Override EdmEntitySet getEntit... | @Test public void testEntityContainerName() throws EdmException { assertEquals("Container1", edmEntityContainer.getName()); } |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public JPAEdmMappingModel getJPAEdmMappingModel() { return mappingModel; } JPAEdmMappingModelService(final ODataJPAContext ctx); @Override void loadMappingModel(); @Override boolean isMappingModelExists(); @Override JPAEdmMappingModel getJPAEdmMa... | @Test public void testGetJPAEdmMappingModel() { assertNotNull(objJPAEdmMappingModelServiceTest.getJPAEdmMappingModel()); } |
EdmEntityContainerImplProv implements EdmEntityContainer, EdmAnnotatable { @Override public EdmEntitySet getEntitySet(final String name) throws EdmException { EdmEntitySet edmEntitySet = edmEntitySets.get(name); if (edmEntitySet != null) { return edmEntitySet; } EntitySet entitySet; try { entitySet = edm.edmProvider.ge... | @Test public void testEntitySetCache() throws EdmException { assertEquals(edmEntityContainer.getEntitySet("foo"), edmEntityContainer.getEntitySet("foo")); assertNotSame(edmEntityContainer.getEntitySet("foo"), edmEntityContainer.getEntitySet("bar")); } |
EdmEntityContainerImplProv implements EdmEntityContainer, EdmAnnotatable { @Override public EdmFunctionImport getFunctionImport(final String name) throws EdmException { EdmFunctionImport edmFunctionImport = edmFunctionImports.get(name); if (edmFunctionImport != null) { return edmFunctionImport; } FunctionImport functio... | @Test public void testFunctionImportCache() throws EdmException { assertEquals(edmEntityContainer.getFunctionImport("foo"), edmEntityContainer.getFunctionImport("foo")); assertNotSame(edmEntityContainer.getFunctionImport("foo"), edmEntityContainer.getFunctionImport("bar")); } |
EdmEntityContainerImplProv implements EdmEntityContainer, EdmAnnotatable { @Override public EdmAnnotations getAnnotations() throws EdmException { return new EdmAnnotationsImplProv(entityContainer.getAnnotationAttributes(), entityContainer.getAnnotationElements()); } EdmEntityContainerImplProv(final EdmImplProv edm, fin... | @Test public void getAnnotations() throws Exception { EdmAnnotatable annotatable = edmEntityContainer; EdmAnnotations annotations = annotatable.getAnnotations(); assertNull(annotations.getAnnotationAttributes()); assertNull(annotations.getAnnotationElements()); } |
EdmAssociationEndImplProv implements EdmAssociationEnd, EdmAnnotatable { @Override public EdmEntityType getEntityType() throws EdmException { final FullQualifiedName type = associationEnd.getType(); EdmEntityType entityType = edm.getEntityType(type.getNamespace(), type.getName()); if (entityType == null) { throw new Ed... | @Test(expected = EdmException.class) public void testAssociationEntityType() throws Exception { EdmAssociationEnd associationEnd = associationEndProv; associationEnd.getEntityType(); } |
EdmAssociationEndImplProv implements EdmAssociationEnd, EdmAnnotatable { @Override public EdmAnnotations getAnnotations() throws EdmException { return new EdmAnnotationsImplProv(associationEnd.getAnnotationAttributes(), associationEnd.getAnnotationElements()); } EdmAssociationEndImplProv(final EdmImplProv edm, final As... | @Test public void getAnnotations() throws Exception { EdmAnnotatable annotatable = associationEndProv; EdmAnnotations annotations = annotatable.getAnnotations(); assertNull(annotations.getAnnotationAttributes()); assertNull(annotations.getAnnotationElements()); } |
EdmImpl implements Edm { @Override public EdmEntityType getEntityType(final String namespace, final String name) throws EdmException { FullQualifiedName fqName = new FullQualifiedName(namespace, name); if (edmEntityTypes.containsKey(fqName)) { return edmEntityTypes.get(fqName); } EdmEntityType edmEntityType = null; try... | @Test public void testEntityTypeCache() throws EdmException { assertEquals(edm.getEntityType("foo", "bar"), edm.getEntityType("foo", "bar")); assertNotSame(edm.getEntityType("foo", "bar"), edm.getEntityType("bar", "foo")); } |
EdmImpl implements Edm { @Override public EdmComplexType getComplexType(final String namespace, final String name) throws EdmException { FullQualifiedName fqName = new FullQualifiedName(namespace, name); if (edmComplexTypes.containsKey(fqName)) { return edmComplexTypes.get(fqName); } EdmComplexType edmComplexType = nul... | @Test public void testComplexTypeCache() throws EdmException { assertEquals(edm.getComplexType("foo", "bar"), edm.getComplexType("foo", "bar")); assertNotSame(edm.getComplexType("foo", "bar"), edm.getComplexType("bar", "foo")); } |
EdmImpl implements Edm { @Override public EdmAssociation getAssociation(final String namespace, final String name) throws EdmException { FullQualifiedName fqName = new FullQualifiedName(namespace, name); if (edmAssociations.containsKey(fqName)) { return edmAssociations.get(fqName); } EdmAssociation edmAssociation = nul... | @Test public void testAssociationCache() throws EdmException { assertEquals(edm.getAssociation("foo", "bar"), edm.getAssociation("foo", "bar")); assertNotSame(edm.getAssociation("foo", "bar"), edm.getAssociation("bar", "foo")); } |
EdmParser { public DataServices readMetadata(final XMLStreamReader reader, final boolean validate) throws EntityProviderException { try { initialize(); DataServices dataServices = new DataServices(); List<Schema> schemas = new ArrayList<Schema>(); while (reader.hasNext() && !(reader.isEndElement() && Edm.NAMESPACE_EDMX... | @Test public void test() throws XMLStreamException, EntityProviderException { int i = 0; EdmParser parser = new EdmParser(); XMLStreamReader reader = createStreamReader(xml); DataServices result = parser.readMetadata(reader, true); assertEquals("2.0", result.getDataServiceVersion()); for (Schema schema : result.getSche... |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public String mapJPAPersistenceUnit(final String persistenceUnitName) { JPAPersistenceUnitMapType persistenceUnit = mappingModel .getPersistenceUnit(); if (persistenceUnit.getName().equals(persistenceUnitName)) { return persistenceUnit.getEDMSche... | @Test public void testMapJPAPersistenceUnit() { assertEquals(PERSISTENCE_UNIT_NAME_EDM, objJPAEdmMappingModelServiceTest.mapJPAPersistenceUnit(PERSISTENCE_UNIT_NAME_JPA)); }
@Test public void testMapJPAPersistenceUnitNegative() { assertNull(objJPAEdmMappingModelServiceTest.mapJPAPersistenceUnit(PERSISTENCE_UNIT_NAME_ED... |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public String mapJPAEntityType(final String jpaEntityTypeName) { JPAEntityTypeMapType jpaEntityTypeMap = searchJPAEntityTypeMapType(jpaEntityTypeName); if (jpaEntityTypeMap != null) { return jpaEntityTypeMap.getEDMEntityType(); } else { return nu... | @Test public void testMapJPAEntityType() { assertEquals(ENTITY_TYPE_NAME_EDM, objJPAEdmMappingModelServiceTest.mapJPAEntityType(ENTITY_TYPE_NAME_JPA)); }
@Test public void testMapJPAEntityTypeNegative() { assertNull(objJPAEdmMappingModelServiceTest.mapJPAEntityType(ENTITY_TYPE_NAME_JPA_WRONG)); } |
EdmxProvider extends EdmProvider { @Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { for (Schema schema : dataServices.getSchemas()) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { for (EntityType entityType : schema.getEntityTypes()) { if (entityType.g... | @Test public void testEntityType() throws EntityProviderException, ODataException, XMLStreamException { Edm edm = createEdm(); assertNotNull(edm); FullQualifiedName fqNameEmployee = new FullQualifiedName("RefScenario", "Employee"); EdmProvider testProvider = new EdmTestProvider(); EdmImplProv edmImpl = (EdmImplProv) ed... |
EdmxProvider extends EdmProvider { @Override public Association getAssociation(final FullQualifiedName edmFQName) throws ODataException { for (Schema schema : dataServices.getSchemas()) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { for (Association association : schema.getAssociations()) { if (associa... | @Test public void testAssociation() throws EntityProviderException, ODataException, XMLStreamException { Edm edm = createEdm(); assertNotNull(edm); FullQualifiedName fqNameAssociation = new FullQualifiedName("RefScenario", "BuildingRooms"); EdmProvider testProvider = new EdmTestProvider(); EdmImplProv edmImpl = (EdmImp... |
EdmxProvider extends EdmProvider { @Override public List<Schema> getSchemas() throws ODataException { return dataServices.getSchemas(); } EdmxProvider parse(final InputStream in, final boolean validate); @Override EntityContainerInfo getEntityContainerInfo(final String name); @Override EntityType getEntityType(final F... | @Test public void testSchema() throws EntityProviderException, ODataException, XMLStreamException { EdmProvider testProvider = new EdmTestProvider(); Edm edm = createEdm(); assertNotNull(edm); EdmImplProv edmImpl = (EdmImplProv) edm; List<Schema> schemas = edmImpl.getEdmProvider().getSchemas(); List<Schema> testSchemas... |
EdmxProvider extends EdmProvider { @Override public EntityContainerInfo getEntityContainerInfo(final String name) throws ODataException { if (name != null) { for (Schema schema : dataServices.getSchemas()) { for (EntityContainer container : schema.getEntityContainers()) { if (container.getName().equals(name)) { return ... | @Test public void testContainer() throws EntityProviderException, ODataException, XMLStreamException { EdmProvider testProvider = new EdmTestProvider(); Edm edm = createEdm(); assertNotNull(edm); EdmImplProv edmImpl = (EdmImplProv) edm; EntityContainerInfo container = edmImpl.getEdmProvider().getEntityContainerInfo("Co... |
Encoder { public static String encode(final String value) { return encoder.encodeInternal(value); } private Encoder(final String unencoded); static String encode(final String value); } | @Test public void asciiCharacters() { final String s = "azAZ019"; assertEquals(s, Encoder.encode(s)); assertEquals(s, Encoder.encode(s)); }
@Test public void asciiControl() { assertEquals("%08%09%0A%0D", Encoder.encode("\b\t\n\r")); }
@Test public void unsafe() { assertEquals("%3C%3E%25%26", Encoder.encode("<>%&")); as... |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public String mapJPAEntitySet(final String jpaEntityTypeName) { JPAEntityTypeMapType jpaEntityTypeMap = searchJPAEntityTypeMapType(jpaEntityTypeName); if (jpaEntityTypeMap != null) { return jpaEntityTypeMap.getEDMEntitySet(); } else { return null... | @Test public void testMapJPAEntitySet() { assertEquals(ENTITY_SET_NAME_EDM, objJPAEdmMappingModelServiceTest.mapJPAEntitySet(ENTITY_TYPE_NAME_JPA)); }
@Test public void testMapJPAEntitySetNegative() { assertNull(objJPAEdmMappingModelServiceTest.mapJPAEntitySet(ENTITY_TYPE_NAME_JPA_WRONG)); } |
ContentType { public boolean isCompatible(final ContentType obj) { Boolean compatible = isEqualWithoutParameters(obj); if (compatible == null) { return true; } return compatible.booleanValue(); } private ContentType(final String type, final String subtype); private ContentType(final String type, final String subtype,... | @Test public void testMe() { MediaType t = new MediaType("*", "xml"); assertNotNull(t); assertTrue(t.isCompatible(new MediaType("app", "xml"))); } |
ContentType { public static boolean isParseable(final String format) { try { return ContentType.create(format) != null; } catch (IllegalArgumentException e) { return false; } } private ContentType(final String type, final String subtype); private ContentType(final String type, final String subtype, final ODataFormat ... | @Test public void parseable() { assertTrue(ContentType.isParseable("application/xml")); assertTrue(ContentType.isParseable("text/plain")); assertTrue(ContentType.isParseable("application/atom+xml; charset=UTF-8")); assertFalse(ContentType.isParseable("application/ atom+xml; charset=UTF-8")); assertFalse(ContentType.isP... |
ContentType { public static ContentType create(final String type, final String subtype) { return new ContentType(type, subtype, mapToODataFormat(type, subtype), null); } private ContentType(final String type, final String subtype); private ContentType(final String type, final String subtype, final ODataFormat odataFo... | @Test(expected = IllegalArgumentException.class) public void testContentTypeCreationWildcardType() { ContentType.create("*", "subtype"); }
@Test(expected = IllegalArgumentException.class) public void testContentTypeCreationWildcardTypeSingleFormat() { ContentType.create("*/subtype"); }
@Test(expected = IllegalArgumentE... |
ContentType { public boolean isWildcard() { return (MEDIA_TYPE_WILDCARD.equals(type) && MEDIA_TYPE_WILDCARD.equals(subtype)); } private ContentType(final String type, final String subtype); private ContentType(final String type, final String subtype, final ODataFormat odataFormat); private ContentType(final String t... | @Test public void testIsWildcard() { assertFalse(ContentType.create("aaa/bbb;x=y;a").isWildcard()); assertFalse(ContentType.create("aaa*;x=y;a").isWildcard()); assertTrue(ContentType.create("*/*").isWildcard()); } |
ContentType { public boolean hasWildcard() { return (MEDIA_TYPE_WILDCARD.equals(type) || MEDIA_TYPE_WILDCARD.equals(subtype)); } private ContentType(final String type, final String subtype); private ContentType(final String type, final String subtype, final ODataFormat odataFormat); private ContentType(final String ... | @Test public void testHasWildcard() { assertFalse(ContentType.create("aaa/bbb;x=y;a").hasWildcard()); assertTrue(ContentType.create("aaa*;x=y;a").hasWildcard()); assertTrue(ContentType.create("*/*").hasWildcard()); } |
Decoder { public static String decode(final String value) throws IllegalArgumentException, NumberFormatException { if (value == null) { return value; } byte[] result = new byte[value.length()]; int position = 0; byte encodedPart = -2; for (final char c : value.toCharArray()) { if (c <= Byte.MAX_VALUE) { if (c == '%') {... | @Test public void asciiCharacters() { assertNull(Decoder.decode(null)); String s = "azAZ019"; assertEquals(s, Decoder.decode(s)); s = "\"\\`{}|"; assertEquals(s, Decoder.decode(s)); }
@Test public void asciiControl() { assertEquals("\u0000\b\t\n\r", Decoder.decode("%00%08%09%0a%0d")); }
@Test public void asciiEncoded()... |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public String mapJPAAttribute(final String jpaEntityTypeName, final String jpaAttributeName) { JPAEntityTypeMapType jpaEntityTypeMap = searchJPAEntityTypeMapType(jpaEntityTypeName); if (jpaEntityTypeMap != null && jpaEntityTypeMap.getJPAAttribute... | @Test public void testMapJPAAttribute() { assertEquals(ATTRIBUTE_NAME_EDM, objJPAEdmMappingModelServiceTest.mapJPAAttribute(ENTITY_TYPE_NAME_JPA, ATTRIBUTE_NAME_JPA)); }
@Test public void testMapJPAAttributeNegative() { assertNull(objJPAEdmMappingModelServiceTest.mapJPAAttribute(ENTITY_TYPE_NAME_JPA, ATTRIBUTE_NAME_JPA... |
ODataDebugResponseWrapper { public ODataResponse wrapResponse() { try { return ODataResponse.status(HttpStatusCodes.OK) .entity(isJson ? wrapInJson(createParts()) : null) .contentHeader(isJson ? HttpContentType.APPLICATION_JSON : null) .build(); } catch (final ODataException e) { throw new ODataRuntimeException("Should... | @Test public void minimal() throws Exception { final ODataContext context = mockContext(ODataHttpMethod.PUT); final ODataResponse wrappedResponse = mockResponse(HttpStatusCodes.NO_CONTENT, null, null); final ODataResponse response = new ODataDebugResponseWrapper(context, wrappedResponse, mock(UriInfo.class), null, ODat... |
DebugInfoBody implements DebugInfo { @Override public void appendJson(final JsonStreamWriter jsonStreamWriter) throws IOException { final String contentType = response.getContentHeader(); if (contentType.startsWith("image/")) { if (response.getEntity() instanceof InputStream) { jsonStreamWriter.stringValueRaw(Base64.en... | @Test public void jsonStringContent() throws Exception { ODataResponse response = mock(ODataResponse.class); when(response.getEntity()).thenReturn(STRING_CONTENT); when(response.getContentHeader()).thenReturn(HttpContentType.APPLICATION_OCTET_STREAM); assertEquals(STRING_CONTENT_JSON, appendJson(response)); when(respon... |
Dispatcher { public ODataResponse dispatch(final ODataHttpMethod method, final UriInfoImpl uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException { switch (uriInfo.getUriType()) { case URI0: if (method == ODataHttpMethod.GET) { return service.getServiceDocum... | @Test public void dispatch() throws Exception { checkDispatch(ODataHttpMethod.GET, UriType.URI0, "readServiceDocument"); checkDispatch(ODataHttpMethod.GET, UriType.URI1, "readEntitySet"); checkDispatch(ODataHttpMethod.POST, UriType.URI1, "createEntity"); checkDispatch(ODataHttpMethod.GET, UriType.URI2, "readEntity"); c... |
JsonStreamWriter { protected void escape(final String value) throws IOException { for (int i = 0; i < value.length(); i++) { final char c = value.charAt(i); switch (c) { case '\\': writer.append('\\').append(c); break; case '"': writer.append('\\').append(c); break; case '\b': writer.append('\\').append('b'); break; ca... | @Test public void escape() throws Exception { final String outsideBMP = String.valueOf(Character.toChars(0x1F603)); StringWriter writer = new StringWriter(); JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer); jsonStreamWriter.beginObject() .namedStringValue("normal", "abc / ? \u007F € \uFDFC").separator(... |
XmlPropertyConsumer { public Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property, final boolean merge) throws EntityProviderException { return readProperty(reader, property, merge, null); } Map<String, Object> readProperty(final XMLStreamReader reader, final EdmProperty property, ... | @Test public void readIntegerProperty() throws Exception { String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">67</Age>"; XMLStreamReader reader = createReaderForTest(xml, true); final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age"); Map<... |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public String mapJPARelationship(final String jpaEntityTypeName, final String jpaRelationshipName) { JPAEntityTypeMapType jpaEntityTypeMap = searchJPAEntityTypeMapType(jpaEntityTypeName); if (jpaEntityTypeMap != null) { for (JPARelationship jpaRe... | @Test public void testMapJPARelationship() { assertEquals(RELATIONSHIP_NAME_EDM, objJPAEdmMappingModelServiceTest.mapJPARelationship(ENTITY_TYPE_NAME_JPA, RELATIONSHIP_NAME_JPA)); }
@Test public void testMapJPARelationshipNegative() { assertNull(objJPAEdmMappingModelServiceTest.mapJPARelationship(ENTITY_TYPE_NAME_JPA, ... |
Team { public List<Employee> getEmployees() { return employees; } Team(final int id, final String name); String getId(); String getName(); void setName(final String name); boolean isScrumTeam(); void setScrumTeam(final boolean isScrumTeam); List<Employee> getEmployees(); @Override int hashCode(); @Override boolean equa... | @Test public void testEmployees() { Team team1 = new Team(1, VALUE_NAME); Employee employee1 = new Employee(1, null); Employee employee2 = new Employee(2, null); List<Employee> testList = Arrays.asList(employee1, employee2); team1.getEmployees().addAll(testList); for (Employee emp : testList) { emp.setTeam(team1); } as... |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public String mapJPAEmbeddableType(final String jpaEmbeddableTypeName) { JPAEmbeddableTypeMapType jpaEmbeddableType = searchJPAEmbeddableTypeMapType(jpaEmbeddableTypeName); if (jpaEmbeddableType != null) { return jpaEmbeddableType.getEDMComplexTy... | @Test public void testMapJPAEmbeddableType() { assertEquals("SalesOrderLineItemKey", objJPAEdmMappingModelServiceTest.mapJPAEmbeddableType("SalesOrderItemKey")); }
@Test public void testMapJPAEmbeddableTypeNegative() { assertNull(objJPAEdmMappingModelServiceTest.mapJPAEmbeddableType(EMBEDDABLE_TYPE_NAME_JPA_WRONG)); } |
JsonLinkConsumer { public String readLink(final JsonReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { String result; reader.beginObject(); String nextName = reader.nextName(); final boolean wrapped = FormatJson.D.equals(nextName); if (wrapped) { reader.beginObject(); nextName = reader.... | @Test public void linkWithD() throws Exception { final String link = "{\"d\":{\"uri\":\"http: JsonReader reader = new JsonReader(new InputStreamReader(createContentAsStream(link))); assertEquals("http: }
@Test public void linkWithoutD() throws Exception { final String link = "{\"uri\":\"http: JsonReader reader = new Js... |
JsonLinkConsumer { public List<String> readLinks(final JsonReader reader, final EdmEntitySet entitySet) throws EntityProviderException { List<String> links = null; int openedObjects = 0; try { String nextName; if (reader.peek() == JsonToken.BEGIN_ARRAY) { nextName = FormatJson.RESULTS; } else { reader.beginObject(); op... | @Test public void linksWithD() throws Exception { final String links = "{\"d\":[{\"uri\":\"http: JsonReader reader = new JsonReader(new InputStreamReader(createContentAsStream(links))); assertEquals(Arrays.asList("http: }
@Test public void linksWithoutD() throws Exception { final String links = "[{\"uri\":\"http: JsonR... |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public String mapJPAEmbeddableTypeAttribute(final String jpaEmbeddableTypeName, final String jpaAttributeName) { JPAEmbeddableTypeMapType jpaEmbeddableType = searchJPAEmbeddableTypeMapType(jpaEmbeddableTypeName); if (jpaEmbeddableType != null && ... | @Test public void testMapJPAEmbeddableTypeAttribute() { assertEquals(EMBEDDABLE_ATTRIBUTE_NAME_EDM, objJPAEdmMappingModelServiceTest.mapJPAEmbeddableTypeAttribute(EMBEDDABLE_TYPE_NAME_JPA, EMBEDDABLE_ATTRIBUTE_NAME_JPA)); }
@Test public void testMapJPAEmbeddableTypeAttributeNegative() { assertNull(objJPAEdmMappingModel... |
XmlFeedConsumer { public ODataFeed readFeed(final XMLStreamReader reader, final EntityInfoAggregator eia, final EntityProviderReadProperties readProperties) throws EntityProviderException { try { reader.require(XMLStreamConstants.START_DOCUMENT, null, null); reader.nextTag(); reader.require(XMLStreamConstants.START_ELE... | @Test public void readEmployeesFeedWithInlineCountValid() throws Exception { String content = readFile("feed_employees_full.xml"); assertNotNull(content); EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"); InputStream reqContent = createContentAsStream(content); XmlE... |
XmlEntityConsumer { public ODataFeed readFeed(final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = createStaxReader(content); EntityInfoAggreg... | @Test public void readDeltaLink() throws Exception { String content = readFile("feed_with_delta_link.xml"); assertNotNull(content); EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"); InputStream reqContent = createContentAsStream(content); XmlEntityConsumer xec = new... |
XmlEntityConsumer { public ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; try { reader = createStaxReader(content); EntityInfoAggr... | @Test public void readWithInlineContentAndCallback() throws Exception { String content = readFile("expanded_team.xml"); assertNotNull(content); EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams"); InputStream reqContent = createContentAsStream(content); XmlEntityConsumer x... |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public boolean checkExclusionOfJPAEntityType(final String jpaEntityTypeName) { JPAEntityTypeMapType type = searchJPAEntityTypeMapType(jpaEntityTypeName); if (type != null) { return type.isExclude(); } return false; } JPAEdmMappingModelService(fin... | @Test public void testCheckExclusionOfJPAEntityType() { assertTrue(!objJPAEdmMappingModelServiceTest.checkExclusionOfJPAEntityType(ENTITY_TYPE_NAME_JPA)); } |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public boolean checkExclusionOfJPAAttributeType(final String jpaEntityTypeName, final String jpaAttributeName) { JPAEntityTypeMapType type = searchJPAEntityTypeMapType(jpaEntityTypeName); if (type != null && type.getJPAAttributes() != null) { for... | @Test public void testCheckExclusionOfJPAAttributeType() { assertTrue(!objJPAEdmMappingModelServiceTest.checkExclusionOfJPAAttributeType(ENTITY_TYPE_NAME_JPA, ATTRIBUTE_NAME_JPA)); } |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public boolean checkExclusionOfJPAEmbeddableType( final String jpaEmbeddableTypeName) { JPAEmbeddableTypeMapType type = searchJPAEmbeddableTypeMapType(jpaEmbeddableTypeName); if (type != null) { return type.isExclude(); } return false; } JPAEdmMa... | @Test public void testCheckExclusionOfJPAEmbeddableType() { assertTrue(!objJPAEdmMappingModelServiceTest.checkExclusionOfJPAEmbeddableType(EMBEDDABLE_TYPE_2_NAME_JPA)); } |
JPAEdmMappingModelService implements JPAEdmMappingModelAccess { @Override public boolean checkExclusionOfJPAEmbeddableAttributeType( final String jpaEmbeddableTypeName, final String jpaAttributeName) { JPAEmbeddableTypeMapType type = searchJPAEmbeddableTypeMapType(jpaEmbeddableTypeName); if (type != null && type.getJPA... | @Test public void testCheckExclusionOfJPAEmbeddableAttributeType() { assertTrue(!objJPAEdmMappingModelServiceTest.checkExclusionOfJPAEmbeddableAttributeType(EMBEDDABLE_TYPE_NAME_JPA, EMBEDDABLE_ATTRIBUTE_NAME_JPA)); } |
XmlEntityConsumer { public Map<String, Object> readProperty(final EdmProperty edmProperty, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { XMLStreamReader reader = null; EntityProviderException cachedException = null; XmlPropertyConsumer xec = new XmlPropertyCo... | @Test public void readProperty() throws Exception { final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age"); String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">67</Age>"; InputStream content = createContentAsStream(xml); Map<String, Object... |
XmlEntityConsumer { public Object readPropertyValue(final EdmProperty edmProperty, final InputStream content) throws EntityProviderException { return readPropertyValue(edmProperty, content, null); } XmlEntityConsumer(); ODataFeed readFeed(final EdmEntitySet entitySet, final InputStream content, final EntityProviderRead... | @Test public void readStringPropertyValue() throws Exception { String xml = "<EmployeeName xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">Max Mustermann</EmployeeName>"; InputStream content = createContentAsStream(xml); final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee... |
XmlLinkConsumer { public String readLink(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { reader.next(); return readLink(reader); } catch (final XMLStreamException e) { throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().... | @Test public void readLink() throws Exception { XMLStreamReader reader = createReaderForTest(SINGLE_LINK, true); final String link = new XmlLinkConsumer().readLink(reader, null); assertEquals(SERVICE_ROOT + "Employees('6')", link); }
@Test(expected = EntityProviderException.class) public void wrongNamespace() throws Ex... |
ODataJPAEdmProvider extends EdmProvider { public ODataJPAContext getODataJPAContext() { return oDataJPAContext; } ODataJPAEdmProvider(); ODataJPAEdmProvider(final ODataJPAContext oDataJPAContext); ODataJPAContext getODataJPAContext(); void setODataJPAContext(final ODataJPAContext jpaContext); @Override EntityContainer... | @Test public void testGetODataJPAContext() { String pUnitName = edmProvider.getODataJPAContext() .getPersistenceUnitName(); assertEquals("salesorderprocessing", pUnitName); } |
Room { public String getId() { return Integer.toString(id); } Room(final int id, final String name); String getId(); String getName(); void setName(final String name); void setSeats(final int seats); int getSeats(); void setVersion(final int version); int getVersion(); void setBuilding(final Building building); Buildin... | @Test public void testId() { Room room1 = new Room(1, NAME); assertNotNull(room1.getId()); } |
XmlLinkConsumer { public List<String> readLinks(final XMLStreamReader reader, final EdmEntitySet entitySet) throws EntityProviderException { try { List<String> links = new ArrayList<String>(); reader.next(); reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, FormatXml.D_LINKS); reader.nextTag(); ... | @Test public void readLinks() throws Exception { XMLStreamReader reader = createReaderForTest(MANAGER_1_EMPLOYEES, true); final List<String> links = new XmlLinkConsumer().readLinks(reader, null); assertEquals(4, links.size()); assertEquals(SERVICE_ROOT + "Employees('1')", links.get(0)); assertEquals(SERVICE_ROOT + "Emp... |
JsonFeedConsumer { private void readFeed() throws IOException, EdmException, EntityProviderException { if (reader.peek() == JsonToken.BEGIN_ARRAY) { readArrayContent(); } else { reader.beginObject(); final String nextName = reader.nextName(); if (FormatJson.D.equals(nextName)) { if (reader.peek() == JsonToken.BEGIN_ARR... | @Test(expected = EntityProviderException.class) public void invalidDoubleClosingBrackets() throws Exception { EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams"); String content = "{\"d\":{\"results\":[]}}}"; InputStream contentBody = createContentAsStream(content); JsonEn... |
ODataJPAEdmProvider extends EdmProvider { @Override public EntityContainerInfo getEntityContainerInfo(final String name) throws ODataException { if (entityContainerInfos.containsKey(name)) { return entityContainerInfos.get(name); } else { if (schemas == null) { getSchemas(); } List<EntityContainer> containerList = sche... | @Test public void testGetEntityContainerInfo() { String entityContainerName = null; EntityContainerInfo entityContainer = null; try { entityContainer = edmProvider .getEntityContainerInfo("salesorderprocessingContainer"); entityContainerName = entityContainer.getName(); } catch (ODataException e) { fail(ODataJPATestCon... |
JsonPropertyConsumer { protected Object readPropertyValue(final JsonReader reader, final EntityPropertyInfo entityPropertyInfo, final Object typeMapping) throws EntityProviderException { try { return entityPropertyInfo.isComplex() ? readComplexProperty(reader, (EntityComplexPropertyInfo) entityPropertyInfo, typeMapping... | @Test public void simplePropertyOnOpenReader() throws Exception { String simplePropertyJson = "{\"Name\":\"Team 1\"}"; JsonReader reader = prepareReader(simplePropertyJson); EdmProperty edmProperty = (EdmProperty) MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams").getEntityType().getProperty("Nam... |
JsonPropertyConsumer { public Map<String, Object> readPropertyStandalone(final JsonReader reader, final EdmProperty property, final EntityProviderReadProperties readProperties) throws EntityProviderException { try { EntityPropertyInfo entityPropertyInfo = EntityInfoAggregator.create(property); Map<String, Object> typeM... | @Test public void veryLongStringStandalone() throws Exception { char[] chars = new char[32768]; Arrays.fill(chars, 0, 32768, 'a'); String propertyValue = new String(chars); String simplePropertyJson = "{\"d\":{\"Name\":\"" + propertyValue + "\"}}"; JsonReader reader = prepareReader(simplePropertyJson); final EdmPropert... |
ODataJPAEdmProvider extends EdmProvider { @Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { String strEdmFQName = edmFQName.toString(); if (edmFQName != null) { if (entityTypes.containsKey(strEdmFQName)) { return entityTypes.get(strEdmFQName); } else if (schemas == nul... | @Test public void testGetEntityType() { FullQualifiedName entityTypeName = new FullQualifiedName( "salesorderprocessing", "SalesOrderHeader"); String entityName = null; try { entityName = edmProvider.getEntityType(entityTypeName).getName(); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + ... |
ODataJPAEdmProvider extends EdmProvider { @Override public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException { if (edmFQName != null) { if (complexTypes.containsKey(edmFQName.toString())) { return complexTypes.get(edmFQName.toString()); } else if (schemas == null) { getSchemas(); } for... | @Test public void testGetComplexType() { FullQualifiedName complexTypeName = new FullQualifiedName( "salesorderprocessing", "Address"); String nameStr = null; try { nameStr = edmProvider.getComplexType(complexTypeName).getName(); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessag... |
ODataJPAEdmProvider extends EdmProvider { @Override public Association getAssociation(final FullQualifiedName edmFQName) throws ODataException { if (edmFQName != null) { if (associations.containsKey(edmFQName.toString())) { return associations.get(edmFQName.toString()); } else if (schemas == null) { getSchemas(); } for... | @Test public void testGetAssociationFullQualifiedName() { Association association = null; try { association = edmProvider.getAssociation(new FullQualifiedName( "salesorderprocessing", "SalesOrderHeader_SalesOrderItem")); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODa... |
XmlMetadataProducer { public static void writeMetadata(final DataServices metadata, final XMLStreamWriter xmlStreamWriter, Map<String, String> predefinedNamespaces) throws EntityProviderException { try { xmlStreamWriter.writeStartDocument(); xmlStreamWriter.setPrefix(Edm.PREFIX_EDMX, Edm.NAMESPACE_EDMX_2007_06); xmlStr... | @Test public void writeValidMetadata() throws Exception { List<Schema> schemas = new ArrayList<Schema>(); List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>(); annotationElements.add(new AnnotationElement().setName("test").setText("hallo")); Schema schema = new Schema().setAnnotationElements(... |
ODataJPAEdmProvider extends EdmProvider { @Override public EntitySet getEntitySet(final String entityContainer, final String name) throws ODataException { EntitySet returnedSet = null; EntityContainer container = null; if (!entityContainerInfos.containsKey(entityContainer)) { container = (EntityContainer) getEntityCont... | @Test public void testGetEntitySet() { String entitySetName = null; try { entitySetName = edmProvider.getEntitySet( "salesorderprocessingContainer", "SalesOrderHeaders") .getName(); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2... |
JsonServiceDocumentProducer { public static void writeServiceDocument(final Writer writer, final Edm edm) throws EntityProviderException { final EdmServiceMetadata serviceMetadata = edm.getServiceMetadata(); JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer); try { jsonStreamWriter.beginObject() .name(For... | @Test public void serviceDocumentEmpty() throws Exception { Edm edm = mock(Edm.class); EdmServiceMetadata metadata = mock(EdmServiceMetadata.class); when(edm.getServiceMetadata()).thenReturn(metadata); final ODataResponse response = new JsonEntityProvider().writeServiceDocument(edm, "http: assertNotNull(response); asse... |
AtomServiceDocumentProducer { public void writeServiceDocument(final Writer writer) throws EntityProviderException { EdmServiceMetadata serviceMetadata = edm.getServiceMetadata(); try { XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer); xmlStreamWriter.writeStartDocument(DEF... | @Test public void writeEmptyServiceDocumentOverRuntimeDelegate() throws Exception { ODataResponse response = EntityProvider.writeServiceDocument(HttpContentType.APPLICATION_ATOM_XML, edm, "http: String xmlString = verifyResponse(response); assertXpathExists("/a:service", xmlString); assertXpathExists("/a:service/a:work... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataEntry readEntry(final String contentType, final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { return create(contentType).readEntry(entitySet, content, proper... | @Test public void readEntry() throws Exception { final String contentType = ContentType.APPLICATION_ATOM_XML_ENTRY.toContentTypeString(); final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Employees"); InputStream content = new ByteArrayInputStream(EMPLOYEE_1_XML.getBytes("... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public Object readPropertyValue(final EdmProperty edmProperty, final InputStream content, final Class<?> typeMapping) throws EntityProviderException { return create().readPropertyValue(edmProperty, content, typeMapping); } @Override ODataResponse writeE... | @Test public void readPropertyValue() throws Exception { final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate"); InputStream content = new ByteArrayInputStream("2012-02-29T01:02:03".getBytes("UTF-8")); final Object result = new ProviderFacade... |
ODataJPAEdmProvider extends EdmProvider { @Override public AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association, final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException { EntityContainer container = null; if (!entityContainerInfos.containsK... | @Test public void testGetAssociationSet() { AssociationSet associationSet = null; try { associationSet = edmProvider.getAssociationSet( "salesorderprocessingContainer", new FullQualifiedName( "salesorderprocessing", "SalesOrderHeader_SalesOrderItem"), "SalesOrderHeaders", "SalesOrderHeader"); } catch (ODataException e)... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public Map<String, Object> readProperty(final String contentType, final EdmProperty edmProperty, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException { return create(contentType).readProperty(edmPropert... | @Test public void readProperty() throws Exception { final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("Age"); final String xml = "<Age xmlns=\"" + Edm.NAMESPACE_D_2007_08 + "\">42</Age>"; InputStream content = new ByteArrayInputStream(xml.getBytes("U... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public String readLink(final String contentType, final EdmEntitySet entitySet, final InputStream content) throws EntityProviderException { return create(contentType).readLink(entitySet, content); } @Override ODataResponse writeErrorDocument(final ODataE... | @Test public void readLink() throws Exception { final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"); InputStream content = new ByteArrayInputStream("{\"d\":{\"uri\":\"http: final String result = new ProviderFacadeImpl().readLink(HttpContentType.APPLICATION_JSON, enti... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public List<String> readLinks(final String contentType, final EdmEntitySet entitySet, final InputStream content) throws EntityProviderException { return create(contentType).readLinks(entitySet, content); } @Override ODataResponse writeErrorDocument(fina... | @Test public void readLinks() throws Exception { final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"); InputStream content = new ByteArrayInputStream("{\"d\":{\"__count\":\"42\",\"results\":[{\"uri\":\"http: final List<String> result = new ProviderFacadeImpl().readLin... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writeFeed(final String contentType, final EdmEntitySet entitySet, final List<Map<String, Object>> data, final EntityProviderWriteProperties properties) throws EntityProviderException { return create(contentType).writeFeed(entitySet, ... | @Test public void writeFeed() throws Exception { final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"); List<Map<String, Object>> propertiesList = new ArrayList<Map<String, Object>>(); final ODataResponse result = new ProviderFacadeImpl().writeFeed(HttpContentType.APPL... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writeEntry(final String contentType, final EdmEntitySet entitySet, final Map<String, Object> data, final EntityProviderWriteProperties properties) throws EntityProviderException { return create(contentType).writeEntry(entitySet, data... | @Test public void writeEntry() throws Exception { final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams"); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("Id", "42"); final ODataResponse result = new ProviderFacadeImpl().writeEntry(HttpCon... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writeProperty(final String contentType, final EdmProperty edmProperty, final Object value) throws EntityProviderException { return create(contentType).writeProperty(edmProperty, value); } @Override ODataResponse writeErrorDocument(f... | @Test public void writeProperty() throws Exception { final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate"); final ODataResponse result = new ProviderFacadeImpl().writeProperty(HttpContentType.APPLICATION_XML, property, 987654321000L); assert... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writeLink(final String contentType, final EdmEntitySet entitySet, final Map<String, Object> data, final EntityProviderWriteProperties properties) throws EntityProviderException { return create(contentType).writeLink(entitySet, data, ... | @Test public void writeLink() throws Exception { final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("Id", "42"); final ODataResponse result = new ProviderFacadeImpl().writeLink(HttpConte... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writeLinks(final String contentType, final EdmEntitySet entitySet, final List<Map<String, Object>> data, final EntityProviderWriteProperties properties) throws EntityProviderException { return create(contentType).writeLinks(entitySet... | @Test public void writeLinks() throws Exception { final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("Id", "42"); List<Map<String, Object>> propertiesList = new ArrayList<Map<String, Obj... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writeServiceDocument(final String contentType, final Edm edm, final String serviceRoot) throws EntityProviderException { return create(contentType).writeServiceDocument(edm, serviceRoot); } @Override ODataResponse writeErrorDocument... | @Test public void writeServiceDocument() throws Exception { final ODataResponse result = new ProviderFacadeImpl().writeServiceDocument(HttpContentType.APPLICATION_JSON, MockFacade.getMockEdm(), "root"); assertEquals("{\"d\":{\"EntitySets\":[]}}", StringHelper.inputStreamToString((InputStream) result.getEntity())); } |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writePropertyValue(final EdmProperty edmProperty, final Object value) throws EntityProviderException { return create().writePropertyValue(edmProperty, value); } @Override ODataResponse writeErrorDocument(final ODataErrorContext cont... | @Test public void writePropertyValue() throws Exception { final EdmProperty property = (EdmProperty) MockFacade.getMockEdm().getEntityType("RefScenario", "Employee").getProperty("EntryDate"); final ODataResponse result = new ProviderFacadeImpl().writePropertyValue(property, 987654321000L); assertEquals(HttpContentType.... |
ODataJPAEdmProvider extends EdmProvider { @Override public FunctionImport getFunctionImport(final String entityContainer, final String name) throws ODataException { if (functionImports.containsKey(name)) { return functionImports.get(name); } EntityContainer container = null; if (!entityContainerInfos.containsKey(entity... | @Test public void testGetFunctionImport() { String functionImportName = null; try { functionImportName = edmProvider.getFunctionImport( "salesorderprocessingContainer", "SalesOrder_FunctionImport1").getName(); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestCo... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writeText(final String value) throws EntityProviderException { return create().writeText(value); } @Override ODataResponse writeErrorDocument(final ODataErrorContext context); @Override ODataResponse writeServiceDocument(final Strin... | @Test public void writeText() throws Exception { final ODataResponse result = new ProviderFacadeImpl().writeText("test"); assertEquals(HttpContentType.TEXT_PLAIN_UTF8, result.getContentHeader()); assertEquals("test", StringHelper.inputStreamToString((InputStream) result.getEntity())); } |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writeBinary(final String mimeType, final byte[] data) throws EntityProviderException { return create().writeBinary(mimeType, data); } @Override ODataResponse writeErrorDocument(final ODataErrorContext context); @Override ODataRespon... | @Test public void writeBinary() throws Exception { final ODataResponse result = new ProviderFacadeImpl().writeBinary(HttpContentType.APPLICATION_OCTET_STREAM, new byte[] { 102, 111, 111 }); assertEquals(HttpContentType.APPLICATION_OCTET_STREAM, result.getContentHeader()); assertEquals("foo", StringHelper.inputStreamToS... |
ProviderFacadeImpl implements EntityProviderInterface { @Override public ODataResponse writeFunctionImport(final String contentType, final EdmFunctionImport functionImport, final Object data, final EntityProviderWriteProperties properties) throws EntityProviderException { return create(contentType).writeFunctionImport(... | @Test public void writeFunctionImport() throws Exception { final EdmFunctionImport function = MockFacade.getMockEdm().getDefaultEntityContainer().getFunctionImport("MaximalAge"); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("MaximalAge", 99); final ODataResponse result = new ProviderFa... |
ODataSingleProcessorService implements ODataService { @Override public List<String> getSupportedContentTypes(final Class<? extends ODataProcessor> processorFeature) throws ODataException { List<String> result = new ArrayList<String>(); if (processor instanceof CustomContentType) { result.addAll(((CustomContentType) pro... | @Test public void defaultSupportedContentTypesForEntitySet() throws Exception { List<String> types = service.getSupportedContentTypes(EntitySetProcessor.class); List<ContentType> convertedTypes = ContentType.convert(types); assertTrue(convertedTypes.contains(appendCharset(ContentType.APPLICATION_ATOM_XML))); assertTrue... |
ODataJPAEdmProvider extends EdmProvider { @Override public List<Schema> getSchemas() throws ODataException { if (schemas == null && jpaEdmModel != null) { jpaEdmModel.getBuilder().build(); schemas = new ArrayList<Schema>(); schemas.add(jpaEdmModel.getEdmSchemaView().getEdmSchema()); } if (jpaEdmModel == null) { throw O... | @Test public void testGetSchemas() { try { assertNotNull(edmProvider.getSchemas()); } catch (ODataException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } } |
Room { public List<Employee> getEmployees() { return employees; } Room(final int id, final String name); String getId(); String getName(); void setName(final String name); void setSeats(final int seats); int getSeats(); void setVersion(final int version); int getVersion(); void setBuilding(final Building building); Bui... | @Test public void testEmployees() { Employee employee1 = new Employee(1, null); Employee employee2 = new Employee(2, null); List<Employee> employeesList = Arrays.asList(employee1, employee2); Room room1 = new Room(1, null); room1.getEmployees().addAll(employeesList); employee1.setRoom(room1); employee2.setRoom(room1); ... |
JPQLSelectStatementBuilder extends JPQLStatementBuilder { @Override public JPQLStatement build() throws ODataJPARuntimeException { jpqlStatement = createStatement(createJPQLQuery()); return jpqlStatement; } JPQLSelectStatementBuilder(final JPQLContextView context); @Override JPQLStatement build(); } | @Test public void testBuildSimpleQuery() throws EdmException, ODataJPARuntimeException { OrderByExpression orderByExpression = EasyMock.createMock(OrderByExpression.class); JPQLSelectContext jpqlSelectContextImpl = createSelectContext(orderByExpression, null); jpqlSelectStatementBuilder = new JPQLSelectStatementBuilder... |
JPQLJoinStatementBuilder extends JPQLStatementBuilder { @Override public JPQLStatement build() throws ODataJPARuntimeException { jpqlStatement = createStatement(createJPQLQuery()); return jpqlStatement; } JPQLJoinStatementBuilder(final JPQLContextView context); @Override JPQLStatement build(); } | @Test public void testBuild() throws Exception { setUp(getJoinClauseList()); JPQLJoinStatementBuilder jpqlJoinStatementBuilder = new JPQLJoinStatementBuilder(context); try { JPQLStatement jpqlStatement = jpqlJoinStatementBuilder.build(); assertEquals("SELECT mat FROM SOHeader soh JOIN soh.soItem soi JOIN soi.material m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.