/*******************************************************************************
* Copyright 2011 André Rouél
*
* 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 net.sf.jacclog.geoip;
import java.io.IOException;
import java.io.InputStream;
import java.net.Inet4Address;
import java.util.List;
import java.util.zip.GZIPInputStream;
import net.sf.jacclog.geoip.internal.CountryGeolocationReader;
import net.sf.jacclog.service.repository.CountryRepositoryService;
import net.sf.jacclog.service.repository.domain.Country;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CountryGeolocationReaderTest {
private static final Logger LOG = LoggerFactory.getLogger(CountryGeolocationReaderTest.class);
@Test
public void testReader() {
try {
final InputStream stream = this.getClass().getClassLoader().getResourceAsStream("GeoIPCountry.csv.gz");
new CountryGeolocationReader(new GZIPInputStream(stream), new CountryRepositoryService<Country>() {
@Override
public long countAll() {
return 0;
}
@Override
public void create(List<Country> countries) {
}
@Override
public void create(Country country) {
}
@Override
public void delete(Country country) {
}
@Override
public Country find(Inet4Address ipAddress) {
return null;
}
@Override
public List<Country> find(int startPosition, int maxResults) {
return null;
}
@Override
public Country read(Long id) {
return null;
}
@Override
public List<Country> readAll() {
return null;
}
@Override
public Country update(Country country) {
return null;
}
});
} catch (final IOException e) {
LOG.warn(e.getLocalizedMessage());
}
}
}