2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2018 TechMahindra
6 *=================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package com.onap.sdnc.reports.repository;
22 import java.util.Date;
24 import java.util.List;
26 import javax.transaction.Transactional;
28 import org.springframework.data.jpa.repository.JpaRepository;
29 import org.springframework.data.jpa.repository.Modifying;
30 import org.springframework.data.jpa.repository.Query;
31 import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
32 import org.springframework.data.repository.query.Param;
33 import org.springframework.stereotype.Repository;
35 import com.onap.sdnc.reports.model.PreTestConfig;
39 public interface PreTestConfigRepository extends JpaRepository<PreTestConfig, Long> {
41 @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate and device.deviceIP = :deviceIP" )
42 List<PreTestConfig> findReportByDeviceIP(@Param("startDate") Date startDate, @Param("endDate")Date endDate, @Param("deviceIP")String deviceIP);
45 @Query(value = "insert into PreTestConfig (testName,result,execuationDetails,timestamp,deviceId) VALUES (:testName,:result,:execuationDetails,:timestamp,:deviceId)", nativeQuery = true)
47 void logPreTestReport(@Param("testName") String testName,@Param("result") String result, @Param("execuationDetails") String execuationDetails,@Param("timestamp") String timestamp,@Param("deviceId") long deviceId);