@@ -0,0 +1,3122 @@
+/*%0A * Copyright 2012-2013 inBloom, Inc. and its affiliates.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0A%0Apackage org.slc.sli.api.resources;%0A%0Aimport static junit.framework.Assert.assertEquals;%0Aimport static junit.framework.Assert.assertNotNull;%0Aimport static junit.framework.Assert.assertTrue;%0A%0Aimport java.io.File;%0Aimport java.io.FileOutputStream;%0A%0Aimport javax.ws.rs.core.MultivaluedMap;%0Aimport javax.ws.rs.core.StreamingOutput;%0A%0Aimport com.sun.jersey.core.spi.factory.ResponseImpl;%0A%0Aimport org.apache.commons.io.FileUtils;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.test.context.ContextConfiguration;%0Aimport org.springframework.test.context.TestExecutionListeners;%0Aimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;%0Aimport org.springframework.test.context.support.DependencyInjectionTestExecutionListener;%0Aimport org.springframework.test.context.support.DirtiesContextTestExecutionListener;%0A%0Aimport org.slc.sli.api.test.WebContextTestExecutionListener;%0A%0A/**%0A * Test for support BulkExtract%0A */%0A@RunWith(SpringJUnit4ClassRunner.class)%0A@ContextConfiguration(locations = %7B %22/spring/applicationContext-test.xml%22 %7D)%0A@TestExecutionListeners(%7B WebContextTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class %7D)%0Apublic class BulkExtractTest %7B%0A%0A    private static final String FILE_NAME = %22NY-WALTON-2013-03-08.zip%22;%0A%0A    @Autowired%0A    private BulkExtract bulkExtract;%0A%0A    @Autowired%0A    private SecurityContextInjector injector;%0A%0A    @Test%0A    public void testGet() throws Exception %7B%0A        injector.setEducatorContext();%0A        ResponseImpl res = (ResponseImpl) bulkExtract.get();%0A        assertEquals(200, res.getStatus());%0A        MultivaluedMap%3CString, Object%3E headers = res.getMetadata();%0A        assertNotNull(headers);%0A        assertTrue(headers.containsKey(%22content-disposition%22));%0A        String header = (String) headers.getFirst(%22content-disposition%22);%0A        assertNotNull(header);%0A        assertTrue(header.startsWith(%22attachment%22));%0A        assertTrue(header.indexOf(FILE_NAME) %3E 0);%0A%0A        Object entity = res.getEntity();%0A        assertNotNull(entity);%0A        StreamingOutput out = (StreamingOutput) entity;%0A        File file = new File(%22out.zip%22);%0A        FileOutputStream os = new FileOutputStream(file);%0A        out.write(os);%0A        os.flush();%0A        assertTrue(file.exists());%0A%0A        assertEquals(915931318L, FileUtils.checksumCRC32(file));%0A        FileUtils.deleteQuietly(file);%0A    %7D%0A%0A%7D%0A

add BulkExtractTest