/** * For JAXB unmarhalling of ISO 19119 document only. Sets {@link #operation} to a temporary * {@link OperationName} placeholder. That temporary instance will be replaced by the real * one when the enclosing {@link DefaultServiceIdentification} is unmarshalled. */ private void setOperationName(final String name) { if (operation == null) { operation = new OperationName(name); } }
/** * For JAXB unmarhalling of ISO 19139:2007 document only. Sets {@link #operation} to a temporary * {@link OperationName} placeholder. That temporary instance will be replaced by the real one * when the enclosing {@link DefaultServiceIdentification} is unmarshalled. */ @SuppressWarnings("unused") private void setOperationName(final String name) { if (operation == null) { operation = new OperationName(name); } }
/** * Tests {@link OperationName#resolve(Collection, Collection)}. */ @Test public void testOperationNameResolve() { final DefaultCoupledResource resource = create(DefaultFactories.forBuildin(NameFactory.class)); final DefaultOperationMetadata operation = resource.getOperation(); /* * Test OperationName replacement when the name matches. */ resource.setOperation(new OperationName(operation.getOperationName())); assertNotSame("Before resolve", operation, resource.getOperation()); OperationName.resolve(singleton(operation), singleton(resource)); assertSame("After resolve", operation, resource.getOperation()); /* * If the name doesn't match, no replacement shall be done. */ final OperationName other = new OperationName("Other"); resource.setOperation(other); assertSame("Before resolve", other, resource.getOperation()); OperationName.resolve(singleton(operation), singleton(resource)); assertSame("After resolve", other, resource.getOperation()); } }