/*
 * Copyright 2017 the original author or authors.
 *
 * 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 org.springframework.cloud.skipper.repository;

import org.junit.Test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.skipper.AbstractIntegrationTest;
import org.springframework.cloud.skipper.domain.Repository;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * @author Mark Pollack
 */
public class RepositoryRepositoryTests extends AbstractIntegrationTest {

	@Autowired
	private RepositoryRepository repositoryRepository;

	@Test
	public void basicCrud() {
		RepositoryCreator.createTwoRepositories(repositoryRepository);
		Iterable<Repository> repositories = repositoryRepository.findAll();
		assertThat(repositories).isNotEmpty();
		assertThat(repositories).hasSize(2);
		Repository repo1 = repositoryRepository.findByName("stable");
		assertThat(repo1.getUrl()).isEqualTo("http://www.example.com/skipper/repository/stable");
		Repository repo2 = repositoryRepository.findByName("unstable");
		assertThat(repo2.getUrl()).isEqualTo("http://www.example.com/skipper/repository/unstable");
	}
}

@@ -660,24 +660,73 @@
 epository;%0A%0A
+import org.junit.After;%0Aimport org.junit.Before;%0A
 import org.j
@@ -736,16 +736,16 @@
 t.Test;%0A
-
 %0Aimport 
@@ -1014,16 +1014,51 @@
 Pollack%0A
+ * @author Ilayaperumal Gopinathan%0A
  */%0Apubl
@@ -1139,16 +1139,16 @@
 towired%0A
-
 %09private
@@ -1192,16 +1192,113 @@
 itory;%0A%0A
+%09@After%0A%09@Before%0A%09public void cleanupRepository() %7B%0A%09%09this.repositoryRepository.deleteAll();%0A%09%7D%0A%0A
 %09@Test%0A%09

Reset Repositories for RepsoitoryTests