LockFeatureKVPAdapter extends QueryKVPAdapter { public static LockFeature parse( Map<String, String> kvpParams ) throws Exception { Version version = Version.parseVersion( KVPUtils.getRequired( kvpParams, "VERSION" ) ); LockFeature result = null; if ( VERSION_100.equals( version ) ) { result = parse100( kvpParams ); } else if ( VERSION_110.equals( version ) ) { result = parse110( kvpParams ); } else if ( VERSION_200.equals( version ) ) { result = parse200( kvpParams ); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", version, getVersionsString( VERSION_100, VERSION_110, VERSION_200 ) ); throw new InvalidParameterValueException( msg ); } return result; }  static LockFeature parse( Map<String, String> kvpParams );  }
@Test public void testExample1Wfs110() throws Exception { URL example = this.getClass().getResource( EXAMPLE1_WFS110 ); Map<String, String> kvpMap = KVPUtils.readFileIntoMap( example ); LockFeature lockFeature = LockFeatureKVPAdapter.parse( kvpMap ); FilterQuery filterLock = (FilterQuery) lockFeature.getQueries().get( 0 ); assertEquals( new QName( "InWaterA_1M" ), filterLock.getTypeNames()[0].getFeatureTypeName() ); }
@Test public void testExample2Wfs110() throws Exception { URL example = this.getClass().getResource( EXAMPLE2_WFS110 ); Map<String, String> kvpMap = KVPUtils.readFileIntoMap( example ); LockFeature lockFeature = LockFeatureKVPAdapter.parse( kvpMap ); FeatureIdQuery featureLock = (FeatureIdQuery) lockFeature.getQueries().get( 0 ); assertEquals( "RoadL_1M.1013", featureLock.getFeatureIds()[0] ); }
@Test public void testExample3Wfs110() throws Exception { URL example = this.getClass().getResource( EXAMPLE3_WFS110 ); Map<String, String> kvpMap = KVPUtils.readFileIntoMap( example ); LockFeature lockFeature = LockFeatureKVPAdapter.parse( kvpMap ); FilterQuery featureLock0 = (FilterQuery) lockFeature.getQueries().get( 0 ); assertEquals( new QName( "InWaterA_1M" ), featureLock0.getTypeNames()[0].getFeatureTypeName() ); FilterQuery featureLock1 = (FilterQuery) lockFeature.getQueries().get( 1 ); assertEquals( new QName( "BuiltUpA_1M" ), featureLock1.getTypeNames()[0].getFeatureTypeName() ); }
@SuppressWarnings("boxing") @Test public void testExample4Wfs110() throws Exception { URL example = this.getClass().getResource( EXAMPLE4_WFS110 ); Map<String, String> kvpMap = KVPUtils.readFileIntoMap( example ); LockFeature lockFeature = LockFeatureKVPAdapter.parse( kvpMap ); assertTrue( lockFeature.getLockAll() ); assertEquals( new BigInteger( "300" ), lockFeature.getExpiryInSeconds() ); List<Query> queries = lockFeature.getQueries(); assertEquals( 2, queries.size() ); FilterQuery filterQuery1 = (FilterQuery) queries.get( 0 ); OperatorFilter filter1 = (OperatorFilter) filterQuery1.getFilter(); assertTrue( filter1.getOperator() instanceof Within ); Within within = (Within) filter1.getOperator(); assertEquals( "wkbGeom", within.getPropName().getAsText() ); Envelope env = (Envelope) within.getGeometry(); verifyEnvelope( env, 10, 10, 20, 20 ); }
@Test public void testExample1Wfs200() throws Exception { URL example = this.getClass().getResource( EXAMPLE1_WFS200 ); Map<String, String> kvpMap = KVPUtils.readFileIntoMap( example ); LockFeature lockFeature = LockFeatureKVPAdapter.parse( kvpMap ); assertNull( lockFeature.getHandle() ); assertNull( lockFeature.getExistingLockId() ); assertNull( lockFeature.getExpiryInSeconds() ); assertNull( lockFeature.getLockAll() ); assertEquals( 1, lockFeature.getQueries().size() ); }
@Test public void testExample2Wfs200() throws Exception { URL example = this.getClass().getResource( EXAMPLE2_WFS200 ); Map<String, String> kvpMap = KVPUtils.readFileIntoMap( example ); LockFeature lockFeature = LockFeatureKVPAdapter.parse( kvpMap ); assertNull( lockFeature.getHandle() ); assertEquals( "LOCK_1", lockFeature.getExistingLockId() ); assertEquals( new BigInteger( "38348348884895485485485623783487548745587548754" ), lockFeature.getExpiryInSeconds() ); assertFalse( lockFeature.getLockAll() ); assertEquals( 1, lockFeature.getQueries().size() ); }